public static void setPathToKeyword(Keyword keyword, String orcid) { if(keyword != null) { keyword.setPath(KEYWORDS.replace("{orcid}", orcid) + '/' + keyword.getPutCode()); } }
public static void validateKeyword(Keyword keyword, Source activeSource, boolean createFlag, boolean isApiRequest, Visibility originalVisibility) { if(createFlag) { if(keyword.getPutCode() != null) { throw InvalidPutCodeException.forSource(activeSource); } } 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); }
private boolean isDuplicated(ProfileKeywordEntity existing, org.orcid.jaxb.model.v3.rc2.record.Keyword keyword, Source activeSource) { if (!existing.getId().equals(keyword.getPutCode())) { String existingSourceId = existing.getElementSourceId(); if (!PojoUtil.isEmpty(existingSourceId) && SourceEntityUtils.isTheSameForDuplicateChecking(activeSource,existing)) { if (existing.getKeywordName() != null && existing.getKeywordName().equals(keyword.getContent())) { return true; } } } return false; }
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());
if (keyword.getPutCode() != null) { form.setPutCode(String.valueOf(keyword.getPutCode()));