Search in sources :

Example 11 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class BlackBoxBaseRC4 method unmarshallFromPath.

public Object unmarshallFromPath(String path, Class<?> type) {
    try (Reader reader = new InputStreamReader(getClass().getResourceAsStream(path))) {
        Object obj = unmarshall(reader, type);
        Object result = null;
        if (Address.class.equals(type)) {
            result = (Address) obj;
        } else if (Education.class.equals(type)) {
            result = (Education) obj;
        } else if (Employment.class.equals(type)) {
            result = (Employment) obj;
        } else if (Funding.class.equals(type)) {
            result = (Funding) obj;
        } else if (Keyword.class.equals(type)) {
            result = (Keyword) obj;
        } else if (Work.class.equals(type)) {
            result = (Work) obj;
        } else if (PeerReview.class.equals(type)) {
            result = (PeerReview) obj;
        } else if (ResearcherUrl.class.equals(type)) {
            result = (ResearcherUrl) obj;
        } else if (PersonalDetails.class.equals(type)) {
            result = (PersonalDetails) obj;
        } else if (OtherName.class.equals(type)) {
            result = (OtherName) obj;
        } else if (PersonExternalIdentifier.class.equals(type)) {
            result = (PersonExternalIdentifier) obj;
        }
        return result;
    } catch (IOException e) {
        throw new RuntimeException("Error reading notification from classpath", e);
    }
}
Also used : InputStreamReader(java.io.InputStreamReader) Education(org.orcid.jaxb.model.record_rc4.Education) Funding(org.orcid.jaxb.model.record_rc4.Funding) Work(org.orcid.jaxb.model.record_rc4.Work) OtherName(org.orcid.jaxb.model.record_rc4.OtherName) Reader(java.io.Reader) InputStreamReader(java.io.InputStreamReader) ResearcherUrl(org.orcid.jaxb.model.record_rc4.ResearcherUrl) IOException(java.io.IOException)

Example 12 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class MemberV2Test method createViewUpdateAndDeleteFunding.

