@Transactional
public static Result addNew() {
try {
Logger.debug("add req body: " + request().body().asJson().toString());
UserDto userDto = new ObjectMapper().readValue(request().body().asJson().toString(), UserDto.class);
User newUser = new User();
userDto.mapBack(newUser);
ConstraintViolation[] violations = Utilities.validateEntity(newUser);
if (violations.length > 0) {
return badRequest(Utilities.violationsToJson(violations));
}
DaoManager.getUserDao().persist(newUser);