Tabnine Logo
Suppliers
Code IndexAdd Tabnine to your IDE (free)

How to use
Suppliers
in
com.atlassian.fugue

Best Java code snippets using com.atlassian.fugue.Suppliers (Showing top 15 results out of 315)

origin: com.atlassian.jira/jira-postsetup-announcements-plugin

  private Boolean isAdmin(final Option<ApplicationUser> userOption)
  {
    return userOption.fold(Suppliers.alwaysFalse(), new Function<ApplicationUser, Boolean>()
    {
      @Override
      public Boolean apply(final ApplicationUser user)
      {
        final boolean isAdmin = permissionManager.hasPermission(GlobalPermissionKey.ADMINISTER, user);
        return isAdmin;
      }
    });
  }
}
origin: com.atlassian.jira/jira-core

@Override
public Promise<Unit> deleteAttachmentContainerForIssue(@Nonnull final Issue issue)
{
  //noinspection NullableProblems
  return fileSystemAttachmentStore.fold(Suppliers.ofInstance(Promises.promise(Unit.VALUE)),
      new Function<FileBasedAttachmentStore, Promise<Unit>>()
  {
    @Override
    public Promise<Unit> apply(final FileBasedAttachmentStore fileBasedAttachmentStore)
    {
      return fileBasedAttachmentStore.deleteAttachmentContainerForIssue(issue);
    }
  });
}
origin: com.atlassian.jira/jira-core

  @Override
  protected int getCount(final Map<String, Object> context)
  {
    return WorkflowTransitionContext.getTransition(context).fold(Suppliers.ofInstance(0), new Function<ActionDescriptor, Integer>()
    {
      @Override
      public Integer apply(final ActionDescriptor input)
      {
        return input.getValidators() == null ? 0 : input.getValidators().size();
      }
    });
  }
}
origin: com.atlassian.jira/jira-postsetup-announcements-plugin

  @Override
  public Boolean apply(final ApplicationUser user)
  {
    return instantSetupUser.fold(Suppliers.alwaysFalse(), new Function<String, Boolean>()
    {
      @Override
      public Boolean apply(final String input)
      {
        return user.getKey().equals(input);
      }
    });
  }
});
origin: com.atlassian.jira/jira-core

  @Override
  protected int getCount(final Map<String, Object> context)
  {
    return WorkflowTransitionContext.getTransition(context).fold(Suppliers.ofInstance(0), new Function<ActionDescriptor, Integer>()
    {
      @Override
      public Integer apply(final ActionDescriptor input)
      {
        final ResultDescriptor result = input.getUnconditionalResult();
        return result != null && result.getPostFunctions() != null ? result.getPostFunctions().size() : 0 ;
      }
    });
  }
}
origin: com.atlassian.jira/jira-postsetup-announcements-plugin

  @Override
  public boolean canUserSeeAnnouncement(final Option<ApplicationUser> applicationUsers, final String announcedActivity)
  {
    final Option<String> instantSetupUser = instantSetupUserSupplier.get();

    if (announcedActivity.equals(PostSetupAnnouncementProvider.ADMIN_ACCOUNT_SETUP))
    {
      return applicationUsers.fold(Suppliers.alwaysFalse(), new Function<ApplicationUser, Boolean>()
      {
        @Override
        public Boolean apply(final ApplicationUser user)
        {
          return instantSetupUser.fold(Suppliers.alwaysFalse(), new Function<String, Boolean>()
          {
            @Override
            public Boolean apply(final String input)
            {
              return user.getKey().equals(input);
            }
          });
        }
      });
    }
    else
    {
      return true;
    }
  }
}
origin: com.atlassian.plugins/base-hipchat-integration-plugin-api

public static SimpleHipChatTokenReference token(String token) {
  return new SimpleHipChatTokenReference(Suppliers.ofInstance(Promises.promise(token)));
}
origin: com.atlassian.plugins/base-hipchat-integration-plugin

