List of usage examples for java.util Collections EMPTY_SET
Set EMPTY_SET
To view the source code for java.util Collections EMPTY_SET.
Click Source Link
From source file:org.slc.sli.api.resources.BulkExtractTest.java
@Test(expected = AccessDeniedException.class) public void testUserNotInLEA() throws Exception { injector.setEducatorContext();/* w w w .j av a 2 s. c om*/ // No BE Field Mockito.when(mockValidator.validate(eq(EntityNames.EDUCATION_ORGANIZATION), Mockito.any(Set.class))) .thenReturn(Collections.EMPTY_SET); bulkExtract.getEdOrgExtract(CONTEXT, req, "BLEEP"); }
From source file:org.talend.core.hadoop.version.custom.HadoopCustomVersionDefineDialog.java
private Set<LibraryFile> getSelectedTypeLibList() { ECustomVersionGroup selectedType = getSelectedType(); if (selectedType != null) { return libMap.get(selectedType.getName()); }//from w ww .j a va 2 s.c o m return Collections.EMPTY_SET; }
From source file:org.forgerock.openam.authentication.modules.impersonation.ImpersonationModule.java
/** * Gets the user's AMIdentity from LDAP. * * @param userName The user's name.//from w ww. j av a 2s .c o m * @return The AMIdentity for the user. */ public AMIdentity getIdentity(String userName) { AMIdentity amIdentity = null; AMIdentityRepository amIdRepo = getAMIdentityRepository(getRequestOrg()); IdSearchControl idsc = new IdSearchControl(); idsc.setAllReturnAttributes(true); Set<AMIdentity> results = Collections.EMPTY_SET; try { idsc.setMaxResults(0); IdSearchResults searchResults = amIdRepo.searchIdentities(IdType.USER, userName, idsc); if (searchResults != null) { results = searchResults.getSearchResults(); System.out.println("results: " + results); } if (results.isEmpty()) { throw new IdRepoException("getIdentity : User " + userName + " is not found"); } else if (results.size() > 1) { throw new IdRepoException("getIdentity : More than one user found for the userName " + userName); } amIdentity = results.iterator().next(); } catch (IdRepoException e) { debug.error("Error searching Identities with username : " + userName, e); } catch (SSOException e) { debug.error("Module exception : ", e); } return amIdentity; }
From source file:net.lightbody.bmp.proxy.jetty.jetty.servlet.ServletHandler.java
public Set getResourcePaths(String uriInContext) { try {/*from w ww . ja va 2s .co m*/ uriInContext = URI.canonicalPath(uriInContext); if (uriInContext == null) return Collections.EMPTY_SET; Resource resource = getHttpContext().getResource(uriInContext); if (resource == null || !resource.isDirectory()) return Collections.EMPTY_SET; String[] contents = resource.list(); if (contents == null || contents.length == 0) return Collections.EMPTY_SET; HashSet set = new HashSet(contents.length * 2); for (int i = 0; i < contents.length; i++) set.add(URI.addPaths(uriInContext, contents[i])); return set; } catch (Exception e) { e.printStackTrace(); LogSupport.ignore(log, e); } return Collections.EMPTY_SET; }
From source file:org.apache.jackrabbit.oak.plugins.index.lucene.LucenePropertyIndexTest.java
@Test public void nodeNameViaPropDefinition() throws Exception { //make index/*from w w w .j a va 2 s .co m*/ Tree idx = createIndex("test1", Collections.EMPTY_SET); useV2(idx); Tree rules = idx.addChild(LuceneIndexConstants.INDEX_RULES); rules.setOrderableChildren(true); Tree rule = rules.addChild("nt:base"); Tree propDef = rule.addChild(PROP_NODE).addChild("nodeName"); propDef.setProperty(PROP_NAME, PROPDEF_PROP_NODE_NAME); propDef.setProperty(PROP_PROPERTY_INDEX, true); root.commit(); //add content Tree test = root.getTree("/"); test.addChild("foo"); test.addChild("camelCase"); test.addChild("test").addChild("bar"); root.commit(); //test String propabQuery = "select [jcr:path] from [nt:base] where LOCALNAME() = 'foo'"; assertThat(explain(propabQuery), containsString("lucene:test1(/oak:index/test1) :nodeName:foo")); assertQuery(propabQuery, asList("/foo")); assertQuery("select [jcr:path] from [nt:base] where LOCALNAME() = 'bar'", asList("/test/bar")); assertQuery("select [jcr:path] from [nt:base] where LOCALNAME() LIKE 'foo'", asList("/foo")); assertQuery("select [jcr:path] from [nt:base] where LOCALNAME() LIKE 'camel%'", asList("/camelCase")); assertQuery("select [jcr:path] from [nt:base] where NAME() = 'bar'", asList("/test/bar")); assertQuery("select [jcr:path] from [nt:base] where NAME() LIKE 'foo'", asList("/foo")); assertQuery("select [jcr:path] from [nt:base] where NAME() LIKE 'camel%'", asList("/camelCase")); }
From source file:org.red5.server.scope.Scope.java
/** * Return set of service handler names. Removing entries from the set unregisters the corresponding service handler. * //from ww w .jav a2s.co m * @return Set of service handler names */ @SuppressWarnings("unchecked") public Set<String> getServiceHandlerNames() { Map<String, Object> serviceHandlers = getServiceHandlers(false); if (serviceHandlers == null) { return Collections.EMPTY_SET; } return serviceHandlers.keySet(); }
From source file:org.apache.openjpa.jdbc.sql.SelectImpl.java
public Collection getTableAliases() { return (_tables == null) ? Collections.EMPTY_SET : _tables.values(); }
From source file:org.talend.updates.runtime.model.P2ExtraFeature.java
/** * add the feauture repo URI to the p2 engine and return the P2 installable units by looking at each repo * sequentially./*from w ww. ja va2s.c om*/ * * @param agent * @return the metadata repo to install anything in it. * @throws URISyntaxException if the feature remote p2 site uri is bad * @throws OperationCanceledException if installation was canceled * @throws ProvisionException if p2 repository could not be loaded */ protected Set<IInstallableUnit> getInstallableIU(IProvisioningAgent agent, List<URI> allRepoUris, IProgressMonitor progress) throws URISyntaxException, ProvisionException, OperationCanceledException { if (allRepoUris.isEmpty()) {// if repo list is empty use the default URI allRepoUris.add(getP2RepositoryURI()); } SubMonitor subMonitor = SubMonitor.convert(progress, allRepoUris.size()); subMonitor.setTaskName(Messages.getString("ExtraFeature.searching.talend.features.label", getName())); //$NON-NLS-1$ // get the repository managers and add our repository IMetadataRepositoryManager metadataManager = (IMetadataRepositoryManager) agent .getService(IMetadataRepositoryManager.SERVICE_NAME); IArtifactRepositoryManager artifactManager = (IArtifactRepositoryManager) agent .getService(IArtifactRepositoryManager.SERVICE_NAME); // create the feature query IQuery<IInstallableUnit> iuQuery = QueryUtil.createLatestQuery(QueryUtil.createIUQuery(getP2IuId())); // remove existing repositories for (URI existingRepUri : metadataManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL)) { metadataManager.removeRepository(existingRepUri); } for (URI existingRepUri : artifactManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_ALL)) { metadataManager.removeRepository(existingRepUri); } for (URI repoUri : allRepoUris) { metadataManager.addRepository(repoUri); artifactManager.addRepository(repoUri); } if (subMonitor.isCanceled()) { return Collections.EMPTY_SET; } return metadataManager.query(iuQuery, progress).toUnmodifiableSet(); }
From source file:org.eclipse.smarthome.io.rest.core.internal.thing.ThingResource.java
@GET @RolesAllowed({ Role.USER, Role.ADMIN }) @Path("/{thingUID}/config/status") @Produces(MediaType.APPLICATION_JSON)// w w w .j av a 2 s.c o m @ApiOperation(value = "Gets thing's config status.") @ApiResponses(value = { @ApiResponse(code = 200, message = "OK", response = String.class), @ApiResponse(code = 404, message = "Thing not found.") }) public Response getConfigStatus(@HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) String language, @PathParam("thingUID") @ApiParam(value = "thing") String thingUID) throws IOException { ThingUID thingUIDObject = new ThingUID(thingUID); // Check if the Thing exists, 404 if not Thing thing = thingRegistry.get(thingUIDObject); if (null == thing) { logger.info("Received HTTP GET request for thing config status at '{}' for the unknown thing '{}'.", uriInfo.getPath(), thingUID); return getThingNotFoundResponse(thingUID); } ConfigStatusInfo info = configStatusService.getConfigStatus(thingUID, localeService.getLocale(language)); if (info != null) { return Response.ok().entity(info.getConfigStatusMessages()).build(); } return Response.ok().entity(Collections.EMPTY_SET).build(); }
From source file:de.csw.expertfinder.expertise.ExpertiseModel.java
/** * Returns all names of authors who contributed to the given topic. * @param topicName the name of the topic * @return a list containing all names of authors who contributed to the given topic. *///from ww w.j a v a 2 s . co m @SuppressWarnings("unchecked") public Set<String> getAuthorsForTopic(String topicName) { Set<String> result = new TreeSet<String>(); OntClass clazz = OntologyIndex.get().getOntClass(topicName); if (clazz == null) { return Collections.EMPTY_SET; } String topicURI = clazz.getURI(); persistenceStore.beginTransaction(); Concept topic = persistenceStore.getConcept(topicURI); List<AuthorContribution> contributions = persistenceStore.getCachedAuthorContributions(topic); persistenceStore.endTransaction(); if (!contributions.isEmpty()) { for (AuthorContribution authorContribution : contributions) { String authorName = authorContribution.getAuthor().getName(); result.add(authorName); } return result; } persistenceStore.beginTransaction(); List<Author> directAuthors = persistenceStore.getAuthorsWhoContributedToTopic(topic); List<Author> indirectAuthors = persistenceStore.getAuthorsWhoIndirectlyContributedToTopic(topic); persistenceStore.endTransaction(); for (Author author : directAuthors) { result.add(author.getName()); } for (Author author : indirectAuthors) { result.add(author.getName()); } return result; }