Search in sources :

Example 21 with AddressEntity

use of org.orcid.persistence.jpa.entities.AddressEntity in project ORCID-Source by ORCID.

the class AddressManagerImpl method updateAddresses.

@Override
public Addresses updateAddresses(String orcid, Addresses addresses) {
    List<AddressEntity> existingAddressList = addressDao.getAddresses(orcid, getLastModified(orcid));
    // Delete the deleted ones
    for (AddressEntity existingAddress : existingAddressList) {
        boolean deleteMe = true;
        if (addresses.getAddress() != null) {
            for (Address updatedOrNew : addresses.getAddress()) {
                if (existingAddress.getId().equals(updatedOrNew.getPutCode())) {
                    deleteMe = false;
                    break;
                }
            }
        }
        if (deleteMe) {
            try {
                addressDao.deleteAddress(orcid, existingAddress.getId());
            } catch (Exception e) {
                throw new ApplicationException("Unable to delete address " + existingAddress.getId(), e);
            }
        }
    }
    if (addresses != null && addresses.getAddress() != null) {
        for (Address updatedOrNew : addresses.getAddress()) {
            if (updatedOrNew.getPutCode() != null) {
                // Update the existing ones
                for (AddressEntity existingAddress : existingAddressList) {
                    if (existingAddress.getId().equals(updatedOrNew.getPutCode())) {
                        existingAddress.setLastModified(new Date());
                        existingAddress.setVisibility(updatedOrNew.getVisibility());
                        existingAddress.setIso2Country(updatedOrNew.getCountry().getValue());
                        existingAddress.setDisplayIndex(updatedOrNew.getDisplayIndex());
                        addressDao.merge(existingAddress);
                    }
                }
            } else {
                // Add the new ones
                AddressEntity newAddress = adapter.toAddressEntity(updatedOrNew);
                SourceEntity sourceEntity = sourceManager.retrieveSourceEntity();
                ProfileEntity profile = new ProfileEntity(orcid);
                newAddress.setUser(profile);
                newAddress.setDateCreated(new Date());
                // Set the source id
                if (sourceEntity.getSourceProfile() != null) {
                    newAddress.setSourceId(sourceEntity.getSourceProfile().getId());
                }
                if (sourceEntity.getSourceClient() != null) {
                    newAddress.setClientSourceId(sourceEntity.getSourceClient().getId());
                }
                newAddress.setVisibility(updatedOrNew.getVisibility());
                newAddress.setDisplayIndex(updatedOrNew.getDisplayIndex());
                addressDao.persist(newAddress);
            }
        }
    }
    return addresses;
}
Also used : ApplicationException(org.orcid.core.exception.ApplicationException) Address(org.orcid.jaxb.model.record_v2.Address) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) AddressEntity(org.orcid.persistence.jpa.entities.AddressEntity) ApplicationException(org.orcid.core.exception.ApplicationException) OrcidDuplicatedElementException(org.orcid.core.exception.OrcidDuplicatedElementException) Date(java.util.Date) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity)

Example 22 with AddressEntity

use of org.orcid.persistence.jpa.entities.AddressEntity in project ORCID-Source by ORCID.

the class AddressManagerImpl method createAddress.

@Override
public Address createAddress(String orcid, Address address, boolean isApiRequest) {
    SourceEntity sourceEntity = sourceManager.retrieveSourceEntity();
    // Validate the address
    PersonValidator.validateAddress(address, sourceEntity, true, isApiRequest, null);
    // Validate it is not duplicated
    List<AddressEntity> existingAddresses = addressDao.getAddresses(orcid, getLastModified(orcid));
    for (AddressEntity existing : existingAddresses) {
        if (isDuplicated(existing, address, sourceEntity)) {
            Map<String, String> params = new HashMap<String, String>();
            params.put("type", "address");
            params.put("value", address.getCountry().getValue().value());
            throw new OrcidDuplicatedElementException(params);
        }
    }
    AddressEntity newEntity = adapter.toAddressEntity(address);
    ProfileEntity profile = profileEntityCacheManager.retrieve(orcid);
    newEntity.setUser(profile);
    newEntity.setDateCreated(new Date());
    // Set the source
    if (sourceEntity.getSourceProfile() != null) {
        newEntity.setSourceId(sourceEntity.getSourceProfile().getId());
    }
    if (sourceEntity.getSourceClient() != null) {
        newEntity.setClientSourceId(sourceEntity.getSourceClient().getId());
    }
    DisplayIndexCalculatorHelper.setDisplayIndexOnNewEntity(newEntity, isApiRequest);
    setIncomingPrivacy(newEntity, profile);
    addressDao.persist(newEntity);
    return adapter.toAddress(newEntity);
}
Also used : HashMap(java.util.HashMap) SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) OrcidDuplicatedElementException(org.orcid.core.exception.OrcidDuplicatedElementException) AddressEntity(org.orcid.persistence.jpa.entities.AddressEntity) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Date(java.util.Date)

Example 23 with AddressEntity

use of org.orcid.persistence.jpa.entities.AddressEntity in project ORCID-Source by ORCID.

the class Jpa2JaxbAdapterTest method testProfileEntityToOrcidMessage.