@Override
public boolean removeOauth2Configuration(@Nonnull final UserKey userKey) {
  return userKeyHipChatUserMapper.findHipChatUser(userKey).fold(
      Suppliers.alwaysFalse(),
      new Function<HipChatUserId, Boolean>() {
        @Override
origin: com.atlassian.jira/jira-core

@Override
@Nonnull
public Option<ErrorCollection> errors()
{
  final Option<ErrorCollection> secondaryStoreErrors = secondaryAttachmentStore.errors();
  //noinspection NullableProblems
  return primaryAttachmentStore.errors().fold(
      Suppliers.ofInstance(secondaryStoreErrors),
      new com.google.common.base.Function<ErrorCollection, Option<ErrorCollection>>()
      {
        @Override
        public Option<ErrorCollection> apply(final ErrorCollection input)
        {
          if (secondaryStoreErrors.isDefined())
          {
            final ErrorCollection errorCollection = secondaryStoreErrors.get();
            input.addErrorCollection(errorCollection);
          }
          return Option.some(input);
        }
      });
}
origin: com.atlassian.jira/jira-postsetup-announcements-plugin

public boolean isEvaluationLicenseOld(final Period period)
{
  final Iterable<LicenseDetails> allLicenses = ImmutableList.copyOf(licenses);
  final boolean evaluation = isEvaluation(allLicenses);
  Option<LicenseDetails> evaluationLicense = evaluation ?
      com.atlassian.fugue.Iterables.first(allLicenses) : Option.<LicenseDetails>none();
  final Boolean isEvaluatingEnough = evaluationLicense.fold(Suppliers.alwaysFalse(), new Function<LicenseDetails, Boolean>()
  {
    @Override
    public Boolean apply(final LicenseDetails input)
    {
      return isLicenseThisOld(input, period);
    }
  });
  return isEvaluatingEnough;
}
origin: com.atlassian.addon.connect.hercules/hercules-ac

public static Result index()
{
  final Result resultPage = ok(index.render());
  return AcController.index(Suppliers.ofInstance(resultPage), descriptorSupplier());
}
origin: com.atlassian.jira/jira-core

public boolean shouldDisplay(final ApplicationUser user, final JiraHelper jiraHelper)
{
  Optional<Long> entityId = getEntityId(jiraHelper.getContextParams());
  if (!entityId.isPresent())
  {
    return false;
  }
  EntityPropertyService.PropertyResult propertyResult = service.getProperty(user, entityId.get(), propertyKey);
  if (!propertyResult.isValid())
  {
    return false;
  }
  Option<EntityProperty> entityProperty = propertyResult.getEntityProperty();
  return entityProperty.fold(Suppliers.alwaysFalse(), new Function<EntityProperty, Boolean>()
  {
    @Override
    public Boolean apply(final EntityProperty entityProperty)
    {
      JsonElement jsonElement = jsonParser.parse(entityProperty.getValue());
      return jsonElement.isJsonPrimitive() && jsonElement.getAsString().equals(value);
    }
  });
}
origin: com.atlassian.jira/jira-core

public String getPostSetupRedirect(Option<String> origin) throws URISyntaxException
{
  final Option<Application> applicationWithPostInstall = getApplicationWithPostInstall();
  final Option<URI> postInstallUri = applicationWithPostInstall.flatMap(new Function<Application, Option<URI>>()
  {
    @Override
    public Option<URI> apply(final Application input)
    {
      return input.getPostInstallURI();
    }
  });
  final String rawUri = postInstallUri.getOrElse(getDefaultPostSetupURI()).toASCIIString();
  final String redirectWithOrigin = origin.fold(Suppliers.ofInstance(rawUri), new Function<String, String>()
  {
    @Override
    public String apply(final String input)
    {
      return addParameterToURI(rawUri, input);
    }
  });
  return redirectWithOrigin;
}
origin: com.atlassian.addon.connect.hercules/hercules-ac

@Override
public Option<Project> getConfigById(final String userId, final AcHost tenant, final Long configId)
{
  try
  {
    return JPA.withTransaction(() -> HerculesProject.findById(tenant.getKey(), configId).
        fold(Suppliers.ofInstance(Option.<Project>none()), new Function<HerculesProject, Option<Project>>()
        {
          @Nullable
          @Override
          public Option<Project> apply(@Nullable final HerculesProject input)
          {
            return Option.some(Project.toProject(input));
          }
        }));
  }
  catch (Throwable t)
  {
    LOGGER.error("Unknown error retrieving project with config id '" + configId + "'", t);
    return Option.none();
  }
}
origin: com.atlassian.addon.connect.hercules/hercules-ac

@Override
public Option<Project> getProjectById(final String userId, final AcHost tenant, final Long projectId)
{
  try
  {
    return JPA.withTransaction(() -> HerculesProject.findByProjectId(tenant.getKey(), projectId).
        fold(Suppliers.ofInstance(Option.<Project>none()), new Function<HerculesProject, Option<Project>>()
        {
          @Nullable
          @Override
          public Option<Project> apply(@Nullable final HerculesProject input)
          {
            return Option.some(Project.toProject(input));
          }
        }));
  }
  catch (Throwable t)
  {
    LOGGER.error("Unknown error retrieving project with id '" + projectId + "'", t);
    return Option.none();
  }
}
com.atlassian.fugueSuppliers

Most used methods

  • alwaysFalse
  • ofInstance

Popular in Java

  • Parsing JSON documents to java classes using gson
  • putExtra (Intent)
  • onRequestPermissionsResult (Fragment)
  • findViewById (Activity)
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JTable (javax.swing)
  • CodeWhisperer alternatives
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