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:amfservices.actions.PGServicesAction.java

public Map<String, Object> deleteUserAction(String uid, String adminPassword) {
    String md5Pass = DigestUtils.md5Hex(adminPassword);
    PGException.Assert(PGConfig.inst().temp().SystemPasswordMD5().equals(md5Pass),
            PGError.INVALID_SIGNED_REQUEST, "Invalid password");

    try {/* ww  w  .  j  a  va 2  s.  c o  m*/
        UserServices.inst().destroyUser(uid);
    } catch (Exception ex) {
        PGException.pgThrow(ex);
    }

    return Collections.EMPTY_MAP;
}

From source file:amfservices.actions.PGServicesAction.java

public Map<String, Object> addGameMessagesAction(List<Map<String, Object>> data, long now) {
    String[] msgIDs = new String[data.size()];
    int i = 0;//from  ww  w.  java  2s  .co m
    for (Map<String, Object> msgData : data) {
        String content = (String) msgData.get("content");
        int order = PGHelper.toInteger(msgData.get("order"));
        int expire = PGHelper.toInteger(msgData.get("expire"));

        String msgID = PGKeys.randomKey();
        GameMessage.newMsg(msgID, content, order, expire);
        msgIDs[i++] = msgID;
    }

    GameMessageList.getMessages().add(msgIDs);

    return Collections.EMPTY_MAP;
}

From source file:amfservices.actions.PGServicesAction.java

public Map<String, Object> disableGameMessagesAction(List<String> msgIDs, long now) {
    for (String msgID : msgIDs) {
        if (GameMessage.isExist(msgID)) {
            GameMessage gm = GameMessage.getMsg(msgID);
            gm.setEnable(false);//from   w w w.  j  ava 2 s  .  c o m
            gm.saveToDB();
        }
    }

    return Collections.EMPTY_MAP;
}

From source file:org.apache.axiom.om.impl.SwitchingWrapper.java

private Map getAllNamespaces(OMSerializable contextNode) {
    if (contextNode == null) {
        return Collections.EMPTY_MAP;
    }//from   ww w . j a  v a 2  s  . c o  m
    OMContainer context;
    if (contextNode instanceof OMContainer) {
        context = (OMContainer) contextNode;
    } else {
        context = ((OMNode) contextNode).getParent();
    }
    Map nsMap = new LinkedHashMap();
    while (context != null && !(context instanceof OMDocument)) {
        OMElement element = (OMElement) context;
        Iterator i = element.getAllDeclaredNamespaces();
        while (i != null && i.hasNext()) {
            addNamespaceToMap((OMNamespace) i.next(), nsMap);
        }
        if (element.getNamespace() != null) {
            addNamespaceToMap(element.getNamespace(), nsMap);
        }
        for (Iterator iter = element.getAllAttributes(); iter != null && iter.hasNext();) {
            OMAttribute attr = (OMAttribute) iter.next();
            if (attr.getNamespace() != null) {
                addNamespaceToMap(attr.getNamespace(), nsMap);
            }
        }
        context = element.getParent();
    }
    return nsMap;
}

From source file:org.apache.openjpa.meta.FieldMetaData.java

/**
 * Parse external values into maps.//from   w  ww . ja v  a 2s.c om
 */
private void parseExternalValues() {
    if (_extValues != Collections.EMPTY_MAP && _fieldValues != Collections.EMPTY_MAP)
        return;

    if (_extString == null) {
        _extValues = null;
        _fieldValues = null;
        return;
    }

    // parse string into options; this takes care of proper trimming etc
    Options values = Configurations.parseProperties(_extString);
    if (values.isEmpty())
        throw new MetaDataException(_loc.get("no-external-values", this, _extString));

    Map extValues = new HashMap((int) (values.size() * 1.33 + 1));
    Map fieldValues = new HashMap((int) (values.size() * 1.33 + 1));
    Map.Entry entry;
    Object extValue, fieldValue;
    for (Iterator itr = values.entrySet().iterator(); itr.hasNext();) {
        entry = (Map.Entry) itr.next();
        fieldValue = transform((String) entry.getKey(), getDeclaredTypeCode());
        extValue = transform((String) entry.getValue(), getTypeCode());

        extValues.put(fieldValue, extValue);
        fieldValues.put(extValue, fieldValue);
    }

    _extValues = extValues;
    _fieldValues = fieldValues;
}

