private int comparePublicationDate(WorkEntity other) { if (other.getPublicationDate() == null) { if (this.publicationDate == null) { return 0; } else { return 1; } } else if (this.publicationDate == null) { return -1; } return this.publicationDate.compareTo(other.getPublicationDate()); }
private void mergeWork(WorkEntity workToUpdate, WorkEntity workWithNewData) { workToUpdate.setTitle(workWithNewData.getTitle()); workToUpdate.setTranslatedTitle(workWithNewData.getTranslatedTitle()); workToUpdate.setSubtitle(workWithNewData.getSubtitle()); workToUpdate.setDescription(workWithNewData.getDescription()); workToUpdate.setWorkUrl(workWithNewData.getWorkUrl()); workToUpdate.setCitation(workWithNewData.getCitation()); workToUpdate.setJournalTitle(workWithNewData.getJournalTitle()); workToUpdate.setLanguageCode(workWithNewData.getLanguageCode()); workToUpdate.setTranslatedTitleLanguageCode(workWithNewData.getTranslatedTitleLanguageCode()); workToUpdate.setIso2Country(workWithNewData.getIso2Country()); workToUpdate.setCitationType(workWithNewData.getCitationType()); workToUpdate.setWorkType(workWithNewData.getWorkType()); workToUpdate.setPublicationDate(workWithNewData.getPublicationDate()); workToUpdate.setContributorsJson(workWithNewData.getContributorsJson()); workToUpdate.setExternalIdentifiersJson(workWithNewData.getExternalIdentifiersJson()); workToUpdate.setVisibility(workWithNewData.getVisibility()); workToUpdate.setDisplayIndex(workWithNewData.getDisplayIndex()); workToUpdate.setSource(workWithNewData.getSource()); workToUpdate.setLastModified(new Date()); if (workWithNewData.getAddedToProfileDate() != null) { workToUpdate.setAddedToProfileDate(workWithNewData.getAddedToProfileDate()); } workToUpdate.setProfile(workWithNewData.getProfile()); }