Search in sources :

Example 6 with Activity

use of org.orcid.jaxb.model.record_rc3.Activity in project ORCID-Source by ORCID.

the class Api2_0_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(ActivitiesContainer actContainerV2) {
    if (actContainerV2 != null) {
        Collection<? extends Activity> activities = actContainerV2.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();
                }
            }
            actContainerV2.setLastModifiedDate(new LastModifiedDate(latest));
        }
    }
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_v2.LastModifiedDate) Activity(org.orcid.jaxb.model.record_v2.Activity) GroupableActivity(org.orcid.jaxb.model.record_v2.GroupableActivity)

Example 7 with Activity

use of org.orcid.jaxb.model.record_rc3.Activity in project ORCID-Source by ORCID.

the class Api2_0_rc3_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(Group group) {
    Collection<? extends GroupableActivity> activities = group.getActivities();
    if (activities != null && !activities.isEmpty()) {
        Iterator<? extends GroupableActivity> activitiesIterator = activities.iterator();
        LastModifiedDate latest = null;
        while (activitiesIterator.hasNext()) {
            GroupableActivity activity = activitiesIterator.next();
            if (activity.getLastModifiedDate() != null && activity.getLastModifiedDate().after(latest)) {
                latest = activity.getLastModifiedDate();
            }
        }
        group.setLastModifiedDate(latest);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_rc3.LastModifiedDate) GroupableActivity(org.orcid.jaxb.model.record_rc3.GroupableActivity)

Aggregations

XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)4 ClientResponse (com.sun.jersey.api.client.ClientResponse)2 Test (org.junit.Test)2 LastModifiedDate (org.orcid.jaxb.model.common_rc3.LastModifiedDate)2 EducationSummary (org.orcid.jaxb.model.record.summary_rc3.EducationSummary)2 Educations (org.orcid.jaxb.model.record.summary_rc3.Educations)2 EmploymentSummary (org.orcid.jaxb.model.record.summary_rc3.EmploymentSummary)2 Employments (org.orcid.jaxb.model.record.summary_rc3.Employments)2 FundingGroup (org.orcid.jaxb.model.record.summary_rc3.FundingGroup)2 FundingSummary (org.orcid.jaxb.model.record.summary_rc3.FundingSummary)2 Fundings (org.orcid.jaxb.model.record.summary_rc3.Fundings)2 PeerReviewGroup (org.orcid.jaxb.model.record.summary_rc3.PeerReviewGroup)2 PeerReviewSummary (org.orcid.jaxb.model.record.summary_rc3.PeerReviewSummary)2 PeerReviews (org.orcid.jaxb.model.record.summary_rc3.PeerReviews)2 WorkGroup (org.orcid.jaxb.model.record.summary_rc3.WorkGroup)2 WorkSummary (org.orcid.jaxb.model.record.summary_rc3.WorkSummary)2 Works (org.orcid.jaxb.model.record.summary_rc3.Works)2 Address (org.orcid.jaxb.model.record_rc3.Address)2 Addresses (org.orcid.jaxb.model.record_rc3.Addresses)2 Biography (org.orcid.jaxb.model.record_rc3.Biography)2