Search in sources :

Example 1 with UserPublication

use of com.odysseusinc.arachne.portal.model.UserPublication in project ArachneCentralAPI by OHDSI.

the class UserPublicationDTOToUserPublicationConverter method convert.

@Override
public UserPublication convert(UserPublicationDTO dto) {
    UserPublication publication = new UserPublication();
    publication.setTitle(dto.getTitle());
    publication.setDescription(dto.getDescription());
    publication.setDate(dto.getDate());
    publication.setPublisher(dto.getPublisher());
    publication.setUrl(dto.getUrl());
    return publication;
}
Also used : UserPublication(com.odysseusinc.arachne.portal.model.UserPublication)

Example 2 with UserPublication

use of com.odysseusinc.arachne.portal.model.UserPublication in project ArachneCentralAPI by OHDSI.

the class UserToUserProfileDTOConverter method convert.

@Override
public UserProfileDTO convert(IUser user) {
    UserProfileDTO dto = new UserProfileDTO();
    dto.setId(user.getUuid());
    dto.setEnabled(user.getEnabled());
    dto.setCreated(user.getCreated());
    dto.setUpdated(user.getUpdated());
    HashSet<SkillDTO> skills = new HashSet<>();
    for (Skill skill : user.getSkills()) {
        skills.add(conversionService.convert(skill, SkillDTO.class));
    }
    dto.setSkills(skills);
    LinkedList<UserPublicationDTO> publications = new LinkedList<>();
    for (UserPublication userPublication : user.getPublications()) {
        publications.add(conversionService.convert(userPublication, UserPublicationDTO.class));
    }
    dto.setPublications(publications);
    LinkedList<UserLinkDTO> links = new LinkedList<>();
    for (UserLink userLink : user.getLinks()) {
        links.add(conversionService.convert(userLink, UserLinkDTO.class));
    }
    dto.setLinks(links);
    dto.setGeneral(conversionService.convert(user, UserProfileGeneralDTO.class));
    return dto;
}
Also used : SkillDTO(com.odysseusinc.arachne.portal.api.v1.dto.dictionary.SkillDTO) UserLinkDTO(com.odysseusinc.arachne.portal.api.v1.dto.UserLinkDTO) UserProfileDTO(com.odysseusinc.arachne.portal.api.v1.dto.UserProfileDTO) LinkedList(java.util.LinkedList) UserPublication(com.odysseusinc.arachne.portal.model.UserPublication) UserLink(com.odysseusinc.arachne.portal.model.UserLink) Skill(com.odysseusinc.arachne.portal.model.Skill) UserProfileGeneralDTO(com.odysseusinc.arachne.portal.api.v1.dto.UserProfileGeneralDTO) UserPublicationDTO(com.odysseusinc.arachne.portal.api.v1.dto.UserPublicationDTO) HashSet(java.util.HashSet)

Example 3 with UserPublication

use of com.odysseusinc.arachne.portal.model.UserPublication in project ArachneCentralAPI by OHDSI.

the class BaseUserServiceImpl method addPublicationToUser.

@Override
public U addPublicationToUser(Long userId, UserPublication publication) throws NotExistException, NotUniqueException, PermissionDeniedException {
    U forUpdate = userRepository.findOne(userId);
    publication.setUser(forUpdate);
    UserPublication userPublication = userPublicationService.create(publication);
    forUpdate.getPublications().add(userPublication);
    return initUserCollections((U) userPublication.getUser());
}
Also used : UserPublication(com.odysseusinc.arachne.portal.model.UserPublication)

Aggregations

UserPublication (com.odysseusinc.arachne.portal.model.UserPublication)3 UserLinkDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserLinkDTO)1 UserProfileDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserProfileDTO)1 UserProfileGeneralDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserProfileGeneralDTO)1 UserPublicationDTO (com.odysseusinc.arachne.portal.api.v1.dto.UserPublicationDTO)1 SkillDTO (com.odysseusinc.arachne.portal.api.v1.dto.dictionary.SkillDTO)1 Skill (com.odysseusinc.arachne.portal.model.Skill)1 UserLink (com.odysseusinc.arachne.portal.model.UserLink)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1