use of javax.xml.datatype.XMLGregorianCalendar in project ORCID-Source by ORCID.
the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.
public static Date calculateLatest(ActivitiesContainer actContainerRc2) {
Date latestAct = null;
Collection<? extends Activity> activities = actContainerRc2.retrieveActivities();
if (activities != null && !activities.isEmpty()) {
Iterator<? extends Activity> activitiesIterator = activities.iterator();
XMLGregorianCalendar latest = activitiesIterator.next().getLastModifiedDate().getValue();
while (activitiesIterator.hasNext()) {
Activity activity = activitiesIterator.next();
if (latest.compare(activity.getLastModifiedDate().getValue()) == -1) {
latest = activity.getLastModifiedDate().getValue();
}
}
actContainerRc2.setLastModifiedDate(new LastModifiedDate(latest));
latestAct = latest.toGregorianCalendar().getTime();
}
return latestAct;
}
use of javax.xml.datatype.XMLGregorianCalendar in project ORCID-Source by ORCID.
the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.
public static Date calculateLatest(Emails emails) {
Date latestAct = null;
if (emails != null && emails.getEmails() != null && !emails.getEmails().isEmpty()) {
XMLGregorianCalendar latest = emails.getEmails().get(0).getLastModifiedDate().getValue();
for (Email email : emails.getEmails()) {
if (latest.compare(email.getLastModifiedDate().getValue()) == -1) {
latest = email.getLastModifiedDate().getValue();
}
}
latestAct = latest.toGregorianCalendar().getTime();
emails.setLastModifiedDate(new LastModifiedDate(latest));
}
return latestAct;
}
use of javax.xml.datatype.XMLGregorianCalendar in project ORCID-Source by ORCID.
the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.
public static Date calculateLatest(Addresses addresses) {
Date latestAct = null;
if (addresses != null && addresses.getAddress() != null && !addresses.getAddress().isEmpty()) {
XMLGregorianCalendar latest = addresses.getAddress().get(0).getLastModifiedDate().getValue();
for (Address address : addresses.getAddress()) {
if (latest.compare(address.getLastModifiedDate().getValue()) == -1) {
latest = address.getLastModifiedDate().getValue();
}
}
latestAct = latest.toGregorianCalendar().getTime();
addresses.setLastModifiedDate(new LastModifiedDate(latest));
}
return latestAct;
}
use of javax.xml.datatype.XMLGregorianCalendar in project ORCID-Source by ORCID.
the class Api2_0_rc3_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(ActivitiesContainer actContainerRc3) {
Collection<? extends Activity> activities = actContainerRc3.retrieveActivities();
if (activities != null && !activities.isEmpty()) {
Iterator<? extends Activity> activitiesIterator = activities.iterator();
XMLGregorianCalendar latest = activitiesIterator.next().getLastModifiedDate().getValue();
while (activitiesIterator.hasNext()) {
Activity activity = activitiesIterator.next();
if (latest.compare(activity.getLastModifiedDate().getValue()) == -1) {
latest = activity.getLastModifiedDate().getValue();
}
}
actContainerRc3.setLastModifiedDate(new LastModifiedDate(latest));
}
}
use of javax.xml.datatype.XMLGregorianCalendar in project opennms by OpenNMS.
the class PersistenceSerializationTest method setUp.
@Before
public void setUp() throws Exception {
MockLogAppender.setupLogging();
fa = new FileAnticipator();
fsr = new MockForeignSourceRepository();
fsr.save(new ForeignSource("cheese"));
fsr.flush();
fs = fsr.getForeignSource("cheese");
// fs.setScanInterval(scanInterval)
XMLGregorianCalendar cal = DatatypeFactory.newInstance().newXMLGregorianCalendar("2009-02-25T12:45:38.800-05:00");
fs.setDateStamp(cal);
List<PluginConfig> detectors = new ArrayList<PluginConfig>();
final PluginConfig detector = new PluginConfig("food", "org.opennms.netmgt.provision.persist.detectors.FoodDetector");
detector.addParameter("type", "cheese");
detector.addParameter("density", "soft");
detector.addParameter("sharpness", "mild");
detectors.add(detector);
fs.setDetectors(detectors);
List<PluginConfig> policies = new ArrayList<PluginConfig>();
PluginConfig policy = new PluginConfig("lower-case-node", "org.opennms.netmgt.provision.persist.policies.NodeCategoryPolicy");
policy.addParameter("label", "~^[a-z]$");
policy.addParameter("category", "Lower-Case-Nodes");
policies.add(policy);
policy = new PluginConfig("all-ipinterfaces", "org.opennms.netmgt.provision.persist.policies.InclusiveInterfacePolicy");
policies.add(policy);
policy = new PluginConfig("10-ipinterfaces", "org.opennms.netmgt.provision.persist.policies.MatchingInterfacePolicy");
policy.addParameter("ipaddress", "~^10\\..*$");
policies.add(policy);
policy = new PluginConfig("cisco-snmp-interfaces", "org.opennms.netmgt.provision.persist.policies.MatchingSnmpInterfacePolicy");
policy.addParameter("ifdescr", "~^(?i:LEC).*$");
policies.add(policy);
fs.setPolicies(policies);
fsw = new ForeignSourceCollection();
fsw.getForeignSources().addAll(fsr.getForeignSources());
c = JAXBContext.newInstance(ForeignSourceCollection.class, ForeignSource.class);
m = c.createMarshaller();
XMLUnit.setIgnoreWhitespace(true);
XMLUnit.setIgnoreAttributeOrder(true);
XMLUnit.setNormalize(true);
}
Aggregations