Tabnine Logo
RemoteIssueLinkService$CreateValidationResult
Code IndexAdd Tabnine to your IDE (free)

How to use
RemoteIssueLinkService$CreateValidationResult
in
com.atlassian.jira.bc.issue.link

Best Java code snippets using com.atlassian.jira.bc.issue.link.RemoteIssueLinkService$CreateValidationResult (Showing top 6 results out of 315)

origin: com.atlassian.jira/jira-core

@Override
public RemoteIssueLinkResult create(final ApplicationUser user, final CreateValidationResult createValidationResult)
{
  if (createValidationResult == null)
  {
    throw new IllegalArgumentException("You cannot create a remote issue link with a null validation result.");
  }
  if (!createValidationResult.isValid())
  {
    throw new IllegalStateException("You cannot create a remote issue link with an invalid validation result.");
  }
  final RemoteIssueLink remoteIssueLink = createValidationResult.getRemoteIssueLink();
  if (remoteIssueLink == null)
  {
    throw new IllegalArgumentException("You cannot create a null remote issue link.");
  }
  final ErrorCollection errors = new SimpleErrorCollection();
  RemoteIssueLink createdRemoteIssueLink = null;
  try
  {
    createdRemoteIssueLink = remoteIssueLinkManager.createRemoteIssueLink(remoteIssueLink, user);
  }
  catch (final CreateException e)
  {
    handleCreateException(getI18n(user), errors, e);
  }
  return new RemoteIssueLinkResult(createdRemoteIssueLink, errors);
}
origin: com.atlassian.cpji/cpji-jira-plugin

public void createLinkToRemoteIssue(final Issue localIssue, final ApplicationLink applicationLink, final String remoteIssueKey, final Long remoteIssueId, final String relationship)
{
  final String globalId = encodeGlobalId(applicationLink.getId(), remoteIssueId);
  final String url = buildIssueUrl(applicationLink.getDisplayUrl().toASCIIString(), remoteIssueKey);
  final RemoteIssueLink remoteIssueLink = new RemoteIssueLinkBuilder()
      .globalId(globalId)
      .applicationType(RemoteIssueLink.APPLICATION_TYPE_JIRA)
      .relationship(relationship)
      .url(url)
      .applicationName(applicationLink.getName())
      .issueId(localIssue.getId())
      .title(remoteIssueKey)
      .build();
  final ApplicationUser user = callingUser();
  final RemoteIssueLinkService.CreateValidationResult issueLinkValidationResult = remoteIssueLinkService.validateCreate(user, remoteIssueLink);
  if (issueLinkValidationResult.isValid())
  {
    final RemoteIssueLinkService.RemoteIssueLinkResult remoteIssueLinkResult = remoteIssueLinkService.create(user, issueLinkValidationResult);
  }
  else
  {
    log.error("Failed to create issue link to remote JIRA issue with key '" + remoteIssueKey + "' Error(s): " + issueLinkValidationResult.getErrorCollection());
  }
}
origin: com.atlassian.jira/jira-issue-link-confluence-plugin

protected void doValidation()
{
  super.doValidation();
  validateUrl(pageUrl);
  if (hasAnyErrors())
  {
    return;
  }
  pageUrl = ConfluencePageUrl.build(pageUrl, appLink).getUrlRebasedToRpcUrl();
  String pageId = getPageId(pageUrl, appLink);
  if (!hasAnyErrors())
  {
    if (pageId == null)
    {
      addErrorMessage(getText("addconfluencelink.error.pageid.notfound"));
    }
  }
  if (!hasAnyErrors())
  {
    RemoteIssueLink remoteIssueLink = new ConfluenceRemoteIssueLinkBuilder().build(appLink, pageId, getIssue().getLong("id"));
    validationResult = remoteIssueLinkService.validateCreate(getLoggedInUser(), remoteIssueLink);
    if (!validationResult.isValid())
    {
      mapErrors(validationResult.getErrorCollection());
      addErrorCollection(validationResult.getErrorCollection());
    }
  }
}
origin: com.atlassian.jira/jira-core

