use of org.orcid.jaxb.model.record_rc3.ExternalIDs in project ORCID-Source by ORCID.
the class OrcidSecurityManagerTestBase method createWorkSummary.
protected WorkSummary createWorkSummary(Visibility v, String sourceId, String extIdValue) {
WorkSummary work = new WorkSummary();
work.setVisibility(v);
ExternalID extId = new ExternalID();
extId.setValue(extIdValue);
ExternalIDs extIds = new ExternalIDs();
extIds.getExternalIdentifier().add(extId);
work.setExternalIdentifiers(extIds);
addSharedExtId(extIds);
setSource(work, sourceId);
return work;
}
use of org.orcid.jaxb.model.record_rc3.ExternalIDs in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateDuplicatedExtIds_noDuplicatesTest.
/**
* VALIDATE DUPLICATED EXTERNAL IDENTIFIERS
* */
@SuppressWarnings("deprecation")
@Test
public void validateDuplicatedExtIds_noDuplicatesTest() {
SourceEntity source1 = mock(SourceEntity.class);
when(source1.getSourceName()).thenReturn("source name");
when(source1.getSourceId()).thenReturn("APP-00000000000000");
SourceOrcid sourceOrcid = new SourceOrcid();
sourceOrcid.setPath("0000-0000-0000-0000");
Source source2 = mock(Source.class);
when(source2.getSourceName()).thenReturn(new SourceName("other source name"));
when(source2.getSourceOrcid()).thenReturn(sourceOrcid);
ExternalIDs extIds1 = getExternalIDs();
ExternalIDs extIds2 = getExternalIDs();
activityValidator.checkExternalIdentifiersForDuplicates(extIds1, extIds2, source2, source1);
}
use of org.orcid.jaxb.model.record_rc3.ExternalIDs in project ORCID-Source by ORCID.
the class ActivityValidatorTest method getExternalIDs.
public ExternalIDs getExternalIDs() {
ExternalID id1 = getExternalID();
ExternalIDs extIds = new ExternalIDs();
extIds.getExternalIdentifier().add(id1);
return extIds;
}
use of org.orcid.jaxb.model.record_rc3.ExternalIDs in project ORCID-Source by ORCID.
the class ActivityValidatorTest method validateDuplicatedExtIds_duplicatesFoundTest.
@SuppressWarnings("deprecation")
@Test(expected = OrcidDuplicatedActivityException.class)
public void validateDuplicatedExtIds_duplicatesFoundTest() {
SourceEntity source1 = mock(SourceEntity.class);
when(source1.getSourceName()).thenReturn("source name");
when(source1.getSourceId()).thenReturn("APP-00000000000000");
SourceClientId sourceClientId = new SourceClientId();
sourceClientId.setPath("APP-00000000000000");
Source source2 = mock(Source.class);
when(source2.getSourceName()).thenReturn(new SourceName("source name"));
when(source2.getSourceClientId()).thenReturn(sourceClientId);
ExternalIDs extIds1 = getExternalIDs();
ExternalIDs extIds2 = getExternalIDs();
activityValidator.checkExternalIdentifiersForDuplicates(extIds1, extIds2, source2, source1);
}
use of org.orcid.jaxb.model.record_rc3.ExternalIDs in project ORCID-Source by ORCID.
the class ActivitiesGroupGenerator_GroupingFundingsTest method generateFundings.
/**
* funding-1 -> A, B, C
* funding-2 -> C, D, E
* funding-3 -> X, Y, Z
* funding-4 -> Y, B, 1
* funding-5 -> M, N, O
* funding-6 -> O, P, Q
* funding-7 -> 1, 2, B
* funding-8 -> No external identifiers
* funding-9 -> No external identifiers
* */
private Map<String, FundingSummary> generateFundings() {
Map<String, FundingSummary> result = new HashMap<String, FundingSummary>();
for (int i = 1; i < 10; i++) {
String name = "funding-" + i;
FundingSummary funding = new FundingSummary();
FundingTitle title = new FundingTitle();
title.setTitle(new Title(name));
funding.setTitle(title);
ExternalIDs fei = new ExternalIDs();
switch(i) {
case 1:
ExternalID f1 = new ExternalID();
f1.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f1.setValue("A");
ExternalID f2 = new ExternalID();
f2.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f2.setValue("B");
ExternalID f3 = new ExternalID();
f3.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f3.setValue("C");
fei.getExternalIdentifier().add(f1);
fei.getExternalIdentifier().add(f2);
fei.getExternalIdentifier().add(f3);
break;
case 2:
ExternalID f4 = new ExternalID();
f4.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f4.setValue("C");
ExternalID f5 = new ExternalID();
f5.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f5.setValue("D");
ExternalID f6 = new ExternalID();
f6.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f6.setValue("E");
fei.getExternalIdentifier().add(f4);
fei.getExternalIdentifier().add(f5);
fei.getExternalIdentifier().add(f6);
break;
case 3:
ExternalID f7 = new ExternalID();
f7.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f7.setValue("X");
ExternalID f8 = new ExternalID();
f8.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f8.setValue("Y");
ExternalID f9 = new ExternalID();
f9.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f9.setValue("Z");
fei.getExternalIdentifier().add(f7);
fei.getExternalIdentifier().add(f8);
fei.getExternalIdentifier().add(f9);
break;
case 4:
ExternalID f10 = new ExternalID();
f10.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f10.setValue("Y");
ExternalID f11 = new ExternalID();
f11.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f11.setValue("B");
ExternalID f12 = new ExternalID();
f12.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f12.setValue("1");
fei.getExternalIdentifier().add(f10);
fei.getExternalIdentifier().add(f11);
fei.getExternalIdentifier().add(f12);
break;
case 5:
ExternalID f13 = new ExternalID();
f13.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f13.setValue("M");
ExternalID f14 = new ExternalID();
f14.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f14.setValue("N");
ExternalID f15 = new ExternalID();
f15.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f15.setValue("O");
fei.getExternalIdentifier().add(f13);
fei.getExternalIdentifier().add(f14);
fei.getExternalIdentifier().add(f15);
break;
case 6:
ExternalID f16 = new ExternalID();
f16.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f16.setValue("O");
ExternalID f17 = new ExternalID();
f17.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f17.setValue("P");
ExternalID f18 = new ExternalID();
f18.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f18.setValue("Q");
fei.getExternalIdentifier().add(f16);
fei.getExternalIdentifier().add(f17);
fei.getExternalIdentifier().add(f18);
break;
case 7:
ExternalID f19 = new ExternalID();
f19.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f19.setValue("1");
ExternalID f20 = new ExternalID();
f20.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f20.setValue("2");
ExternalID f21 = new ExternalID();
f21.setType(org.orcid.jaxb.model.message.FundingExternalIdentifierType.GRANT_NUMBER.value());
f21.setValue("B");
fei.getExternalIdentifier().add(f19);
fei.getExternalIdentifier().add(f20);
fei.getExternalIdentifier().add(f21);
break;
}
funding.setExternalIdentifiers(fei);
result.put(name, funding);
}
return result;
}
Aggregations