@Override public int compareTo(ResearcherUrl o) { if(o == null || o.getUrlName() == null) { return 1; } if(getUrlName() == null) { return -1; } int urlNameComp = this.getUrlName().compareTo(o.getUrlName()); if(urlNameComp == 0) { if(o.getUrl() == null) { return 1; } if(this.getUrl() == null) { return -1; } return this.getUrl().compareTo(o.getUrl()); } return 0; } }
public static void setPathToResearcherUrl(ResearcherUrl researcherUrl, String orcid) { if(researcherUrl != null) { researcherUrl.setPath(RESEARCHER_URLS.replace("{orcid}", orcid) + '/' + researcherUrl.getPutCode()); } }
/** * Create an instance of {@link ResearcherUrl } * */ public ResearcherUrl createResearcherUrl() { return new ResearcherUrl(); }
if(researcherUrls.getResearcherUrls() != null) { for(ResearcherUrl updatedOrNew : researcherUrls.getResearcherUrls()) { if(existingEntity.getId().equals(updatedOrNew.getPutCode())) { deleteMe = false; break; if(updatedOrNew.getPutCode() != null) { if(existingEntity.getId().equals(updatedOrNew.getPutCode())) { existingEntity.setLastModified(new Date()); existingEntity.setVisibility(updatedOrNew.getVisibility().name()); existingEntity.setUrl(updatedOrNew.getUrl().getValue()); existingEntity.setUrlName(updatedOrNew.getUrlName()); existingEntity.setDisplayIndex(updatedOrNew.getDisplayIndex()); researcherUrlDao.merge(existingEntity); newResearcherUrl.setVisibility(updatedOrNew.getVisibility().name()); newResearcherUrl.setDisplayIndex(updatedOrNew.getDisplayIndex()); researcherUrlDao.persist(newResearcherUrl);
return; if(PojoUtil.isEmpty(researcherUrl.getUrl().getValue())) { String message = "Url field must not be empty"; LOGGER.error(message); throw new OrcidValidationException(message); } else { if(SiteConstants.URL_MAX_LENGTH < researcherUrl.getUrl().getValue().length()) { String message = "Url field must not be longer than " + SiteConstants.URL_MAX_LENGTH + " characters"; LOGGER.error(message); if(PojoUtil.isEmpty(researcherUrl.getUrlName())) { String message = "Url name must not be empty"; LOGGER.error(message); throw new OrcidValidationException(message); } else { if(SiteConstants.URL_MAX_LENGTH < researcherUrl.getUrlName().length()) { String message = "Url name must not be longer than " + SiteConstants.URL_MAX_LENGTH + " characters"; LOGGER.error(message); if(researcherUrl.getPutCode() != null) { Map<String, String> params = new HashMap<String, String>(); if (sourceEntity != null) { if(researcherUrl.getPutCode() == null) { Map<String, String> params = new HashMap<String, String>(); throw new PutCodeRequiredException(params);
private boolean isDuplicated(ResearcherUrlEntity existing, ResearcherUrl newResearcherUrl, SourceEntity source) { if (!existing.getId().equals(newResearcherUrl.getPutCode())) { //If they have the same source String existingSourceId = existing.getElementSourceId(); // If they have the same source if (!PojoUtil.isEmpty(existingSourceId) && existingSourceId.equals(SourceEntityUtils.getSourceId(source))) { // If the url is the same if (existing.getUrl() != null && existing.getUrl().equals(newResearcherUrl.getUrl().getValue())) { return true; } } } return false; }
@Override @Transactional public ResearcherUrl updateResearcherUrl(String orcid, ResearcherUrl researcherUrl, boolean isApiRequest) { ResearcherUrlEntity updatedResearcherUrlEntity = researcherUrlDao.getResearcherUrl(orcid, researcherUrl.getPutCode()); Visibility originalVisibility = Visibility.fromValue(updatedResearcherUrlEntity.getVisibility()); SourceEntity sourceEntity = sourceManager.retrieveSourceEntity(); Map<String, String> params = new HashMap<String, String>(); params.put("type", "researcher-url"); params.put("value", researcherUrl.getUrlName()); throw new OrcidDuplicatedElementException(params);
Map<String, String> params = new HashMap<String, String>(); params.put("type", "researcher-url"); params.put("value", researcherUrl.getUrlName()); throw new OrcidDuplicatedElementException(params);
doc.url.add(u.getUrl().getValue());
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-04-24T11:17:38-05:00", comments = "JAXB RI v2.2.11") public String toString() { final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE; final StringBuilder buffer = new StringBuilder(); append(null, buffer, strategy); return buffer.toString(); }
public static void calculateLastModified(ResearcherUrls researcherUrls) { if (researcherUrls != null && researcherUrls.getResearcherUrls() != null && !researcherUrls.getResearcherUrls().isEmpty()) { LastModifiedDate latest = null; for (ResearcherUrl researcherUrl : researcherUrls.getResearcherUrls()) { if (researcherUrl.getLastModifiedDate() != null && researcherUrl.getLastModifiedDate().after(latest)) { latest = researcherUrl.getLastModifiedDate(); } } researcherUrls.setLastModifiedDate(latest); } }
@Generated(value = "com.sun.tools.xjc.Driver", date = "2018-04-24T11:17:38-05:00", comments = "JAXB RI v2.2.11") public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) { strategy.appendStart(locator, this, buffer); appendFields(locator, buffer, strategy); strategy.appendEnd(locator, this, buffer); return buffer; }
Individual page = m.createIndividual(url.getUrl().getValue(), null); String urlName = url.getUrlName(); if (isHomePage(urlName)) { person.addProperty(FOAF.homepage, page);