Search in sources :

Example 16 with LastModifiedDate

use of org.orcid.jaxb.model.common_rc4.LastModifiedDate in project ORCID-Source by ORCID.

the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.

public static Date calculateLatest(GroupIdRecords groupIdRecords) {
    Date latestAct = null;
    if (groupIdRecords != null && groupIdRecords.getGroupIdRecord() != null && !groupIdRecords.getGroupIdRecord().isEmpty()) {
        XMLGregorianCalendar latest = groupIdRecords.getGroupIdRecord().get(0).getLastModifiedDate().getValue();
        for (GroupIdRecord groupid : groupIdRecords.getGroupIdRecord()) {
            if (latest.compare(groupid.getLastModifiedDate().getValue()) == -1) {
                latest = groupid.getLastModifiedDate().getValue();
            }
        }
        latestAct = latest.toGregorianCalendar().getTime();
        groupIdRecords.setLastModifiedDate(new LastModifiedDate(latest));
    }
    return latestAct;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) GroupIdRecord(org.orcid.jaxb.model.groupid_rc2.GroupIdRecord) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Date(java.util.Date)

Example 17 with LastModifiedDate

use of org.orcid.jaxb.model.common_rc4.LastModifiedDate in project ORCID-Source by ORCID.

the class Api2_0_rc2_LastModifiedDatesHelper method calculateLatest.

public static Date calculateLatest(ResearcherUrls researcherUrls) {
    Date latestAct = null;
    if (researcherUrls != null && researcherUrls.getResearcherUrls() != null && !researcherUrls.getResearcherUrls().isEmpty()) {
        XMLGregorianCalendar latest = researcherUrls.getResearcherUrls().get(0).getLastModifiedDate().getValue();
        for (ResearcherUrl researcherUrl : researcherUrls.getResearcherUrls()) {
            if (latest.compare(researcherUrl.getLastModifiedDate().getValue()) == -1) {
                latest = researcherUrl.getLastModifiedDate().getValue();
            }
        }
        latestAct = latest.toGregorianCalendar().getTime();
        researcherUrls.setLastModifiedDate(new LastModifiedDate(latest));
    }
    return latestAct;
}
Also used : XMLGregorianCalendar(javax.xml.datatype.XMLGregorianCalendar) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) ResearcherUrl(org.orcid.jaxb.model.record_rc2.ResearcherUrl) LastModifiedDate(org.orcid.jaxb.model.common_rc2.LastModifiedDate) Date(java.util.Date)

Example 18 with LastModifiedDate

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

Example 19 with LastModifiedDate

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

Example 20 with LastModifiedDate

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

Aggregations

LastModifiedDate (org.orcid.jaxb.model.common_v2.LastModifiedDate)34 Test (org.junit.Test)13 LastModifiedDate (org.orcid.jaxb.model.common_rc3.LastModifiedDate)13 LastModifiedDate (org.orcid.jaxb.model.common_rc4.LastModifiedDate)13 XMLGregorianCalendar (javax.xml.datatype.XMLGregorianCalendar)12 DBUnitTest (org.orcid.test.DBUnitTest)12 Date (java.util.Date)11 Response (javax.ws.rs.core.Response)10 LastModifiedDate (org.orcid.jaxb.model.common_rc2.LastModifiedDate)10 ArrayList (java.util.ArrayList)7 CreatedDate (org.orcid.jaxb.model.common_v2.CreatedDate)5 Url (org.orcid.jaxb.model.common_v2.Url)5 ResearcherUrl (org.orcid.jaxb.model.record_v2.ResearcherUrl)5 Title (org.orcid.jaxb.model.common_v2.Title)3 OtherName (org.orcid.jaxb.model.record_v2.OtherName)3 CreditName (org.orcid.jaxb.model.common_v2.CreditName)2 FuzzyDate (org.orcid.jaxb.model.common_v2.FuzzyDate)2 PublicationDate (org.orcid.jaxb.model.common_v2.PublicationDate)2 Source (org.orcid.jaxb.model.common_v2.Source)2 Subtitle (org.orcid.jaxb.model.common_v2.Subtitle)2