private Result validateMandatoryFields(final RemoteIssueLink remoteIssueLink) { if (remoteIssueLink.getIssueId() == null) { return new Result(false, missingMandatoryFieldMessage("issueId")); } if (StringUtils.isBlank(remoteIssueLink.getTitle())) { return new Result(false, missingMandatoryFieldMessage("title")); } if (StringUtils.isBlank(remoteIssueLink.getUrl())) { return new Result(false, missingMandatoryFieldMessage("url")); } return TRUE; }
private Result validateGlobalIds(final Collection<String> globalIds) { if (globalIds != null) { if (globalIds.size() > MAX_GLOBAL_ID_LIST_SIZE_FOR_FIND) { return new Result(false, "The number of globalIds cannot exceed " + MAX_GLOBAL_ID_LIST_SIZE_FOR_FIND + "."); } for (String globalId : globalIds) { if (globalId == null) { return new Result(false, "A globalId in the input collection is null."); } if (isLongerThan(globalId, MAX_LONG_VARCHAR_LENGTH)) { return new Result(false, tooLongFieldMessage("globalId", MAX_LONG_VARCHAR_LENGTH)); } } } return TRUE; }
private Result validateFieldLengths(final RemoteIssueLink remoteIssueLink) { if (isLongerThan(remoteIssueLink.getGlobalId(), MAX_LONG_VARCHAR_LENGTH)) { return new Result(false, tooLongFieldMessage("globalId", MAX_LONG_VARCHAR_LENGTH)); } if (isLongerThan(remoteIssueLink.getTitle(), MAX_LONG_VARCHAR_LENGTH)) { return new Result(false, tooLongFieldMessage("title", MAX_LONG_VARCHAR_LENGTH)); } if (isLongerThan(remoteIssueLink.getRelationship(), MAX_LONG_VARCHAR_LENGTH)) { return new Result(false, tooLongFieldMessage("relationship", MAX_LONG_VARCHAR_LENGTH)); } if (isLongerThan(remoteIssueLink.getApplicationType(), MAX_LONG_VARCHAR_LENGTH)) { return new Result(false, tooLongFieldMessage("applicationType", MAX_LONG_VARCHAR_LENGTH)); } if (isLongerThan(remoteIssueLink.getApplicationName(), MAX_LONG_VARCHAR_LENGTH)) { return new Result(false, tooLongFieldMessage("applicationName", MAX_LONG_VARCHAR_LENGTH)); } return TRUE; }
private Result validateUrls(final RemoteIssueLink remoteIssueLink) { if (!isValidUrl(remoteIssueLink.getUrl())) { return new Result(false, invalidUrlMessage("url")); } if (!isValidUrl(remoteIssueLink.getIconUrl())) { return new Result(false, invalidUrlMessage("iconUrl")); } if (!isValidUrl(remoteIssueLink.getStatusIconUrl())) { return new Result(false, invalidUrlMessage("statusIconUrl")); } if (!isValidUrl(remoteIssueLink.getStatusIconLink())) { return new Result(false, invalidUrlMessage("statusIconLink")); } return TRUE; }
private Result validateGlobalId(final Issue issue, final String globalId) { if (globalId == null) { return TRUE; } // Check for duplicate globalId on this issue if (getRemoteIssueLinkByGlobalId(issue, globalId) != null) { return new Result(false, "A remote issue link already exists on this issue with the globalId '" + globalId + "'"); } return TRUE; }