@Test
public void createViewUpdateAndDeleteFunding() throws JSONException, InterruptedException, URISyntaxException {
    long time = System.currentTimeMillis();
    Funding funding = (Funding) unmarshallFromPath("/record_2.0_rc4/samples/funding-2.0_rc4.xml", Funding.class);
    funding.setPutCode(null);
    funding.setVisibility(Visibility.PUBLIC);
    funding.getExternalIdentifiers().getExternalIdentifier().clear();
    ExternalID fExtId = new ExternalID();
    fExtId.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
    fExtId.setValue("Funding Id " + time);
    fExtId.setRelationship(Relationship.SELF);
    funding.getExternalIdentifiers().getExternalIdentifier().add(fExtId);
    String accessToken = getAccessToken();
    ClientResponse postResponse = memberV2ApiClient.createFundingXml(this.getUser1OrcidId(), funding, accessToken);
    assertNotNull(postResponse);
    assertEquals(Response.Status.CREATED.getStatusCode(), postResponse.getStatus());
    String locationPath = postResponse.getLocation().getPath();
    assertTrue("Location header path should match pattern, but was " + locationPath, locationPath.matches(".*/v2.0_rc4/" + this.getUser1OrcidId() + "/funding/\\d+"));
    ClientResponse getResponse = memberV2ApiClient.viewLocationXml(postResponse.getLocation(), accessToken);
    assertEquals(Response.Status.OK.getStatusCode(), getResponse.getStatus());
    Funding gotFunding = getResponse.getEntity(Funding.class);
    assertEquals("common:title", gotFunding.getTitle().getTitle().getContent());
    assertEquals("common:translated-title", gotFunding.getTitle().getTranslatedTitle().getContent());
    assertEquals("en", gotFunding.getTitle().getTranslatedTitle().getLanguageCode());
    //Save the original visibility
    Visibility originalVisibility = gotFunding.getVisibility();
    Visibility updatedVisibility = Visibility.PRIVATE.equals(originalVisibility) ? Visibility.LIMITED : Visibility.PRIVATE;
    //Verify you cant update the visibility
    gotFunding.setVisibility(updatedVisibility);
    ClientResponse putResponse = memberV2ApiClient.updateLocationXml(postResponse.getLocation(), accessToken, gotFunding);
    assertEquals(Response.Status.FORBIDDEN.getStatusCode(), putResponse.getStatus());
    OrcidError error = putResponse.getEntity(OrcidError.class);
    assertNotNull(error);
    assertEquals(Integer.valueOf(9035), error.getErrorCode());
    //Set the visibility again to the initial one
    gotFunding.setVisibility(originalVisibility);
    gotFunding.getTitle().getTitle().setContent("Updated title");
    gotFunding.getTitle().getTranslatedTitle().setContent("Updated translated title");
    gotFunding.getTitle().getTranslatedTitle().setLanguageCode("es");
    putResponse = memberV2ApiClient.updateLocationXml(postResponse.getLocation(), accessToken, gotFunding);
    assertEquals(Response.Status.OK.getStatusCode(), putResponse.getStatus());
    ClientResponse getAfterUpdateResponse = memberV2ApiClient.viewLocationXml(postResponse.getLocation(), accessToken);
    assertEquals(Response.Status.OK.getStatusCode(), getAfterUpdateResponse.getStatus());
    Funding gotAfterUpdateFunding = getAfterUpdateResponse.getEntity(Funding.class);
    assertEquals("Updated title", gotAfterUpdateFunding.getTitle().getTitle().getContent());
    assertEquals("Updated translated title", gotAfterUpdateFunding.getTitle().getTranslatedTitle().getContent());
    assertEquals("es", gotAfterUpdateFunding.getTitle().getTranslatedTitle().getLanguageCode());
    ClientResponse deleteResponse = memberV2ApiClient.deleteFundingXml(this.getUser1OrcidId(), gotFunding.getPutCode(), accessToken);
    assertEquals(Response.Status.NO_CONTENT.getStatusCode(), deleteResponse.getStatus());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) OrcidError(org.orcid.jaxb.model.error_rc4.OrcidError) Funding(org.orcid.jaxb.model.record_rc4.Funding) ExternalID(org.orcid.jaxb.model.record_rc4.ExternalID) Visibility(org.orcid.jaxb.model.common_rc4.Visibility) Test(org.junit.Test)

Example 13 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class MemberV2Test method testTokenWorksOnlyForTheScopeItWasIssued.

