/** * @deprecated since version 6.0 */ @Deprecated public Version createVersion(final String name, final Date releaseDate, final String description, final GenericValue project, final Long scheduleAfterVersion) throws CreateException { if (project == null) { throw new CreateException("You cannot create a version without a project."); } return createVersion(name, releaseDate, description, project.getLong("id"), scheduleAfterVersion); }
private void validateFieldLengthsForCreate(final RemoteIssueLink remoteIssueLink) throws CreateException { final Result result = validateFieldLengths(remoteIssueLink); if (!result.isValid()) { throw new CreateException(result.getMessage()); } }
private void validateUrlsForCreate(final RemoteIssueLink remoteIssueLink) throws CreateException { final Result result = validateUrls(remoteIssueLink); if (!result.isValid()) { throw new CreateException(result.getMessage()); } }
private void validateGlobalIdForCreate(final Issue issue, final String globalId) throws CreateException { final Result result = validateGlobalId(issue, globalId); if (!result.isValid()) { throw new CreateException(result.getMessage()); } }
if ((cause != null) && (cause instanceof InvalidInputException)) throw new CreateException("Error occurred while creating issue through workflow: " + cause.getMessage(), (InvalidInputException) cause); throw new CreateException(e.getMessage(), e);
@Override public GenericValue createIssue(final ApplicationUser remoteUser, final Issue issue) throws CreateException { validateCreateIssueTextFieldsLength(issue); try { final Map<String, Object> fields = new HashMap<>(); fields.put(ISSUE_MAP_KEY, issue); final MutableIssue originalIssueGV = getIssueObject(issue.getId()); fields.put(WorkflowFunctionUtils.ORIGINAL_ISSUE_KEY, originalIssueGV); final GenericValue issueGV = workflowManager.createIssue(remoteUser != null ? remoteUser.getName() : null, fields); return issueGV; } catch (final WorkflowException workflowException) { final Throwable cause = workflowException.getCause(); if (cause instanceof InvalidInputException) { throw new CreateException("Error occurred while creating issue through workflow: " + cause.getMessage(), (InvalidInputException) cause); } throw new CreateException(workflowException); } }
/** * Mandatory fields are: * - issueId * - title * - url * * @param remoteIssueLink * @throws CreateException */ private void validateMandatoryFieldsForCreate(final RemoteIssueLink remoteIssueLink) throws CreateException { final Result result = validateMandatoryFields(remoteIssueLink); if (!result.isValid()) { throw new CreateException(result.getMessage()); } }
public IssueType insertSubTaskIssueType(String name, Long sequence, String description, Long avatarId) throws CreateException { // Check that an issue type of that name does not already exist. if (issueTypeExistsByName(name)) { throw new CreateException("Issue Type with name '" + name + "' already exists."); } // Insert the record into the database final IssueType subTaskIssueType = constantsManager.insertIssueType(name, sequence, SUB_TASK_ISSUE_TYPE_STYLE, description, avatarId); // Add to default scheme issueTypeSchemeManager.addOptionToDefault(subTaskIssueType.getId()); return subTaskIssueType; }
@Override public IssueType insertSubTaskIssueType(String name, Long sequence, String description, String iconurl) throws CreateException { // Check that an issue type of that name does not already exist. if (issueTypeExistsByName(name)) { throw new CreateException("Issue Type with name '" + name + "' already exists."); } // Insert the record into the database final IssueType subTaskIssueType = constantsManager.insertIssueType(name, sequence, SUB_TASK_ISSUE_TYPE_STYLE, description, iconurl); // Add to default scheme issueTypeSchemeManager.addOptionToDefault(subTaskIssueType.getId()); return subTaskIssueType; }
throw new CreateException(e);
throw new CreateException("You cannot create a version without a name."); throw new CreateException("You cannot create a version without a project.");
String msg = String.format("There is no IssueLinkType with id: %s", issueLinkTypeId); log.error(msg); throw new CreateException(msg);
@Override public RemoteIssueLink createRemoteIssueLink(final RemoteIssueLink remoteIssueLink, final ApplicationUser user) throws CreateException { validateMandatoryFieldsForCreate(remoteIssueLink); validateFieldLengthsForCreate(remoteIssueLink); validateUrlsForCreate(remoteIssueLink); final Issue issue = issueManager.getIssueObject(remoteIssueLink.getIssueId()); if (issue == null) { throw new CreateException("Issue with id '" + remoteIssueLink.getIssueId() + "' does not exist."); } validateGlobalIdForCreate(issue, remoteIssueLink.getGlobalId()); final RemoteIssueLink created = remoteIssueLinkStore.createRemoteIssueLink(remoteIssueLink); if (hasDuplicateGlobalId(issue, created)) { remoteIssueLinkStore.removeRemoteIssueLink(created.getId()); throw new CreateException("A remote issue link already exists on this issue with the globalId '" + created.getGlobalId() + "'"); } createChangeItemForCreate(created, issue, user); eventPublisher.publish(new RemoteIssueLinkCreateEvent(remoteIssueLink)); return created; }
if (!result.isValid()) throw new CreateException("Validation failed, user " + result.getUsername() + " cannot be created");