Search in sources :

Example 11 with GroupableActivity

use of org.orcid.jaxb.model.record_rc3.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;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) GroupableActivity(org.orcid.jaxb.model.record_rc2.GroupableActivity) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Date(java.util.Date)

Aggregations

GroupableActivity (org.orcid.jaxb.model.record_v2.GroupableActivity)8 ExternalID (org.orcid.jaxb.model.record_v2.ExternalID)4 GroupAble (org.orcid.jaxb.model.record_v2.GroupAble)4 ActivitiesGroup (org.orcid.core.utils.activities.ActivitiesGroup)3 ActivitiesGroupGenerator (org.orcid.core.utils.activities.ActivitiesGroupGenerator)3 GroupableActivityComparator (org.orcid.core.utils.activities.GroupableActivityComparator)2 Date (java.util.Date)1 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)1 LastModifiedDate (org.orcid.jaxb.model.common_rc2.LastModifiedDate)1 LastModifiedDate (org.orcid.jaxb.model.common_rc3.LastModifiedDate)1 LastModifiedDate (org.orcid.jaxb.model.common_rc4.LastModifiedDate)1 LastModifiedDate (org.orcid.jaxb.model.common_v2.LastModifiedDate)1 FundingGroup (org.orcid.jaxb.model.record.summary_v2.FundingGroup)1 FundingSummary (org.orcid.jaxb.model.record.summary_v2.FundingSummary)1 Fundings (org.orcid.jaxb.model.record.summary_v2.Fundings)1 PeerReviewGroup (org.orcid.jaxb.model.record.summary_v2.PeerReviewGroup)1 PeerReviewGroupKey (org.orcid.jaxb.model.record.summary_v2.PeerReviewGroupKey)1 PeerReviewSummary (org.orcid.jaxb.model.record.summary_v2.PeerReviewSummary)1 PeerReviews (org.orcid.jaxb.model.record.summary_v2.PeerReviews)1 WorkGroup (org.orcid.jaxb.model.record.summary_v2.WorkGroup)1