public Optional<T> getValue() { return Optional.ofNullable(result.right().getOrNull()); }
private Either<AttachmentError, Attachment> createAttachmentFromFile( final File file, final String filename, final String contentType, final @Nullable ApplicationUser author, final Issue issue, final Boolean zip, final Boolean thumbnailable, final Map<String, Object> attachmentProperties, final Date createdTime, final Boolean copySourceFile) { final AttachmentKey attachmentKey = createAttachmentKey(filename, issue); final long fileSize = file.length(); final Either<AttachmentError, StoreAttachmentResult> putResult = safelyPutAttachmentFileToAttachmentStore( attachmentKey, file, !(TRUE.equals(copySourceFile)), author); return putResult.right().map(new Function<StoreAttachmentResult, Attachment>() { @Override public Attachment apply(final StoreAttachmentResult ignore) { return insertAttachment( issue.getId(), ApplicationUsers.getKeyFor(author), contentType, filename, fileSize, zip, thumbnailable, attachmentProperties, createdTime, attachmentKey.getAttachmentId() ); } }); }
commentService.create(user, issue, template.getComment(), null, securityLevel.right().get(), true, jiraErrorCollection);
final Iterable<AuditMessage> auditMessages = auditResult.right().get(); final List<String> ruleNamesList = Lists.newArrayList(); for (AuditMessage auditMessage : auditMessages)
if (resultOrError.isRight()) return responseFactory.generateErrorResponse(resultOrError.right().get());
return createErrorResponse(result.right().get());
final Long roleId = groupOrRole.right().get(); boolean roleExists = Iterables.any(roleLevels, new Predicate<ProjectRole>()
final ApplicationKey appKey = eitherApplicationKey.right().get();
errors.add(result.right().get());
final RoleRecipient recipient = roleRecipient.get().right().get(); final ConfluenceUser recipientUser = userAccessor.getUserByKey(recipient.getUserKey());
orderByRequest = parsedOrderBy.right().get();
return left(futureResult.left().get()); } else { renderedLines.addAll(futureResult.right().get());
if (scheme.isRight()) final PermissionScheme originalScheme = scheme.right().get();
if (getActions.isRight()) return getActions.right().get();
protected <T> T handleGenericResponseStatus(JiraProxy jira, Either<NegativeResponseStatus, T> response, Function<NegativeResponseStatus, Void> errorOccuredHandler){ if(response.isRight()){ return response.right().get(); } else { NegativeResponseStatus status = response.left().get();
@Override public ErrorCollection addConditionToWorkflow(@Nonnull String transitionName, @Nonnull ConditionDescriptor condition, @Nonnull JiraWorkflow workflow) { ErrorCollection errorCollection = checkArguments(transitionName, workflow, condition, "admin.workflowtransitions.service.error.null.condition"); if (errorCollection.hasAnyErrors()) { return errorCollection; } Option<JiraWorkflow> getDraft = draftOf(errorCollection, workflow); if (getDraft.isEmpty()) { //Draft creation might fail, if so, return the resulting error. return errorCollection; } JiraWorkflow draftWorkflow = getDraft.get(); Either<Collection<ActionDescriptor>, ErrorCollection> getActions = getActionsByName(transitionName, draftWorkflow); if (getActions.isRight()) { return getActions.right().get(); } for (ActionDescriptor action : getActions.left().get()) { transitionConditionUtil.addCondition(action, "", condition); } workflowService.updateWorkflow(getServiceContext(errorCollection), draftWorkflow); return errorCollection; }