congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Pair.first
Code IndexAdd Tabnine to your IDE (free)

How to use
first
method
in
com.atlassian.jira.util.lang.Pair

Best Java code snippets using com.atlassian.jira.util.lang.Pair.first (Showing top 20 results out of 315)

origin: com.atlassian.jira/jira-api

public Option getParent()
{
  return this.options.first();
}
origin: com.atlassian.jira/jira-core

@Override
public KeyPair getKeyPair()
{
  return cache.get().first();
}
origin: com.atlassian.jira/jira-core

  @Override
  public void doWith(final Method method) throws IllegalArgumentException, IllegalAccessException
  {
    Option<Pair<String, Object>> pair = invoke(targetObject, method);
    for (Pair<String, Object> tuple : pair)
    {
      Object value = tuple.second();
      if (value instanceof Map)
      {
        //noinspection unchecked
        data.putAll((Map<String, Object>) value);
      }
      else
      {
        data.put(tuple.first(), value);
      }
    }
  }
},
origin: com.atlassian.jira/jira-core

/**
 * Converts the usernames into User objects using the given function.
 *
 * @param watchers a Pair of watcher count and watcher usernames
 * @param function a Function used for conversion
 * @return a Pair of watcher count and User object
 */
protected <T extends ApplicationUser> Pair<Integer, List<T>> convertUsers(final Pair<Integer, List<String>> watchers,
    final Function<String, T> function)
{
  return Pair.<Integer, List<T>>of(
      watchers.first(),
      copyOf(Iterables.transform(watchers.second(), function))
  );
}
origin: com.atlassian.jira/jira-core

public int[] getVersionNumbers()
{
  return parseVersion(getVersion()).first();
}
origin: com.atlassian.jira/jira-core

@Override
public void doFilter(final ServletRequest servletRequest, final ServletResponse servletResponse, final FilterChain filterChain)
    throws IOException, ServletException
{
  Pair<ServletRequest, ServletResponse> debugWrapped = wrap(servletRequest, servletResponse);
  super.doFilter(debugWrapped.first(), debugWrapped.second(), filterChain);
}
origin: com.atlassian.jira/jira-core

@Override
public BulkWatchResult removeWatcherFromAll(final Collection<Issue> issues, final ApplicationUser remoteUser,
    final ApplicationUser watcher, final Context taskContext) throws WatchingDisabledException
{
  Collection<Issue> successfulIssues = new ArrayList<Issue> ();
  Collection<Pair<Issue,String>> failedIssues = new ArrayList<Pair<Issue,String>> ();
  for (Issue issue : issues)
  {
    Pair<Boolean, String> canUnwatchIssue = canUnwatchIssue(issue, remoteUser, watcher);
    if (canUnwatchIssue.first().booleanValue())
    {
      successfulIssues.add (issue);
    }
    else
    {
      failedIssues.add (Pair.nicePairOf(issue, canUnwatchIssue.second()));
    }
  }
  if (!successfulIssues.isEmpty())
  {
    watcherManager.stopWatching(watcher, successfulIssues, taskContext);
  }
  return new BulkWatchResult(failedIssues);
}
origin: com.atlassian.jira/jira-core

  public void registerWith(final ComponentContainer.Scope defaultScope, final ComponentContainer container)
  {
    Assertions.stateTrue("must implement some interfaces", !implementing.isEmpty());

    //at first register under concrete implementation key with default adapter factory
    if(parameters.isEmpty())
      container.implementation(ComponentContainer.Scope.INTERNAL, concrete, concrete);
    else
      container.implementation(ComponentContainer.Scope.INTERNAL, concrete, concrete, parameters.toArray(new Parameter[parameters.size()]));

    final ComponentAdapter adapter = container.getComponentAdapter(concrete);
    for (Pair<Class<? super T>, ComponentContainer.Scope> pair : implementing)
    {
      ComponentAdapter delegatingAdapter = new KeyedDelegateComponentAdapter<T>(pair.first(), adapter);
      container.component(pair.second() != null ? pair.second() : defaultScope, delegatingAdapter);
    }

  }
}
origin: com.atlassian.jira/jira-core

  @Override
  public void apply(final Pair<String, ErrorCollection.Reason> error)
  {
    errors.addError(nameFieldName, authenticationContext.getI18nHelper().getText(error.first()), error.second());
  }
});
origin: com.atlassian.jira/jira-core