@Test
public void testProfileEntityToOrcidMessage() {
    String userOrcid = "0000-0000-0000-1234";
    String clientId = "APP-5555555555555555";
    ProfileEntity profile = new ProfileEntity(userOrcid);
    // Set default visibility
    profile.setActivitiesVisibilityDefault(org.orcid.jaxb.model.common_v2.Visibility.LIMITED);
    // Set name
    RecordNameEntity name = new RecordNameEntity();
    name.setCreditName("My credit name");
    name.setFamilyName("My family name");
    name.setGivenNames("My given names");
    name.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    profile.setRecordNameEntity(name);
    // Set biography
    BiographyEntity bio = new BiographyEntity();
    bio.setBiography("This is my biography");
    bio.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    profile.setBiographyEntity(bio);
    // Set other names
    TreeSet<OtherNameEntity> otherNames = new TreeSet<OtherNameEntity>();
    OtherNameEntity otherName = new OtherNameEntity();
    otherName.setDisplayName("My other name");
    otherName.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    otherName.setDisplayIndex(20000L);
    otherName.setClientSourceId(clientId);
    otherName.setId(24816L);
    otherNames.add(otherName);
    profile.setOtherNames(otherNames);
    // Set address
    Set<AddressEntity> addresses = new HashSet<AddressEntity>();
    AddressEntity address = new AddressEntity();
    address.setIso2Country(Iso3166Country.US);
    address.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    address.setDisplayIndex(20000L);
    address.setClientSourceId(clientId);
    address.setId(24816L);
    addresses.add(address);
    profile.setAddresses(addresses);
    // Set keywords
    TreeSet<ProfileKeywordEntity> keywords = new TreeSet<ProfileKeywordEntity>();
    ProfileKeywordEntity keyword = new ProfileKeywordEntity();
    keyword.setKeywordName("My keyword");
    keyword.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    keyword.setDisplayIndex(20000L);
    keyword.setClientSourceId(clientId);
    keyword.setId(24816L);
    keywords.add(keyword);
    profile.setKeywords(keywords);
    // Set researcher urls
    TreeSet<ResearcherUrlEntity> rUrls = new TreeSet<ResearcherUrlEntity>();
    ResearcherUrlEntity rUrl = new ResearcherUrlEntity();
    rUrl.setUrl("http://orcid.org");
    rUrl.setUrlName("My rUrl");
    rUrl.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    rUrl.setDisplayIndex(20000L);
    rUrl.setClientSourceId(clientId);
    rUrl.setId(24816L);
    rUrls.add(rUrl);
    profile.setResearcherUrls(rUrls);
    // Set external identifiers
    Set<ExternalIdentifierEntity> extIds = new HashSet<ExternalIdentifierEntity>();
    ExternalIdentifierEntity extId = new ExternalIdentifierEntity();
    extId.setExternalIdCommonName("My common name");
    extId.setExternalIdReference("My refrence");
    extId.setExternalIdUrl("http://orcid.org");
    extId.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    extId.setDisplayIndex(20000L);
    extId.setClientSourceId(clientId);
    extId.setId(24816L);
    extIds.add(extId);
    profile.setExternalIdentifiers(extIds);
    // Set works
    TreeSet<WorkEntity> works = new TreeSet<WorkEntity>();
    WorkEntity work = new WorkEntity();
    work.setWorkType(WorkType.OTHER);
    work.setTitle("My work title");
    work.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    work.setDisplayIndex(20000L);
    work.setClientSourceId(clientId);
    work.setId(24816L);
    work.setOrcid(profile.getId());
    works.add(work);
    when(mockWorkEntityCacheManager.retrieveFullWorks(userOrcid, 0)).thenReturn(new ArrayList<>(works));
    // Existing org
    OrgEntity newOrg = new OrgEntity();
    newOrg.setId(1234L);
    newOrg.setCity("San Jose");
    newOrg.setCountry(org.orcid.jaxb.model.message.Iso3166Country.CR);
    newOrg.setName("My org name");
    // Set funding
    TreeSet<ProfileFundingEntity> fundings = new TreeSet<ProfileFundingEntity>();
    ProfileFundingEntity funding = new ProfileFundingEntity();
    funding.setOrg(newOrg);
    funding.setTitle("My funding title");
    funding.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    funding.setDisplayIndex(20000L);
    funding.setClientSourceId(clientId);
    funding.setId(24816L);
    fundings.add(funding);
    profile.setProfileFunding(fundings);
    // Set affiliations
    TreeSet<OrgAffiliationRelationEntity> affiliations = new TreeSet<OrgAffiliationRelationEntity>();
    OrgAffiliationRelationEntity affiliation = new OrgAffiliationRelationEntity();
    affiliation.setAffiliationType(org.orcid.jaxb.model.v3.dev1.record.AffiliationType.EDUCATION);
    affiliation.setOrg(newOrg);
    affiliation.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.PUBLIC);
    affiliation.setClientSourceId(clientId);
    affiliation.setId(24816L);
    affiliations.add(affiliation);
    profile.setOrgAffiliationRelations(affiliations);
    OrcidProfile orcidProfile = adapter.toOrcidProfile(profile, LoadOptions.ALL);
    // Check profile
    assertNotNull(orcidProfile);
    assertNotNull(orcidProfile.getOrcidIdentifier());
    assertEquals("http://orcid.org/" + userOrcid, orcidProfile.getOrcidIdentifier().getUri());
    assertEquals("orcid.org", orcidProfile.getOrcidIdentifier().getHost());
    assertEquals(userOrcid, orcidProfile.getOrcidIdentifier().getPath());
    // Check activities
    assertNotNull(orcidProfile.getOrcidActivities());
    // Check works
    assertNotNull(orcidProfile.getOrcidActivities().getOrcidWorks());
    assertNotNull(orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork());
    assertEquals(1, orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork().size());
    assertEquals("My work title", orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork().get(0).getWorkTitle().getTitle().getContent());
    assertEquals("24816", orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork().get(0).getPutCode());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork().get(0).getVisibility());
    checkSource(orcidProfile.getOrcidActivities().getOrcidWorks().getOrcidWork().get(0).getSource(), clientId);
    // Check fundings
    assertNotNull(orcidProfile.getOrcidActivities().getFundings());
    assertNotNull(orcidProfile.getOrcidActivities().getFundings().getFundings());
    assertEquals(1, orcidProfile.getOrcidActivities().getFundings().getFundings().size());
    assertEquals("My funding title", orcidProfile.getOrcidActivities().getFundings().getFundings().get(0).getTitle().getTitle().getContent());
    assertEquals("24816", orcidProfile.getOrcidActivities().getFundings().getFundings().get(0).getPutCode());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidActivities().getFundings().getFundings().get(0).getVisibility());
    checkSource(orcidProfile.getOrcidActivities().getFundings().getFundings().get(0).getSource(), clientId);
    // Check affiliations
    assertNotNull(orcidProfile.getOrcidActivities().getAffiliations());
    assertNotNull(orcidProfile.getOrcidActivities().getAffiliations().getAffiliation());
    assertEquals(1, orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().size());
    assertEquals(AffiliationType.EDUCATION, orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getType());
    assertEquals("My org name", orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getOrganization().getName());
    assertEquals("San Jose", orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getOrganization().getAddress().getCity());
    assertEquals(org.orcid.jaxb.model.message.Iso3166Country.CR, orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getOrganization().getAddress().getCountry());
    assertEquals("24816", orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getPutCode());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getVisibility());
    checkSource(orcidProfile.getOrcidActivities().getAffiliations().getAffiliation().get(0).getSource(), clientId);
    // Check biography
    assertNotNull(orcidProfile.getOrcidBio());
    // Check name
    assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails());
    assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails().getCreditName());
    assertEquals("My credit name", orcidProfile.getOrcidBio().getPersonalDetails().getCreditName().getContent());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getPersonalDetails().getCreditName().getVisibility());
    assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails().getGivenNames());
    assertEquals("My given names", orcidProfile.getOrcidBio().getPersonalDetails().getGivenNames().getContent());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getPersonalDetails().getGivenNames().getVisibility());
    assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails().getFamilyName());
    assertEquals("My family name", orcidProfile.getOrcidBio().getPersonalDetails().getFamilyName().getContent());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getPersonalDetails().getFamilyName().getVisibility());
    // Check other names
    assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames());
    assertNotNull(orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility());
    assertEquals(1, orcidProfile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().size());
    // Check biography
    assertNotNull(orcidProfile.getOrcidBio().getBiography());
    assertEquals("This is my biography", orcidProfile.getOrcidBio().getBiography().getContent());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getBiography().getVisibility());
    // Check address
    assertNotNull(orcidProfile.getOrcidBio().getContactDetails());
    assertNotNull(orcidProfile.getOrcidBio().getContactDetails().getAddress());
    assertNotNull(orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry());
    assertEquals(org.orcid.jaxb.model.message.Iso3166Country.US, orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry().getValue());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getContactDetails().getAddress().getCountry().getVisibility());
    // Check keywords
    assertNotNull(orcidProfile.getOrcidBio().getKeywords());
    assertNotNull(orcidProfile.getOrcidBio().getKeywords().getKeyword());
    assertEquals(1, orcidProfile.getOrcidBio().getKeywords().getKeyword().size());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getKeywords().getVisibility());
    assertEquals("My keyword", orcidProfile.getOrcidBio().getKeywords().getKeyword().get(0).getContent());
    // Check researcher urls
    assertNotNull(orcidProfile.getOrcidBio().getResearcherUrls());
    assertNotNull(orcidProfile.getOrcidBio().getResearcherUrls().getResearcherUrl());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getResearcherUrls().getVisibility());
    assertEquals(1, orcidProfile.getOrcidBio().getResearcherUrls().getResearcherUrl().size());
    assertEquals("My rUrl", orcidProfile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrlName().getContent());
    assertEquals("http://orcid.org", orcidProfile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrl().getValue());
    // Check external identifiers
    assertNotNull(orcidProfile.getOrcidBio().getExternalIdentifiers());
    assertNotNull(orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier());
    assertEquals(1, orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().size());
    assertEquals("My common name", orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
    assertEquals("My refrence", orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdReference().getContent());
    assertEquals("http://orcid.org", orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdUrl().getValue());
    assertEquals(org.orcid.jaxb.model.message.Visibility.PUBLIC, orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getVisibility());
    checkSource(orcidProfile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getSource(), clientId);
}
Also used : ProfileKeywordEntity(org.orcid.persistence.jpa.entities.ProfileKeywordEntity) ExternalIdentifierEntity(org.orcid.persistence.jpa.entities.ExternalIdentifierEntity) RecordNameEntity(org.orcid.persistence.jpa.entities.RecordNameEntity) OrgEntity(org.orcid.persistence.jpa.entities.OrgEntity) ProfileFundingEntity(org.orcid.persistence.jpa.entities.ProfileFundingEntity) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) WorkEntity(org.orcid.persistence.jpa.entities.WorkEntity) TreeSet(java.util.TreeSet) AddressEntity(org.orcid.persistence.jpa.entities.AddressEntity) HashSet(java.util.HashSet) ResearcherUrlEntity(org.orcid.persistence.jpa.entities.ResearcherUrlEntity) BiographyEntity(org.orcid.persistence.jpa.entities.BiographyEntity) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) OtherNameEntity(org.orcid.persistence.jpa.entities.OtherNameEntity) OrgAffiliationRelationEntity(org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Example 24 with AddressEntity

use of org.orcid.persistence.jpa.entities.AddressEntity in project ORCID-Source by ORCID.

the class SetUpClientsAndUsers method clearRegistry.

private boolean clearRegistry(OrcidProfile existingProfile, Map<String, String> params) {
    if (existingProfile != null) {
        String orcid = params.get(ORCID);
        String email = params.get(EMAIL);
        // exception
        if (existingProfile.getOrcidBio() == null || existingProfile.getOrcidBio().getContactDetails() == null || existingProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail() == null || !email.equals(existingProfile.getOrcidBio().getContactDetails().retrievePrimaryEmail().getValue())) {
            throw new ApplicationException("User with email " + params.get(EMAIL) + " must have orcid id '" + orcid + "' but it is '" + existingProfile.getOrcidId() + "'");
        }
        // Check if the profile have the same password, if not, update the
        // password
        String encryptedPassword = encryptionManager.hashForInternalUse(params.get(PASSWORD));
        if (!encryptedPassword.equals(existingProfile.getPassword())) {
            existingProfile.setPassword(params.get(PASSWORD));
            orcidProfileManager.updatePasswordInformation(existingProfile);
        }
        // Set default names
        Name name = new Name();
        name.setCreditName(new CreditName(params.get(CREDIT_NAME)));
        name.setGivenNames(new GivenNames(params.get(GIVEN_NAMES)));
        name.setFamilyName(new FamilyName(params.get(FAMILY_NAMES)));
        name.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.NAMES_DEFAULT.getVisibility().value()));
        if (recordNameManager.exists(orcid)) {
            recordNameManager.updateRecordName(orcid, name);
        } else {
            recordNameManager.createRecordName(orcid, name);
        }
        profileDao.updatePreferences(orcid, true, true, true, true, org.orcid.jaxb.model.common_v2.Visibility.PUBLIC, true, 1f);
        // Set default bio
        org.orcid.jaxb.model.record_v2.Biography bio = biographyManager.getBiography(orcid);
        if (bio == null || bio.getContent() == null) {
            bio = new org.orcid.jaxb.model.record_v2.Biography(params.get(BIO));
            bio.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.BIOGRAPHY_DEFAULT.getVisibility().value()));
            biographyManager.createBiography(orcid, bio);
        } else {
            bio.setContent(params.get(BIO));
            bio.setVisibility(org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.BIOGRAPHY_DEFAULT.getVisibility().value()));
            biographyManager.updateBiography(orcid, bio);
        }
        // Remove other names
        List<OtherNameEntity> otherNames = otherNameDao.getOtherNames(orcid, 0L);
        if (otherNames != null && !otherNames.isEmpty()) {
            for (OtherNameEntity otherName : otherNames) {
                otherNameDao.deleteOtherName(otherName);
            }
        }
        // Remove keywords
        List<ProfileKeywordEntity> keywords = profileKeywordDao.getProfileKeywords(orcid, 0L);
        if (keywords != null && !keywords.isEmpty()) {
            for (ProfileKeywordEntity keyword : keywords) {
                profileKeywordDao.deleteProfileKeyword(keyword);
            }
        }
        // Remove researcher urls
        List<ResearcherUrlEntity> rUrls = researcherUrlDao.getResearcherUrls(orcid, 0L);
        if (rUrls != null && !rUrls.isEmpty()) {
            for (ResearcherUrlEntity rUrl : rUrls) {
                researcherUrlDao.deleteResearcherUrl(orcid, rUrl.getId());
            }
        }
        // Remove external ids
        List<ExternalIdentifierEntity> extIds = externalIdentifierDao.getExternalIdentifiers(orcid, System.currentTimeMillis());
        if (extIds != null && !extIds.isEmpty()) {
            for (ExternalIdentifierEntity extId : extIds) {
                externalIdentifierDao.removeExternalIdentifier(orcid, extId.getId());
            }
        }
        // Remove addresses
        List<AddressEntity> addresses = addressDao.getAddresses(orcid, 0L);
        if (addresses != null && !addresses.isEmpty()) {
            for (AddressEntity address : addresses) {
                addressDao.deleteAddress(orcid, address.getId());
            }
        }
        // Remove emails
        List<EmailEntity> emails = emailDao.findByOrcid(orcid, profileEntityManager.getLastModified(orcid));
        if (emails != null && !emails.isEmpty()) {
            for (EmailEntity rc2Email : emails) {
                if (!params.get(EMAIL).equals(rc2Email.getId())) {
                    emailDao.removeEmail(orcid, rc2Email.getId());
                }
            }
        }
        // Remove notifications
        List<NotificationEntity> notifications = notificationDao.findByOrcid(orcid, true, 0, 10000);
        if (notifications != null && !notifications.isEmpty()) {
            for (NotificationEntity notification : notifications) {
                notificationDao.deleteNotificationItemByNotificationId(notification.getId());
                notificationDao.deleteNotificationWorkByNotificationId(notification.getId());
                notificationDao.deleteNotificationById(notification.getId());
            }
        }
        // Remove works
        List<WorkLastModifiedEntity> works = workDao.getWorkLastModifiedList(orcid);
        if (works != null && !works.isEmpty()) {
            for (WorkLastModifiedEntity work : works) {
                workDao.removeWork(orcid, work.getId());
            }
        }
        // Remove affiliations
        List<OrgAffiliationRelationEntity> affiliations = orgAffiliationRelationDao.getByUser(orcid);
        if (affiliations != null && !affiliations.isEmpty()) {
            for (OrgAffiliationRelationEntity affiliation : affiliations) {
                orgAffiliationRelationDao.remove(affiliation.getId());
            }
        }
        // Remove fundings
        List<ProfileFundingEntity> fundings = profileFundingDao.getByUser(orcid, profileEntityManager.getLastModified(orcid));
        if (fundings != null && !fundings.isEmpty()) {
            for (ProfileFundingEntity funding : fundings) {
                profileFundingDao.removeProfileFunding(orcid, funding.getId());
            }
        }
        // Remove peer reviews
        List<PeerReviewEntity> peerReviews = peerReviewDao.getByUser(orcid, profileEntityManager.getLastModified(orcid));
        if (peerReviews != null && !peerReviews.isEmpty()) {
            for (PeerReviewEntity peerReview : peerReviews) {
                peerReviewDao.removePeerReview(orcid, peerReview.getId());
            }
        }
        // Remove 3d party links
        List<OrcidOauth2TokenDetail> tokenDetails = orcidOauth2TokenDetailDao.findByUserName(orcid);
        if (tokenDetails != null && !tokenDetails.isEmpty()) {
            for (OrcidOauth2TokenDetail token : tokenDetails) {
                orcidOauth2TokenDetailDao.remove(token.getId());
            }
        }
        // Unlock just in case it is locked
        profileDao.unlockProfile(orcid);
        return true;
    }
    return false;
}
Also used : ProfileKeywordEntity(org.orcid.persistence.jpa.entities.ProfileKeywordEntity) FamilyName(org.orcid.jaxb.model.record_v2.FamilyName) ExternalIdentifierEntity(org.orcid.persistence.jpa.entities.ExternalIdentifierEntity) FamilyName(org.orcid.jaxb.model.record_v2.FamilyName) CreditName(org.orcid.jaxb.model.common_v2.CreditName) Name(org.orcid.jaxb.model.record_v2.Name) ProfileFundingEntity(org.orcid.persistence.jpa.entities.ProfileFundingEntity) WorkLastModifiedEntity(org.orcid.persistence.jpa.entities.WorkLastModifiedEntity) GivenNames(org.orcid.jaxb.model.record_v2.GivenNames) PeerReviewEntity(org.orcid.persistence.jpa.entities.PeerReviewEntity) NotificationEntity(org.orcid.persistence.jpa.entities.NotificationEntity) AddressEntity(org.orcid.persistence.jpa.entities.AddressEntity) OrcidOauth2TokenDetail(org.orcid.persistence.jpa.entities.OrcidOauth2TokenDetail) ResearcherUrlEntity(org.orcid.persistence.jpa.entities.ResearcherUrlEntity) CreditName(org.orcid.jaxb.model.common_v2.CreditName) EmailEntity(org.orcid.persistence.jpa.entities.EmailEntity) ApplicationException(org.orcid.core.exception.ApplicationException) OtherNameEntity(org.orcid.persistence.jpa.entities.OtherNameEntity) OrgAffiliationRelationEntity(org.orcid.persistence.jpa.entities.OrgAffiliationRelationEntity)

