Example usage for java.util Collections EMPTY_MAP

List of usage examples for java.util Collections EMPTY_MAP

Introduction

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

Prototype

Map EMPTY_MAP

To view the source code for java.util Collections EMPTY_MAP.

Click Source Link

Document

The empty map (immutable).

Usage

From source file:com.jaspersoft.jasperserver.war.action.ViewReportAction.java

protected Map<String, String[]> getInputControlsState(RequestContext context) {
    return (Map<String, String[]>) context.getFlowScope().get(getAttributeSavedInputsState(), Map.class,
            Collections.EMPTY_MAP);
}

From source file:com.redhat.rhn.domain.kickstart.KickstartFactory.java

/**
 * list all kickstart trees stored in the satellite
 * @return list of kickstart trees//from ww  w .j a v a  2s  .c  o  m
 */
public static List<KickstartableTree> lookupKickstartTrees() {
    Session session = null;
    List retval = null;
    String query = "KickstartableTree.findAll";
    return singleton.listObjectsByNamedQuery(query, Collections.EMPTY_MAP, false);
}

From source file:org.apache.openjpa.kernel.QueryImpl.java

private Object execute(int operation, Map params) {
    if (params == null)
        params = Collections.EMPTY_MAP;

    lock();//  w  w  w .  j  av  a2s .  co  m
    try {
        _broker.beginOperation(true);
        try {
            assertNotSerialized();
            assertOpen();
            _broker.assertNontransactionalRead();

            // get executor
            Compilation comp = compileForCompilation();
            StoreQuery.Executor ex = (isInMemory(operation)) ? compileForInMemory(comp)
                    : compileForDataStore(comp);

            assertParameters(_storeQuery, ex, params);
            Object[] arr = (params.isEmpty()) ? StoreQuery.EMPTY_OBJECTS
                    : ex.toParameterArray(_storeQuery, params);
            if (_log.isTraceEnabled())
                logExecution(operation, params);

            if (operation == OP_SELECT)
                return execute(_storeQuery, ex, arr);
            if (operation == OP_DELETE)
                return delete(_storeQuery, ex, arr);
            if (operation == OP_UPDATE)
                return update(_storeQuery, ex, arr);
            throw new UnsupportedException();
        } catch (OpenJPAException ke) {
            throw ke;
        } catch (Exception e) {
            throw new UserException(_loc.get("query-execution-error", _query), e);
        } finally {
            _broker.endOperation();
        }
    } finally {
        unlock();
    }
}

From source file:br.msf.commons.util.CollectionUtils.java

public static Map<String, String> getSystemProps() {
    try {/*  w  ww .  j a v a2s. co m*/
        final Properties props = System.getProperties();
        final Map<String, String> map = new LinkedHashMap<>();
        for (Entry<Object, Object> entry : props.entrySet()) {
            map.put(entry.getKey().toString(), entry.getValue().toString());
        }
        return map;
    } catch (SecurityException ex) {
        LOGGER.log(Level.WARNING, "Could not use System Properties.", ex);
        return Collections.EMPTY_MAP;
    }
}

From source file:br.ojimarcius.commons.util.CollectionUtils.java

public static Map<String, String> getSystemProps() {
    try {//from www.  j a va  2 s  .  c o  m
        final Properties props = System.getProperties();
        final Map<String, String> map = new LinkedHashMap<String, String>();
        for (Entry<Object, Object> entry : props.entrySet()) {
            map.put(entry.getKey().toString(), entry.getValue().toString());
        }
        return map;
    } catch (SecurityException ex) {
        LOGGER.log(Level.WARNING, "Could not use System Properties.", ex);
        return Collections.EMPTY_MAP;
    }
}

From source file:de.betterform.xml.xforms.Container.java

/**
 * todo:prefixMapping for Host document needed
 *
 * @param baseURI/*from w  w  w . j av  a2  s .c om*/
 * @return
 */
public BetterFormXPathContext getHostContext(String baseURI) {
    //lazy instanciation of BetterFormContext
    if (this.hostContext == null) {
        List nodes = de.betterform.xml.xpath.impl.saxon.XPathUtil.getRootContext(document, baseURI);
        this.hostContext = new BetterFormXPathContext(nodes, 1, Collections.EMPTY_MAP, null);
    }
    return this.hostContext;
}

From source file:org.andromda.cartridges.gui.metafacades.GuiActionLogicImpl.java

/**
 * Collects specific messages in a map./* w  w w . j ava2 s .c o  m*/
 * 
 * @param taggedValue the tagged value from which to read the message
 * @return maps message keys to message values, but only those that match the arguments
 * will have been recorded
 */
private Map<String, String> getMessages(final String taggedValue) {

    Map<String, String> messages;

    final Collection<Object> taggedValues = this.findTaggedValues(taggedValue);

    if (taggedValues.isEmpty()) {

        messages = Collections.EMPTY_MAP;

    } else {

        messages = new LinkedHashMap<String, String>(); // we want to keep the order

        for (final Object tag : taggedValues) {

            final String value = (String) tag;

            messages.put(StringUtilsHelper.toResourceMessageKey(value), value);

        }

    }

    return messages;

}

