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.syncope.core.propagation.PropagationManager.java
private List<PropagationTask> getUpdateTaskIds(final SyncopeUser user, final PropagationByResource propByRes, final String password, final Set<String> vAttrsToBeRemoved, final Set<AttributeMod> vAttrsToBeUpdated, final Boolean enable, final Set<String> syncResourceNames) throws NotFoundException { PropagationByResource localPropByRes = userDataBinder.fillVirtual(user, vAttrsToBeRemoved == null ? Collections.EMPTY_SET : vAttrsToBeRemoved, vAttrsToBeUpdated == null ? Collections.EMPTY_SET : vAttrsToBeUpdated, AttributableUtil.USER); if (propByRes != null && !propByRes.isEmpty()) { localPropByRes.merge(propByRes); } else {// w w w .j ava 2 s . co m localPropByRes.addAll(PropagationOperation.UPDATE, user.getResourceNames()); } if (syncResourceNames != null) { localPropByRes.get(PropagationOperation.CREATE).removeAll(syncResourceNames); localPropByRes.get(PropagationOperation.UPDATE).removeAll(syncResourceNames); localPropByRes.get(PropagationOperation.DELETE).removeAll(syncResourceNames); } return provision(user, password, enable, localPropByRes); }
From source file:org.lightjason.agentspeak.grammar.CASTVisitorPlanBundle.java
@Override public final Object visitAnnotations(final PlanBundleParser.AnnotationsContext p_context) { if ((p_context == null) || (p_context.isEmpty())) return Collections.EMPTY_SET; final Set<IAnnotation<?>> l_annotation = new HashSet<>(); if (p_context.annotation_atom() != null) p_context.annotation_atom().stream().map(i -> (IAnnotation<?>) this.visitAnnotation_atom(i)) .forEach(l_annotation::add); if (p_context.annotation_literal() != null) p_context.annotation_literal().stream().map(i -> (IAnnotation<?>) this.visitAnnotation_literal(i)) .forEach(l_annotation::add); return l_annotation.isEmpty() ? Collections.EMPTY_SET : l_annotation; }
From source file:uk.ac.ebi.intact.dataexchange.psimi.solr.ontology.OntologySearcher.java
public Set<String> getOntologyNames() throws SolrServerException { if (ontologyNames == null) { SolrQuery query = new SolrQuery("*:*"); query.setStart(0);//from w w w . j a v a2s . com query.setRows(0); // prepare faceting query.setFacet(true); query.setParam(FacetParams.FACET_FIELD, "ontology"); query.setFacetLimit(10); query.setFacetMinCount(1); query.set(FacetParams.FACET_OFFSET, 0); // order by unique id query.addSortField(OntologyFieldNames.ID, SolrQuery.ORDER.asc); QueryResponse response = search(query, null); FacetField facetField = response.getFacetField("ontology"); if (facetField.getValues() == null) { return Collections.EMPTY_SET; } ontologyNames = new HashSet<String>(facetField.getValues().size()); for (FacetField.Count c : facetField.getValues()) { ontologyNames.add(c.getName()); } } return ontologyNames; }
From source file:org.apache.axis2.classloader.MultiParentClassLoader.java
public Enumeration findResources(String name) throws IOException { if (isDestroyed()) { return Collections.enumeration(Collections.EMPTY_SET); }/* w ww.java 2 s . com*/ List resources = new ArrayList(); // // if we are using inverse class loading, add the resources from local urls first // if (inverseClassLoading && !isDestroyed()) { List myResources = Collections.list(super.findResources(name)); resources.addAll(myResources); } // // Add parent resources // for (int i = 0; i < parents.length; i++) { ClassLoader parent = parents[i]; List parentResources = Collections.list(parent.getResources(name)); resources.addAll(parentResources); } // // if we are not using inverse class loading, add the resources from local urls now // if (!inverseClassLoading && !isDestroyed()) { List myResources = Collections.list(super.findResources(name)); resources.addAll(myResources); } return Collections.enumeration(resources); }
From source file:org.apache.roller.weblogger.config.PingConfig.java
/** * Get the set of variant options configured for the given ping target url. * * @param pingTargetUrl//from w w w . jav a 2 s . c om * @return the set of variant options configured for the given ping target url, or * the empty set if there are no variants configured. */ public static Set getVariantOptions(String pingTargetUrl) { Set variantOptions = (Set) configuredVariants.get(pingTargetUrl); if (variantOptions == null) { variantOptions = Collections.EMPTY_SET; } return variantOptions; }
From source file:org.nuclos.server.navigation.ejb3.TreeNodeFacadeBean.java
private static Set<String> getSubEntityNamesRequiredForGenericObjectTreeNode(Integer iModuleId) { // we need no dependend subforms here. get them on demand as child subnode. /*final Set<String> result = new HashSet<String>(); final MasterDataVO mdcvoModule = Modules.getInstance().getModuleById(iModuleId); /*from ww w . ja va 2s . c o m*/ final String base = (String)mdcvoModule.getField("entity"); final Collection<EntityTreeViewVO> etvs = Modules.getInstance().getSubnodesETV(base); for (EntityTreeViewVO etv : etvs) { if (etv.isActive()) result.add(etv.getEntity()); } return result;*/ return Collections.EMPTY_SET; }
From source file:org.lightjason.agentspeak.grammar.CASTVisitorAgent.java
@Override public final Object visitAnnotations(final AgentParser.AnnotationsContext p_context) { if ((p_context == null) || (p_context.isEmpty())) return Collections.EMPTY_SET; final Set<IAnnotation<?>> l_annotation = new HashSet<>(); if (p_context.annotation_atom() != null) p_context.annotation_atom().stream().map(i -> (IAnnotation<?>) this.visitAnnotation_atom(i)) .forEach(l_annotation::add); if (p_context.annotation_literal() != null) p_context.annotation_literal().stream().map(i -> (IAnnotation<?>) this.visitAnnotation_literal(i)) .forEach(l_annotation::add); return l_annotation.isEmpty() ? Collections.EMPTY_SET : l_annotation; }
From source file:org.xcmis.search.query.content.AbstractQueryTest.java
protected void save(Node node) throws IndexModificationException { searchService.update(node.getTree(), Collections.EMPTY_SET); }
From source file:fr.gael.dhus.sync.impl.ODataUserSynchronizer.java
@Override public boolean synchronize() throws InterruptedException { int created = 0, updated = 0; try {/*from www . j a v a 2 s . c o m*/ // Makes query parameters Map<String, String> query_param = new HashMap<>(); if (skip != 0) { query_param.put("$skip", String.valueOf(skip)); } query_param.put("$top", String.valueOf(pageSize)); log(Level.DEBUG, "Querying users from " + skip + " to " + skip + pageSize); ODataFeed userfeed = readFeedLogPerf("/Users", query_param); // For each entry, creates a DataBase Object for (ODataEntry pdt : userfeed.getEntries()) { String username = null; try { Map<String, Object> props = pdt.getProperties(); username = (String) props.get(UserEntitySet.USERNAME); String email = (String) props.get(UserEntitySet.EMAIL); String firstname = (String) props.get(UserEntitySet.FIRSTNAME); String lastname = (String) props.get(UserEntitySet.LASTNAME); String country = (String) props.get(UserEntitySet.COUNTRY); String domain = (String) props.get(UserEntitySet.DOMAIN); String subdomain = (String) props.get(UserEntitySet.SUBDOMAIN); String usage = (String) props.get(UserEntitySet.USAGE); String subusage = (String) props.get(UserEntitySet.SUBUSAGE); String phone = (String) props.get(UserEntitySet.PHONE); String address = (String) props.get(UserEntitySet.ADDRESS); String hash = (String) props.get(UserEntitySet.HASH); String password = (String) props.get(UserEntitySet.PASSWORD); Date creation = ((GregorianCalendar) props.get(UserEntitySet.CREATED)).getTime(); // Uses the Scheme encoder as it is the most restrictives, it only allows // '+' (forbidden char in usernames, so it's ok) // '-' (forbidden char in usernames, so it's ok) // '.' (allowed char in usernames, not problematic) // the alphanumeric character class (a-z A-Z 0-9) String encoded_username = UriUtils.encodeScheme(username, "UTF-8"); // Retrieves Roles String roleq = String.format("/Users('%s')/SystemRoles", encoded_username); ODataFeed userrole = readFeedLogPerf(roleq, null); List<ODataEntry> roles = userrole.getEntries(); List<Role> new_roles = new ArrayList<>(); for (ODataEntry role : roles) { String rolename = (String) role.getProperties().get(SystemRoleEntitySet.NAME); new_roles.add(Role.valueOf(rolename)); } // Has restriction? String restricq = String.format("/Users('%s')/Restrictions", encoded_username); ODataFeed userrestric = readFeedLogPerf(restricq, null); boolean has_restriction = !userrestric.getEntries().isEmpty(); // Reads user in database, may be null User user = USER_SERVICE.getUserNoCheck(username); // Updates existing user if (user != null && (force || creation.equals(user.getCreated()))) { boolean changed = false; // I wish users had their `Updated` field exposed on OData if (!username.equals(user.getUsername())) { user.setUsername(username); changed = true; } if (email == null && user.getEmail() != null || email != null && !email.equals(user.getEmail())) { user.setEmail(email); changed = true; } if (firstname == null && user.getFirstname() != null || firstname != null && !firstname.equals(user.getFirstname())) { user.setFirstname(firstname); changed = true; } if (lastname == null && user.getLastname() != null || lastname != null && !lastname.equals(user.getLastname())) { user.setLastname(lastname); changed = true; } if (country == null && user.getCountry() != null || country != null && !country.equals(user.getCountry())) { user.setCountry(country); changed = true; } if (domain == null && user.getDomain() != null || domain != null && !domain.equals(user.getDomain())) { user.setDomain(domain); changed = true; } if (subdomain == null && user.getSubDomain() != null || subdomain != null && !subdomain.equals(user.getSubDomain())) { user.setSubDomain(subdomain); changed = true; } if (usage == null && user.getUsage() != null || usage != null && !usage.equals(user.getUsage())) { user.setUsage(usage); changed = true; } if (subusage == null && user.getSubUsage() != null || subusage != null && !subusage.equals(user.getSubUsage())) { user.setSubUsage(subusage); changed = true; } if (phone == null && user.getPhone() != null || phone != null && !phone.equals(user.getPhone())) { user.setPhone(phone); changed = true; } if (address == null && user.getAddress() != null || address != null && !address.equals(user.getAddress())) { user.setAddress(address); changed = true; } if (password == null && user.getPassword() != null || password != null && !password.equals(user.getPassword())) { if (hash == null) hash = PasswordEncryption.NONE.getAlgorithmKey(); user.setEncryptedPassword(password, User.PasswordEncryption.valueOf(hash)); changed = true; } //user.setPasswordEncryption(User.PasswordEncryption.valueOf(hash)); if (!SetUtils.isEqualSet(user.getRoles(), new_roles)) { user.setRoles(new_roles); changed = true; } if (has_restriction != !user.getRestrictions().isEmpty()) { if (has_restriction) { user.addRestriction(new LockedAccessRestriction()); } else { user.setRestrictions(Collections.EMPTY_SET); } changed = true; } if (changed) { log(Level.DEBUG, "Updating user " + user.getUsername()); USER_SERVICE.systemUpdateUser(user); updated++; } } // Creates new user else if (user == null) { user = new User(); user.setUsername(username); user.setEmail(email); user.setFirstname(firstname); user.setLastname(lastname); user.setCountry(country); user.setDomain(domain); user.setSubDomain(subdomain); user.setUsage(usage); user.setSubUsage(subusage); user.setPhone(phone); user.setAddress(address); user.setPassword(password); //user.setPasswordEncryption(User.PasswordEncryption.valueOf(hash)); user.setCreated(creation); user.setRoles(new_roles); if (has_restriction) { user.addRestriction(new LockedAccessRestriction()); } log(Level.DEBUG, "Creating new user " + user.getUsername()); USER_SERVICE.systemCreateUser(user); created++; } else { log(Level.ERROR, "Namesake '" + username + "' detected!"); } } catch (RootNotModifiableException e) { } // Ignored exception catch (RequiredFieldMissingException ex) { log(Level.ERROR, "Cannot create user '" + username + "'", ex); } catch (IOException | ODataException ex) { log(Level.ERROR, "OData failure on user '" + username + "'", ex); } this.skip++; } // This is the end, resets `skip` to 0 if (userfeed.getEntries().size() < pageSize) { this.skip = 0; } } catch (IOException | ODataException ex) { log(Level.ERROR, "OData failure", ex); } catch (LockAcquisitionException | CannotAcquireLockException e) { throw new InterruptedException(e.getMessage()); } finally { StringBuilder sb = new StringBuilder("done: "); sb.append(created).append(" new Users, "); sb.append(updated).append(" updated Users, "); sb.append(" from ").append(this.client.getServiceRoot()); log(Level.INFO, sb.toString()); this.syncConf.setConfig("skip", String.valueOf(skip)); SYNC_SERVICE.saveSynchronizer(this); } return false; }
From source file:org.apromore.plugin.portal.compareBP.ComparePlugin.java
private ModelAbstractions toModelAbstractions(ProcessSummaryType process, VersionSummaryType version) throws Exception { ExportFormatResultType result = processService.exportProcess(process.getName(), // process name process.getId(), // process ID version.getName(), // branch new Version(version.getVersionNumber()), // version number, "BPMN 2.0", // nativeType, null, // annotation name, false, // with annotations? Collections.EMPTY_SET // canoniser properties );//from w w w .j a va 2s . co m ByteArrayOutputStream baos = new ByteArrayOutputStream(); TransformerFactory.newInstance().newTransformer() .transform(new StreamSource(result.getNative().getInputStream()), new StreamResult(baos)); return new ModelAbstractions(baos.toByteArray()); }