Search in sources :

Example 41 with Record

use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.

the class ContributorUtilsTest method getWorkWithOrcidContributor.

private Work getWorkWithOrcidContributor() {
    Work work = new Work();
    WorkTitle workTitle = new WorkTitle();
    workTitle.setTitle(new Title("work with contributor who has ORCID record"));
    work.setWorkTitle(workTitle);
    work.setWorkContributors(getWorkContributorWithOrcid());
    return work;
}
Also used : WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle) Work(org.orcid.jaxb.model.v3.dev1.record.Work) Title(org.orcid.jaxb.model.v3.dev1.common.Title) FundingTitle(org.orcid.jaxb.model.v3.dev1.record.FundingTitle) WorkTitle(org.orcid.jaxb.model.v3.dev1.record.WorkTitle)

Example 42 with Record

use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.

the class BlackBoxBaseV3 method createGroupIdsV3.

/**
 * Create group ids
 */
public List<GroupIdRecord> createGroupIdsV3() throws JSONException {
    // Use the existing ones
    if (groupRecords != null && !groupRecords.isEmpty())
        return groupRecords;
    groupRecords = new ArrayList<GroupIdRecord>();
    String token = getClientCredentialsAccessToken(ScopePathType.GROUP_ID_RECORD_UPDATE, getClient1ClientId(), getClient1ClientSecret(), APIRequestType.MEMBER);
    GroupIdRecord g1 = new GroupIdRecord();
    g1.setDescription("Description");
    g1.setGroupId("orcid-generated:01" + System.currentTimeMillis());
    g1.setName("Group # 1");
    g1.setType("publisher");
    GroupIdRecord g2 = new GroupIdRecord();
    g2.setDescription("Description");
    g2.setGroupId("orcid-generated:02" + System.currentTimeMillis());
    g2.setName("Group # 2");
    g2.setType("publisher");
    ClientResponse r1 = memberV3Dev1ApiClient.createGroupIdRecord(g1, token);
    String r1LocationPutCode = r1.getLocation().getPath().replace("/orcid-api-web/v3.0_dev1/group-id-record/", "");
    g1.setPutCode(Long.valueOf(r1LocationPutCode));
    groupRecords.add(g1);
    ClientResponse r2 = memberV3Dev1ApiClient.createGroupIdRecord(g2, token);
    String r2LocationPutCode = r2.getLocation().getPath().replace("/orcid-api-web/v3.0_dev1/group-id-record/", "");
    g2.setPutCode(Long.valueOf(r2LocationPutCode));
    groupRecords.add(g2);
    return groupRecords;
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) GroupIdRecord(org.orcid.jaxb.model.v3.dev1.groupid.GroupIdRecord)

Example 43 with Record

use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.

the class NotificationController method getAmendedNotificationHtml.

