Example usage for java.util LinkedHashMap LinkedHashMap

List of usage examples for java.util LinkedHashMap LinkedHashMap

Introduction

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

Prototype

public LinkedHashMap() 

Source Link

Document

Constructs an empty insertion-ordered LinkedHashMap instance with the default initial capacity (16) and load factor (0.75).

Usage

From source file:br.com.catbag.gifreduxsample.models.AppState.java

@Value.Default
public Map<String, Gif> getGifs() {
    return new LinkedHashMap<>();
}

From source file:com.thoughtworks.go.plugin.access.common.handler.JSONResultMessageHandler.java

public Map configurationToMap(Configuration configuration) {
    Map configuredValuesForRepo = new LinkedHashMap();
    for (Property property : configuration.list()) {
        Map map = new LinkedHashMap();
        map.put("value", property.getValue());
        configuredValuesForRepo.put(property.getKey(), map);
    }//from  w  ww .ja va  2 s . c o  m
    return configuredValuesForRepo;
}

From source file:ca.sfu.federation.utils.IContextUtils.java

public static Map<String, INamed> getElementMap(List<INamed> Elements) {
    LinkedHashMap<String, INamed> map = new LinkedHashMap<String, INamed>();
    Iterator e = Elements.iterator();
    while (e.hasNext()) {
        INamed named = (INamed) e.next();
        map.put(named.getName(), named);
    }/*from   w w w. j av a  2 s.c o m*/
    return map;
}

From source file:com.mirth.connect.client.ui.editors.ScriptPanel.java

@Override
public Map<Object, Object> getData() {
    Map<Object, Object> m = new LinkedHashMap<Object, Object>();
    m.put("Script", scriptTextPane.getText().trim());
    return m;/*from   w  w w  .j ava2s . c  om*/
}

From source file:de.vandermeer.skb.base.utils.Skb_STUtils.java

/**
 * Returns a map of missing templates and/or missing arguments of templates.
 * In detail, the given chunk list is tested against all templates of the template group and missing templates and/or
 * missing arguments of a template are returned.
 * @param stg template group to be tested
 * @param expectedChunks expected arguments - map key is the expected template name and the associated list are the expected arguments
 * @return empty map if nothing is missing, non-empty map otherwise. If the map is not empty, then a mapping of a string to null
 *         indicates that the template did not exist at all while a mapping of a string to a list indicates that the template
 *         did exist but the arguments noted in the list were missing.
 *///from  w w  w  .  j  a v  a2s.  c o  m
public static final Map<String, List<String>> getMissingChunks(STGroup stg,
        Map<String, List<String>> expectedChunks) {
    if (stg == null || expectedChunks == null) {
        return null;
    }

    Map<String, List<String>> ret = new LinkedHashMap<String, List<String>>();
    for (String s : expectedChunks.keySet()) {
        if (s != null && !"".equals(s)) { //null and "" are no valid templates, so we ignore them
            if (stg.isDefined(s)) {
                List<String> missingArgs = Skb_STUtils.getMissingSTArguments(stg.getInstanceOf(s),
                        expectedChunks.get(s));
                if (missingArgs != null && missingArgs.size() > 0) {
                    ret.put(s, missingArgs);
                }
            } else {
                ret.put(s, null);
            }
        }
    }
    return ret;
}

From source file:models.security.SecurityRole.java

public static Map<String, String> options() {
    @SuppressWarnings("unchecked")
    final List<SecurityRole> securityRoles = find.findList();
    final LinkedHashMap<String, String> options = new LinkedHashMap<String, String>();
    for (final SecurityRole securityRole : securityRoles) {
        options.put(securityRole.id.toString(), securityRole.roleName);
    }/*from   ww  w . j  av a2  s .c  o m*/
    return options;
}

From source file:com.dianping.maven.plugin.tools.misc.file.ProjectMetaGenerator.java

@Override
protected Object getArgs(ProjectMetaContext context) throws Exception {
    Map<String, Integer> projectPortMapping = new LinkedHashMap<String, Integer>();

    Class.forName(context.getDriverClass());

    Connection conn = null;//from  w w w. j a  v a  2s  . c o  m
    Statement stmt = null;
    try {
        if (StringUtils.isNotBlank(context.getUser())) {
            conn = DriverManager.getConnection(context.getUrl(), context.getUser(), context.getPwd());
        } else {
            conn = DriverManager.getConnection(context.getUrl());
        }
        stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery(
                "SELECT DISTINCT p.id AS id, p.name AS project, j.port1 AS port FROM jrobin_host j, project p WHERE j.projectId=p.id AND j.port1 IS NOT NULL ORDER BY port ASC");
        while (rs.next()) {
            String project = rs.getString("project");
            int port = rs.getInt("port");
            if (StringUtils.isNotBlank(project)) {
                projectPortMapping.put(project, port);
            }
        }
    } finally {
        if (stmt != null) {
            try {
                stmt.close();
            } catch (Exception e) {

            }
        }
        if (conn != null) {
            try {
                conn.close();
            } catch (Exception e) {

            }
        }
    }

    return projectPortMapping;

}

From source file:com.mirth.connect.plugins.datatypes.xml.XMLBatchProperties.java

