Search in sources :

Example 6 with Relationship

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;
}
Also used : AttributedQName(org.apache.cxf.ws.addressing.v200408.AttributedQName) QName(javax.xml.namespace.QName) Relationship(org.apache.cxf.ws.addressing.v200408.Relationship)

Example 7 with Relationship

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;
}
Also used : RelatesToType(org.apache.cxf.ws.addressing.RelatesToType) QName(javax.xml.namespace.QName) Relationship(org.apache.cxf.ws.addressing.v200408.Relationship)

Example 8 with Relationship

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");
}
Also used : ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Url(org.orcid.jaxb.model.common_v2.Url) Test(org.junit.Test)

Example 9 with Relationship

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);
}
Also used : ExternalID(org.orcid.jaxb.model.record_v2.ExternalID) Url(org.orcid.jaxb.model.common_v2.Url) Test(org.junit.Test)

Example 10 with Relationship

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);
}
Also used : ExternalID(org.orcid.jaxb.model.record_v2.ExternalID)

Aggregations

Test (org.junit.Test)7 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)7 Url (org.orcid.jaxb.model.common_v2.Url)4 Work (org.orcid.jaxb.model.record_v2.Work)3 QName (javax.xml.namespace.QName)2 Validator (javax.xml.validation.Validator)2 Relationship (org.apache.cxf.ws.addressing.v200408.Relationship)2 MarshallingTest (org.orcid.jaxb.model.notification.custom.MarshallingTest)2 MapperFactory (ma.glasnost.orika.MapperFactory)1 DefaultMapperFactory (ma.glasnost.orika.impl.DefaultMapperFactory)1 RelatesToType (org.apache.cxf.ws.addressing.RelatesToType)1 AttributedQName (org.apache.cxf.ws.addressing.v200408.AttributedQName)1 Item (org.orcid.jaxb.model.notification.permission_v2.Item)1 Funding (org.orcid.jaxb.model.record_v2.Funding)1 PeerReview (org.orcid.jaxb.model.record_v2.PeerReview)1 PersonExternalIdentifier (org.orcid.jaxb.model.record_v2.PersonExternalIdentifier)1 ExternalIdentifierEntity (org.orcid.persistence.jpa.entities.ExternalIdentifierEntity)1 PeerReviewEntity (org.orcid.persistence.jpa.entities.PeerReviewEntity)1 ProfileFundingEntity (org.orcid.persistence.jpa.entities.ProfileFundingEntity)1 PublicationDateEntity (org.orcid.persistence.jpa.entities.PublicationDateEntity)1