private Errors addErrorCollection(ErrorCollection collection) { errors.addErrorCollection(collection); return this; }
public ErrorMatcher addErrorCollection(final ErrorCollection errors) { errorCollection.addErrorCollection(errors); return this; }
/** * Creates a new error collection with contents copied from the supplied argument. * * @param errorCollection error collection to copy * @return a new instance of error collection with the same contents as argument */ public static ErrorCollection copyOf(ErrorCollection errorCollection) { ErrorCollection result = empty(); result.addErrorCollection(errorCollection); return result; }
private void populateErrorCollection(final ErrorCollection collectionToBeAddedTo, final ErrorCollection collectionContainingErrors) { if (collectionContainingErrors.hasAnyErrors()) { collectionToBeAddedTo.addErrorCollection(collectionContainingErrors); } } }
/** * Creates an error collection containing all errors from given error collections * @param errorCollections an array of error collections to join * @return error collection containing all errors from given error collections */ public static ErrorCollection join(ErrorCollection... errorCollections) { ErrorCollection errorCollection = new SimpleErrorCollection(); for (ErrorCollection collection : errorCollections) { errorCollection.addErrorCollection(collection); } return errorCollection; } }
public ErrorCollection validateGrants(ApplicationUser user, Iterable<PermissionGrantInput> grants) { ErrorCollection result = empty(); for (PermissionGrantInput grant : grants) { result.addErrorCollection(validateGrant(user, grant)); } return result; }
private ErrorCollection initialValidation(PermissionGrantInput grant) { ErrorCollection result = empty(); result.addErrorCollection(validatePermission(grant.getPermission())); result.addErrorCollection(validateHolder(grant.getHolder())); return result; }
private boolean validCommentProperty(final CommentParameters commentParameters, ErrorCollection errorCollection) { for (Map.Entry<String, JSONObject> property : commentParameters.getCommentProperties().entrySet()) { errorCollection.addErrorCollection(commentPropertyService.validatePropertyInput(new PropertyInput(property.getValue().toString(), property.getKey()))); } return !errorCollection.hasAnyErrors(); }
private com.atlassian.jira.util.ErrorCollection validateArchiveReleaseUpdate(VersionBean bean, Version currentVersion) { final com.atlassian.jira.util.ErrorCollection errors = new SimpleErrorCollection(); if (bean.isArchived() != null) { errors.addErrorCollection(validateArchived(bean, currentVersion)); } if (bean.isReleased() != null) { errors.addErrorCollection(validateReleased(bean, currentVersion)); } return errors; }
public void removeAllRoleActorsByNameAndType(ApplicationUser currentUser, String name, String type, ErrorCollection errorCollection) { ErrorCollection errors = validateRemoveAllRoleActorsByNameAndType(currentUser, name, type); if (errors.hasAnyErrors()) { errorCollection.addErrorCollection(errors); } else { removeAllRoleActorsByNameAndType(name, type); } }
boolean licenseInvalidForIssueCreation(ApplicationUser user, ErrorCollection errorCollection, I18nHelper i18n) { final SimpleErrorCollection errorCollection1 = new SimpleErrorCollection(); issueCreationHelperBean.validateLicense(user, errorCollection1, i18n); if (errorCollection1.hasAnyErrors()) { errorCollection.addErrorCollection(errorCollection1); return true; } return false; }
@Override public ErrorCollection getErrorCollection() { ErrorCollection allErrors = new SimpleErrorCollection(); for (WorkflowMigrationResult result : results) { ErrorCollection projectErrors = result.getErrorCollection(); if (projectErrors != null && projectErrors.hasAnyErrors()) { allErrors.addErrorCollection(projectErrors); } } return allErrors; }
public void validateCommentProperties(Map<String, Object> properties, ErrorCollection errorCollection) { try { final ImmutableMap<String, JSONObject> commentProperties = getCommentPropertiesFromParameters(properties); for (Map.Entry<String, JSONObject> property : commentProperties.entrySet()) { EntityPropertyService.PropertyInput propertyInput = new EntityPropertyService.PropertyInput(property.getValue().toString(), property.getKey()); errorCollection.addErrorCollection(commentPropertyService.validatePropertyInput(propertyInput)); } } catch (JSONException e) { errorCollection.addErrorMessage(i18nFactory.getInstance(authenticationContext.getUser()).getText("jira.properties.service.invalid.json", properties.get(PARAM_COMMENT_PROPERTY))); } }
@Override public boolean isValidProjectKey(JiraServiceContext serviceContext, String key) { final ErrorCollection errorCollection = ErrorCollections.empty(); final I18nHelper i18nBean = serviceContext.getI18nBean(); validateProjectKey(null, key, errorCollection, i18nBean); if (errorCollection.hasAnyErrors()) { serviceContext.getErrorCollection().addErrorCollection(errorCollection); return false; } return true; }
@Override public void validateCommentUpdate(ApplicationUser user, Long commentId, String body, String groupLevel, Long roleLevelId, ErrorCollection errorCollection) { final CommentParameters commentParameters = CommentParameters.builder() .body(body) .visibility(Visibilities.fromGroupAndRoleId(groupLevel, roleLevelId)) .build(); CommentUpdateValidationResult commentValidationResult = validateCommentUpdate(user, commentId, commentParameters); errorCollection.addErrorCollection(commentValidationResult.getErrorCollection()); }
@Override public boolean hasPermissionToEdit(JiraServiceContext jiraServiceContext, Long commentId) { final ErrorCollection errorCollection = new SimpleErrorCollection(); final ApplicationUser user = jiraServiceContext.getLoggedInApplicationUser(); // This will do the checks against the commentId and comment object existing final Comment comment = getCommentById(user, commentId, errorCollection); if (errorCollection.hasAnyErrors()) { jiraServiceContext.getErrorCollection().addErrorCollection(errorCollection); return false; } return hasPermissionToEdit(user, comment, jiraServiceContext.getErrorCollection()); }
/** * Checks that the attachment root directory and the temporary attachment directories exist and are writeable. */ @Override public Option<ErrorCollection> errors() { ErrorCollection errors = checkDirectoryHealth(getAttachmentRootPath()); errors.addErrorCollection(checkDirectoryHealth(getTemporaryAttachmentDirectory())); if (errors.hasAnyErrors()) { return Option.some(errors); } else { return Option.none(); } }
@Override public Comment create(ApplicationUser user, Issue issue, String body, boolean dispatchEvent, ErrorCollection errorCollection) { CommentCreateValidationResult validationResult = validateCommentCreate(user, CommentParameters.builder().body(body).issue(issue).build()); if (validationResult.isValid()) { return create(user, validationResult, dispatchEvent); } else { errorCollection.addErrorCollection(validationResult.getErrorCollection()); return null; } }
@Override public boolean isValidRequiredProjectData(JiraServiceContext serviceContext, ProjectCreationData projectCreationData) { final ErrorCollection errorCollection = ErrorCollections.empty(); final I18nHelper i18nBean = serviceContext.getI18nBean(); validateProjectName(projectCreationData.getName(), errorCollection, i18nBean); validateProjectKey(null, projectCreationData.getKey(), errorCollection, i18nBean); validateProjectLead(Option.option(projectCreationData.getLead()), errorCollection, i18nBean); validateProjectType(serviceContext.getLoggedInApplicationUser(), projectCreationData.getProjectTypeKey(), errorCollection, i18nBean); if (errorCollection.hasAnyErrors()) { serviceContext.getErrorCollection().addErrorCollection(errorCollection); return false; } return true; }
@Override public boolean isValidAllProjectData(JiraServiceContext serviceContext, ProjectCreationData projectCreationData) { final ErrorCollection errorCollection = ErrorCollections.empty(); final I18nHelper i18nHelper = serviceContext.getI18nBean(); isValidRequiredProjectData(getServiceContext(serviceContext.getLoggedInApplicationUser(), errorCollection), projectCreationData); validateProjectUrl(projectCreationData.getUrl(), errorCollection, i18nHelper); validateProjectAssigneeType(projectCreationData.getAssigneeType(), errorCollection, i18nHelper); validateAvatarId(projectCreationData.getAvatarId(), projectManager.getProjectObjByKey(projectCreationData.getKey()), errorCollection, i18nHelper); validateProjectTemplate(projectCreationData.getProjectTemplateKey(), errorCollection, i18nHelper); if (errorCollection.hasAnyErrors()) { serviceContext.getErrorCollection().addErrorCollection(errorCollection); return false; } return true; }