Example usage for java.util LinkedHashMap put

List of usage examples for java.util LinkedHashMap put

Introduction

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

Prototype

V put(K key, V value);

Source Link

Document

Associates the specified value with the specified key in this map (optional operation).

Usage

From source file:com.intel.iotkitlib.LibModules.ComponentTypesCatalog.ComponentTypesCatalog.java

public boolean listComponentTypeDetails(String componentId) {
    //initiating get for component type details
    HttpGetTask componentTypeDetails = new HttpGetTask(new HttpTaskHandler() {
        @Override/* w ww .j a  v  a  2s  . c om*/
        public void taskResponse(int responseCode, String response) {
            Log.d(TAG, String.valueOf(responseCode));
            Log.d(TAG, response);
            statusHandler.readResponse(responseCode, response);
        }
    });
    componentTypeDetails.setHeaders(basicHeaderList);
    LinkedHashMap<String, String> linkedHashMap = new LinkedHashMap<String, String>();
    linkedHashMap.put("cmp_catalog_id", componentId);
    String url = objIotKit.prepareUrl(objIotKit.componentTypeCatalogDetails, linkedHashMap);
    return super.invokeHttpExecuteOnURL(url, componentTypeDetails, "component type details");
}

From source file:com.streamsets.pipeline.lib.jdbc.multithread.TestMultithreadedTableProvider.java

@NotNull
private static TableContext createTableContext(String schema, String tableName, String offsetColumn,
        String partitionSize, String minOffsetColValue, int maxActivePartitions, boolean enablePartitioning,
        boolean enableNonIncremental) {
    LinkedHashMap<String, Integer> offsetColumnToType = new LinkedHashMap<>();
    Map<String, String> offsetColumnToStartOffset = new HashMap<>();
    Map<String, String> offsetColumnToPartitionSizes = new HashMap<>();
    Map<String, String> offsetColumnToMinValues = new HashMap<>();

    if (offsetColumn != null) {
        offsetColumnToType.put(offsetColumn, Types.INTEGER);
        if (minOffsetColValue != null) {
            offsetColumnToMinValues.put(offsetColumn, minOffsetColValue);
        }/*from  ww  w  .j a v  a 2 s .  c o  m*/
        offsetColumnToPartitionSizes.put(offsetColumn, partitionSize);
    }
    String extraOffsetColumnConditions = null;

    return new TableContext(schema, tableName, offsetColumnToType, offsetColumnToStartOffset,
            offsetColumnToPartitionSizes, offsetColumnToMinValues, enableNonIncremental,
            enablePartitioning ? PartitioningMode.BEST_EFFORT : PartitioningMode.DISABLED, maxActivePartitions,
            extraOffsetColumnConditions);
}

From source file:com.streamsets.pipeline.lib.jdbc.multithread.TestMultithreadedTableProvider.java

@NotNull
private static TableContext createTableContext(String schema, String tableName, String offsetColumn,
        String partitionSize, String minOffsetColValue, int maxActivePartitions, boolean enablePartitioning,
        boolean enableNonIncremental, long offset) {
    LinkedHashMap<String, Integer> offsetColumnToType = new LinkedHashMap<>();
    Map<String, String> offsetColumnToStartOffset = new HashMap<>();
    Map<String, String> offsetColumnToPartitionSizes = new HashMap<>();
    Map<String, String> offsetColumnToMinValues = new HashMap<>();

    if (offsetColumn != null) {
        offsetColumnToType.put(offsetColumn, Types.INTEGER);
        if (minOffsetColValue != null) {
            offsetColumnToMinValues.put(offsetColumn, minOffsetColValue);
        }//from w  w w.  ja  va2  s  . c  o  m
        offsetColumnToPartitionSizes.put(offsetColumn, partitionSize);
    }
    String extraOffsetColumnConditions = null;

    return new TableContext(schema, tableName, offsetColumnToType, offsetColumnToStartOffset,
            offsetColumnToPartitionSizes, offsetColumnToMinValues, enableNonIncremental,
            enablePartitioning ? PartitioningMode.BEST_EFFORT : PartitioningMode.DISABLED, maxActivePartitions,
            extraOffsetColumnConditions, offset);
}