@RequestMapping(value = "/AMENDED/{id}/notification.html", produces = OrcidApiConstants.HTML_UTF)
public ModelAndView getAmendedNotificationHtml(@PathVariable("id") String id) {
    String orcid = getEffectiveUserOrcid();
    ProfileEntity record = profileEntityCacheManager.retrieve(orcid);
    ModelAndView mav = new ModelAndView();
    Notification notification = notificationManager.findByOrcidAndId(getCurrentUserOrcid(), Long.valueOf(id));
    addSourceDescription(notification);
    mav.addObject("notification", notification);
    mav.addObject("emailName", notificationManager.deriveEmailFriendlyName(record));
    mav.setViewName("notification/amended_notification");
    mav.addObject("noIndex", true);
    return mav;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Notification(org.orcid.jaxb.model.v3.dev1.notification.Notification) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 44 with Record

use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.

the class FundingsController method createFundingIdList.

/**
 * Create a funding id list and sorts a map associated with the list in in
 * the session
 */
private List<String> createFundingIdList(HttpServletRequest request) {
    Map<String, String> languages = lm.buildLanguageMap(getUserLocale(), false);
    String orcid = getEffectiveUserOrcid();
    List<Funding> fundings = profileFundingManager.getFundingList(orcid);
    HashMap<String, FundingForm> fundingsMap = new HashMap<String, FundingForm>();
    List<String> fundingIds = new ArrayList<String>();
    if (fundings != null) {
        for (Funding funding : fundings) {
            try {
                FundingForm form = FundingForm.valueOf(funding);
                if (funding.getType() != null) {
                    form.setFundingTypeForDisplay(getMessage(buildInternationalizationKey(org.orcid.jaxb.model.message.FundingType.class, funding.getType().value())));
                }
                // Set translated title language name
                if (!(funding.getTitle().getTranslatedTitle() == null) && !StringUtils.isEmpty(funding.getTitle().getTranslatedTitle().getLanguageCode())) {
                    String languageName = languages.get(funding.getTitle().getTranslatedTitle().getLanguageCode());
                    form.getFundingTitle().getTranslatedTitle().setLanguageName(languageName);
                }
                // Set the formatted amount
                if (funding.getAmount() != null && StringUtils.isNotBlank(funding.getAmount().getContent())) {
                    BigDecimal bigDecimal = new BigDecimal(funding.getAmount().getContent());
                    String formattedAmount = formatAmountString(bigDecimal);
                    form.setAmount(Text.valueOf(formattedAmount));
                }
                if (form.getContributors() != null) {
                    for (Contributor contributor : form.getContributors()) {
                        if (!PojoUtil.isEmpty(contributor.getOrcid())) {
                            String contributorOrcid = contributor.getOrcid().getValue();
                            if (profileEntityManager.orcidExists(contributorOrcid)) {
                                // contributor is an ORCID user - visibility of user's name in record must be taken into account
                                ProfileEntity profileEntity = profileEntityCacheManager.retrieve(contributorOrcid);
                                String publicContributorCreditName = cacheManager.getPublicCreditName(profileEntity);
                                contributor.setCreditName(Text.valueOf(publicContributorCreditName));
                            }
                        }
                    }
                }
                form.setCountryForDisplay(getMessage(buildInternationalizationKey(CountryIsoEntity.class, funding.getOrganization().getAddress().getCountry().name())));
                String putCode = String.valueOf(funding.getPutCode());
                fundingsMap.put(putCode, form);
                fundingIds.add(putCode);
            } catch (Exception e) {
                LOGGER.error("Failed to parse as Funding. Put code" + funding.getPutCode(), e);
            }
        }
        request.getSession().setAttribute(GRANT_MAP, fundingsMap);
    }
    return fundingIds;
}
Also used : Funding(org.orcid.jaxb.model.v3.dev1.record.Funding) HashMap(java.util.HashMap) FundingForm(org.orcid.pojo.ajaxForm.FundingForm) ArrayList(java.util.ArrayList) Contributor(org.orcid.pojo.ajaxForm.Contributor) BigDecimal(java.math.BigDecimal) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity)

Example 45 with Record

use of org.orcid.jaxb.model.v3.dev1.record.Record in project ORCID-Source by ORCID.

the class OrcidSecurityManager_FullRecordTest method testRecord_When_AllPrivate_NoSource_ReadLimitedToken.