Example 25 with AddressEntity

use of org.orcid.persistence.jpa.entities.AddressEntity in project ORCID-Source by ORCID.

the class OrcidProfileManagerImplTest method testPrimaryAddressDontChangeOnClaimedRecords.

@Test
@Transactional
@Rollback(true)
public void testPrimaryAddressDontChangeOnClaimedRecords() {
    OrcidProfile profile = createBasicProfile();
    String orcidIdentifier = null;
    profile.setOrcidIdentifier(orcidIdentifier);
    setBio(profile, Visibility.PUBLIC);
    String email = profile.getOrcidBio().getContactDetails().getEmail().get(0).getValue();
    profile = orcidProfileManager.createOrcidProfile(profile, true, false);
    assertNotNull(profile);
    assertNotNull(profile.getOrcidIdentifier());
    assertFalse(PojoUtil.isEmpty(profile.getOrcidIdentifier().getPath()));
    profile = orcidProfileManager.retrieveOrcidProfile(profile.getOrcidIdentifier().getPath());
    assertNotNull(profile);
    assertNotNull(profile.getOrcidBio());
    assertNotNull(profile.getOrcidBio().getBiography());
    assertEquals("This is my biography", profile.getOrcidBio().getBiography().getContent());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getBiography().getVisibility());
    assertNotNull(profile.getOrcidBio().getContactDetails());
    assertNotNull(profile.getOrcidBio().getContactDetails().getAddress());
    assertNotNull(profile.getOrcidBio().getContactDetails().getAddress().getCountry());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getContactDetails().getAddress().getCountry().getVisibility());
    assertEquals(Iso3166Country.US, profile.getOrcidBio().getContactDetails().getAddress().getCountry().getValue());
    assertNotNull(profile.getOrcidBio().getContactDetails().getEmail());
    assertEquals(1, profile.getOrcidBio().getContactDetails().getEmail().size());
    assertNotNull(profile.getOrcidBio().getContactDetails().getEmail().get(0).getValue());
    assertEquals(email, profile.getOrcidBio().getContactDetails().getEmail().get(0).getValue());
    assertNotNull(profile.getOrcidBio().getExternalIdentifiers());
    assertNotNull(profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getExternalIdentifiers().getVisibility());
    assertEquals(1, profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().size());
    assertEquals("common-name", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
    assertEquals("ext-id-reference", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdReference().getContent());
    assertEquals("http://orcid.org/ext-id", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdUrl().getValue());
    assertNotNull(profile.getOrcidBio().getKeywords());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getKeywords().getVisibility());
    assertEquals(1, profile.getOrcidBio().getKeywords().getKeyword().size());
    assertEquals("k1", profile.getOrcidBio().getKeywords().getKeyword().get(0).getContent());
    assertNotNull(profile.getOrcidBio().getPersonalDetails());
    assertNotNull(profile.getOrcidBio().getPersonalDetails().getOtherNames());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility());
    assertEquals(1, profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().size());
    assertEquals("o1", profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().get(0).getContent());
    assertNotNull(profile.getOrcidBio().getResearcherUrls());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getResearcherUrls().getVisibility());
    assertEquals(1, profile.getOrcidBio().getResearcherUrls().getResearcherUrl().size());
    assertEquals("http://orcid.org/researcher-url-1", profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrl().getValue());
    assertEquals("url-name-1", profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrlName().getContent());
    ProfileEntity profileEntity = profileDao.find(profile.getOrcidIdentifier().getPath());
    assertNotNull(profileEntity);
    assertNotNull(profileEntity.getAddresses());
    assertEquals(1, profileEntity.getAddresses().size());
    assertEquals(org.orcid.jaxb.model.common_v2.Iso3166Country.US, profileEntity.getAddresses().iterator().next().getIso2Country());
    // Update all values
    profile.getOrcidBio().getBiography().setContent("This is my biography # 2");
    profile.getOrcidBio().getContactDetails().getAddress().setCountry(new Country(Iso3166Country.CR));
    profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).setSource(null);
    profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).setExternalIdCommonName(new ExternalIdCommonName("common-name-2"));
    profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).setExternalIdReference(new ExternalIdReference("ext-id-reference-2"));
    profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).setExternalIdUrl(new ExternalIdUrl("http://orcid.org/ext-id-2"));
    profile.getOrcidBio().getKeywords().getKeyword().get(0).setSource(null);
    profile.getOrcidBio().getKeywords().getKeyword().get(0).setContent("k2");
    profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().get(0).setSource(null);
    profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().get(0).setContent("o2");
    profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).setSource(null);
    profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).setUrl(new Url("http://orcid.org/researcher-url-2"));
    profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).setUrlName(new UrlName("url-name-2"));
    orcidProfileManager.updateOrcidBio(profile);
    // Everything should be updated but the primary address that was already set
    profile = orcidProfileManager.retrieveOrcidProfile(profile.getOrcidIdentifier().getPath());
    assertNotNull(profile);
    assertNotNull(profile.getOrcidBio());
    assertNotNull(profile.getOrcidBio().getBiography());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getBiography().getVisibility());
    assertEquals("This is my biography # 2", profile.getOrcidBio().getBiography().getContent());
    assertNotNull(profile.getOrcidBio().getContactDetails());
    assertNotNull(profile.getOrcidBio().getContactDetails().getAddress());
    assertNotNull(profile.getOrcidBio().getContactDetails().getAddress().getCountry());
    assertNotNull(profile.getOrcidBio().getContactDetails().getEmail());
    assertEquals(1, profile.getOrcidBio().getContactDetails().getEmail().size());
    assertNotNull(profile.getOrcidBio().getContactDetails().getEmail().get(0).getValue());
    assertEquals(email, profile.getOrcidBio().getContactDetails().getEmail().get(0).getValue());
    assertNotNull(profile.getOrcidBio().getExternalIdentifiers());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getExternalIdentifiers().getVisibility());
    assertNotNull(profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier());
    assertEquals(1, profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().size());
    assertEquals("common-name-2", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
    assertEquals("ext-id-reference-2", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdReference().getContent());
    assertEquals("http://orcid.org/ext-id-2", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdUrl().getValue());
    assertNotNull(profile.getOrcidBio().getKeywords());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getKeywords().getVisibility());
    assertEquals(1, profile.getOrcidBio().getKeywords().getKeyword().size());
    assertEquals("k2", profile.getOrcidBio().getKeywords().getKeyword().get(0).getContent());
    assertNotNull(profile.getOrcidBio().getPersonalDetails());
    assertNotNull(profile.getOrcidBio().getPersonalDetails().getOtherNames());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility());
    assertEquals(1, profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().size());
    assertEquals("o2", profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().get(0).getContent());
    assertNotNull(profile.getOrcidBio().getResearcherUrls());
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getResearcherUrls().getVisibility());
    assertEquals(1, profile.getOrcidBio().getResearcherUrls().getResearcherUrl().size());
    assertEquals("http://orcid.org/researcher-url-2", profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrl().getValue());
    assertEquals("url-name-2", profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrlName().getContent());
    // Primary address should remain
    assertEquals(Iso3166Country.US, profile.getOrcidBio().getContactDetails().getAddress().getCountry().getValue());
    profileEntity = profileDao.find(profile.getOrcidIdentifier().getPath());
    assertNotNull(profileEntity);
    assertNotNull(profileEntity.getAddresses());
    assertEquals(2, profileEntity.getAddresses().size());
    Iterator<AddressEntity> it = profileEntity.getAddresses().iterator();
    while (it.hasNext()) {
        assertThat(it.next().getIso2Country(), anyOf(is(org.orcid.jaxb.model.common_v2.Iso3166Country.US), is(org.orcid.jaxb.model.common_v2.Iso3166Country.CR)));
    }
    // Claim the record
    OrcidHistory orcidHistory = new OrcidHistory();
    orcidHistory.setClaimed(new Claimed(true));
    orcidHistory.setCreationMethod(CreationMethod.DIRECT);
    orcidHistory.setSubmissionDate(new SubmissionDate(DateUtils.convertToXMLGregorianCalendar(new Date())));
    profile.setOrcidHistory(orcidHistory);
    Preferences preferences = new Preferences();
    preferences.setSendChangeNotifications(new SendChangeNotifications(true));
    preferences.setSendOrcidNews(new SendOrcidNews(true));
    // Default visibility for user will be LIMITED
    preferences.setActivitiesVisibilityDefault(new ActivitiesVisibilityDefault(Visibility.LIMITED));
    preferences.setNotificationsEnabled(DefaultPreferences.NOTIFICATIONS_ENABLED);
    preferences.setSendEmailFrequencyDays(DefaultPreferences.SEND_EMAIL_FREQUENCY_DAYS);
    preferences.setSendMemberUpdateRequests(DefaultPreferences.SEND_MEMBER_UPDATE_REQUESTS);
    OrcidInternal internal = new OrcidInternal();
    internal.setPreferences(preferences);
    profile.setOrcidInternal(internal);
    orcidProfileManager.updateOrcidProfile(profile);
    // Everything should be updated but the address, because the record is claimed
    profile.getOrcidBio().getBiography().setContent("This is my biography # 3");
    profile.getOrcidBio().getContactDetails().getAddress().setCountry(new Country(Iso3166Country.PE));
    profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).setSource(null);
    profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).setExternalIdCommonName(new ExternalIdCommonName("common-name-3"));
    profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).setExternalIdReference(new ExternalIdReference("ext-id-reference-3"));
    profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).setExternalIdUrl(new ExternalIdUrl("http://orcid.org/ext-id-3"));
    profile.getOrcidBio().getKeywords().getKeyword().get(0).setSource(null);
    profile.getOrcidBio().getKeywords().getKeyword().get(0).setContent("k3");
    profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().get(0).setSource(null);
    profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().get(0).setContent("o3");
    profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).setSource(null);
    profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).setUrl(new Url("http://orcid.org/researcher-url-3"));
    profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).setUrlName(new UrlName("url-name-3"));
    orcidProfileManager.updateOrcidBio(profile);
    profile = orcidProfileManager.retrieveOrcidProfile(profile.getOrcidIdentifier().getPath());
    assertNotNull(profile);
    assertNotNull(profile.getOrcidBio());
    assertNotNull(profile.getOrcidBio().getBiography());
    assertEquals(Visibility.LIMITED, profile.getOrcidBio().getBiography().getVisibility());
    assertEquals("This is my biography # 3", profile.getOrcidBio().getBiography().getContent());
    assertNotNull(profile.getOrcidBio().getContactDetails());
    assertNotNull(profile.getOrcidBio().getContactDetails().getAddress());
    assertNotNull(profile.getOrcidBio().getContactDetails().getAddress().getCountry());
    assertNotNull(profile.getOrcidBio().getContactDetails().getEmail());
    assertEquals(1, profile.getOrcidBio().getContactDetails().getEmail().size());
    assertNotNull(profile.getOrcidBio().getContactDetails().getEmail().get(0).getValue());
    assertEquals(email, profile.getOrcidBio().getContactDetails().getEmail().get(0).getValue());
    assertNotNull(profile.getOrcidBio().getExternalIdentifiers());
    assertEquals(Visibility.LIMITED, profile.getOrcidBio().getExternalIdentifiers().getVisibility());
    assertNotNull(profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier());
    assertEquals(1, profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().size());
    assertEquals("common-name-3", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdCommonName().getContent());
    assertEquals("ext-id-reference-3", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdReference().getContent());
    assertEquals("http://orcid.org/ext-id-3", profile.getOrcidBio().getExternalIdentifiers().getExternalIdentifier().get(0).getExternalIdUrl().getValue());
    assertNotNull(profile.getOrcidBio().getKeywords());
    assertEquals(Visibility.LIMITED, profile.getOrcidBio().getKeywords().getVisibility());
    assertEquals(1, profile.getOrcidBio().getKeywords().getKeyword().size());
    assertEquals("k3", profile.getOrcidBio().getKeywords().getKeyword().get(0).getContent());
    assertNotNull(profile.getOrcidBio().getPersonalDetails());
    assertNotNull(profile.getOrcidBio().getPersonalDetails().getOtherNames());
    assertEquals(Visibility.LIMITED, profile.getOrcidBio().getPersonalDetails().getOtherNames().getVisibility());
    assertEquals(1, profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().size());
    assertEquals("o3", profile.getOrcidBio().getPersonalDetails().getOtherNames().getOtherName().get(0).getContent());
    assertNotNull(profile.getOrcidBio().getResearcherUrls());
    assertEquals(Visibility.LIMITED, profile.getOrcidBio().getResearcherUrls().getVisibility());
    assertEquals(1, profile.getOrcidBio().getResearcherUrls().getResearcherUrl().size());
    assertEquals("http://orcid.org/researcher-url-3", profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrl().getValue());
    assertEquals("url-name-3", profile.getOrcidBio().getResearcherUrls().getResearcherUrl().get(0).getUrlName().getContent());
    profileEntity = profileDao.find(profile.getOrcidIdentifier().getPath());
    assertNotNull(profileEntity);
    assertNotNull(profileEntity.getAddresses());
    assertEquals(3, profileEntity.getAddresses().size());
    it = profileEntity.getAddresses().iterator();
    while (it.hasNext()) {
        assertThat(it.next().getIso2Country(), anyOf(is(org.orcid.jaxb.model.common_v2.Iso3166Country.US), is(org.orcid.jaxb.model.common_v2.Iso3166Country.CR), is(org.orcid.jaxb.model.common_v2.Iso3166Country.PE)));
    }
    // Primary address should remain
    assertEquals(Visibility.PUBLIC, profile.getOrcidBio().getContactDetails().getAddress().getCountry().getVisibility());
    assertEquals(Iso3166Country.US, profile.getOrcidBio().getContactDetails().getAddress().getCountry().getValue());
}
Also used : SendOrcidNews(org.orcid.jaxb.model.message.SendOrcidNews) ExternalIdReference(org.orcid.jaxb.model.message.ExternalIdReference) OrcidInternal(org.orcid.jaxb.model.message.OrcidInternal) UrlName(org.orcid.jaxb.model.message.UrlName) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Url(org.orcid.jaxb.model.message.Url) ResearcherUrl(org.orcid.jaxb.model.message.ResearcherUrl) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) Claimed(org.orcid.jaxb.model.message.Claimed) SubmissionDate(org.orcid.jaxb.model.message.SubmissionDate) Date(java.util.Date) ApprovalDate(org.orcid.jaxb.model.message.ApprovalDate) ExternalIdUrl(org.orcid.jaxb.model.message.ExternalIdUrl) OrcidProfile(org.orcid.jaxb.model.message.OrcidProfile) ExternalIdCommonName(org.orcid.jaxb.model.message.ExternalIdCommonName) OrcidHistory(org.orcid.jaxb.model.message.OrcidHistory) Country(org.orcid.jaxb.model.message.Country) Iso3166Country(org.orcid.jaxb.model.message.Iso3166Country) ActivitiesVisibilityDefault(org.orcid.jaxb.model.message.ActivitiesVisibilityDefault) Preferences(org.orcid.jaxb.model.message.Preferences) DefaultPreferences(org.orcid.core.constants.DefaultPreferences) SendChangeNotifications(org.orcid.jaxb.model.message.SendChangeNotifications) AddressEntity(org.orcid.persistence.jpa.entities.AddressEntity) Test(org.junit.Test) Rollback(org.springframework.test.annotation.Rollback) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

