private void addLinkFromNewParent(final MutableIssue newIssue, final Issue newParent, final ApplicationUser applicationUser) { if (newParent != null) { try { subTaskManager.createSubTaskIssueLink(newParent, newIssue, applicationUser); } catch (CreateException e) { log.warn(e.getMessage(), e); throw new RuntimeException(e); } } }
private void handleCreateException(final I18nHelper i18n, final ErrorCollection errors, final CreateException createException) { errors.addErrorMessage(i18n.getText("remotelink.service.error.creating", createException.getMessage()), Reason.SERVER_ERROR); }
private void handleCreateException(final I18nHelper i18n, final ErrorCollection errors, final CreateException createException) { final String errMsg = i18n.getText("admin.errors.issues.error.creating", createException.getMessage()); Throwable cause = createException.getCause(); if (cause instanceof InvalidInputException) { InvalidInputException inputException = (InvalidInputException) cause; handleInvalidInputException(errors, inputException); } else { errors.addErrorMessage(errMsg); } }
@Override @Nonnull public ServiceOutcome<Version> create(@Nullable ApplicationUser user, @Nonnull VersionBuilderValidationResult validationResult) { check(validationResult); try { final VersionBuilderImpl builder = (VersionBuilderImpl) validationResult.getResult(); Version version = versionManager.createVersion(builder.getName(), builder.getStartDate(), builder.getReleaseDate(), builder.getDescription(), builder.getProjectId(), builder.getScheduleAfterVersion()); return ServiceOutcomeImpl.ok(version); } catch (CreateException ex) { log.error("Unable to create version", ex); return ServiceOutcomeImpl.error("Unable to create version: " + ex.getMessage(), ErrorCollection.Reason.SERVER_ERROR); } }
public RemoteUser createUser(User remoteUser, String username, String password, String fullName, String email) throws RemoteValidationException, RemotePermissionException { if (username != null) { username = username.trim(); } final com.atlassian.jira.bc.user.UserService.CreateUserValidationResult result = userService.validateCreateUserForAdminPasswordRequired(remoteUser, username, password, password, email, fullName); if (!result.isValid()) { throw new RemoteValidationException("Error creating user", result.getErrorCollection()); } try { User user = userService.createUserWithNotification(result); return remoteEntityFactory.createUser(user); } catch (PermissionException e) { throw new RemoteValidationException("cannot create user details, cause: " + e.getMessage(), e); } catch (CreateException e) { throw new RemoteValidationException("cannot create user details, cause: " + e.getMessage(), e); } }
@Override public Either<NegativeResponseStatus, SuccessfulResponse> copyRemoteIssueLink(RemoteIssueLink remoteIssueLink, String remoteIssueKey) { Issue issue = issueManager.getIssueObject(remoteIssueKey); try { RemoteIssueLinkBuilder builder = new RemoteIssueLinkBuilder(remoteIssueLink).issueId(issue.getId()).id(null); remoteIssueLinkManager.createRemoteIssueLink(builder.build(), jiraAuthenticationContext.getUser()); return SuccessfulResponse.buildEither(jiraLocation); } catch (CreateException e) { return Either.left(NegativeResponseStatus.errorOccured(jiraLocation, e.getMessage())); } }
@Override public Either<NegativeResponseStatus, SuccessfulResponse> copyLocalIssueLink(Issue localIssue, String remoteIssueKey, Long remoteIssueId, SimplifiedIssueLinkType issueLinkType, LinkCreationDirection localDirection, LinkCreationDirection remoteDirection) { try { //In contrary to remote links, local are always created in both directions so is is not possible to create only one-way local link. //So here we care only local direction (ie creating link from source issue) if (localDirection == LinkCreationDirection.OUTWARD) { issueLinkManager.createIssueLink(localIssue.getId(), remoteIssueId, issueLinkType.getId(), null, jiraAuthenticationContext.getLoggedInUser()); } else if (localDirection == LinkCreationDirection.INWARD) { issueLinkManager.createIssueLink(remoteIssueId, localIssue.getId(), issueLinkType.getId(), null, jiraAuthenticationContext.getLoggedInUser()); } return SuccessfulResponse.buildEither(jiraLocation); } catch (CreateException e) { return Either.left(NegativeResponseStatus.errorOccured(jiraLocation, e.getMessage())); } }
addError("username", getText("admin.errors.user.cannot.create", e.getMessage()));