From source file:ddf.catalog.source.solr.SolrMetacardClientImpl.java

protected String setSortProperty(QueryRequest request, SolrQuery query, SolrFilterDelegate solrFilterDelegate) {

    List<SortBy> sortBys = new ArrayList<>();
    String sortProperty = "";
    if (request.getQuery() != null) {
        SortBy querySortBy = request.getQuery().getSortBy();
        if (querySortBy != null && querySortBy.getPropertyName() != null) {
            sortBys.add(querySortBy);/*from ww w . j ava2  s. c o  m*/
        }
    }

    Serializable sortBySer = request.getPropertyValue(ADDITIONAL_SORT_BYS);
    if (sortBySer instanceof SortBy[]) {
        SortBy[] extSortBys = (SortBy[]) sortBySer;
        if (extSortBys.length > 0) {
            sortBys.addAll(Arrays.asList(extSortBys));
        }
    }

    for (SortBy sortBy : sortBys) {
        sortProperty = sortBy.getPropertyName().getPropertyName();
        SolrQuery.ORDER order = SolrQuery.ORDER.desc;

        if (sortBy.getSortOrder() == SortOrder.ASCENDING) {
            order = SolrQuery.ORDER.asc;
        }

        query.setFields("*", RELEVANCE_SORT_FIELD);

        if (Result.RELEVANCE.equals(sortProperty)) {
            query.addSort(RELEVANCE_SORT_FIELD, order);
        } else if (Result.DISTANCE.equals(sortProperty)) {
            addDistanceSort(query, resolver.getSortKey(GEOMETRY_FIELD), order, solrFilterDelegate);
        } else if (sortProperty.equals(Result.TEMPORAL)) {
            query.addSort(resolver.getSortKey(resolver.getField(Metacard.EFFECTIVE,
                    AttributeType.AttributeFormat.DATE, false, Collections.EMPTY_MAP)), order);
        } else {
            List<String> resolvedProperties = resolver.getAnonymousField(sortProperty);

            if (!resolvedProperties.isEmpty()) {
                for (String sortField : resolvedProperties) {
                    if (sortField.endsWith(SchemaFields.GEO_SUFFIX)) {
                        addDistanceSort(query, resolver.getSortKey(sortField), order, solrFilterDelegate);
                    } else if (!(sortField.endsWith(SchemaFields.BINARY_SUFFIX)
                            || sortField.endsWith(SchemaFields.OBJECT_SUFFIX))) {
                        query.addSort(resolver.getSortKey(sortField), order);
                    }
                }
            } else {
                LOGGER.debug(
                        "No schema field was found for sort property [{}]. No sort field was added to the query.",
                        sortProperty);
            }
        }
    }
    return resolver.getSortKey(sortProperty);
}

From source file:com.redhat.rhn.manager.errata.ErrataManager.java

/**
 * Returns the systems affected by a given errata
 *
 * @param user Logged-in user.//  www  .j a va 2s . c  om
 * @param serverGroup Server group.
 * @param erratum Errata ID.
 * @param pc PageControl
 * @return systems Affected by current errata, that are in serverGroup.
 */
public static DataResult<SystemOverview> systemsAffected(User user, ManagedServerGroup serverGroup,
        Errata erratum, PageControl pc) {
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("eid", erratum.getId());
    params.put("user_id", user.getId());
    params.put("sgid", serverGroup.getId());
    return makeDataResult(params, Collections.EMPTY_MAP, pc,
            ModeFactory.getMode("Errata_queries", "in_group_and_affected_by_errata"));
}

From source file:com.redhat.rhn.manager.user.UserManager.java

/**
 * Returns visible Systems as a SystemSearchResult Object
 * @param user the user we want/*from  w  w w.j  a  v  a 2s  . c  o m*/
 * @param ids the list of desired system ids
 * @return DataResult of systems
 */
public static DataResult<SystemSearchResult> visibleSystemsAsDtoFromList(User user, List<Long> ids) {

    SelectMode m = ModeFactory.getMode("System_queries", "visible_to_user_from_sysid_list");
    DataResult<SystemSearchResult> dr = null;

    int batchSize = 500;
    for (int batch = 0; batch < ids.size(); batch = batch + batchSize) {
        int toIndex = batch + batchSize;
        if (toIndex > ids.size()) {
            toIndex = ids.size();
        }
        Map params = new HashMap();
        params.put("user_id", user.getId());
        DataResult partial = m.execute(params, ids.subList(batch, toIndex));
        partial.setElaborationParams(Collections.EMPTY_MAP);
        if (dr == null) {
            dr = partial;
        } else {
            dr.addAll(partial);
        }
    }
    return dr;
}