@SuppressWarnings({ "deprecation", "rawtypes" })
@Test
public void testTokenWorksOnlyForTheScopeItWasIssued() throws JSONException, InterruptedException, URISyntaxException {
    long time = System.currentTimeMillis();
    List<String> scopes = getScopes(ScopePathType.FUNDING_CREATE, ScopePathType.FUNDING_UPDATE);
    String accessToken = getAccessToken(scopes);
    Work work1 = (Work) unmarshallFromPath("/record_2.0_rc3/samples/work-2.0_rc3.xml", Work.class);
    work1.setPutCode(null);
    work1.getExternalIdentifiers().getExternalIdentifier().clear();
    org.orcid.jaxb.model.record_rc3.WorkTitle title1 = new org.orcid.jaxb.model.record_rc3.WorkTitle();
    title1.setTitle(new Title("Work # 1"));
    work1.setWorkTitle(title1);
    ExternalID wExtId1 = new ExternalID();
    wExtId1.setValue("Work Id " + time);
    wExtId1.setType(WorkExternalIdentifierType.AGR.value());
    wExtId1.setRelationship(Relationship.SELF);
    wExtId1.setUrl(new Url("http://orcid.org/work#1"));
    work1.getExternalIdentifiers().getExternalIdentifier().clear();
    work1.getExternalIdentifiers().getExternalIdentifier().add(wExtId1);
    //Add the work
    ClientResponse postResponse = memberV2ApiClient.createWorkXml(this.getUser1OrcidId(), work1, accessToken);
    assertNotNull(postResponse);
    assertEquals(Response.Status.FORBIDDEN.getStatusCode(), postResponse.getStatus());
    Funding funding = (Funding) unmarshallFromPath("/record_2.0_rc3/samples/funding-2.0_rc3.xml", Funding.class);
    funding.setPutCode(null);
    funding.setVisibility(Visibility.PUBLIC);
    funding.getExternalIdentifiers().getExternalIdentifier().clear();
    ExternalID fExtId = new ExternalID();
    fExtId.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
    fExtId.setValue("Funding Id " + time);
    fExtId.setRelationship(Relationship.SELF);
    funding.getExternalIdentifiers().getExternalIdentifier().add(fExtId);
    //Add the funding
    postResponse = memberV2ApiClient.createFundingXml(this.getUser1OrcidId(), funding, accessToken);
    assertNotNull(postResponse);
    assertEquals(Response.Status.CREATED.getStatusCode(), postResponse.getStatus());
    // Delete funding        
    Map map = postResponse.getMetadata();
    assertNotNull(map);
    assertTrue(map.containsKey("Location"));
    List resultWithPutCode = (List) map.get("Location");
    String location = resultWithPutCode.get(0).toString();
    Long putCode = Long.valueOf(location.substring(location.lastIndexOf('/') + 1));
    ClientResponse deleteResponse = memberV2ApiClient.deleteFundingXml(this.getUser1OrcidId(), putCode, accessToken);
    assertNotNull(deleteResponse);
    assertEquals(Response.Status.NO_CONTENT.getStatusCode(), deleteResponse.getStatus());
}
Also used : ClientResponse(com.sun.jersey.api.client.ClientResponse) Funding(org.orcid.jaxb.model.record_rc3.Funding) ExternalID(org.orcid.jaxb.model.record_rc3.ExternalID) Title(org.orcid.jaxb.model.common_rc3.Title) Url(org.orcid.jaxb.model.common_rc3.Url) Work(org.orcid.jaxb.model.record_rc3.Work) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) Test(org.junit.Test)

Example 14 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class OrcidRecordToSolrDocument method convert.

