use of org.orcid.jaxb.model.common_v2.LastModifiedDate 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;
}
use of org.orcid.jaxb.model.common_v2.LastModifiedDate in project ORCID-Source by ORCID.
the class Api2_0_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(Addresses addresses) {
if (addresses != null && addresses.getAddress() != null && !addresses.getAddress().isEmpty()) {
LastModifiedDate latest = null;
for (Address address : addresses.getAddress()) {
if (address.getLastModifiedDate() != null && address.getLastModifiedDate().after(latest)) {
latest = address.getLastModifiedDate();
}
}
addresses.setLastModifiedDate(latest);
}
}
use of org.orcid.jaxb.model.common_v2.LastModifiedDate in project ORCID-Source by ORCID.
the class Api2_0_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(Keywords keywords) {
if (keywords != null && keywords.getKeywords() != null && !keywords.getKeywords().isEmpty()) {
LastModifiedDate latest = null;
for (Keyword keyword : keywords.getKeywords()) {
if (keyword.getLastModifiedDate() != null && keyword.getLastModifiedDate().after(latest)) {
latest = keyword.getLastModifiedDate();
}
}
keywords.setLastModifiedDate(latest);
}
}
use of org.orcid.jaxb.model.common_v2.LastModifiedDate in project ORCID-Source by ORCID.
the class Api2_0_LastModifiedDatesHelper method calculateLastModified.
public static void calculateLastModified(PersonalDetails personalDetails) {
if (personalDetails != null) {
calculateLastModified(personalDetails.getOtherNames());
LastModifiedDate l1 = personalDetails.getBiography() == null ? null : personalDetails.getBiography().getLastModifiedDate();
LastModifiedDate l2 = personalDetails.getName() == null ? null : personalDetails.getName().getLastModifiedDate();
LastModifiedDate l3 = personalDetails.getOtherNames() == null ? null : personalDetails.getOtherNames().getLastModifiedDate();
LastModifiedDate globalLatest = calculateLatest(l1, l2, l3);
personalDetails.setLastModifiedDate(globalLatest);
}
}
use of org.orcid.jaxb.model.common_v2.LastModifiedDate in project ORCID-Source by ORCID.
the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.
public static XMLGregorianCalendar calculateLatest(OtherNames otherNames) {
XMLGregorianCalendar latest = null;
if (otherNames != null && otherNames.getOtherNames() != null && !otherNames.getOtherNames().isEmpty()) {
latest = otherNames.getOtherNames().get(0).getLastModifiedDate().getValue();
for (OtherName otherName : otherNames.getOtherNames()) {
if (latest.compare(otherName.getLastModifiedDate().getValue()) == -1) {
latest = otherName.getLastModifiedDate().getValue();
}
}
otherNames.setLastModifiedDate(new LastModifiedDate(latest));
}
return latest;
}
Aggregations