Search in sources :

Example 46 with V2Convertible

use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.

the class VersionConverterImplV2_0ToV2_1 method downgrade.

@Override
public V2Convertible downgrade(V2Convertible objectToDowngrade) {
    Object objectToConvert = objectToDowngrade.getObjectToConvert();
    Object targetObject = v2VersionObjectFactory.createEquivalentInstance(objectToConvert, LOWER_VERSION);
    MappingContext context = new MappingContext.Factory().getContext();
    context.setProperty("downgrade", true);
    mapper.map(objectToConvert, targetObject, context);
    return new V2Convertible(targetObject, LOWER_VERSION);
}
Also used : MappingContext(ma.glasnost.orika.MappingContext) V2Convertible(org.orcid.core.version.V2Convertible)

Aggregations

V2Convertible (org.orcid.core.version.V2Convertible)46 InputStream (java.io.InputStream)39 JAXBContext (javax.xml.bind.JAXBContext)39 Unmarshaller (javax.xml.bind.Unmarshaller)39 Test (org.junit.Test)39 BaseTest (org.orcid.core.BaseTest)39 MappingContext (ma.glasnost.orika.MappingContext)2 GroupIdRecords (org.orcid.jaxb.model.groupid_rc1.GroupIdRecords)1 GroupIdRecords (org.orcid.jaxb.model.groupid_rc2.GroupIdRecords)1 GroupIdRecords (org.orcid.jaxb.model.groupid_rc3.GroupIdRecords)1 GroupIdRecords (org.orcid.jaxb.model.groupid_rc4.GroupIdRecords)1 GroupIdRecords (org.orcid.jaxb.model.groupid_v2.GroupIdRecords)1 ActivitiesSummary (org.orcid.jaxb.model.record.summary_rc1.ActivitiesSummary)1 Educations (org.orcid.jaxb.model.record.summary_rc1.Educations)1 Employments (org.orcid.jaxb.model.record.summary_rc1.Employments)1 Fundings (org.orcid.jaxb.model.record.summary_rc1.Fundings)1 PeerReviews (org.orcid.jaxb.model.record.summary_rc1.PeerReviews)1 Works (org.orcid.jaxb.model.record.summary_rc1.Works)1 ActivitiesSummary (org.orcid.jaxb.model.record.summary_rc2.ActivitiesSummary)1 Educations (org.orcid.jaxb.model.record.summary_rc2.Educations)1