@Override
MigrationState migrate(MigrationState state, final boolean licenseSuppliedByUser)
{
  final Set<Group> sdAgentGroups = globalPermissionDao.groupsWithSdAgentPermission();
  final List<String> notMigratedGroups = new ArrayList<>();
  for (Group sdAgentGroup : sdAgentGroups)
  {
    Pair<MigrationState, Boolean> result = checkGroupAndMigrate(sdAgentGroup, state);
    if (!result.second())
    {
      notMigratedGroups.add(sdAgentGroup.getName());
    }
    state = result.first();
  }
  return state.withAfterSaveTask(() -> saveNotMigratedGroups(notMigratedGroups));
}
origin: com.atlassian.jira/jira-core

public boolean getSectionContainsAtleastOneLink(String parentSection, String section)
{
  LinkedList<Pair<String,String>> parentAndSectionList = new LinkedList<>();
  parentAndSectionList.add(Pair.nicePairOf(parentSection,section));
  while (!parentAndSectionList.isEmpty())
  {
    final Pair<String,String> currentPair = parentAndSectionList.pop();
    final List<SimpleLinkSection> sectionList = getChildSectionsForSection(currentPair.second());
    if (sectionList != null)
    {
      for (final SimpleLinkSection aSectionList : sectionList)
      {
        parentAndSectionList.addLast(Pair.of(currentPair.second(), aSectionList.getId()));
      }
    }
    final List<SimpleLink> links = getLinksForSection(currentPair.first(),currentPair.second());
    if (links != null && !links.isEmpty())
    {
      return true;
    }
  }
  return false;
}
origin: com.atlassian.jira/jira-core

  @Override
  public void apply(final Pair<String, ErrorCollection.Reason> error)
  {
    errors.addError(nameFieldName, authenticationContext.getI18nHelper().getText(error.first()), error.second());
  }
});
origin: com.atlassian.jira/jira-core

@Override
public ServiceOutcome<List<ApplicationUser>> addWatcher(final Issue issue, final ApplicationUser remoteUser, final ApplicationUser watcher)
    throws WatchingDisabledException
{
  Pair<Boolean, String> canWatchIssue = canWatchIssue(issue, remoteUser, watcher);
  if (canWatchIssue.first().booleanValue())
  {
    watcherManager.startWatching(watcher, issue);
    return ServiceOutcomeImpl.ok(getCurrentWatchersFor(issue));
  }
  return ServiceOutcomeImpl.error(canWatchIssue.second());
}
origin: com.atlassian.jira/jira-core

@Override
public ServiceOutcome<List<ApplicationUser>> removeWatcher(final Issue issue, final ApplicationUser remoteUser, final ApplicationUser watcher)
    throws WatchingDisabledException
{
  Pair<Boolean, String> canUnwatchIssue = canUnwatchIssue(issue, remoteUser, watcher);
  if (canUnwatchIssue.first().booleanValue())
  {
    watcherManager.stopWatching(watcher, issue);
    return ServiceOutcomeImpl.ok(getCurrentWatchersFor(issue));
  }
  return ServiceOutcomeImpl.error(canUnwatchIssue.second());
}
origin: com.atlassian.jira/jira-core

private Option<ErrorCollection> validateName(final String name, final Option<IssueType> issueTypeToUpdate)
{
  final Option<Pair<String, ErrorCollection.Reason>> nameValidation = constantsManager.validateName(name, issueTypeToUpdate);
  if (nameValidation.isDefined())
  {
    return errorCollection("name", nameValidation.get().first(), nameValidation.get().second());
  }
  return none();
}
origin: com.atlassian.jira/jira-core

public ApplicationPropertiesServiceImpl(ApplicationPropertiesStore applicationPropertiesStore, EventPublisher eventPublisher, PermissionManager permissionManager, JiraAuthenticationContext authenticationContext, FeatureManager featureManager)
{
  this.applicationPropertiesStore = applicationPropertiesStore;
  this.eventPublisher = eventPublisher;
  this.permissionManager = permissionManager;
  this.authenticationContext = authenticationContext;
  this.featureManager = featureManager;
  this.featurePredicate = input -> {
    if (input.getMetadata().getRequiredFeatureKey() == null)
    {
      return true;
    }
    if (input.getMetadata().getRequiredFeatureKey().second())
    {
      return ApplicationPropertiesServiceImpl.this.featureManager.isEnabled(input.getMetadata().getRequiredFeatureKey().first());
    }
    else
    {
      return !ApplicationPropertiesServiceImpl.this.featureManager.isEnabled(input.getMetadata().getRequiredFeatureKey().first());
    }
  };
}
origin: com.atlassian.jira/jira-rest-plugin

