use of org.orcid.jaxb.model.v3.dev1.record.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;
}
use of org.orcid.jaxb.model.v3.dev1.record.ExternalIDs in project ORCID-Source by ORCID.
the class JSONFundingExternalIdentifiersConverterV3 method convertFrom.
@Override
public ExternalIDs convertFrom(String source, Type<ExternalIDs> destinationType) {
JSONFundingExternalIdentifiers fundingExternalIdentifiers = JsonUtils.readObjectFromJsonString(source, JSONFundingExternalIdentifiers.class);
ExternalIDs externalIDs = new ExternalIDs();
for (JSONExternalIdentifier externalIdentifier : fundingExternalIdentifiers.getFundingExternalIdentifier()) {
ExternalID id = new ExternalID();
if (externalIdentifier.getType() == null) {
id.setType(FundingExternalIdentifierType.GRANT_NUMBER.value());
} else {
id.setType(externalIdentifier.getType().toLowerCase());
}
if (externalIdentifier.getUrl() != null && !PojoUtil.isEmpty(externalIdentifier.getUrl().getValue())) {
Url url = new Url(externalIdentifier.getUrl().getValue());
id.setUrl(url);
}
if (!PojoUtil.isEmpty(externalIdentifier.getValue())) {
id.setValue(externalIdentifier.getValue());
}
if (externalIdentifier.getRelationship() != null) {
id.setRelationship(Relationship.fromValue(conv.convertFrom(externalIdentifier.getRelationship(), null)));
}
externalIDs.getExternalIdentifier().add(id);
}
return externalIDs;
}
use of org.orcid.jaxb.model.v3.dev1.record.ExternalIDs in project ORCID-Source by ORCID.
the class JSONFundingExternalIdentifiersConverterV3 method convertTo.
@Override
public String convertTo(ExternalIDs source, Type<String> destinationType) {
JSONFundingExternalIdentifiers jsonFundingExternalIdentifiers = new JSONFundingExternalIdentifiers();
for (ExternalID externalID : source.getExternalIdentifier()) {
JSONExternalIdentifier jsonExternalIdentifier = new JSONExternalIdentifier();
if (externalID.getType() != null) {
jsonExternalIdentifier.setType(conv.convertTo(externalID.getType(), null));
}
if (externalID.getUrl() != null) {
jsonExternalIdentifier.setUrl(new JSONUrl(externalID.getUrl().getValue()));
}
if (!PojoUtil.isEmpty(externalID.getValue())) {
jsonExternalIdentifier.setValue(externalID.getValue());
}
if (externalID.getRelationship() != null) {
jsonExternalIdentifier.setRelationship(conv.convertTo(externalID.getRelationship().value(), null));
}
jsonFundingExternalIdentifiers.getFundingExternalIdentifier().add(jsonExternalIdentifier);
}
return JsonUtils.convertToJsonString(jsonFundingExternalIdentifiers);
}
use of org.orcid.jaxb.model.v3.dev1.record.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.v3.dev1.record.ExternalIDs in project ORCID-Source by ORCID.
the class OrcidSecurityManagerTestBase method addSharedExtId.
protected void addSharedExtId(ExternalIDs extIds) {
ExternalID extId = new ExternalID();
extId.setValue(EXTID_SHARED);
extIds.getExternalIdentifier().add(extId);
}
Aggregations