public static void setPathToKeyword(Keyword keyword, String orcid) { if(keyword != null) { keyword.setPath(KEYWORDS.replace("{orcid}", orcid) + '/' + keyword.getPutCode()); } }
private boolean isDuplicated(ProfileKeywordEntity existing, org.orcid.jaxb.model.record_v2.Keyword keyword, SourceEntity source) { if (!existing.getId().equals(keyword.getPutCode())) { String existingSourceId = existing.getElementSourceId(); if (!PojoUtil.isEmpty(existingSourceId) && existingSourceId.equals(SourceEntityUtils.getSourceId(source))) { if (existing.getKeywordName() != null && existing.getKeywordName().equals(keyword.getContent())) { return true; } } } return false; }
public static void validateKeyword(Keyword keyword, SourceEntity sourceEntity, boolean createFlag, boolean isApiRequest, Visibility originalVisibility) { if(createFlag) { if(keyword.getPutCode() != null) { Map<String, String> params = new HashMap<String, String>(); if (sourceEntity != null) { params.put("clientName", SourceEntityUtils.getSourceName(sourceEntity)); } throw new InvalidPutCodeException(params); } } else { if(keyword.getPutCode() == null) { Map<String, String> params = new HashMap<String, String>(); throw new PutCodeRequiredException(params); } } if(PojoUtil.isEmpty(keyword.getContent())) { String message = "Keyword cannot be null"; LOGGER.error(message); throw new OrcidValidationException(message); } //Check that we are not changing the visibility validateAndFixVisibility(keyword, createFlag, isApiRequest, originalVisibility); }
if(keywords.getKeywords() != null) { for (Keyword updatedOrNew : keywords.getKeywords()) { if (existing.getId().equals(updatedOrNew.getPutCode())) { deleteMe = false; break; if (updatedOrNew.getPutCode() != null) { if (existingKeyword.getId().equals(updatedOrNew.getPutCode())) { existingKeyword.setLastModified(new Date()); existingKeyword.setVisibility(updatedOrNew.getVisibility().name());