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)); } } }
public static LastModifiedDate calculateLatest(LastModifiedDate... dates) { LastModifiedDate latest = null; for (LastModifiedDate obj : dates) { if (obj != null) { if (obj.after(latest)) { latest = obj; } } } return latest; } }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; GroupIdRecords other = (GroupIdRecords) obj; if (groupIdRecord == null) { if (other.groupIdRecord != null) return false; } else if (!groupIdRecord.equals(other.groupIdRecord)) return false; if (lastModifiedDate == null) { if (other.lastModifiedDate != null) return false; } else if (!lastModifiedDate.equals(other.lastModifiedDate)) return false; if (page != other.page) return false; if (pageSize != other.pageSize) return false; if (total != other.total) return false; return true; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((groupIdRecord == null) ? 0 : groupIdRecord.hashCode()); result = prime * result + ((lastModifiedDate == null) ? 0 : lastModifiedDate.hashCode()); result = prime * result + page; result = prime * result + pageSize; result = prime * result + total; return result; }
org.orcid.jaxb.model.v3.rc2.common.LastModifiedDate lastModified = new org.orcid.jaxb.model.v3.rc2.common.LastModifiedDate(); lastModified.setValue(DateUtils.convertToXMLGregorianCalendar(this.getLastModified().toJavaDate())); work.setLastModifiedDate(lastModified);
public LastModifiedDate toLastModifiedDate() { GregorianCalendar cal = toCalendar(); return new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(cal)); }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((content == null) ? 0 : content.hashCode()); result = prime * result + ((createdDate == null) ? 0 : createdDate.hashCode()); result = prime * result + ((lastModifiedDate == null) ? 0 : lastModifiedDate.hashCode()); result = prime * result + ((path == null) ? 0 : path.hashCode()); result = prime * result + ((visibility == null) ? 0 : visibility.hashCode()); return result; }
@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.fromValue(biographyEntity.getVisibility())); bio.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(biographyEntity.getLastModified()))); bio.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(biographyEntity.getDateCreated()))); return bio; } return null; }
@Override public PersonalDetails getPersonalDetails(String orcid) { Date lastModified = getLastModifiedDate(orcid); 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; }
lastModifiedDate.setYear(String.valueOf(otherName.getLastModifiedDate().getValue().getYear())); lastModifiedDate.setMonth(String.valueOf(otherName.getLastModifiedDate().getValue().getMonth())); lastModifiedDate.setDay(String.valueOf(otherName.getLastModifiedDate().getValue().getDay())); form.setLastModified(lastModifiedDate);
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((createdDate == null) ? 0 : createdDate.hashCode()); result = prime * result + ((description == null) ? 0 : description.hashCode()); result = prime * result + ((groupId == null) ? 0 : groupId.hashCode()); result = prime * result + ((lastModifiedDate == null) ? 0 : lastModifiedDate.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + ((putCode == null) ? 0 : putCode.hashCode()); result = prime * result + ((source == null) ? 0 : source.hashCode()); result = prime * result + ((type == null) ? 0 : type.hashCode()); return result; }
if (other.lastModifiedDate != null) return false; } else if (!lastModifiedDate.equals(other.lastModifiedDate)) return false; if (path == null) {
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); } }
public Keyword toKeyword() { Keyword keyword = new Keyword(); if (!PojoUtil.isEmpty(putCode)) { keyword.setPutCode(Long.valueOf(putCode)); } if (!PojoUtil.isEmpty(content)) { keyword.setContent(content); } if (visibility != null && visibility.getVisibility() != null) { keyword.setVisibility(org.orcid.jaxb.model.v3.rc2.common.Visibility.fromValue(visibility.getVisibility().value())); } else { keyword.setVisibility(org.orcid.jaxb.model.v3.rc2.common.Visibility.fromValue(OrcidVisibilityDefaults.KEYWORD_DEFAULT.getVisibility().value())); } if (createdDate != null) { keyword.setCreatedDate(new CreatedDate(DateUtils.convertToXMLGregorianCalendar(createdDate.toCalendar()))); } if (lastModified != null) { keyword.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(lastModified.toCalendar()))); } if (displayIndex != null) { keyword.setDisplayIndex(displayIndex); } else { keyword.setDisplayIndex(0L); } keyword.setSource(new Source(source)); return keyword; }
if (personalDetails.getLastModifiedDate() == null || personalDetails.getLastModifiedDate().getValue() == null) { personalDetails.setLastModifiedDate(new LastModifiedDate(DateUtils.convertToXMLGregorianCalendar(lastModified)));
lastModifiedDate.setYear(String.valueOf(address.getLastModifiedDate().getValue().getYear())); lastModifiedDate.setMonth(String.valueOf(address.getLastModifiedDate().getValue().getMonth())); lastModifiedDate.setDay(String.valueOf(address.getLastModifiedDate().getValue().getDay())); form.setLastModified(lastModifiedDate);
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((createdDate == null) ? 0 : createdDate.hashCode()); result = prime * result + ((email == null) ? 0 : email.hashCode()); result = prime * result + ((lastModifiedDate == null) ? 0 : lastModifiedDate.hashCode()); result = prime * result + ((path == null) ? 0 : path.hashCode()); result = prime * result + ((putCode == null) ? 0 : putCode.hashCode()); result = prime * result + ((source == null) ? 0 : source.hashCode()); result = prime * result + ((visibility == null) ? 0 : visibility.hashCode()); return result; }
if (other.lastModifiedDate != null) return false; } else if (!lastModifiedDate.equals(other.lastModifiedDate)) return false; if (path == null) {