From source file:com.msopentech.odatajclient.engine.it.EntityRetrieveTestITCase.java

private void multiKey(final ODataPubFormat format) {
    final LinkedHashMap<String, Object> multiKey = new LinkedHashMap<String, Object>();
    multiKey.put("FromUsername", "1");
    multiKey.put("MessageId", -10);

    final URIBuilder uriBuilder = client.getURIBuilder(getServiceRoot()).appendEntityTypeSegment("Message")
            .appendKeySegment(multiKey);

    final ODataEntityRequest req = client.getRetrieveRequestFactory().getEntityRequest(uriBuilder.build());
    req.setFormat(format);/*from   w  w w  . j ava2s  .com*/

    final ODataRetrieveResponse<ODataEntity> res = req.execute();
    final ODataEntity entity = res.getBody();
    assertNotNull(entity);
    assertEquals("1", entity.getProperty("FromUsername").getPrimitiveValue().<String>toCastValue());
}

From source file:data.services.ProfileParamService.java

public LinkedHashMap<ProfileParam, BaseParam> getParamsMap(Radical rd) throws Exception {
    LinkedHashMap<ProfileParam, BaseParam> ppMap = new LinkedHashMap();
    List<ProfileParam> pplist = getParams(rd);
    List<BaseParam> bpList = baseParamService.getParams();
    for (ProfileParam pp : pplist) {
        ppMap.put(pp, new BaseParam());
        for (BaseParam bp : bpList) {
            if (pp.getUid().trim().equals(bp.getUid().trim())) {
                ppMap.put(pp, bp);//from w ww.j a  va 2 s .  co  m
            }
        }
    }
    //throw new Exception(pplist.size()+" " +bpList.size()+" "+ ppMap.size() );
    return ppMap;
}

From source file:com.supernovapps.audio.jstreamsourcer.Icecast.java

private void writeHeaders(PrintWriter output) {
    LinkedHashMap<String, String> headers = new LinkedHashMap<String, String>();
    headers.put("User-Agent", USER_AGENT);
    headers.put("icy-notice1", USER_AGENT);

    for (Entry<String, String> entry : headers.entrySet()) {
        output.println(entry.getKey() + ": " + entry.getValue());
    }/*from   w w  w  . ja v a  2  s.com*/

    for (Entry<String, String> entry : streamInfos.entrySet()) {
        output.println(entry.getKey() + ": " + entry.getValue());
    }
}

From source file:com.intel.iotkitlib.LibModules.ComponentTypesCatalog.ComponentTypesCatalog.java

public boolean updateAComponent(CreateOrUpdateComponentCatalog updateComponentCatalog, String componentId)
        throws JSONException {
    if (!validateActuatorCommand(updateComponentCatalog)) {
        return false;
    }//w  w w  . ja  v a  2  s .c om
    String body;
    if ((body = createBodyForComponentUpdation(updateComponentCatalog)) == null) {
        return false;
    }
    //initiating put for component updation
    HttpPutTask updateComponent = new HttpPutTask(new HttpTaskHandler() {
        @Override
        public void taskResponse(int responseCode, String response) {
            Log.d(TAG, String.valueOf(responseCode));
            Log.d(TAG, response);
            statusHandler.readResponse(responseCode, response);
        }
    });
    updateComponent.setHeaders(basicHeaderList);
    LinkedHashMap<String, String> linkedHashMap = new LinkedHashMap<String, String>();
    linkedHashMap.put("cmp_catalog_id", componentId);
    updateComponent.setRequestBody(body);
    String url = objIotKit.prepareUrl(objIotKit.updateComponent, linkedHashMap);
    return super.invokeHttpExecuteOnURL(url, updateComponent, "update component");
}

From source file:de.ingrid.importer.udk.strategy.v33.IDCStrategy3_3_0_fixServiceToData.java

