List of usage examples for com.google.common.collect FluentIterable from
@Deprecated @CheckReturnValue public static <E> FluentIterable<E> from(FluentIterable<E> iterable)
From source file:org.sonar.server.computation.issue.ScmAccountToUserLoader.java
@Override public String load(String scmAccount) { List<UserDoc> users = index.getAtMostThreeActiveUsersForScmAccount(scmAccount); if (users.size() == 1) { return users.get(0).login(); }//w w w . ja va 2s . com if (!users.isEmpty()) { // multiple users are associated to the same SCM account, for example // the same email Collection<String> logins = FluentIterable.from(users).transform(UserDocToLogin.INSTANCE) .toSortedList(Ordering.natural()); LOGGER.warn(String.format("Multiple users share the SCM account '%s': %s", scmAccount, Joiner.on(", ").join(logins))); } return null; }
From source file:com.feedzai.commons.sql.abstraction.engine.testconfig.DatabaseTestUtil.java
/** * Filters the instances given by {@code vendor}. * <p/>/*from w w w . j av a 2 s . c o m*/ * The match is performed by contains, i.e. oracle matches oracle11 and oracle12. * * @param vendor The list of instances to test. * @return The filtered instances to test. * @throws Exception */ public static Collection<Object[]> loadConfigurations(final String... vendor) throws Exception { return FluentIterable.from(loadConfigurations()).filter(new Predicate<Object[]>() { @Override public boolean apply(Object[] input) { final DatabaseConfiguration db = (DatabaseConfiguration) input[0]; for (String v : vendor) { if (db.vendor.contains(v)) { return true; } } return false; } }).toList(); }
From source file:brooklyn.networking.vclouddirector.natservice.resources.NatServiceResource.java
@Override public List<NatRuleSummary> list(String endpoint, String vDC, String identity, String credential) { try {//from ww w .j a v a 2 s. c o m LOG.info("listing nat rule on {} @ {} (vDC {})", new Object[] { identity, endpoint, vDC }); List<NatRuleType> rules = dispatcher().getNatRules(endpoint, vDC, identity, credential); return FluentIterable.from(rules).transform(new Function<NatRuleType, NatRuleSummary>() { @Override public NatRuleSummary apply(NatRuleType input) { return NatRuleSummary.from(input); } }).toList(); } catch (VCloudException e) { throw Exceptions.propagate(e); } }
From source file:org.apache.james.transport.mailets.RecipientToLowerCase.java
@Override public void service(Mail mail) throws MessagingException { mail.setRecipients(FluentIterable.from(mail.getRecipients()).transform(TO_LOWERCASE).toList()); }
From source file:org.immutables.generator.TypeHierarchyCollector.java
public ImmutableList<String> extendedClassNames() { return FluentIterable.from(extendedClasses).transform(ToNameOfTypeElement.FUNCTION).toList(); }
From source file:com.ebay.pulsar.analytics.dao.service.DirectSQLAccessService.java
public List<String> getAllRightsForValidUser(String userName) { String sql = "select rightname as name from " + DBFactory.getPrefix() + "DBRightGroup where groupname in ('public')"; String sql2 = "select rightname as name from " + DBFactory.getPrefix() + "DBRightGroup where groupname in (\n" + " select groupname from " + DBFactory.getPrefix() + "DBUserGroup where username = :userName\n" + " union\n" + " select name as groupname from " + DBFactory.getPrefix() + "DBGroup where owner = :userName\n" + ")\n"; String sql3 = "select name from " + DBFactory.getPrefix() + "DBDashboard where owner = :userName\n" + "union\n" + "select name from " + DBFactory.getPrefix() + "DBDatasource where owner = :userName\n" + "union\n" + "select name from " + DBFactory.getPrefix() + "DBGroup where owner = :userName\n"; List<String> rights1 = getDB().queryForList(sql, ImmutableMap.of("userName", userName), -1); List<String> rights2 = getDB().queryForList(sql2, ImmutableMap.of("userName", userName), -1); List<String> rights3 = getDB().queryForList(sql3, ImmutableMap.of("userName", userName), -1); return FluentIterable.from(rights3).transform(new Function<String, String>() { @Override//from www . j a va 2s. c om public String apply(String input) { return input + "_MANAGE"; } }).append(rights1).append(rights2).toList(); }
From source file:springfox.documentation.service.ResolvedMethodParameter.java
public <T extends Annotation> Optional<T> findAnnotation(Class<T> annotation) { return FluentIterable.from(annotations).filter(annotation).first(); }
From source file:com.b2international.snowowl.snomed.datastore.request.EvaluateQueryRefSetRequest.java
@Override public QueryRefSetMemberEvaluations execute(final BranchContext context) { final SnomedReferenceSet referenceSet = SnomedRequests.prepareGetReferenceSet(referenceSetId).build() .execute(context);/*from w w w. j a v a 2 s .com*/ return new QueryRefSetMemberEvaluations( FluentIterable.from(getQueryMembers(context, referenceSet)).transform( new Function<SnomedReferenceSetMember, Request<BranchContext, QueryRefSetMemberEvaluation>>() { @Override public Request<BranchContext, QueryRefSetMemberEvaluation> apply( SnomedReferenceSetMember input) { return SnomedRequests.prepareQueryRefSetMemberEvaluation(input.getId()) .setLocales(locales()).setExpand(expand()).build(); } }).transform( new Function<Request<BranchContext, QueryRefSetMemberEvaluation>, QueryRefSetMemberEvaluation>() { @Override public QueryRefSetMemberEvaluation apply( Request<BranchContext, QueryRefSetMemberEvaluation> input) { return input.execute(context); } }) .toList()); }
From source file:com.thepsionic.ingens.upgrades.UpgradeManager.java
/** * Finds and returns all registered universal upgrades. * @return A list with all registered universal upgrades *//* ww w.j a v a 2s.c o m*/ public Collection<UniversalUpgrade> universalUpgrades() { return FluentIterable.from(upgrades.values()).filter(UniversalUpgrade.class).toList(); }
From source file:com.example.ModelWithAnonymousClass.java
private List<String> createFromPaths(List<String> paths) { return FluentIterable.from(paths).transform(new Function<String, String>() { @Override/*ww w . j a va2 s . c o m*/ public String apply(String path) { return resourceResolver.getResource(path).getValueMap().get("property", String.class); } }).filter(Predicates.notNull()).toList(); }