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:com.perceptive.epm.perkolcentral.dataaccessor.EmployeeDataAccessor.java

public LinkedHashMap<Long, EmployeeBO> getAllEmployees() throws ExceptionWrapper {
    LinkedHashMap<Long, EmployeeBO> employeeLinkedHashMap = new LinkedHashMap<Long, EmployeeBO>();
    Session session = hibernateTemplate.getSessionFactory().openSession();
    Transaction tx = session.beginTransaction();
    try {//  w ww.ja  v  a  2  s.co m

        Criteria criteria = session.createCriteria(Employee.class);
        criteria.add(Restrictions.eq("isActive", true));
        criteria.addOrder(Order.asc("employeeName"));

        for (Object item : criteria.list()) {
            Employee employee = (Employee) item;
            EmployeeBO employeeBO = new EmployeeBO(employee);

            for (Object obj : employee.getEmployeegroupmaps()) {
                Employeegroupmap employeegroupmap = (Employeegroupmap) obj;

                GroupBO groupBO = new GroupBO(employeegroupmap.getGroups());
                employeeBO.getGroups().add(groupBO);
            }
            //==================================================================================================================
            //Get the license info for the employee
            for (Object obj : employee.getEmployeelicensemappings()) {
                Employeelicensemapping employeelicensemapping = (Employeelicensemapping) obj;
                LicenseBO licenseBO = new LicenseBO(employeelicensemapping.getLicensemaster());
                employeeBO.getLicenses().add(licenseBO);
            }
            //==================================================================================================================
            //==================================================================================================================
            //Get the roles for the employee
            for (Employeerolemapping employeerolemapping : employee.getEmployeerolemappings()) {
                RoleBO roleBO = new RoleBO(employeerolemapping.getRolemaster());
                employeeBO.getRoles().add(roleBO);
            }
            //==================================================================================================================
            employeeLinkedHashMap.put(Long.valueOf(employee.getEmployeeId()), employeeBO);
        }

    } catch (Exception ex) {
        throw new ExceptionWrapper(ex);
    } finally {
        if (tx.isActive())
            tx.commit();
        if (session.isOpen())
            session.close();
    }
    return employeeLinkedHashMap;
}

From source file:com.dianping.wed.cache.redis.biz.WeddingRedisMonitorServiceImpl.java

@Override
public LinkedHashMap<String, String> info(String ipPort) {
    Jedis jedis = jedisFactory.getByIPPort(ipPort);
    if (jedis == null) {
        return null;
    }/* w w  w  .j ava 2  s. c o  m*/
    try {
        Object redisMacheInfo = jedis.eval("return redis.call(\"info\")");
        LinkedHashMap<String, String> infoMap = new LinkedHashMap<String, String>();
        if (redisMacheInfo != null) {
            String[] infoArray = redisMacheInfo.toString().split("\n");
            for (String inf : infoArray) {
                if (StringUtils.isEmpty(inf)) {
                    continue;
                }
                String[] kv = inf.split(":");
                if (kv.length != 2) {
                    continue;
                }
                //???
                infoMap.put(kv[0].replace("\r", "").replace("\n", ""),
                        kv[1].replace("\r", "").replace("\n", ""));
            }
        }
        return infoMap;
    } finally {
        jedis.close();
    }
}

From source file:com.consol.citrus.selenium.xml.SetInputActionParser.java

/**
 * @param element/* ww w  .ja v a 2 s. c o  m*/
 * @param parserContext
 * @return
 */
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
    actionClass = SetInputAction.class;
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(actionClass);
    this.doParse(element, builder);

    Map<By, String> fields = new LinkedHashMap<>();
    List<Element> fieldElements = DomUtils.getChildElementsByTagName(element, "field");
    for (Element fieldElement : fieldElements) {
        String value = fieldElement.getAttribute("value");
        By by = getByFromElement(fieldElement);
        fields.put(by, value);
    }
    builder.addPropertyValue("fields", fields);

    return builder.getBeanDefinition();
}

From source file:com.rockhoppertech.music.DurationParser.java