AddressEntity (org.orcid.persistence.jpa.entities.AddressEntity)31 Date (java.util.Date)13 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)13 Test (org.junit.Test)9 OrcidDuplicatedElementException (org.orcid.core.exception.OrcidDuplicatedElementException)8 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)7 Address (org.orcid.jaxb.model.record_v2.Address)6 ExternalIdentifierEntity (org.orcid.persistence.jpa.entities.ExternalIdentifierEntity)6 OtherNameEntity (org.orcid.persistence.jpa.entities.OtherNameEntity)6 ProfileKeywordEntity (org.orcid.persistence.jpa.entities.ProfileKeywordEntity)6 ResearcherUrlEntity (org.orcid.persistence.jpa.entities.ResearcherUrlEntity)6 ApplicationException (org.orcid.core.exception.ApplicationException)5 Address (org.orcid.jaxb.model.v3.dev1.record.Address)5 Transactional (org.springframework.transaction.annotation.Transactional)5 HashMap (java.util.HashMap)4 Transactional (javax.transaction.Transactional)4 Visibility (org.orcid.jaxb.model.common_v2.Visibility)3 DBUnitTest (org.orcid.test.DBUnitTest)3 InvalidParameterException (java.security.InvalidParameterException)2 MapperFactory (ma.glasnost.orika.MapperFactory)2