@Override
public Map<String, DataTypePropertyDescriptor> getPropertyDescriptors() {
    Map<String, DataTypePropertyDescriptor> properties = new LinkedHashMap<String, DataTypePropertyDescriptor>();

    properties.put("splitType", new DataTypePropertyDescriptor(splitType, "Split Batch By",
            "Select the method for splitting the batch message.  This option has no effect unless Process Batch Files is enabled in the connector.\n\nElement Name: Use the element name to split messages. Does not work with namespaces.\n\nLevel: Use the element level to split messages.\n\nXPath Query: Use a custom XPath Query to split messages.\n\nJavaScript: Use JavaScript to split messages.",
            PropertyEditorType.OPTION, SplitType.values()));
    properties.put("elementName", new DataTypePropertyDescriptor(elementName, "Element Name",
            "Each element with this name will split into its own message.", PropertyEditorType.STRING));
    properties.put("level", new DataTypePropertyDescriptor(Integer.toString(level), "Level",
            "Each element at this level will be split into its own message. The root element is at level 0.",
            PropertyEditorType.STRING));
    properties.put("query",
            new DataTypePropertyDescriptor(query, "XPath Query",
                    "Each element found with the XPath Query will be split into its own message.",
                    PropertyEditorType.STRING));
    properties.put("batchScript", new DataTypePropertyDescriptor(batchScript, "JavaScript",
            "Enter JavaScript that splits the batch, and returns the next message.  This script has access to 'reader', a Java BufferedReader, to read the incoming data stream.  The script must return a string containing the next message, or a null/empty string to indicate end of input.  This option has no effect unless Process Batch is enabled in the connector.",
            PropertyEditorType.JAVASCRIPT));

    return properties;
}

From source file:com.mirth.connect.connectors.jms.JmsConnectorProperties.java

protected JmsConnectorProperties() {
    useJndi = false;/*from   w ww  .  j a v  a  2 s  .c  o  m*/
    jndiProviderUrl = "";
    jndiInitialContextFactory = "";
    jndiConnectionFactoryName = "";
    connectionFactoryClass = "";
    connectionProperties = new LinkedHashMap<String, String>();
    username = "";
    password = "";
    destinationName = "";
    topic = false;
    clientId = "";
}

From source file:com.sugaronrest.restapicalls.methodcalls.GetAvailableModules.java

/**
 *  Gets available module names [SugarCRM REST method - get_available_modules].
 *
 * @param url REST API Url./*ww  w . ja va  2  s .  c  om*/
 * @param sessionId Session identifier.
 * @return ReadAvailableModulesResponse object.
 * @throws Exception
 */
public static ReadAvailableModulesResponse run(String url, String sessionId) throws Exception {

    ReadAvailableModulesResponse readAvailableModulesResponse = new ReadAvailableModulesResponse();
    ErrorResponse errorResponse = null;

    ObjectMapper mapper = JsonObjectMapper.getMapper();
    String jsonRequest = new String();
    String jsonResponse = new String();

    try {
        Map<String, Object> requestData = new LinkedHashMap<String, Object>();
        requestData.put("session", sessionId);
        requestData.put("filter", "all");

        String jsonRequestData = mapper.writeValueAsString(requestData);

        Map<String, Object> request = new LinkedHashMap<String, Object>();
        request.put("method", "get_available_modules");
        request.put("input_type", "json");
        request.put("response_type", "json");
        request.put("rest_data", requestData);

        jsonRequest = mapper.writeValueAsString(request);

        request.put("rest_data", jsonRequestData);

        HttpResponse response = Unirest.post(url).fields(request).asJson();

        if (response == null) {
            readAvailableModulesResponse = new ReadAvailableModulesResponse();
            errorResponse = ErrorResponse.format("An error has occurred!", "No data returned.");
            readAvailableModulesResponse.setStatusCode(HttpStatus.SC_BAD_REQUEST);
            readAvailableModulesResponse.setError(errorResponse);
        } else {

            jsonResponse = response.getBody().toString();

            if (StringUtils.isNotBlank(jsonResponse)) {
                // First check if we have an error
                errorResponse = ErrorResponse.fromJson(jsonResponse);
                if (errorResponse == null) {
                    readAvailableModulesResponse = mapper.readValue(jsonResponse,
                            ReadAvailableModulesResponse.class);
                }
            }

            if (readAvailableModulesResponse == null) {
                readAvailableModulesResponse = new ReadAvailableModulesResponse();
                readAvailableModulesResponse.setError(errorResponse);

                readAvailableModulesResponse.setStatusCode(HttpStatus.SC_OK);
                if (errorResponse != null) {
                    readAvailableModulesResponse.setStatusCode(errorResponse.getStatusCode());
                }
            } else {
                readAvailableModulesResponse.setStatusCode(HttpStatus.SC_OK);
            }
        }
    } catch (Exception exception) {
        readAvailableModulesResponse = new ReadAvailableModulesResponse();
        errorResponse = ErrorResponse.format(exception, exception.getMessage());
        readAvailableModulesResponse.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);
        errorResponse.setStatusCode(HttpStatus.SC_INTERNAL_SERVER_ERROR);
        readAvailableModulesResponse.setError(errorResponse);
    }

    readAvailableModulesResponse.setJsonRawRequest(jsonRequest);
    readAvailableModulesResponse.setJsonRawResponse(jsonResponse);

    return readAvailableModulesResponse;
}