Search in sources :

Example 6 with LastModifiedDate

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

the class Api2_0_rc4_LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(Person person) {
    if (person != null) {
        calculateLastModified(person.getAddresses());
        calculateLastModified(person.getEmails());
        calculateLastModified(person.getExternalIdentifiers());
        calculateLastModified(person.getKeywords());
        calculateLastModified(person.getOtherNames());
        calculateLastModified(person.getResearcherUrls());
        LastModifiedDate l1 = person.getAddresses() == null ? null : person.getAddresses().getLastModifiedDate();
        LastModifiedDate l2 = person.getEmails() == null ? null : person.getEmails().getLastModifiedDate();
        LastModifiedDate l3 = person.getExternalIdentifiers() == null ? null : person.getExternalIdentifiers().getLastModifiedDate();
        LastModifiedDate l4 = person.getKeywords() == null ? null : person.getKeywords().getLastModifiedDate();
        LastModifiedDate l5 = person.getOtherNames() == null ? null : person.getOtherNames().getLastModifiedDate();
        LastModifiedDate l6 = person.getResearcherUrls() == null ? null : person.getResearcherUrls().getLastModifiedDate();
        LastModifiedDate globalLatest = calculateLatest(l1, l2, l3, l4, l5, l6);
        person.setLastModifiedDate(globalLatest);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_rc4.LastModifiedDate)

Example 7 with LastModifiedDate

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

the class Api2_0_rc4_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_rc4.LastModifiedDate) GroupableActivity(org.orcid.jaxb.model.record_rc4.GroupableActivity)

Example 8 with LastModifiedDate

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

the class Api2_0_rc4_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);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_rc4.LastModifiedDate) Keyword(org.orcid.jaxb.model.record_rc4.Keyword)

Example 9 with LastModifiedDate

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

the class Api2_0_rc4_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);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_rc4.LastModifiedDate)

Example 10 with LastModifiedDate

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

the class Api2_0_rc3_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);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.common_rc3.LastModifiedDate) Keyword(org.orcid.jaxb.model.record_rc3.Keyword)

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