Package models.dto

Examples of models.dto.UserDto


        try {
            User user = DaoManager.getUserDao().findById(id);
            if (user == null) {
                return notFound("Can't find user with id " + id);
            }
            UserDto userDto = UserDto.createFrom(user);
            return ok(toJson(userDto));
        } catch (DataAccessException e) {
            Logger.error("Can't find user with id " + id, e);
            return notFound("Can't find user with id " + id);
        }
View Full Code Here


    @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);
View Full Code Here

            User user = DaoManager.getUserDao().findById(userId);
            if (user == null) {
                return notFound(Utilities.getJsonErrorNode("Can't find user with id " + userId));
            }
            Logger.debug("update req body: " + request().body().asJson().toString());
            UserDto userDto = new ObjectMapper().readValue(request().body().asJson().toString(), UserDto.class);
            userDto.mapBack(user);
            ConstraintViolation[] violations = Utilities.validateEntity(user);
            if (violations.length > 0) {
                return badRequest(Utilities.violationsToJson(violations));
            }
            DaoManager.getUserDao().persist(user);
View Full Code Here

TOP

Related Classes of models.dto.UserDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.