@Override
public CreateValidationResult validateCreate(final ApplicationUser user, final RemoteIssueLink remoteIssueLink)
{
  final ErrorCollection errors = new SimpleErrorCollection();
  final I18nHelper i18n = getI18n(user);
  validateLinkingEnabled(i18n, errors);
  Issue issue = null;
  if (!errors.hasAnyErrors())
  {
    issue = validateIssueExists(remoteIssueLink, errors, i18n);
  }
  if (!errors.hasAnyErrors())
  {
    validatePermissionToCreate(user, issue, errors, i18n);
  }
  if (!errors.hasAnyErrors())
  {
    validateMandatoryFields(remoteIssueLink, i18n, errors);
    validateFieldLengths(remoteIssueLink, i18n, errors);
    validateUrls(remoteIssueLink, i18n, errors);
    validateGlobalId(remoteIssueLink, issue, errors, i18n);
  }
  return new CreateValidationResult((errors.hasAnyErrors() ? null : remoteIssueLink), errors);
}
origin: com.atlassian.jira/jira-rest-plugin

/**
 * Creates a remote issue link.
 *
 * @param issue the issue to create the link with
 * @param request the request, containing the values of the remote issue link to be created
 * @param contextUriInfo uri context, for building the self link
 * @return a Response containing a RemoteIssueLinkCreateOrUpdateResponse, or the error details if something went wrong
 */
private Response createRemoteIssueLink(final Issue issue, final RemoteIssueLinkCreateOrUpdateRequest request, final ContextUriInfo contextUriInfo)
{
  final RemoteIssueLink remoteIssueLink = buildRemoteIssueLink(issue.getId(), request);
  final ApplicationUser user = callingUser();
  final CreateValidationResult validationResult = remoteIssueLinkService.validateCreate(user, remoteIssueLink);
  if (!validationResult.isValid())
  {
    throw new RESTException(ErrorCollection.of(validationResult.getErrorCollection()));
  }
  final RemoteIssueLinkResult result = remoteIssueLinkService.create(user, validationResult);
  if (!result.isValid())
  {
    throw new RESTException(ErrorCollection.of(validationResult.getErrorCollection()));
  }
  final URI self = RemoteIssueLinkBeanBuilder.createSelfLink(result.getRemoteIssueLink(), issue, contextUriInfo);
  final RemoteIssueLinkCreateOrUpdateResponse response = newCreateOrUpdateResponse(result.getRemoteIssueLink(), self);
  return status(CREATED).location(self).entity(response).build();
}
origin: com.atlassian.jira/jira-issue-link-remote-jira-plugin

private CreateValidationResult validateCreateRemote(final RemoteJiraIssue remoteJiraIssue)
{
  final String globalId = RemoteJiraGlobalIdFactoryImpl.encode(new RemoteJiraGlobalId(getJiraAppLink(), remoteJiraIssue.getId()));
  // Only store the bare minimum information, the rest will be shown using the renderer plugin
  final RemoteIssueLink remoteIssueLink = new RemoteIssueLinkBuilder()
      .url(remoteJiraIssue.getBrowseUrl())
      .title(remoteJiraIssue.getKey())
      .globalId(globalId)
      .issueId(id)
      .relationship(linkDesc)
      .applicationName(getJiraAppLink().getName())
      .applicationType(RemoteIssueLink.APPLICATION_TYPE_JIRA)
      .build();
  final CreateValidationResult validationResult = remoteIssueLinkService.validateCreate(getLoggedInUser(), remoteIssueLink);
  if (!validationResult.isValid())
  {
    mapErrors(validationResult.getErrorCollection());
    addErrorCollection(validationResult.getErrorCollection());
  }
  return validationResult;
}
com.atlassian.jira.bc.issue.linkRemoteIssueLinkService$CreateValidationResult

Javadoc

Holds the information about validating a create remote issue link operation. This object should not be constructed directly, you should invoke the #validateCreate(User,RemoteIssueLink)method to obtain this.

Most used methods

  • isValid
  • getErrorCollection
  • <init>
  • getRemoteIssueLink

Popular in Java

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • getSharedPreferences (Context)
  • startActivity (Activity)
  • Menu (java.awt)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now