public void onReleaseDateUpdated(Publication publication, Date oldDate) { if (oldDate == null){ publicationChangeLogger.log(Level.INFO, "The released date has been initialised for the publication " + publication.toString()); } else if (publication.getReleasedDate() == null){ publicationChangeLogger.log(Level.INFO, "The released date has been reset for the publication " + publication.toString()); } else { publicationChangeLogger.log(Level.INFO, "The released date " + oldDate + " has been updated with " + publication.getReleasedDate() + " in the publication " + publication.toString()); } }
/** * * @param pub * @return the hashcode consistent with the equals method for this comparator */ public static int hashCode(Publication pub){ if (unambiguousCuratedPublicationComparator == null){ unambiguousCuratedPublicationComparator = new UnambiguousCuratedPublicationComparator(); } if (pub == null){ return 0; } int hashcode = UnambiguousPublicationComparator.hashCode(pub); hashcode = 31*hashcode + pub.getCurationDepth().hashCode(); hashcode = 31*hashcode + UnambiguousCvTermComparator.hashCode(pub.getSource()); hashcode = 31*hashcode + (pub.getReleasedDate() != null ? pub.getReleasedDate().hashCode() : 0); return hashcode; } }
Date date1 = publication1.getReleasedDate(); Date date2 = publication2.getReleasedDate();
Date date1 = publication1.getReleasedDate(); Date date2 = publication2.getReleasedDate();
if (publication.getReleasedDate() != null){ GregorianCalendar c = new GregorianCalendar(); c.setTime(publication.getReleasedDate()); try { XMLGregorianCalendar date2 = DatatypeFactory.newInstance().newXMLGregorianCalendar(c);
/*** * This method will copy properties of publication source in publication target and will override all the other properties of Target publication. * This method will ignore experiments * @param source * @param target */ public static void copyAndOverridePublicationProperties(Publication source, Publication target){ if (source != null && target != null){ target.setCurationDepth(source.getCurationDepth()); target.setJournal(source.getJournal()); target.setReleasedDate(source.getReleasedDate()); target.setTitle(source.getTitle()); target.setPublicationDate(source.getPublicationDate()); target.setSource(source.getSource()); // copy collections target.getAnnotations().clear(); target.getAnnotations().addAll(source.getAnnotations()); target.getIdentifiers().clear(); target.getIdentifiers().addAll(source.getIdentifiers()); target.getAuthors().clear(); target.getAuthors().addAll(source.getAuthors()); target.getXrefs().clear(); target.getXrefs().addAll(source.getXrefs()); } }