Search in sources :

Example 1 with UserProfileRequest

use of com.zavada.domain.UserProfileRequest in project Logos_Materials_October_2017 by VolodymyrZavada.

the class UserController method showUserProfile.

@GetMapping
public String showUserProfile(Model model, Principal principal) throws IOException {
    System.out.println("Secured user name: " + principal.getName());
    UserEntity entity = userService.findUserByEmail(principal.getName());
    if (entity == null)
        return "redirect:/";
    UserProfileRequest request = UserMapper.entityToUserProfile(entity);
    model.addAttribute("userProfile", request);
    model.addAttribute("imageSrc", CustomFileUtils.getImage("user_" + entity.getId(), entity.getImagePath()));
    return "user/profile";
}
Also used : UserProfileRequest(com.zavada.domain.UserProfileRequest) UserEntity(com.zavada.entity.UserEntity) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with UserProfileRequest

use of com.zavada.domain.UserProfileRequest in project Logos_Materials_October_2017 by VolodymyrZavada.

the class UserMapper method entityToUserProfile.

public static UserProfileRequest entityToUserProfile(UserEntity entity) {
    UserProfileRequest request = new UserProfileRequest();
    request.setId(entity.getId());
    request.setEmail(entity.getEmail());
    request.setFirstName(entity.getFirstName());
    request.setLastName(entity.getLastName());
    request.setAge(entity.getAge());
    request.setPhoneNumber(entity.getPhoneNumber());
    return request;
}
Also used : UserProfileRequest(com.zavada.domain.UserProfileRequest)

Aggregations

UserProfileRequest (com.zavada.domain.UserProfileRequest)2 UserEntity (com.zavada.entity.UserEntity)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1