From source file:cc.tooyoung.common.db.JdbcTemplate.java

/**
 * Process the given ResultSet from a stored procedure.
 * @param rs the ResultSet to process//from  w ww .j av  a 2 s .com
 * @param param the corresponding stored procedure parameter
 * @return Map that contains returned results
 */
@SuppressWarnings("unchecked")
protected Map processResultSet(ResultSet rs, ResultSetSupportingSqlParameter param) throws SQLException {
    if (rs == null) {
        return Collections.EMPTY_MAP;
    }
    Map returnedResults = new HashMap();
    try {
        ResultSet rsToUse = rs;
        if (this.nativeJdbcExtractor != null) {
            rsToUse = this.nativeJdbcExtractor.getNativeResultSet(rs);
        }
        if (param.getRowMapper() != null) {
            RowMapper rowMapper = param.getRowMapper();
            Object result = (new RowMapperResultSetExtractor(rowMapper)).extractData(rsToUse);
            returnedResults.put(param.getName(), result);
        } else if (param.getRowCallbackHandler() != null) {
            RowCallbackHandler rch = param.getRowCallbackHandler();
            (new RowCallbackHandlerResultSetExtractor(rch)).extractData(rsToUse);
            returnedResults.put(param.getName(), "ResultSet returned from stored procedure was processed");
        } else if (param.getResultSetExtractor() != null) {
            Object result = param.getResultSetExtractor().extractData(rsToUse);
            returnedResults.put(param.getName(), result);
        }
    } finally {
        JdbcUtils.closeResultSet(rs);
    }
    return returnedResults;
}

From source file:org.apache.solr.servlet.HttpSolrCall.java

protected Map<String, JsonSchemaValidator> getValidators() {
    return Collections.EMPTY_MAP;
}

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

public String[] getDataStoreActions(Map params) {
    if (params == null)
        params = Collections.EMPTY_MAP;

    lock();//from   ww  w . jav  a  2s  . co m
    try {
        assertNotSerialized();
        assertOpen();

        StoreQuery.Executor ex = compileForExecutor();
        assertParameters(_storeQuery, ex, params);
        Object[] arr = ex.toParameterArray(_storeQuery, params);
        StoreQuery.Range range = new StoreQuery.Range(_startIdx, _endIdx);
        if (!_rangeSet)
            ex.getRange(_storeQuery, arr, range);
        return ex.getDataStoreActions(_storeQuery, arr, range);
    } catch (OpenJPAException ke) {
        throw ke;
    } catch (Exception e) {
        throw new UserException(e);
    } finally {
        unlock();
    }
}

From source file:com.redhat.rhn.manager.system.SystemManager.java

/**
 * Returns the list of activation keys used when the system was
 * registered./*from  ww w . java 2  s.c o m*/
 * @param serverIn the server to query for
 * @return list of ActivationKeyDto containing the token id and name
 */
public static DataResult<ActivationKeyDto> getActivationKeys(Server serverIn) {

    SelectMode m = ModeFactory.getMode("General_queries", "activation_keys_for_server");
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("server_id", serverIn.getId());
    return makeDataResult(params, Collections.EMPTY_MAP, null, m, ActivationKeyDto.class);
}

From source file:org.apache.ode.bpel.engine.BpelRuntimeContextImpl.java

/**
 * We record all values of properties of a 'MessageType' variable for
 * efficient lookup.//w  w w .  ja  va2 s . c om
 */
private void writeProperties(VariableInstance variable, Node value, XmlDataDAO dao) {
    if (variable.declaration.type instanceof OMessageVarType) {
        for (OProcess.OProperty property : variable.declaration.getOwner().properties) {
            OProcess.OPropertyAlias alias = property.getAlias(variable.declaration.type);
            if (alias != null) {
                try {
                    String val = _bpelProcess.extractProperty((Element) value, Collections.EMPTY_MAP, alias,
                            variable.declaration.getDescription());
                    if (val != null) {
                        dao.setProperty(property.name.toString(), val);
                    }
                } catch (FaultException e) {
                    // This will fail as we're basically trying to extract properties on all
                    // received messages for optimization purposes.
                    if (__log.isWarnEnabled())
                        __log.warn("Couldn't extract property '" + property.toString() + "' and variable "
                                + variable.declaration + debugInfoToString(variable.declaration.debugInfo)
                                + " in property pre-extraction: " + e.toString());
                }
            }
        }
    }
}