private WatchersBean buildBean(final Issue issue, final ApplicationUser callingUser)
{
  try
  {
    Pair<Integer, List<ApplicationUser>> watcherCountList = watcherService.getWatchers(issue, callingUser).get();
    List<UserJsonBean> watcherUserBeans = transform(watcherCountList.second(), toJson(callingUser));
    log.trace("Visible watchers on issue '{}': {}", issue.getKey(), watcherUserBeans);
    return WatchersBean.Builder.create()
        .self(selfLink(issue))
        .isWatching(watcherCountList.second().contains(callingUser))
        .watchers(watcherUserBeans)
        .watchCount(watcherCountList.first())
        .build();
  }
  catch (WatchingDisabledException e)
  {
    return null; // don't report any watcher info
  }
}
origin: com.atlassian.jira/jira-api

Result getResult()
{
  if (previousFieldValue == null && nextFieldValue == null)
  {
    return null;
  }
  Pair<String, Long> previousValueAndOffset = valueAndOffSet(previousFieldValue, config.getPreviousField());
  Pair<String, Long> nextValueAndOffset = valueAndOffSet(nextFieldValue, config.getNextField());
  String previousValue = previousValueAndOffset.first();
  String nextValue = nextValueAndOffset.first();
  if (previousValue == null && nextValue == null)
  {
    return null;
  }
  Long previousPeriodOffSet = previousValueAndOffset.second();
  Long nextPeriodOffSet = nextValueAndOffset.second();
  if (previousValue != null && nextValue != null)
  {
    return new Result(getBothFieldsMessage(previousValue, nextValue, previousPeriodOffSet, nextPeriodOffSet), true, true);
  }
  if (previousValue != null)
  {
    return new Result(getPreviousFieldMessage(previousValue), true, false);
  }
  return new Result(getNextFieldMessage(nextValue, nextPeriodOffSet), false, true);
}
origin: com.atlassian.jira.plugins/jira-fisheye-plugin

public ReviewList getReviewsForProject(final Project project, final int lastNDays) {
  final String timerKey = "ReviewManager.getReviewsForProject() project=" + project.getKey() + " lastNDays=" + lastNDays;
  List<Review> reviews = Lists.newArrayList();
  List<SourceErrorReport> errors = Lists.newArrayList();
  try {
    UtilTimerStack.push(timerKey);
    if (fisheyeConfig.isTextCruSearch() || fishEyeManager.existsCrucibleStandaloneInstances()) {
      reviews.addAll(getReviewsFromCrucibleInstances(project.getKey(), project.getKey() + "-", false, errors));
    }
    if (fisheyeConfig.isChangesetCruSearch()) {
      Pair<Set<FishEyeRepository>, Map<FishEyeInstance, Set<FishEyeRepository>>> repositoriesToSearch =
          splitOutLegacyRepositories(project.getKey(), fishEyeManager.getRepositoriesForProject(project.getKey()));
      Set<FishEyeRepository> legacyReposToSearch = repositoriesToSearch.first();
      Map<FishEyeInstance, Set<FishEyeRepository>> instancesToSearch = repositoriesToSearch.second();
      reviews.addAll(getReviewsFromFishEyeInstances(instancesToSearch, project.getKey(), errors));
      reviews.addAll(getReviewsFromRepositories(legacyReposToSearch, project.getKey(), lastNDays, errors));
    }
    reviews = ReviewFilter.unique(reviews);
    reviews = ReviewFilter.orderByKeyAndTruncate(reviews, MAX_REVIEWS_PROJECT);
  } finally {
    UtilTimerStack.pop(timerKey);
  }
  return new ReviewList(reviews, errors);
}
origin: com.atlassian.jira/jira-core

@Override
public Unit get(final AttachmentGetData attachmentGetData)
{
  final Pair<InputStream, Effect<Object>> streamWithCloseHandler = resendingAttachmentStreamCreator
      .getInputStreamWithCloseHandler(attachmentGetData);
  final Effect<Object> cleanup = streamWithCloseHandler.second();
  try
  {
    final StoreAttachmentBean storeAttachmentBean = new StoreAttachmentBean.Builder(streamWithCloseHandler.first())
        .withSize(attachmentGetData.getSize())
        .withKey(attachmentKey)
        .build();
    store.putAttachment(storeAttachmentBean)
        .then(getFutureCallbackFromEffect(cleanup));
    return Unit.VALUE;
  }
  catch (final RuntimeException e)
  {
    cleanup.apply(Unit.VALUE);
    throw e;
  }
}
com.atlassian.jira.util.langPairfirst

Popular methods of Pair

  • second
  • nicePairOf
    A pair that does allows null values.
  • of
    By default we create a strict pair of non-null values.
  • strictPairOf
    A pair that doesn't allow null values.
  • <init>

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • getSharedPreferences (Context)
  • requestLocationUpdates (LocationManager)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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