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:com.agilejava.maven.docbkx.GeneratorMojo.java
/** * Returns a {@link Collection} of all parameter names defined in the * stylesheet or in one of the stylesheets imported or included in the * stylesheet.//from ww w.j a v a 2 s . c om * * @param url * The location of the stylesheet to analyze. * @return A {@link Collection} of all parameter names found in the * stylesheet pinpointed by the <code>url</code> argument. * * @throws MojoExecutionException * If the operation fails to detect parameter names. */ private Collection getParameterNames(String url) throws MojoExecutionException { ByteArrayOutputStream out = null; try { Transformer transformer = createParamListTransformer(); Source source = new StreamSource(url); out = new ByteArrayOutputStream(); Result result = new StreamResult(out); transformer.transform(source, result); out.flush(); if (out.size() != 0) { // at least one param has been found, because the split with return an empty string if there is no data String[] paramNames = new String(out.toByteArray()).split("\n"); return new HashSet(Arrays.asList(paramNames)); } else { // else no param found return new HashSet(); } } catch (IOException ioe) { // Impossible, but let's satisfy PMD and FindBugs getLog().warn("Failed to flush ByteArrayOutputStream."); } catch (TransformerConfigurationException tce) { throw new MojoExecutionException("Failed to create Transformer for retrieving parameter names", tce); } catch (TransformerException te) { throw new MojoExecutionException("Failed to apply Transformer for retrieving parameter names.", te); } finally { IOUtils.closeQuietly(out); } return Collections.EMPTY_SET; }
From source file:uk.ac.ebi.intact.editor.services.curate.EditorObjectService.java
@Transactional(value = "jamiTransactionManager", readOnly = true, propagation = Propagation.REQUIRED) public void synchronizeExperimentShortLabel(IntactExperiment object) { IntactUtils.synchronizeExperimentShortLabel(object, getIntactDao().getEntityManager(), Collections.EMPTY_SET); }
From source file:org.egov.services.budget.BudgetDetailService.java
public Set<Budget> findBudgetTree(final Budget budget, final BudgetDetail example) { if (budget == null) return Collections.EMPTY_SET; final Criteria budgetDetailCriteria = constructCriteria(example); budgetDetailCriteria.createCriteria(Constants.BUDGET); final List<Budget> leafBudgets = budgetDetailCriteria .setProjection(Projections.distinct(Projections.property(Constants.BUDGET))).list(); final List<Budget> parents = new ArrayList<Budget>(); final Set<Budget> budgetTree = new LinkedHashSet<Budget>(); for (Budget leaf : leafBudgets) { parents.clear();//from w w w . j a v a2 s. com while (leaf != null && leaf.getId() != budget.getId()) { parents.add(leaf); leaf = leaf.getParent(); } if (leaf != null) { parents.add(leaf); budgetTree.addAll(parents); } } return budgetTree; }
From source file:uk.ac.ebi.intact.editor.services.curate.EditorObjectService.java
@Transactional(value = "jamiTransactionManager", readOnly = true, propagation = Propagation.REQUIRED) public void synchronizeInteractionShortLabel(IntactInteractionEvidence object) { IntactUtils.synchronizeInteractionEvidenceShortName(object, getIntactDao().getEntityManager(), Collections.EMPTY_SET); }
From source file:org.apache.myfaces.shared_impl.renderkit.RendererUtils.java
private static Set internalSubmittedOrSelectedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany, Object values) { if (values == null || EMPTY_STRING.equals(values)) { return Collections.EMPTY_SET; } else if (values instanceof Object[]) { //Object array Object[] ar = (Object[]) values; if (ar.length == 0) { return Collections.EMPTY_SET; }//w w w .j a v a 2 s . co m HashSet set = new HashSet(HashMapUtils.calcCapacity(ar.length)); for (int i = 0; i < ar.length; i++) { set.add(getConvertedStringValue(context, component, converter, ar[i])); } return set; } else if (values.getClass().isArray()) { //primitive array int len = Array.getLength(values); HashSet set = new HashSet(org.apache.myfaces.shared_impl.util.HashMapUtils.calcCapacity(len)); for (int i = 0; i < len; i++) { set.add(getConvertedStringValue(context, component, converter, Array.get(values, i))); } return set; } else if (values instanceof List) { List lst = (List) values; if (lst.size() == 0) { return Collections.EMPTY_SET; } else { HashSet set = new HashSet(HashMapUtils.calcCapacity(lst.size())); for (Iterator i = lst.iterator(); i.hasNext();) set.add(getConvertedStringValue(context, component, converter, i.next())); return set; } } else { throw new IllegalArgumentException("Value of UISelectMany component with path : " + getPathToComponent(uiSelectMany) + " is not of type Array or List"); } }
From source file:org.apache.jcs.auxiliary.remote.server.RemoteCacheServer.java
/** * Gets the set of keys of objects currently in the group. * <p>//from w w w .jav a 2 s. c om * @param cacheName * @param group * @return A Set of group keys */ public Set getGroupKeys(String cacheName, String group) { CacheListeners cacheDesc = null; try { cacheDesc = getCacheListeners(cacheName); } catch (Exception e) { log.error("Problem getting listeners.", e); } if (cacheDesc == null) { return Collections.EMPTY_SET; } CompositeCache c = (CompositeCache) cacheDesc.cache; return c.getGroupKeys(group); }
From source file:org.opendaylight.ovsdb.hwvtepsouthbound.transact.HwvtepOperationalState.java
public Set<InstanceIdentifier> getDeletedKeysInCurrentTx(Class<? extends Identifiable> cls) { if (currentTxDeletedKeys.containsKey(cls)) { return currentTxDeletedKeys.get(cls).keySet(); }//w w w .ja v a 2s . co m return Collections.EMPTY_SET; }
From source file:org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule.java
@Override public @NonNull Iterable<@NonNull ITmfStateSystem> getStateSystems() { ITmfStateSystemBuilder stateSystem = fStateSystem; if (stateSystem == null) { return Collections.EMPTY_SET; }//from ww w .jav a2 s. co m return Collections.singleton(stateSystem); }
From source file:org.lockss.servlet.AuConfig.java
/** Create a form to edit a (possibly not-yet-existing) AU. * @param actions list of action buttons for bottom of form. If an * element is a String, a button will be created for it. * @param au the AU//from ww w . j av a2s .c o m * @param editable true if the form should be editable. (Not all the * fields will be editable in any case). */ private Form createAuEditForm(List actions, AuProxy au, boolean editable) throws IOException { boolean isNew = au == null; Collection noEditKeys = Collections.EMPTY_SET; Configuration initVals; if (titleConfig != null) { initVals = titleConfig.getConfig(); noEditKeys = titleConfig.getUnEditableKeys(); } else if (formConfig != null) { initVals = formConfig; } else if (auConfig != null) { initVals = auConfig; } else { initVals = ConfigManager.EMPTY_CONFIGURATION; } Form frm = ServletUtil.newForm(srvURL(myServletDescr())); ServletUtil.layoutAuPropsTable(this, frm, getAuConfigParams(), getDefKeys(), initVals, noEditKeys, isNew, getEditKeys(), editable); if (isNew) { addRepoChoice(frm); addPlugId(frm, plugin); } else { addAuId(frm, au); } ServletUtil.layoutAuPropsButtons(this, frm, actions.iterator(), ACTION_TAG); return frm; }
From source file:org.niord.core.publication.PublicationService.java
/** * When a publication enters the RECORDING status, check if any of the currently published messages * should be assigned to the associated message tag. * @param publication the publication/*from w w w .ja va 2 s. co m*/ */ private void startRecordingPublication(Publication publication) { // Sanity checks if (publication.getStatus() != RECORDING || publication.getMessageTag() == null || StringUtils.isBlank(publication.getMessageTagFilter())) { return; } Set<String> seriesIds = publication.getDomain() != null ? publication.getDomain().getMessageSeries() .stream().map(MessageSeries::getSeriesId).collect(Collectors.toSet()) : Collections.EMPTY_SET; // Look up all published messages MessageSearchParams params = new MessageSearchParams().seriesIds(seriesIds).statuses(PUBLISHED); List<Message> messages = messageService.search(params).getData(); // For each message, check if it should be included in the associated message tag messages.forEach(m -> checkMessageForRecordingPublication(publication, m, PHASE_START_RECORDING)); }