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.apache.nifi.processors.standard.AttributesToJSON.java
@OnScheduled public void onScheduled(ProcessContext context) { attributesToRemove = context.getProperty(INCLUDE_CORE_ATTRIBUTES).asBoolean() ? Collections.EMPTY_SET : Arrays.stream(CoreAttributes.values()).map(CoreAttributes::key).collect(Collectors.toSet()); attributes = buildAtrs(context.getProperty(ATTRIBUTES_LIST).getValue(), attributesToRemove); nullValueForEmptyString = context.getProperty(NULL_VALUE_FOR_EMPTY_STRING).asBoolean(); destinationContent = DESTINATION_CONTENT.equals(context.getProperty(DESTINATION).getValue()); }
From source file:org.keycloak.models.jpa.JpaRealmProvider.java
@Override public Set<RoleModel> getRealmRoles(RealmModel realm) { TypedQuery<String> query = em.createNamedQuery("getRealmRoleIds", String.class); query.setParameter("realm", realm.getId()); List<String> roles = query.getResultList(); if (roles.isEmpty()) return Collections.EMPTY_SET; Set<RoleModel> list = new HashSet<>(); for (String id : roles) { list.add(session.realms().getRoleById(id, realm)); }//from w w w . j a v a 2 s . c o m return Collections.unmodifiableSet(list); }
From source file:org.apache.jackrabbit.core.security.principal.DefaultPrincipalProvider.java
/** * Recursively collect all Group-principals the specified principal is * member of.//from w ww .ja v a 2 s . c o m * * @param princ * @return all Group principals the specified <code>princ</code> is member of * including inherited membership. */ private Set collectGroupMembership(Principal princ, Set membership) { String princName = princ.getName(); if (!hasPrincipal(princName)) { return Collections.EMPTY_SET; } try { Authorizable auth = userManager.getAuthorizable(princ); if (auth != null) { Iterator itr = auth.memberOf(); while (itr.hasNext()) { Group group = (Group) itr.next(); Principal groupPrinc = group.getPrincipal(); if (membership.add(groupPrinc)) { membership.addAll(collectGroupMembership(groupPrinc, membership)); } else { String msg = "Cyclic group membership detected with Group " + groupPrinc.getName(); log.error(msg); } } } else { log.debug("Cannot find authorizable for principal " + princ.getName()); } } catch (RepositoryException e) { log.warn("Failed to determine membership for " + princName, e.getMessage()); } return membership; }
From source file:org.apache.geronimo.tomcat.deployment.TomcatModuleBuilderTest.java
private EARContext createEARContext(File outputPath, Environment environment, Repository repository, ConfigurationStore configStore, AbstractName moduleName) throws DeploymentException { Set repositories = repository == null ? Collections.EMPTY_SET : Collections.singleton(repository); Set configurationManagers = configurationManager == null ? Collections.EMPTY_SET : Collections.singleton(configurationManager); ArtifactManager artifactManager = new DefaultArtifactManager(); ArtifactResolver artifactResolver = new DefaultArtifactResolver(artifactManager, repositories, null, configurationManagers);// w w w . j a va2 s. c o m return new EARContext(outputPath, null, environment, ConfigurationModuleType.WAR, naming, configurationManager, bundle.getBundleContext(), new AbstractNameQuery(serverName), moduleName, new AbstractNameQuery(tmName), new AbstractNameQuery(ctcName), null); }
From source file:org.jsecurity.session.mgt.SimpleSession.java
public Collection<Object> getAttributeKeys() throws InvalidSessionException { Map<Object, Object> attributes = getAttributes(); if (attributes == null) { //noinspection unchecked return Collections.EMPTY_SET; }/* w w w .jav a2 s . co m*/ return attributes.keySet(); }
From source file:de.hybris.platform.catalog.jalo.synchronization.ItemCopyCreatorTest.java
@Test public void testUpdatingNullValues() throws JaloBusinessException { final UnitModel u = modelService.create(UnitModel.class); u.setCode("unit-" + System.nanoTime()); u.setUnitType("type"); u.setConversion(Double.valueOf(1.0)); modelService.save(u);/*from w w w . j av a 2 s. c o m*/ final ProductModel p = modelService.create(ProductModel.class); p.setCatalogVersion((CatalogVersionModel) modelService.get(src)); p.setCode("foo-" + System.nanoTime()); p.setMinOrderQuantity(12); p.setUnit(u); p.setApprovalStatus(ArticleApprovalStatus.APPROVED); modelService.save(p); final Product pJalo = modelService.getSource(p); // 1. create copy -> values are non-null final Product pCopyJalo = (Product) new CatalogVersionSyncCopyContext(syncJob, syncCronJob, worker) { @Override protected Set<Language> getTargetLanguages() { return jaloSession.getC2LManager().getAllLanguages(); } @Override protected SyncSchedule getCurrentSchedule() { return new SyncSchedule(pJalo.getPK(), null, null, Collections.EMPTY_SET, Collections.EMPTY_MAP); } }.copy(pJalo); Assert.assertNotNull("Product not copied", pCopyJalo); final ProductModel pCopy = modelService.get(pCopyJalo); Assert.assertEquals(p.getCode(), pCopy.getCode()); Assert.assertEquals(p.getMinOrderQuantity(), pCopy.getMinOrderQuantity()); Assert.assertEquals(p.getApprovalStatus(), pCopy.getApprovalStatus()); Assert.assertEquals(p.getUnit(), pCopy.getUnit()); // 2. change original -> some values are null now p.setUnit(null); p.setMinOrderQuantity(null); modelService.save(p); Assert.assertNull(p.getMinOrderQuantity()); Assert.assertNull(p.getUnit()); // 3. copy again -> copy should have null values too final Product pCopyJalo2 = (Product) new CatalogVersionSyncCopyContext(syncJob, syncCronJob, worker) { @Override protected Set<Language> getTargetLanguages() { return jaloSession.getC2LManager().getAllLanguages(); } @Override protected SyncSchedule getCurrentSchedule() { return new SyncSchedule(pJalo.getPK(), pCopyJalo.getPK(), null, Collections.EMPTY_SET, Collections.EMPTY_MAP); } }.copy(pJalo); Assert.assertNotNull("Product not copied", pCopyJalo2); final ProductModel pCopy2 = modelService.get(pCopyJalo2); Assert.assertSame(pCopy, pCopy2); modelService.refresh(pCopy2); // unchanged ? Assert.assertEquals(p.getCode(), pCopy2.getCode()); Assert.assertEquals(p.getApprovalStatus(), pCopy2.getApprovalStatus()); // null'ed ? Assert.assertNull(pCopy2.getUnit()); Assert.assertNull(pCopy2.getMinOrderQuantity()); }
From source file:de.tudarmstadt.ukp.clarin.webanno.brat.curation.CasDiff2.java
private DiffAdapter getAdapter(String aType) { DiffAdapter adapter = typeAdapters.get(aType); if (adapter == null) { log.warn("No diff adapter for type [" + aType + "] -- treating as without features"); adapter = new SpanDiffAdapter(aType, Collections.EMPTY_SET); typeAdapters.put(aType, adapter); }/* w w w .j av a 2 s . c o m*/ return adapter; }
From source file:org.forgerock.openam.upgrade.steps.UpgradeServiceSchemaStep.java
private Set<String> listNewServices(Set<String> serviceNames, Set<String> existingServices) { Set<String> newServiceNames = new HashSet<String>(serviceNames); if (newServiceNames.removeAll(existingServices)) { return newServiceNames; }/*from w ww . j a v a 2s . c o m*/ return Collections.EMPTY_SET; }
From source file:pl.datamatica.traccar.api.providers.UserProvider.java
private void removeUserSettings(User user) throws Exception { Query query;/*from w w w .j a va 2 s . c o m*/ query = em.createQuery("DELETE FROM NotificationSettings WHERE user = ?"); query.setParameter(1, user); query.executeUpdate(); //Remove user data from table users_notifications user.setNotificationEvents(Collections.EMPTY_SET); //Remove user data from table users_mobilenotifications user.setMobileNotificationSettings(Collections.EMPTY_MAP); em.persist(user); query = em.createQuery("DELETE FROM UIStateEntry WHERE user = ?"); query.setParameter(1, user); query.executeUpdate(); query = em.createQuery("DELETE FROM UserDeviceStatus uds WHERE uds.id.user = ?"); query.setParameter(1, user); query.executeUpdate(); query = em.createQuery("DELETE FROM UserSession us WHERE us.userId = ?"); query.setParameter(1, user.getId()); query.executeUpdate(); }
From source file:web.MockServletContext.java
@Override public Enumeration getServlets() { return Collections.enumeration(Collections.EMPTY_SET); }