public static void useDefaultDurationMap() {
    durKeyMap = new LinkedHashMap<String, Double>();
    durKeyMap.put("dt", Duration.DOUBLE_WHOLE_TRIPLET_NOTE);
    durKeyMap.put("d", Duration.DOUBLE_WHOLE_NOTE);
    durKeyMap.put("wt", Duration.WHOLE_TRIPLET_NOTE);
    durKeyMap.put("w", Duration.WHOLE_NOTE);
    durKeyMap.put("ht", Duration.HALF_TRIPLET_NOTE);
    durKeyMap.put("h", Duration.HALF_NOTE);
    durKeyMap.put("qt", Duration.QUARTER_TRIPLET_NOTE);
    durKeyMap.put("q", Duration.QUARTER_NOTE);
    durKeyMap.put("et", Duration.EIGHTH_TRIPLET_NOTE);
    durKeyMap.put("e", Duration.EIGHTH_NOTE);
    durKeyMap.put("st", Duration.SIXTEENTH_TRIPLET_NOTE);
    durKeyMap.put("s", Duration.SIXTEENTH_NOTE);
    durKeyMap.put("tt", Duration.THIRTY_SECOND_TRIPLET_NOTE);
    durKeyMap.put("t", Duration.THIRTY_SECOND_NOTE);
    durKeyMap.put("xt", Duration.SIXTY_FOURTH_TRIPLET_NOTE);
    durKeyMap.put("x", Duration.SIXTY_FOURTH_NOTE);
    durKeyMap.put("ot", Duration.ONE_TWENTY_EIGHTH_TRIPLET_NOTE);
    durKeyMap.put("o", Duration.ONE_TWENTY_EIGHTH_NOTE);
}

From source file:org.thymeleaf.engine21spring31.requestdata.processor.TestRequestDataValueProcessor.java

public Map<String, String> getExtraHiddenFields(HttpServletRequest request) {
    final Map<String, String> map = new LinkedHashMap<String, String>();
    map.put("extra-field1", "The value of the First Extra field");
    map.put("extra-field2", "The value of the Second Extra field");
    return map;//  www .  j a va  2  s  .co  m
}

From source file:com.janrain.oauth2.AuthorizationRequest.java

public AuthorizationRequest(String cookie, Map parameterMap) throws SimpleDBException {
    Map<String, String> data = new LinkedHashMap<String, String>();
    for (Field f : EnumSet.allOf(Field.class)) {
        Object value = parameterMap.get(f.getFieldName().toLowerCase());
        if (value != null && ((String[]) value).length > 0 && StringUtils.isNotEmpty(((String[]) value)[0])) {
            data.put(f.getFieldName(), ((String[]) value)[0]);
        }/*from  w  w w  .jav a  2s . c om*/
    }
    data.put(Field.COOKIE.getFieldName(), cookie);
    data.put(Field.EXPIRES.getFieldName(), DateTimeUtils.ISO8601.get()
            .format(new Date(System.currentTimeMillis() + AUTH_REQUEST_TIMEOUT_SECONDS * 1000)));
    super.init(cookie, data);
}

From source file:com.github.horrorho.liquiddonkey.settings.commandline.CommandLineOptions.java