public OrcidSolrDocument convert(Record record, List<Funding> fundings) {
    OrcidSolrDocument profileIndexDocument = new OrcidSolrDocument();
    profileIndexDocument.setOrcid(record.getOrcidIdentifier().getPath());
    if (record.getHistory() != null) {
        if (record.getHistory().getLastModifiedDate() != null) {
            profileIndexDocument.setProfileLastModifiedDate(record.getHistory().getLastModifiedDate().getValue().toGregorianCalendar().getTime());
        }
        if (record.getHistory().getSubmissionDate() != null) {
            profileIndexDocument.setProfileSubmissionDate(record.getHistory().getSubmissionDate().getValue().toGregorianCalendar().getTime());
        }
    }
    if (record.getDeprecated() != null) {
        profileIndexDocument.setPrimaryRecord(record.getDeprecated().getPrimaryRecord() != null ? record.getDeprecated().getPrimaryRecord().getOrcidIdentifier().getPath() : null);
    }
    if (record.getPerson() != null) {
        if (record.getPerson().getName() != null) {
            profileIndexDocument.setFamilyName(record.getPerson().getName().getFamilyName() != null ? record.getPerson().getName().getFamilyName().getContent() : null);
            profileIndexDocument.setGivenNames(record.getPerson().getName().getGivenNames() != null ? record.getPerson().getName().getGivenNames().getContent() : null);
            profileIndexDocument.setCreditName(record.getPerson().getName().getCreditName() != null ? record.getPerson().getName().getCreditName().getContent() : null);
        }
        if (record.getPerson().getOtherNames() != null) {
            if (record.getPerson().getOtherNames().getOtherNames() != null && !record.getPerson().getOtherNames().getOtherNames().isEmpty()) {
                List<String> names = new ArrayList<String>();
                for (org.orcid.jaxb.model.record_v2.OtherName on : record.getPerson().getOtherNames().getOtherNames()) {
                    names.add(on.getContent());
                }
                profileIndexDocument.setOtherNames(names);
            }
        }
        if (record.getPerson().getEmails() != null && record.getPerson().getEmails().getEmails() != null) {
            for (org.orcid.jaxb.model.record_v2.Email e : record.getPerson().getEmails().getEmails()) {
                profileIndexDocument.addEmailAddress(e.getEmail());
            }
        }
        //weird, the type is not indexed...!
        if (record.getPerson().getExternalIdentifiers() != null && record.getPerson().getExternalIdentifiers().getExternalIdentifiers() != null) {
            List<String> extIdOrcids = new ArrayList<String>();
            List<String> extIdRefs = new ArrayList<String>();
            List<String> extIdOrcidsAndRefs = new ArrayList<String>();
            for (PersonExternalIdentifier externalIdentifier : record.getPerson().getExternalIdentifiers().getExternalIdentifiers()) {
                String sourcePath = null;
                if (externalIdentifier.getSource() != null && externalIdentifier.getSource().retrieveSourcePath() != null) {
                    sourcePath = externalIdentifier.getSource().retrieveSourcePath();
                    extIdOrcids.add(sourcePath);
                }
                if (externalIdentifier.getValue() != null) {
                    //weird, the type is not indexed...!
                    extIdRefs.add(externalIdentifier.getValue());
                }
                if (NullUtils.noneNull(sourcePath, externalIdentifier.getValue())) {
                    extIdOrcidsAndRefs.add(sourcePath + "=" + externalIdentifier.getValue());
                }
            }
            if (!extIdOrcids.isEmpty()) {
                profileIndexDocument.setExternalIdSources(extIdOrcids);
            }
            if (!extIdRefs.isEmpty()) {
                profileIndexDocument.setExternalIdReferences(extIdRefs);
            }
            if (!extIdOrcidsAndRefs.isEmpty()) {
                profileIndexDocument.setExternalIdSourcesAndReferences(extIdOrcidsAndRefs);
            }
        }
        //weird, we only index keywords if activities exist...!
        if (record.getActivitiesSummary() != null) {
            if (record.getPerson().getKeywords() != null && record.getPerson().getKeywords().getKeywords() != null) {
                List<String> keywordValues = new ArrayList<String>();
                for (org.orcid.jaxb.model.record_v2.Keyword keyword : record.getPerson().getKeywords().getKeywords()) {
                    keywordValues.add(keyword.getContent());
                }
                profileIndexDocument.setKeywords(keywordValues);
            }
        }
        if (record.getActivitiesSummary() != null && record.getActivitiesSummary().getWorks() != null && record.getActivitiesSummary().getWorks().getWorkGroup() != null) {
            //work ids
            Map<String, List<String>> allExternalIdentifiers = new HashMap<String, List<String>>();
            Map<String, List<String>> partOf = new HashMap<String, List<String>>();
            Map<String, List<String>> self = new HashMap<String, List<String>>();
            Set<String> workTitles = new HashSet<String>();
            for (WorkGroup wg : record.getActivitiesSummary().getWorks().getWorkGroup()) {
                if (wg.getWorkSummary() != null) {
                    for (WorkSummary w : wg.getWorkSummary()) {
                        // have to use summaries here as group does not include part-of
                        if (w.getExternalIdentifiers() != null && w.getExternalIdentifiers().getExternalIdentifier() != null) {
                            for (ExternalID id : w.getExternalIdentifiers().getExternalIdentifier()) {
                                //old way
                                if (!allExternalIdentifiers.containsKey(id.getType())) {
                                    allExternalIdentifiers.put(id.getType(), new ArrayList<String>());
                                }
                                if (!allExternalIdentifiers.get(id.getType()).contains(id.getValue())) {
                                    allExternalIdentifiers.get(id.getType()).add(id.getValue());
                                }
                                //new way
                                if (Relationship.SELF.equals(id.getRelationship())) {
                                    if (!self.containsKey(id.getType() + SolrConstants.DYNAMIC_SELF)) {
                                        self.put(id.getType() + SolrConstants.DYNAMIC_SELF, new ArrayList<String>());
                                    }
                                    if (!self.get(id.getType() + SolrConstants.DYNAMIC_SELF).contains(id.getValue())) {
                                        self.get(id.getType() + SolrConstants.DYNAMIC_SELF).add(id.getValue());
                                    }
                                }
                                if (Relationship.PART_OF.equals(id.getRelationship())) {
                                    if (!partOf.containsKey(id.getType() + SolrConstants.DYNAMIC_PART_OF)) {
                                        partOf.put(id.getType() + SolrConstants.DYNAMIC_PART_OF, new ArrayList<String>());
                                    }
                                    if (!partOf.get(id.getType() + SolrConstants.DYNAMIC_PART_OF).contains(id.getValue())) {
                                        partOf.get(id.getType() + SolrConstants.DYNAMIC_PART_OF).add(id.getValue());
                                    }
                                }
                            }
                        }
                        if (w.getTitle() != null) {
                            if (w.getTitle().getTitle() != null && StringUtils.isNotEmpty(w.getTitle().getTitle().getContent())) {
                                workTitles.add(w.getTitle().getTitle().getContent());
                            }
                            if (w.getTitle().getSubtitle() != null && StringUtils.isNotEmpty(w.getTitle().getSubtitle().getContent())) {
                                workTitles.add(w.getTitle().getSubtitle().getContent());
                            }
                            if (w.getTitle().getTranslatedTitle() != null && StringUtils.isNotEmpty(w.getTitle().getTranslatedTitle().getContent())) {
                                workTitles.add(w.getTitle().getTranslatedTitle().getContent());
                            }
                        }
                    }
                }
            }
            profileIndexDocument.setSelfIds(self);
            profileIndexDocument.setPartOfIds(partOf);
            //now add them to the doc, the old way
            addExternalIdentifiersToIndexDocument(profileIndexDocument, allExternalIdentifiers);
            profileIndexDocument.setWorkTitles(new ArrayList<String>(workTitles));
        }
        Map<String, List<String>> organisationIds = new HashMap<String, List<String>>();
        organisationIds.put(SolrConstants.FUNDREF_ORGANISATION_ID, new ArrayList<String>());
        organisationIds.put(SolrConstants.RINGGOLD_ORGANISATION_ID, new ArrayList<String>());
        Map<String, List<String>> organisationNames = new HashMap<String, List<String>>();
        organisationNames.put(SolrConstants.AFFILIATION_ORGANISATION_NAME, new ArrayList<String>());
        organisationNames.put(SolrConstants.FUNDING_ORGANISATION_NAME, new ArrayList<String>());
        if (!fundings.isEmpty()) {
            Set<String> fundingTitle = new HashSet<String>();
            Set<String> fundingGrantNumbers = new HashSet<String>();
            for (Funding f : fundings) {
                if (f.getTitle() != null) {
                    if (f.getTitle().getTitle() != null && StringUtils.isNotEmpty(f.getTitle().getTitle().getContent())) {
                        fundingTitle.add(f.getTitle().getTitle().getContent());
                    }
                    if (f.getTitle().getTranslatedTitle() != null && StringUtils.isNotEmpty(f.getTitle().getTranslatedTitle().getContent())) {
                        fundingTitle.add(f.getTitle().getTranslatedTitle().getContent());
                    }
                }
                if (f.getExternalIdentifiers() != null && f.getExternalIdentifiers().getExternalIdentifier() != null) {
                    for (ExternalID id : f.getExternalIdentifiers().getExternalIdentifier()) {
                        if (id.getType().equals("grant_number")) {
                            fundingGrantNumbers.add(id.getValue());
                        }
                    }
                }
                if (f.getOrganization() != null) {
                    organisationNames.get(SolrConstants.FUNDING_ORGANISATION_NAME).add(f.getOrganization().getName());
                    if (f.getOrganization().getDisambiguatedOrganization() != null)
                        organisationIds.get(SolrConstants.FUNDREF_ORGANISATION_ID).add(f.getOrganization().getDisambiguatedOrganization().getDisambiguatedOrganizationIdentifier());
                }
            }
            profileIndexDocument.setFundingTitles(new ArrayList<String>(fundingTitle));
            profileIndexDocument.setGrantNumbers(new ArrayList<String>(fundingGrantNumbers));
        }
        //now do affiliations
        if (record.getActivitiesSummary() != null && record.getActivitiesSummary().getEducations() != null && record.getActivitiesSummary().getEducations().getSummaries() != null) {
            for (EducationSummary e : record.getActivitiesSummary().getEducations().getSummaries()) {
                if (e.getOrganization() != null) {
                    organisationNames.get(SolrConstants.AFFILIATION_ORGANISATION_NAME).add(e.getOrganization().getName());
                    if (e.getOrganization().getDisambiguatedOrganization() != null)
                        organisationIds.get(SolrConstants.RINGGOLD_ORGANISATION_ID).add(e.getOrganization().getDisambiguatedOrganization().getDisambiguatedOrganizationIdentifier());
                }
            }
        }
        if (record.getActivitiesSummary() != null && record.getActivitiesSummary().getEmployments() != null && record.getActivitiesSummary().getEmployments().getSummaries() != null) {
            for (EmploymentSummary e : record.getActivitiesSummary().getEmployments().getSummaries()) {
                if (e.getOrganization() != null) {
                    organisationNames.get(SolrConstants.AFFILIATION_ORGANISATION_NAME).add(e.getOrganization().getName());
                    if (e.getOrganization().getDisambiguatedOrganization() != null)
                        organisationIds.get(SolrConstants.RINGGOLD_ORGANISATION_ID).add(e.getOrganization().getDisambiguatedOrganization().getDisambiguatedOrganizationIdentifier());
                }
            }
        }
        profileIndexDocument.setOrganisationIds(organisationIds);
        profileIndexDocument.setOrganisationNames(organisationNames);
    }
    if (indexProfile) {
        try {
            StringWriter sw = new StringWriter();
            jaxbContext_2_0_api.createMarshaller().marshal(record, sw);
            profileIndexDocument.setPublicProfileMessage(sw.getBuffer().toString());
        } catch (JAXBException e) {
            LOG.error("problem marshalling xml", e);
        }
    }
    LOG.debug(profileIndexDocument.toString());
    return profileIndexDocument;
}
Also used : HashMap(java.util.HashMap) Funding(org.orcid.jaxb.model.record_v2.Funding) ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) ArrayList(java.util.ArrayList) WorkGroup(org.orcid.jaxb.model.record.summary_v2.WorkGroup) WorkSummary(org.orcid.jaxb.model.record.summary_v2.WorkSummary) StringWriter(java.io.StringWriter) OrcidSolrDocument(org.orcid.utils.solr.entities.OrcidSolrDocument) ArrayList(java.util.ArrayList) List(java.util.List) HashSet(java.util.HashSet) JAXBException(javax.xml.bind.JAXBException) PersonExternalIdentifier(org.orcid.jaxb.model.record_v2.PersonExternalIdentifier) EducationSummary(org.orcid.jaxb.model.record.summary_v2.EducationSummary) EmploymentSummary(org.orcid.jaxb.model.record.summary_v2.EmploymentSummary)

