use of org.orcid.jaxb.model.record_rc2.GroupableActivity in project ORCID-Source by ORCID.
the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.
public static Date calculateLatest(Group groupRc2) {
Date latestAct = null;
Collection<? extends GroupableActivity> activities = groupRc2.getActivities();
if (activities != null && !activities.isEmpty()) {
Iterator<? extends GroupableActivity> activitiesIterator = activities.iterator();
XMLGregorianCalendar latest = activitiesIterator.next().getLastModifiedDate().getValue();
while (activitiesIterator.hasNext()) {
GroupableActivity activity = activitiesIterator.next();
if (latest.compare(activity.getLastModifiedDate().getValue()) == -1) {
latest = activity.getLastModifiedDate().getValue();
}
}
latestAct = latest.toGregorianCalendar().getTime();
groupRc2.setLastModifiedDate(new LastModifiedDate(latest));
}
return latestAct;
}
Aggregations