use of org.orcid.jaxb.model.record_v2.Relationship in project cxf by apache.
the class VersionTransformer method convert.
// THERE IS NO ReferenceParametersType for 2004/03
/**
* Convert from 2005/08 RelatesToType to 2004/08 Relationship.
*
* @param internal the 2005/08 RelatesToType
* @return an equivalent 2004/08 Relationship
*/
public static Relationship convert(RelatesToType internal) {
Relationship exposed = null;
if (internal != null) {
exposed = Names200408.WSA_OBJECT_FACTORY.createRelationship();
exposed.setValue(internal.getValue());
String internalRelationshipType = internal.getRelationshipType();
if (internalRelationshipType != null) {
QName exposedRelationshipType = null;
if (!Names.WSA_RELATIONSHIP_REPLY.equals(internalRelationshipType)) {
exposedRelationshipType = new QName(internalRelationshipType);
}
exposed.setRelationshipType(exposedRelationshipType);
}
putAll(exposed.getOtherAttributes(), internal.getOtherAttributes());
}
return exposed;
}
use of org.orcid.jaxb.model.record_v2.Relationship in project cxf by apache.
the class MAPCodecTest method isReply.
private boolean isReply(boolean exposedAsNative) {
boolean isReply = false;
if (exposedAsNative) {
isReply = Names.WSA_RELATIONSHIP_REPLY.equals(((RelatesToType) expectedValues[4]).getRelationshipType());
} else {
QName relationship = expectedValues[4] instanceof Relationship ? ((Relationship) expectedValues[4]).getRelationshipType() : ((org.apache.cxf.ws.addressing.v200403.Relationship) expectedValues[4]).getRelationshipType();
isReply = relationship == null || Names.WSA_REPLY_NAME.equalsIgnoreCase(relationship.getLocalPart());
}
return isReply;
}
use of org.orcid.jaxb.model.record_v2.Relationship in project ORCID-Source by ORCID.
the class ExternalIDValidatorTest method testEmptyRelationshipOnSingleExternalId_flagOn.
@Test(expected = ActivityIdentifierValidationException.class)
public void testEmptyRelationshipOnSingleExternalId_flagOn() {
validator.setRequireRelationshipOnExternalIdentifier(true);
ExternalID id1 = new ExternalID();
id1.setType("doi");
id1.setValue("value1");
id1.setUrl(new Url("http://value1.com"));
validator.validateWorkOrPeerReview(id1);
//empty relationship
id1.setRelationship(null);
validator.validateWorkOrPeerReview(id1);
fail("no exception thrown for invalid type");
}
use of org.orcid.jaxb.model.record_v2.Relationship in project ORCID-Source by ORCID.
the class ExternalIDValidatorTest method testEmptyRelationshipOnSingleExternalId_flagOff.
@Test
public void testEmptyRelationshipOnSingleExternalId_flagOff() {
ExternalID id1 = new ExternalID();
id1.setType("doi");
id1.setValue("value1");
id1.setUrl(new Url("http://value1.com"));
validator.validateWorkOrPeerReview(id1);
//empty relationship
id1.setRelationship(null);
validator.validateWorkOrPeerReview(id1);
}
use of org.orcid.jaxb.model.record_v2.Relationship in project ORCID-Source by ORCID.
the class ExternalIDValidator method validateFunding.
public void validateFunding(ExternalIDs ids) {
if (// urgh
ids == null)
return;
List<String> errors = Lists.newArrayList();
for (ExternalID id : ids.getExternalIdentifier()) {
if (id.getType() == null || !identifierTypeManager.fetchIdentifierTypesByAPITypeName(null).containsKey(id.getType())) {
errors.add(id.getType());
}
if (PojoUtil.isEmpty(id.getValue())) {
errors.add("value");
}
if (requireRelationshipOnExternalIdentifier) {
if (id.getRelationship() == null) {
errors.add("relationship");
}
}
}
checkAndThrow(errors);
}
Aggregations