Example usage for java.util Collections unmodifiableCollection

List of usage examples for java.util Collections unmodifiableCollection

Introduction

In this page you can find the example usage for java.util Collections unmodifiableCollection.

Prototype

public static <T> Collection<T> unmodifiableCollection(Collection<? extends T> c) 

Source Link

Document

Returns an unmodifiable view of the specified collection.

Usage

From source file:net.ymate.platform.webmvc.RequestMeta.java

public Collection<ParameterMeta> getClassParameterMetas() {
    return Collections.unmodifiableCollection(__CLASS_PARAMETER_METAS.get(targetClass).values());
}

From source file:com.ibm.jaggr.service.impl.transport.AbstractHttpTransport.java

/**
 * Unfolds the folded module list in the request into a {@code Collection<String>}
 * of module names.//from  w  w  w . j a  v  a 2s . c  o m
 * 
 * @param request the request object
 * @return the Collection of module names
 * @throws IOException
 */
protected Collection<String> getModuleListFromRequest(HttpServletRequest request) throws IOException {
    List<String> moduleList = new LinkedList<String>();
    String moduleQueryArg = request.getParameter(REQUESTEDMODULES_REQPARAM);
    String countParam = request.getParameter(REQUESTEDMODULESCOUNT_REQPARAM);
    int count = 0;
    if (countParam != null) {
        count = Integer.parseInt(request.getParameter(REQUESTEDMODULESCOUNT_REQPARAM));
    }

    if (moduleQueryArg == null) {
        return Collections.emptySet();
    }

    try {
        moduleQueryArg = URLDecoder.decode(moduleQueryArg, "UTF-8"); //$NON-NLS-1$
    } catch (UnsupportedEncodingException e) {
        throw new BadRequestException(e.getMessage());
    }

    if (count > 0) {
        if (_encJsonMap.containsKey(moduleQueryArg))
            moduleList.addAll(_encJsonMap.get(moduleQueryArg));
        else {
            try {
                moduleList.addAll(Arrays.asList(unfoldModules(decodeModules(moduleQueryArg), count)));
            } catch (JSONException e) {
                throw new IOException(e);
            }

            // Save buildReader so we don't have to do this again.
            _encJsonMap.put(moduleQueryArg, moduleList);
        }
    } else {
        // Hand crafted URL; get module names from one or more module query args
        moduleList.addAll(Arrays.asList(moduleQueryArg.split("\\s*,\\s*", 0))); //$NON-NLS-1$
        String required = request.getParameter(REQUIRED_REQPARAM);
        if (required != null) {
            Set<String> requiredSet = new HashSet<String>(Arrays.asList(required.split("\\s*,\\s*"))); //$NON-NLS-1$
            request.setAttribute(REQUIRED_REQATTRNAME, Collections.unmodifiableSet(requiredSet));
        }
    }
    return Collections.unmodifiableCollection(new ModuleList(moduleList, moduleQueryArg));
}

From source file:info.magnolia.ui.workbench.tree.HierarchicalJcrContainer.java

public Collection<Item> getChildren(Item item) {
    if (!item.isNode()) {
        return Collections.emptySet();
    }// w w  w .jav  a2s . c o m

    Node node = (Node) item;
    ArrayList<Item> items = new ArrayList<Item>();
    try {
        NodeIterator iterator;
        // we cannot use query just for getting children of a node as SQL2 is not returning them in natural order
        // so if any sorter is defined use query, otherwise get all children from the node
        if (isSortable()) {
            nodePath = node.getPath();
            String query = constructJCRQuery(true);
            iterator = QueryUtil.search(getWorkspace(), query, Query.JCR_SQL2);
        } else {
            iterator = node.getNodes();
        }

        while (iterator.hasNext()) {
            Node next = iterator.nextNode();
            if (isNodeVisible(next)) {
                items.add(next);
            }
        }

        if (getConfiguration().isIncludeProperties()) {
            ArrayList<Property> properties = new ArrayList<Property>();
            PropertyIterator propertyIterator = node.getProperties();
            while (propertyIterator.hasNext()) {
                final Property property = propertyIterator.nextProperty();
                if (!isJcrOrMgnlProperty(property)) {
                    properties.add(property);
                }
            }
            ItemNameComparator itemNameComparator = new ItemNameComparator();
            Collections.sort(properties, itemNameComparator);
            items.addAll(properties);
        }
    } catch (RepositoryException e) {
        handleRepositoryException(log, "Could not retrieve children", e);
    }

    return Collections.unmodifiableCollection(items);
}

From source file:de.xirp.mail.MailManager.java

/**
 * Returns the collection of// ww w .  j av  a2s .  co m
 * {@link de.xirp.mail.MailDescriptor}.
 * 
 * @return The mail descriptors.
 * @see de.xirp.mail.MailDescriptor
 */
public static Collection<MailDescriptor> getMailDescriptors() {
    try {
        return Collections.unmodifiableCollection((mailDescriptors.values()));
    } catch (NullPointerException e) {
        mailDescriptors = new HashMap<String, MailDescriptor>(0);
        return Collections.unmodifiableCollection(mailDescriptors.values());
    }
}

From source file:com.smartitengineering.cms.spi.impl.workspace.WorkspaceServiceImpl.java

@Override
public Collection<Workspace> getWorkspaces() {
    final List<PersistentWorkspace> list = commonReadDao.getList(SELF_PARAM,
            QueryParameterFactory.getStringLikePropertyParam("id", "", MatchMode.START));
    if (list == null || list.isEmpty()) {
        return Collections.emptyList();
    }/*w ww  .j  av  a2 s  .c  o m*/
    return Collections.unmodifiableCollection(
            adapter.convertInversely(list.toArray(new PersistentWorkspace[list.size()])));
}

From source file:com.netxforge.oss2.config.ThresholdingConfigFactory.java

/**
 * <p>getGroupNames</p>/*w w w  . ja v  a  2  s.com*/
 *
 * @return a {@link java.util.Collection} object.
 */
public Collection<String> getGroupNames() {
    return Collections.unmodifiableCollection(m_groupMap.keySet());
}

From source file:nl.salp.warcraft4j.casc.cdn.CdnCascContext.java

/**
 * Get all root entries.//w  ww  .j  a v a2  s  . co  m
 *
 * @return The root entries.
 */
public Collection<RootEntry> getRootEntries() {
    return Collections.unmodifiableCollection(getRootFile().getEntries());
}

From source file:com.haulmont.cuba.web.gui.components.WebPopupButton.java

@Override
public Collection<Action> getActions() {
    return Collections.unmodifiableCollection(actionOrder);
}

From source file:org.obiba.onyx.core.service.impl.DefaultActiveInterviewServiceImpl.java

public Collection<StageExecutionContext> getStageExecutionContexts(Participant participant) {
    return Collections.unmodifiableCollection(getStageContexts().values());
}