@Test
public void testRecord_When_AllPrivate_NoSource_ReadLimitedToken() {
    SecurityContextTestUtils.setUpSecurityContext(ORCID_1, CLIENT_1, ScopePathType.READ_LIMITED);
    Name name = createName(Visibility.PRIVATE);
    Biography bio = createBiography(Visibility.PRIVATE);
    Address a1 = createAddress(Visibility.PRIVATE, CLIENT_2);
    Address a2 = createAddress(Visibility.PRIVATE, CLIENT_2);
    Address a3 = createAddress(Visibility.PRIVATE, CLIENT_2);
    Addresses addresses = new Addresses();
    addresses.setAddress(new ArrayList<Address>(Arrays.asList(a1, a2, a3)));
    Email e1 = createEmail(Visibility.PRIVATE, CLIENT_2);
    Email e2 = createEmail(Visibility.PRIVATE, CLIENT_2);
    Email e3 = createEmail(Visibility.PRIVATE, CLIENT_2);
    Emails emails = new Emails();
    emails.setEmails(new ArrayList<Email>(Arrays.asList(e1, e2, e3)));
    Keyword k1 = createKeyword(Visibility.PRIVATE, CLIENT_2);
    Keyword k2 = createKeyword(Visibility.PRIVATE, CLIENT_2);
    Keyword k3 = createKeyword(Visibility.PRIVATE, CLIENT_2);
    Keywords keywords = new Keywords();
    keywords.setKeywords(new ArrayList<Keyword>(Arrays.asList(k1, k2, k3)));
    OtherName o1 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o2 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherName o3 = createOtherName(Visibility.PRIVATE, CLIENT_2);
    OtherNames otherNames = new OtherNames();
    otherNames.setOtherNames(new ArrayList<OtherName>(Arrays.asList(o1, o2, o3)));
    PersonExternalIdentifier ext1 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
    PersonExternalIdentifier ext2 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
    PersonExternalIdentifier ext3 = createPersonExternalIdentifier(Visibility.PRIVATE, CLIENT_2);
    PersonExternalIdentifiers extIds = new PersonExternalIdentifiers();
    extIds.setExternalIdentifiers(new ArrayList<PersonExternalIdentifier>(Arrays.asList(ext1, ext2, ext3)));
    ResearcherUrl r1 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
    ResearcherUrl r2 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
    ResearcherUrl r3 = createResearcherUrl(Visibility.PRIVATE, CLIENT_2);
    ResearcherUrls researcherUrls = new ResearcherUrls();
    researcherUrls.setResearcherUrls(new ArrayList<ResearcherUrl>(Arrays.asList(r1, r2, r3)));
    EducationSummary edu1 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
    EducationSummary edu2 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
    EducationSummary edu3 = createEducationSummary(Visibility.PRIVATE, CLIENT_2);
    EmploymentSummary em1 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
    EmploymentSummary em2 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
    EmploymentSummary em3 = createEmploymentSummary(Visibility.PRIVATE, CLIENT_2);
    FundingSummary f1 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_1);
    FundingSummary f2 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
    FundingSummary f3 = createFundingSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    PeerReviewSummary p1 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_1);
    PeerReviewSummary p2 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
    PeerReviewSummary p3 = createPeerReviewSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    WorkSummary w1 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_1);
    WorkSummary w2 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_2);
    WorkSummary w3 = createWorkSummary(Visibility.PRIVATE, CLIENT_2, EXTID_3);
    DistinctionSummary d1 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
    DistinctionSummary d2 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
    DistinctionSummary d3 = createDistinctionSummary(Visibility.PRIVATE, CLIENT_2);
    InvitedPositionSummary i1 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
    InvitedPositionSummary i2 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
    InvitedPositionSummary i3 = createInvitedPositionSummary(Visibility.PRIVATE, CLIENT_2);
    MembershipSummary m1 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
    MembershipSummary m2 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
    MembershipSummary m3 = createMembershipSummary(Visibility.PRIVATE, CLIENT_2);
    QualificationSummary q1 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
    QualificationSummary q2 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
    QualificationSummary q3 = createQualificationSummary(Visibility.PRIVATE, CLIENT_2);
    ServiceSummary s1 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
    ServiceSummary s2 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
    ServiceSummary s3 = createServiceSummary(Visibility.PRIVATE, CLIENT_2);
    ActivitiesSummary as = new ActivitiesSummary();
    as.setEducations(createEducations(edu1, edu2, edu3));
    as.setEmployments(createEmployments(em1, em2, em3));
    as.setFundings(createFundings(f1, f2, f3));
    as.setPeerReviews(createPeerReviews(p1, p2, p3));
    as.setWorks(createWorks(w1, w2, w3));
    as.setDistinctions(createDistinctions(d1, d2, d3));
    as.setInvitedPositions(createInvitedPositions(i1, i2, i3));
    as.setMemberships(createMemberships(m1, m2, m3));
    as.setQualifications(createQualifications(q1, q2, q3));
    as.setServices(createServices(s1, s2, s3));
    Person p = new Person();
    p.setBiography(bio);
    p.setName(name);
    p.setAddresses(addresses);
    p.setEmails(emails);
    p.setExternalIdentifiers(extIds);
    p.setKeywords(keywords);
    p.setOtherNames(otherNames);
    p.setResearcherUrls(researcherUrls);
    Record record = new Record();
    record.setActivitiesSummary(as);
    record.setPerson(p);
    orcidSecurityManager.checkAndFilter(ORCID_1, record);
    assertNotNull(record);
    // Check person
    assertNull(p.getName());
    assertNull(p.getBiography());
    // Check addresses
    assertEquals(0, p.getAddresses().getAddress().size());
    // Check emails
    assertEquals(0, p.getEmails().getEmails().size());
    // Check ext ids
    assertEquals(0, p.getExternalIdentifiers().getExternalIdentifiers().size());
    // Check keywords
    assertEquals(0, p.getKeywords().getKeywords().size());
    // Check other names
    assertEquals(0, p.getOtherNames().getOtherNames().size());
    // Check researcher urls
    assertEquals(0, p.getResearcherUrls().getResearcherUrls().size());
    // Check activities
    assertNotNull(as);
    // Check distinctions
    assertEquals(0, as.getDistinctions().getSummaries().size());
    // Check invited positions
    assertEquals(0, as.getInvitedPositions().getSummaries().size());
    // Check memberships
    assertEquals(0, as.getMemberships().getSummaries().size());
    // Check qualifications
    assertEquals(0, as.getQualifications().getSummaries().size());
    // Check services
    assertEquals(0, as.getServices().getSummaries().size());
    // Check educations
    assertEquals(0, as.getEducations().getSummaries().size());
    // Check employments
    assertEquals(0, as.getEmployments().getSummaries().size());
    // Check fundings
    assertEquals(0, as.getFundings().getFundingGroup().size());
    // Check peer reviews
    assertEquals(0, as.getPeerReviews().getPeerReviewGroup().size());
    // Check works
    assertEquals(0, as.getWorks().getWorkGroup().size());
}
Also used : Email(org.orcid.jaxb.model.v3.dev1.record.Email) Keywords(org.orcid.jaxb.model.v3.dev1.record.Keywords) Address(org.orcid.jaxb.model.v3.dev1.record.Address) OtherNames(org.orcid.jaxb.model.v3.dev1.record.OtherNames) OtherName(org.orcid.jaxb.model.v3.dev1.record.OtherName) Name(org.orcid.jaxb.model.v3.dev1.record.Name) ActivitiesSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary) Addresses(org.orcid.jaxb.model.v3.dev1.record.Addresses) WorkSummary(org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary) Biography(org.orcid.jaxb.model.v3.dev1.record.Biography) FundingSummary(org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary) ResearcherUrls(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrls) DistinctionSummary(org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary) ResearcherUrl(org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl) Record(org.orcid.jaxb.model.v3.dev1.record.Record) Emails(org.orcid.jaxb.model.v3.dev1.record.Emails) ServiceSummary(org.orcid.jaxb.model.v3.dev1.record.summary.ServiceSummary) Keyword(org.orcid.jaxb.model.v3.dev1.record.Keyword) OtherName(org.orcid.jaxb.model.v3.dev1.record.OtherName) PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier) InvitedPositionSummary(org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary) QualificationSummary(org.orcid.jaxb.model.v3.dev1.record.summary.QualificationSummary) PersonExternalIdentifiers(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifiers) EducationSummary(org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary) PeerReviewSummary(org.orcid.jaxb.model.v3.dev1.record.summary.PeerReviewSummary) EmploymentSummary(org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary) MembershipSummary(org.orcid.jaxb.model.v3.dev1.record.summary.MembershipSummary) Person(org.orcid.jaxb.model.v3.dev1.record.Person) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)34 Record (org.orcid.jaxb.model.v3.dev1.record.Record)33 Email (org.orcid.jaxb.model.v3.dev1.record.Email)18 ActivitiesSummary (org.orcid.jaxb.model.v3.dev1.record.summary.ActivitiesSummary)18 Person (org.orcid.jaxb.model.v3.dev1.record.Person)17 Address (org.orcid.jaxb.model.v3.dev1.record.Address)16 Keyword (org.orcid.jaxb.model.v3.dev1.record.Keyword)16 PersonExternalIdentifier (org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)16 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)16 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)15 Emails (org.orcid.jaxb.model.v3.dev1.record.Emails)15 Name (org.orcid.jaxb.model.v3.dev1.record.Name)15 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)15 EducationSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EducationSummary)15 EmploymentSummary (org.orcid.jaxb.model.v3.dev1.record.summary.EmploymentSummary)15 FundingSummary (org.orcid.jaxb.model.v3.dev1.record.summary.FundingSummary)15 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)15 OtherNames (org.orcid.jaxb.model.v3.dev1.record.OtherNames)14 DistinctionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.DistinctionSummary)14 InvitedPositionSummary (org.orcid.jaxb.model.v3.dev1.record.summary.InvitedPositionSummary)14