protected void updateSysList() throws Exception {
    log.info("\nUpdating sys_list ...");

    // ---------------------------
    int lstId = 2000;
    log.info("Insert new entry \"3600/Gekoppelte Daten\" to syslist " + lstId + " (link type) ...");

    // german syslist
    LinkedHashMap<Integer, String> newSyslistMap_de = new LinkedHashMap<Integer, String>();
    newSyslistMap_de = new LinkedHashMap<Integer, String>();
    newSyslistMap_de.put(3600, "Gekoppelte Daten");
    // english syslist
    LinkedHashMap<Integer, String> newSyslistMap_en = new LinkedHashMap<Integer, String>();
    newSyslistMap_en = new LinkedHashMap<Integer, String>();
    newSyslistMap_en.put(3600, "Coupled Data");

    try {/*from   w w w  .ja va  2 s. com*/
        writeNewSyslist(lstId, false, newSyslistMap_de, newSyslistMap_en, -1, -1, null, null);
    } catch (Exception ex) {
        log.warn("Problems adding new entry \"3600/Gekoppelte Daten\" to syslist " + lstId
                + " (already there !?), we ignore !", ex);
    }

    log.info("Updating sys_list... done\n");
}

From source file:org.obiba.onyx.jade.instrument.jtech.Tracker5InstrumentRunner.java

private void extractTrials() {
    log.info("Extracting data");
    Map<String, Data> exam = extractExam();

    ParadoxDb dataDb = getGripTestDataDB();

    for (ParadoxRecord record : dataDb) {

        Long examMax = record.getValue("Maximum");
        Long avg = record.getValue("Average");
        Long cv = record.getValue("CV");

        for (int i = 1; i <= 4; i++) {
            String side = record.getValue("Side");
            String rungPosition = record.getValue("Position");
            Long rep = record.getValue("Rep" + i);
            Integer exclude = record.getValue("Rep" + i + "Exclude");
            if (rep != null && (exclude == null || exclude == 0)) {
                LinkedHashMap<String, Data> map = new LinkedHashMap<String, Data>(exam);
                map.put("Side", DataBuilder.buildText(side));
                // Convert it to an int
                map.put("Position", DataBuilder.build(DataType.INTEGER, rungPosition));
                map.put("Rep", DataBuilder.buildDecimal(Tracker5Util.asKg(rep.intValue())));

                // These don't change for each rep... but onyx doesn't support repeated and non-repeated values
                map.put("Max", DataBuilder.buildDecimal(Tracker5Util.asKg(examMax.intValue())));
                map.put("Avg", DataBuilder.buildDecimal(Tracker5Util.asKg(avg.intValue())));
                map.put("CV", DataBuilder.buildInteger(cv));
                sendToOnyx(map);//from  w  ww.j  a v  a 2 s  .  co m
            }
        }
    }
}

From source file:com.streamsets.pipeline.stage.destination.hive.HiveMetastoreTargetIT.java

@Test
public void testCreateNonExistingTable() throws Exception {
    HiveMetastoreTarget hiveTarget = new HiveMetastoreTargetBuilder().build();

    TargetRunner runner = new TargetRunner.Builder(HiveMetastoreTarget.class, hiveTarget)
            .setOnRecordError(OnRecordError.STOP_PIPELINE).build();
    runner.runInit();/*  w  ww. ja  v a 2  s  . co m*/

    LinkedHashMap<String, HiveTypeInfo> columns = new LinkedHashMap<>();
    columns.put("name", HiveType.STRING.getSupport().generateHiveTypeInfoFromResultSet("STRING"));

    LinkedHashMap<String, HiveTypeInfo> partitions = new LinkedHashMap<>();
    partitions.put("dt", HiveType.STRING.getSupport().generateHiveTypeInfoFromResultSet("STRING"));

    Field newTableField = HiveMetastoreUtil.newSchemaMetadataFieldBuilder("default", "tbl", columns, partitions,
            true, BaseHiveIT.getDefaultWareHouseDir(), HiveMetastoreUtil.generateAvroSchema(columns, "tbl"));

    Record record = RecordCreator.create();
    record.set(newTableField);
    Assert.assertTrue(HiveMetastoreUtil.isSchemaChangeRecord(record));

    runner.runWrite(ImmutableList.of(record));
    runner.runDestroy();

    assertTableStructure("default.tbl", new ImmutablePair("tbl.name", Types.VARCHAR),
            new ImmutablePair("tbl.dt", Types.VARCHAR));
}