static LinkedHashMap<Property, Option> propertyToOption(String itemTypes) {
    LinkedHashMap<Property, Option> options = new LinkedHashMap<>();

    options.put(FILE_OUTPUT_DIRECTORY, new Option("o", "output", true, "Output folder."));

    options.put(FILE_COMBINED,//from w  ww  .  ja v  a  2 s .  c o  m
            new Option("c", "combined", false, "Do not separate each snapshot into its own folder."));

    options.put(SELECTION_UDID,
            Option.builder("u").longOpt("udid")
                    .desc("Download the backup/s with the specified UDID/s. "
                            + "Will match partial UDIDs. Leave empty to download all.")
                    .argName("hex").hasArgs().optionalArg(true).build());

    options.put(SELECTION_SNAPSHOT, Option.builder("s").longOpt("snapshot")
            .desc("Only download data in the snapshot/s specified.\n"
                    + "Negative numbers indicate relative positions from newest backup "
                    + "with -1 being the newest, -2 second newest, etc.")
            .argName("int").hasArgs().build());

    options.put(FILTER_ITEM_TYPES,
            Option.builder(null).longOpt("item-types")
                    .desc("Only download the specified item type/s:\n" + itemTypes).argName("item_type")
                    .hasArgs().build());

    options.put(FILTER_DOMAIN,
            Option.builder("d").longOpt("domain")
                    .desc("Limit files to those within the specified application domain/s.").argName("str")
                    .hasArgs().build());

    options.put(FILTER_RELATIVE_PATH, Option.builder("r").longOpt("relative-path")
            .desc("Limit files to those with the specified relative path/s").argName("str").hasArgs().build());

    options.put(FILTER_EXTENSION, Option.builder("e").longOpt("extension")
            .desc("Limit files to those with the specified extension/s.").argName("str").hasArgs().build());

    options.put(FILTER_DATE_MIN,
            Option.builder().longOpt("min-date")
                    .desc("Minimum last-modified timestamp, ISO format date. E.g. 2000-12-31.").argName("date")
                    .hasArgs().build());

    options.put(FILTER_DATE_MAX,
            Option.builder().longOpt("max-date")
                    .desc("Maximum last-modified timestamp, ISO format date. E.g. 2000-12-31.").argName("date")
                    .hasArgs().build());

    options.put(FILTER_SIZE_MIN, Option.builder().longOpt("min-size").desc("Minimum size in kilobytes.")
            .argName("Kb").hasArgs().build());

    options.put(FILTER_SIZE_MAX, Option.builder().longOpt("max-size").desc("Maximum size in kilobytes.")
            .argName("Kb").hasArgs().build());

    options.put(ENGINE_FORCE_OVERWRITE,
            new Option("f", "force", false, "Download files regardless of whether a local version exists."));

    options.put(ENGINE_PERSISTENT, new Option("p", "persistent", false,
            "More persistent in the handling of network errors, for unstable connections."));

    options.put(ENGINE_AGGRESSIVE, new Option("a", "aggressive", false, "Aggressive retrieval tactics."));

    options.put(ENGINE_THREAD_COUNT, Option.builder("t").longOpt("threads")
            .desc("The maximum number of concurrent threads.").argName("int").hasArgs().build());

    options.put(HTTP_RELAX_SSL,
            new Option(null, "relax-ssl", false, "Relaxed SSL verification, for SSL validation errors."));

    options.put(DEBUG_REPORT, new Option("w", "report", false, "Write out rudimentary reports."));

    options.put(DEBUG_PRINT_STACK_TRACE,
            new Option("x", "stack-trace", false, "Print stack trace on errors, useful for debugging."));

    options.put(ENGINE_DUMP_TOKEN, new Option(null, "token", false, "Output authentication token and exit."));

    options.put(COMMAND_LINE_HELP, new Option(null, "help", false, "Display this help and exit."));

    options.put(COMMAND_LINE_VERSION,
            new Option(null, "version", false, "Output version information and exit."));

    //        options.put(FILE_FLAT,
    //                new Option("i", "--itunes-style", false, "Download files to iTunes style format."));
    return options;
}

From source file:ch.algotrader.config.spring.ConfigLoader.java

public static Map<String, String> loadResources(final Resource... resources) throws IOException {

    // Load common and core parameters
    Map<String, String> paramMap = new LinkedHashMap<>();
    for (Resource resource : resources) {
        loadResource(paramMap, resource);
    }//from www.j  a v  a  2  s.  co  m
    return paramMap;
}

From source file:com.tdclighthouse.commons.simpleform.html.FormItemGroup.java

FormItemGroup(String groupName, String groupLabel, FormItemGroup parent, GroupType groupType) {
    this.items = new LinkedHashMap<String, FormItem>();
    this.subgroups = new LinkedHashMap<String, FormItemGroup>();
    this.parent = parent;
    this.name = groupName;
    this.label = groupLabel;
    this.groupType = groupType;
}

From source file:org.gitana.platform.client.node.type.TypeDefinitionImpl.java

private Map<String, HasFormAssociation> _convert(Map<String, Association> map) {
    Map<String, HasFormAssociation> converted = new LinkedHashMap<String, HasFormAssociation>();
    for (Association association : map.values()) {
        converted.put(association.getId(), (HasFormAssociation) association);
    }/* w  w  w .ja va2s .c o m*/

    return converted;
}