use of org.orcid.jaxb.model.groupid_rc4.GroupIdRecords in project ORCID-Source by ORCID.
the class ConvertVrc2ToVrc3Test method upgradeGroupIdToVrc3Test.
@Test
public void upgradeGroupIdToVrc3Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(GroupIdRecords.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.groupid_rc3.GroupIdRecords.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc2Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc2.xml");
InputStream rc3Stream = ConvertVrc2ToVrc3Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc3.xml");
GroupIdRecords rc2Group = (GroupIdRecords) jaxbUnmarshaller.unmarshal(rc2Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.groupid_rc3.GroupIdRecords rc3GroupId1 = (org.orcid.jaxb.model.groupid_rc3.GroupIdRecords) jaxbUnmarshaller.unmarshal(rc3Stream);
V2Convertible result = versionConverterV2_0_rc2ToV2_0_rc3.upgrade(new V2Convertible(rc2Group, "v2_rc2"));
org.orcid.jaxb.model.groupid_rc3.GroupIdRecords rc3GroupId2 = (org.orcid.jaxb.model.groupid_rc3.GroupIdRecords) result.getObjectToConvert();
assertEquals(rc3GroupId1, rc3GroupId2);
}
use of org.orcid.jaxb.model.groupid_rc4.GroupIdRecords in project ORCID-Source by ORCID.
the class ConvertVrc3ToVrc4Test method upgradeGroupIdToVrc3Test.
@Test
public void upgradeGroupIdToVrc3Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(GroupIdRecords.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(org.orcid.jaxb.model.groupid_rc4.GroupIdRecords.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream rc3Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc3.xml");
InputStream rc4Stream = ConvertVrc3ToVrc4Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0_rc4.xml");
GroupIdRecords rc4Group = (GroupIdRecords) jaxbUnmarshaller.unmarshal(rc3Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
org.orcid.jaxb.model.groupid_rc4.GroupIdRecords rc4GroupId1 = (org.orcid.jaxb.model.groupid_rc4.GroupIdRecords) jaxbUnmarshaller.unmarshal(rc4Stream);
V2Convertible result = versionConverterV2_0_rc3ToV2_0_rc4.upgrade(new V2Convertible(rc4Group, "v2_rc3"));
org.orcid.jaxb.model.groupid_rc4.GroupIdRecords rc4GroupId2 = (org.orcid.jaxb.model.groupid_rc4.GroupIdRecords) result.getObjectToConvert();
assertEquals(rc4GroupId1, rc4GroupId2);
}
use of org.orcid.jaxb.model.groupid_rc4.GroupIdRecords in project ORCID-Source by ORCID.
the class ConvertV2ToV2_1Test method upgradeGroupIdToV21Test.
@Test
public void upgradeGroupIdToV21Test() throws JAXBException {
JAXBContext jaxbContext1 = JAXBContext.newInstance(GroupIdRecords.class);
JAXBContext jaxbContext2 = JAXBContext.newInstance(GroupIdRecords.class);
Unmarshaller jaxbUnmarshaller = jaxbContext1.createUnmarshaller();
InputStream v20Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-group-id-2.0.xml");
InputStream v21Stream = ConvertV2ToV2_1Test.class.getClassLoader().getResourceAsStream("test-group-id-2.1.xml");
GroupIdRecords v20Group = (GroupIdRecords) jaxbUnmarshaller.unmarshal(v20Stream);
jaxbUnmarshaller = jaxbContext2.createUnmarshaller();
GroupIdRecords v21GroupId1 = (GroupIdRecords) jaxbUnmarshaller.unmarshal(v21Stream);
V2Convertible result = versionConverterV2_0ToV2_1.upgrade(new V2Convertible(v20Group, "v2.1"));
GroupIdRecords v21GroupId2 = (GroupIdRecords) result.getObjectToConvert();
assertEquals(v21GroupId1, v21GroupId2);
}
use of org.orcid.jaxb.model.groupid_rc4.GroupIdRecords in project ORCID-Source by ORCID.
the class PublicV2ApiServiceDelegatorImpl method viewGroupIdRecords.
@Override
public Response viewGroupIdRecords(String pageSize, String pageNum) {
GroupIdRecords records = groupIdRecordManagerReadOnly.getGroupIdRecords(pageSize, pageNum);
Api2_0_LastModifiedDatesHelper.calculateLastModified(records);
return Response.ok(records).build();
}
use of org.orcid.jaxb.model.groupid_rc4.GroupIdRecords in project ORCID-Source by ORCID.
the class Api2_0_rc4_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(GroupIdRecords groupIdRecords) {
if (groupIdRecords != null && groupIdRecords.getGroupIdRecord() != null && !groupIdRecords.getGroupIdRecord().isEmpty()) {
LastModifiedDate latest = null;
for (GroupIdRecord groupid : groupIdRecords.getGroupIdRecord()) {
if (groupid.getLastModifiedDate() != null && groupid.getLastModifiedDate().after(latest)) {
latest = groupid.getLastModifiedDate();
}
}
groupIdRecords.setLastModifiedDate(latest);
}
}
Aggregations