Search in sources :

Example 21 with LastModifiedDate

use of org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate in project ORCID-Source by ORCID.

the class Api3_0_Dev1LastModifiedDatesHelper 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.v3.dev1.common.LastModifiedDate)

Example 22 with LastModifiedDate

use of org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate in project ORCID-Source by ORCID.

the class Api3_0_Dev1LastModifiedDatesHelper method calculateLastModified.

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

Example 23 with LastModifiedDate

use of org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate in project ORCID-Source by ORCID.

the class Api3_0_Dev1LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(GroupsContainer groupsContainer) {
    if (groupsContainer.retrieveGroups() != null && !groupsContainer.retrieveGroups().isEmpty()) {
        List<? extends Group> groupsRc1 = new ArrayList<>(groupsContainer.retrieveGroups());
        List<Group> groups = new ArrayList<>(groupsContainer.retrieveGroups());
        if (groupsRc1.get(0).getActivities() != null && !groupsRc1.get(0).getActivities().isEmpty()) {
            LastModifiedDate latest = null;
            for (Group group : groups) {
                calculateLastModified(group);
                if (group.getLastModifiedDate() != null && group.getLastModifiedDate().after(latest)) {
                    latest = group.getLastModifiedDate();
                }
            }
            groupsContainer.setLastModifiedDate(latest);
        }
    }
}
Also used : Group(org.orcid.jaxb.model.v3.dev1.record.Group) LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) ArrayList(java.util.ArrayList)

Example 24 with LastModifiedDate

use of org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate in project ORCID-Source by ORCID.

the class Api3_0_Dev1LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(OtherNames otherNames) {
    if (otherNames != null && otherNames.getOtherNames() != null && !otherNames.getOtherNames().isEmpty()) {
        LastModifiedDate latest = null;
        for (OtherName otherName : otherNames.getOtherNames()) {
            if (otherName.getLastModifiedDate() != null && otherName.getLastModifiedDate().after(latest)) {
                latest = otherName.getLastModifiedDate();
            }
        }
        otherNames.setLastModifiedDate(latest);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) OtherName(org.orcid.jaxb.model.v3.dev1.record.OtherName)

Example 25 with LastModifiedDate

use of org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate in project ORCID-Source by ORCID.

the class Api3_0_Dev1LastModifiedDatesHelper method calculateLastModified.

public static void calculateLastModified(PersonExternalIdentifiers extIds) {
    if (extIds != null && extIds.getExternalIdentifiers() != null && !extIds.getExternalIdentifiers().isEmpty()) {
        LastModifiedDate latest = null;
        for (PersonExternalIdentifier extId : extIds.getExternalIdentifiers()) {
            if (extId.getLastModifiedDate() != null && extId.getLastModifiedDate().after(latest)) {
                latest = extId.getLastModifiedDate();
            }
        }
        extIds.setLastModifiedDate(latest);
    }
}
Also used : LastModifiedDate(org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate) PersonExternalIdentifier(org.orcid.jaxb.model.v3.dev1.record.PersonExternalIdentifier)

Aggregations

LastModifiedDate (org.orcid.jaxb.model.v3.dev1.common.LastModifiedDate)45 Test (org.junit.Test)18 DBUnitTest (org.orcid.test.DBUnitTest)17 Response (javax.ws.rs.core.Response)15 CreatedDate (org.orcid.jaxb.model.v3.dev1.common.CreatedDate)8 DisambiguatedOrganization (org.orcid.jaxb.model.v3.dev1.common.DisambiguatedOrganization)7 Url (org.orcid.jaxb.model.v3.dev1.common.Url)5 ResearcherUrl (org.orcid.jaxb.model.v3.dev1.record.ResearcherUrl)5 ArrayList (java.util.ArrayList)4 OtherName (org.orcid.jaxb.model.v3.dev1.record.OtherName)4 FuzzyDate (org.orcid.jaxb.model.v3.dev1.common.FuzzyDate)3 PublicationDate (org.orcid.jaxb.model.v3.dev1.common.PublicationDate)3 Title (org.orcid.jaxb.model.v3.dev1.common.Title)3 Biography (org.orcid.jaxb.model.v3.dev1.record.Biography)3 Name (org.orcid.jaxb.model.v3.dev1.record.Name)3 WorkGroup (org.orcid.jaxb.model.v3.dev1.record.summary.WorkGroup)3 WorkSummary (org.orcid.jaxb.model.v3.dev1.record.summary.WorkSummary)3 Works (org.orcid.jaxb.model.v3.dev1.record.summary.Works)3 Date (java.util.Date)2 CreditName (org.orcid.jaxb.model.v3.dev1.common.CreditName)2