Example 15 with Funding

use of org.orcid.jaxb.model.record_rc4.Funding in project ORCID-Source by ORCID.

the class SolrMessageProcessor method updateSolrIndex.

private void updateSolrIndex(String orcid) {
    LOG.info("Updating using Record " + orcid + " in SOLR index");
    if (!isSolrIndexingEnabled) {
        LOG.info("Solr indexing is disabled");
        return;
    }
    try {
        org.orcid.jaxb.model.record_v2.Record record = orcid20ApiClient.fetchPublicProfile(orcid);
        //get detailed funding so we can discover org name and id
        List<Funding> fundings = new ArrayList<Funding>();
        if (record.getActivitiesSummary() != null && record.getActivitiesSummary().getFundings() != null && record.getActivitiesSummary().getFundings().getFundingGroup() != null) {
            for (FundingGroup group : record.getActivitiesSummary().getFundings().getFundingGroup()) {
                if (group.getFundingSummary() != null) {
                    for (FundingSummary f : group.getFundingSummary()) {
                        fundings.add(orcid20ApiClient.fetchFunding(record.getOrcidIdentifier().getPath(), f.getPutCode()));
                    }
                }
            }
        }
        solrUpdater.persist(recordConv.convert(record, fundings));
        recordStatusManager.markAsSent(orcid, AvailableBroker.SOLR);
    } catch (LockedRecordException lre) {
        LOG.error("Record " + orcid + " is locked");
        solrUpdater.updateSolrIndexForLockedOrDeprecatedRecord(orcid, solrUpdater.retrieveLastModified(orcid));
        recordStatusManager.markAsSent(orcid, AvailableBroker.SOLR);
    } catch (DeprecatedRecordException dre) {
        LOG.error("Record " + orcid + " is deprecated");
        solrUpdater.updateSolrIndexForLockedOrDeprecatedRecord(orcid, solrUpdater.retrieveLastModified(orcid));
        recordStatusManager.markAsSent(orcid, AvailableBroker.SOLR);
    } catch (Exception e) {
        LOG.error("Unable to fetch record " + orcid + " for SOLR");
        LOG.error(e.getMessage(), e);
        recordStatusManager.markAsFailed(orcid, AvailableBroker.SOLR);
    }
}
Also used : LockedRecordException(org.orcid.listener.exception.LockedRecordException) Funding(org.orcid.jaxb.model.record_v2.Funding) DeprecatedRecordException(org.orcid.listener.exception.DeprecatedRecordException) ArrayList(java.util.ArrayList) FundingSummary(org.orcid.jaxb.model.record.summary_v2.FundingSummary) FundingGroup(org.orcid.jaxb.model.record.summary_v2.FundingGroup) LockedRecordException(org.orcid.listener.exception.LockedRecordException) DeprecatedRecordException(org.orcid.listener.exception.DeprecatedRecordException) JAXBException(javax.xml.bind.JAXBException)

Aggregations

Funding (org.orcid.jaxb.model.record_v2.Funding)82 Test (org.junit.Test)71 ClientResponse (com.sun.jersey.api.client.ClientResponse)28 ArrayList (java.util.ArrayList)17 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)16 Response (javax.ws.rs.core.Response)15 Url (org.orcid.jaxb.model.common_v2.Url)15 DBUnitTest (org.orcid.test.DBUnitTest)15 Title (org.orcid.jaxb.model.common_v2.Title)11 Work (org.orcid.jaxb.model.record_v2.Work)10 List (java.util.List)9 FundingTitle (org.orcid.jaxb.model.record_v2.FundingTitle)9 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)9 Funding (org.orcid.jaxb.model.record_rc1.Funding)8 ExternalIDs (org.orcid.jaxb.model.record_v2.ExternalIDs)8 WorkTitle (org.orcid.jaxb.model.record_v2.WorkTitle)8 IOException (java.io.IOException)7 InputStreamReader (java.io.InputStreamReader)6 Reader (java.io.Reader)6 BaseTest (org.orcid.core.BaseTest)6