/** * Create an instance of {@link LastModifiedDate } * */ public LastModifiedDate createLastModifiedDate() { return new LastModifiedDate(); }
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)); } } }
@Override public PersonalDetails getPersonalDetails(String orcid) { Date lastModified = getLastModifiedDate(orcid); long lastModifiedTime = lastModified.getTime(); PersonalDetails personalDetails = new PersonalDetails(); Name name = recordNameManager.getRecordName(orcid); if (name != null) { personalDetails.setName(name); } Biography bio = biographyManager.getBiography(orcid); if (bio != null) { personalDetails.setBiography(bio); } OtherNames otherNames = otherNameManager.getOtherNames(orcid); OtherNames filteredOtherNames = new OtherNames(); personalDetails.setOtherNames(filteredOtherNames); if (otherNames != null && otherNames.getOtherNames() != null && !otherNames.getOtherNames().isEmpty()) { // Lets copy the list so we don't modify the cached collection List<OtherName> filteredList = new ArrayList<OtherName>(otherNames.getOtherNames()); filteredOtherNames.setOtherNames(filteredList); } if (personalDetails.getLastModifiedDate() == null || personalDetails.getLastModifiedDate().getValue() == null) { personalDetails.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(lastModified))); } return personalDetails; }
@Override public Biography getBiography(String orcid) { BiographyEntity biographyEntity = null; try { biographyEntity = biographyDao.getBiography(orcid, getLastModified(orcid)); } catch(Exception e) { LOGGER.debug("Couldn't find biography for " + orcid); } if(biographyEntity != null) { Biography bio = new Biography(); bio.setContent(biographyEntity.getBiography()); bio.setVisibility(Visibility.valueOf(biographyEntity.getVisibility())); bio.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(biographyEntity.getLastModified()))); bio.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(biographyEntity.getDateCreated()))); return bio; } return null; }
personalDetails.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(lastModified)));
history.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(profile.getLastModified())));