List of usage examples for java.util Collections emptySet
@SuppressWarnings("unchecked") public static final <T> Set<T> emptySet()
From source file:com.netflix.spinnaker.clouddriver.cloudfoundry.client.ServiceInstances.java
private Set<CloudFoundrySpace> vetSharingOfServicesArgumentsAndGetSharingSpaces(String sharedFromRegion, @Nullable String serviceInstanceName, @Nullable Set<String> sharingRegions, String gerund) { if (isBlank(serviceInstanceName)) { throw new CloudFoundryApiException("Please specify a name for the " + gerund + " service instance"); }//from ww w . j a v a2s .co m sharingRegions = Optional.ofNullable(sharingRegions).orElse(Collections.emptySet()); if (sharingRegions.size() == 0) { throw new CloudFoundryApiException( "Please specify a list of regions for " + gerund + " '" + serviceInstanceName + "'"); } return sharingRegions.stream().map(r -> { if (sharedFromRegion.equals(r)) { throw new CloudFoundryApiException( "Cannot specify 'org > space' as any of the " + gerund + " regions"); } return orgs.findSpaceByRegion(r).orElseThrow( () -> new CloudFoundryApiException("Cannot find region '" + r + "' for " + gerund)); }).collect(toSet()); }
From source file:com.yahoo.bard.webservice.data.metric.TemplateDruidQuery.java
/** * Transforms a N-pass query into a (N+1)-pass query. The original query is not mutated. * * @return nested query/* w w w . jav a2 s . c o m*/ */ public TemplateDruidQuery nest() { /* * each aggregation needs to be split into an inner & outer. Sometimes this involves transformation of the * aggregation type, name, or field name. */ LinkedHashSet<Aggregation> innerAggregations = new LinkedHashSet<>(); LinkedHashSet<Aggregation> outerAggregations = new LinkedHashSet<>(); for (Aggregation agg : aggregations) { Pair<Aggregation, Aggregation> split = agg.nest(); innerAggregations.add(split.getRight()); outerAggregations.add(split.getLeft()); } // Create the inner query. TemplateDruidQuery innerQuery; if (isNested()) { innerQuery = new TemplateDruidQuery(innerAggregations, Collections.emptySet(), nestedQuery, null); } else { innerQuery = new TemplateDruidQuery(innerAggregations, Collections.emptySet(), null, null); } // Create the outer query, floating the post aggregations upward return new TemplateDruidQuery(outerAggregations, postAggregations, innerQuery, timeGrain); }
From source file:eu.trentorise.smartcampus.permissionprovider.model.ClientDetailsEntity.java
@Override public Set<String> getAuthorizedGrantTypes() { if (authorizedGrantTypes != null) { return Utils.delimitedStringToSet(authorizedGrantTypes, ","); }/*from w w w. j a va2 s . co m*/ return Collections.emptySet(); }
From source file:org.eclipse.virgo.ide.manifest.internal.core.BundleManifestManager.java
/** * {@inheritDoc}/*from w ww . j a v a 2 s . c o m*/ */ public Set<String> getResolvedPackageImports(IJavaProject javaProject) { try { r.lock(); if (packageImports.containsKey(javaProject)) { return packageImports.get(javaProject); } return Collections.emptySet(); } finally { r.unlock(); } }
From source file:com.espertech.esper.epl.join.table.PropertySortedEventTable.java
public Set<EventBean> lookupLess(Object keyStart) { if (keyStart == null) { return Collections.emptySet(); }//ww w . jav a 2s.c om keyStart = coerce(keyStart); return normalize(propertyIndex.headMap(keyStart)); }
From source file:org.grails.jpa.domain.JpaGrailsDomainClass.java
public Set<GrailsDomainClass> getSubClasses() { return Collections.emptySet(); }
From source file:com.xpn.xwiki.plugin.workspacesmanager.apps.WorkspaceApplicationManager.java
private Set<String> getAllWorkspacesApps(XWikiContext context) { if (allWorkspacesApps == null) { allWorkspacesApps = new HashSet<String>(); try {//w ww . j a v a 2 s. c o m List<XWikiApplication> allApps = getXWikiApplicationManagerApi(context) .getApplicationDocumentList(); for (XWikiApplication app : allApps) { if (app.getObject("XWiki.XWSApplicationClass") != null) { allWorkspacesApps.add(app.getAppName()); } } } catch (XWikiException e) { allWorkspacesApps = null; return Collections.emptySet(); } } return allWorkspacesApps; }
From source file:ca.sqlpower.object.SPSimpleVariableResolver.java
public Collection<String> keySet(String namespace) { // Call the subclass hook. this.beforeKeyLookup(namespace); if (this.resolvesNamespace(namespace)) { if (this.namespace == null) { return this.variables.keySet(); } else {/*from w ww.ja v a2 s . c o m*/ Set<String> keys = new HashSet<String>(); for (Object key : this.variables.keySet()) { keys.add(this.namespace.concat(NAMESPACE_DELIMITER).concat(key.toString())); } return keys; } } return Collections.emptySet(); }
From source file:com.ikanow.aleph2.graph.titan.services.TestTitanGraphService.java
@Test public void test_onPublishOrUpdate() { final DataBucketBean bucket = BeanTemplateUtils.build(DataBucketBean.class) .with(DataBucketBean::full_name, "/test/validate/schema").done().get(); // do nothing {//w w w. ja v a2 s .c om CompletableFuture<Collection<BasicMessageBean>> ret_val = _mock_graph_db_service.onPublishOrUpdate( bucket, Optional.empty(), false, Collections.emptySet(), Collections.emptySet()); assertEquals(Collections.emptyList(), ret_val.join()); } // create all the indexes { CompletableFuture<Collection<BasicMessageBean>> ret_val = _mock_graph_db_service.onPublishOrUpdate( bucket, Optional.empty(), false, ImmutableSet.of(GraphSchemaBean.name), Collections.emptySet()); assertEquals("" + ret_val.join().stream().map(b -> b.message()).collect(Collectors.joining(" // ")), Collections.emptyList(), ret_val.join()); // But also now check the Titan indexes have all been created: final TitanManagement mgmt = _titan.openManagement(); Stream<TitanGraphIndex> v_indexes = StreamUtils.stream(mgmt.getGraphIndexes(Vertex.class)); Stream<TitanGraphIndex> e_indexes = StreamUtils.stream(mgmt.getGraphIndexes(Edge.class)); assertEquals(4L, v_indexes.count()); assertEquals(1L, e_indexes.count()); } // rerun to check it all works second+ time round { CompletableFuture<Collection<BasicMessageBean>> ret_val = _mock_graph_db_service.onPublishOrUpdate( bucket, Optional.empty(), false, ImmutableSet.of(GraphSchemaBean.name), Collections.emptySet()); assertEquals( "Should return no errors: " + ret_val.join().stream().map(b -> b.message()).collect(Collectors.joining(";")), Collections.emptyList(), ret_val.join()); // But also now check the Titan indexes have all been created: final TitanManagement mgmt = _titan.openManagement(); Stream<TitanGraphIndex> v_indexes = StreamUtils.stream(mgmt.getGraphIndexes(Vertex.class)); Stream<TitanGraphIndex> e_indexes = StreamUtils.stream(mgmt.getGraphIndexes(Edge.class)); assertEquals(4L, v_indexes.count()); assertEquals(1L, e_indexes.count()); } // Error if specifying deduplication fields { final GraphSchemaBean graph_schema = BeanTemplateUtils.build(GraphSchemaBean.class) .with(GraphSchemaBean::custom_decomposition_configs, Arrays.asList()) .with(GraphSchemaBean::deduplication_fields, Arrays.asList("nonempty")).done().get(); final DataBucketBean dedup_fields_bucket = BeanTemplateUtils.build(DataBucketBean.class) .with(DataBucketBean::full_name, "/test/on/publish") .with(DataBucketBean::data_schema, BeanTemplateUtils.build(DataSchemaBean.class) .with(DataSchemaBean::graph_schema, graph_schema).done().get()) .done().get(); CompletableFuture<Collection<BasicMessageBean>> ret_val = _mock_graph_db_service.onPublishOrUpdate( dedup_fields_bucket, Optional.empty(), false, ImmutableSet.of(GraphSchemaBean.name), Collections.emptySet()); assertEquals(1, ret_val.join().size()); assertEquals(1, ret_val.join().stream().filter(b -> !b.success()).count()); } //(See also test_handleBucketDeletionRequest, for some coverage testing of onPublishOrUpdate) }
From source file:fr.mby.portal.coreimpl.auth.DbPortalUserAuthenticationProvider.java
/** * @param auth// w w w .java 2 s . c o m * @param user */ protected PortalUserAuthentication performAuthentication(final PortalUserAuthentication auth, final PortalUser portalUser) { PortalUserAuthentication resultingAuth = null; final String creds = (String) auth.getCredentials(); if (portalUser.getPassword().equals(creds)) { Set<IRole> roles = null; try { roles = this.aclManager.retrievePrincipalRoles(auth); } catch (final PrincipalNotFoundException e) { roles = Collections.emptySet(); } final IAuthorization authorizations = new BasicAuthorization(roles); resultingAuth = new PortalUserAuthentication(auth, authorizations); } return resultingAuth; }