use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.
the class MemberV2ApiServiceVersionedDelegatorImpl method downgradeResponse.
private Response downgradeResponse(Response response) {
Object entity = response.getEntity();
V2Convertible result = null;
if (entity != null) {
result = v2VersionConverterChain.downgrade(new V2Convertible(entity, MemberV2ApiServiceDelegator.LATEST_V2_VERSION), externalVersion);
return Response.fromResponse(response).entity(result.getObjectToConvert()).build();
}
return response;
}
use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.
the class PublicV2ApiServiceVersionedDelegatorImpl method upgradeResponse.
private Response upgradeResponse(Response response) {
Object entity = response.getEntity();
V2Convertible result = null;
if (entity != null) {
result = v2_1VersionConverterChain.upgrade(new V2Convertible(entity, PublicV2ApiServiceDelegator.LATEST_V2_VERSION), externalVersion);
return Response.fromResponse(response).entity(result.getObjectToConvert()).build();
}
return response;
}
use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.
the class PublicV2ApiServiceVersionedDelegatorImpl method downgradeResponse.
private Response downgradeResponse(Response response) {
Object entity = response.getEntity();
V2Convertible result = null;
if (entity != null) {
result = v2VersionConverterChain.downgrade(new V2Convertible(entity, PublicV2ApiServiceDelegator.LATEST_V2_VERSION), externalVersion);
return Response.fromResponse(response).entity(result.getObjectToConvert()).build();
}
return response;
}
use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.
the class ConvertVrc3ToVrc4Test method upgradeAddressesToVrc3Test.
@Test
public void upgradeAddressesToVrc3Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(Addresses.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record_rc4.Addresses.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc3Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-addresses-2.0_rc3.xml");
InputStream rc4Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-addresses-2.0_rc4.xml");
Addresses rc4Element = (Addresses) jaxbUnmarshaller.unmarshal(rc3Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.record_rc4.Addresses rc4Element1 = (org.orcid.jaxb.model.record_rc4.Addresses) jaxbUnmarshaller.unmarshal(rc4Stream);
V2Convertible result = versionConverterV2_0_rc3ToV2_0_rc4.upgrade(new V2Convertible(rc4Element, "v2_rc3"));
org.orcid.jaxb.model.record_rc4.Addresses rc4Element2 = (org.orcid.jaxb.model.record_rc4.Addresses) result.getObjectToConvert();
assertEquals(rc4Element1, rc4Element2);
}
use of org.orcid.core.version.V2Convertible in project ORCID-Source by ORCID.
the class ConvertVrc3ToVrc4Test method upgradePeerReviewsToVrc3Test.
@Test
public void upgradePeerReviewsToVrc3Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(PeerReviews.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.record.summary_rc4.PeerReviews.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc3Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-peer-reviews-2.0_rc3.xml");
InputStream rc4Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-peer-reviews-2.0_rc4.xml");
PeerReviews rc4PeerReviews = (PeerReviews) jaxbUnmarshaller.unmarshal(rc3Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.record.summary_rc4.PeerReviews rc4PeerReviews1 = (org.orcid.jaxb.model.record.summary_rc4.PeerReviews) jaxbUnmarshaller.unmarshal(rc4Stream);
V2Convertible result = versionConverterV2_0_rc3ToV2_0_rc4.upgrade(new V2Convertible(rc4PeerReviews, "v2_rc3"));
org.orcid.jaxb.model.record.summary_rc4.PeerReviews rc4PeerReviews2 = (org.orcid.jaxb.model.record.summary_rc4.PeerReviews) result.getObjectToConvert();
assertEquals(rc4PeerReviews1, rc4PeerReviews2);
}
Aggregations