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:ch.gianulli.trelloapi.Card.java

/**
 * Moves this card to a different list. Attention: this operation does not update TrelloList
 * objects with a reference to this card.
 * <p/>/*  w  w w . j a  v a  2s.  c o m*/
 * This operation is asynchronous and handles errors itself.
 *
 * @param api
 * @param listId
 */
public void moveToListAsync(final TrelloAPI api, final String listId) {
    new AsyncTask<Void, Void, Boolean>() {
        @Override
        protected Boolean doInBackground(Void... voids) {
            try {
                LinkedHashMap<String, String> args = new LinkedHashMap<>();
                args.put("value", listId);
                JSONObject result = api.makeJSONObjectRequest("PUT", "cards/" + mId + "/idList", args, true);
                if (result == null) {
                    Log.i("TrelloAPI", "Error occurred when moving card: null result");
                    return false;
                }
            } catch (TrelloNotAccessibleException | TrelloNotAuthorizedException e) {
                Log.i("TrelloAPI", "Error occurred when moving card: ", e);
                return false;
            }

            return true;
        }

        @Override
        protected void onPostExecute(Boolean successful) {
            if (!successful) {
                Toast.makeText(api.getContext(), "Error: Card could not be moved.", Toast.LENGTH_LONG).show();
            }
        }
    }.execute();
}

From source file:com.streamsets.pipeline.stage.processor.fieldorder.FieldOrderProcessor.java

private void orderToListMap(Record record) {
    LinkedHashMap<String, Field> list = new LinkedHashMap<>(fields.size());
    for (String fieldPath : config.fields) {
        list.put(toFieldName(fieldPath), record.has(fieldPath) ? record.get(fieldPath) : defaultField);
    }//from www  .ja  va 2s .com

    record.set(Field.create(Field.Type.LIST_MAP, list));
}

From source file:edu.cornell.kfs.fp.businessobject.PaymentMethod.java

@SuppressWarnings("unchecked")
protected LinkedHashMap toStringMapper() {
    LinkedHashMap<String, String> lhm = new LinkedHashMap<String, String>();
    lhm.put("paymentMethodCode", paymentMethodCode);
    lhm.put("paymentMethodName", paymentMethodName);
    return lhm;//  w  w  w .j  av  a  2 s  .  c  o m
}

From source file:org.kitodo.data.index.elasticsearch.type.WorkpieceType.java

@SuppressWarnings("unchecked")
@Override/*  w w  w .  ja v  a  2  s .co m*/
public HttpEntity createDocument(Workpiece workpiece) {

    LinkedHashMap<String, String> orderedWorkpieceMap = new LinkedHashMap<>();
    String process = workpiece.getProcess() != null ? workpiece.getProcess().getId().toString() : "null";
    orderedWorkpieceMap.put("process", process);

    JSONObject processObject = new JSONObject(orderedWorkpieceMap);

    JSONArray properties = new JSONArray();
    List<WorkpieceProperty> workpieceProperties = workpiece.getProperties();
    for (WorkpieceProperty property : workpieceProperties) {
        JSONObject propertyObject = new JSONObject();
        propertyObject.put("title", property.getTitle());
        propertyObject.put("value", property.getValue());
        properties.add(propertyObject);
    }
    processObject.put("properties", properties);

    return new NStringEntity(processObject.toJSONString(), ContentType.APPLICATION_JSON);
}

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

public List<Record> runNewPartitionRecord() throws Exception {
    HiveMetastoreTarget hiveTarget = new HiveMetastoreTargetBuilder().build();

    TargetRunner runner = new TargetRunner.Builder(HiveMetastoreTarget.class, hiveTarget)
            .setOnRecordError(OnRecordError.TO_ERROR).build();
    runner.runInit();/*from  w w  w  . ja v  a 2s . c o  m*/

    Assert.assertEquals("There should be no error records", 0, runner.getErrorRecords().size());
    LinkedHashMap<String, String> partitionVals = new LinkedHashMap<String, String>();
    partitionVals.put("dt", "2016");

    Field newPartitionField = HiveMetastoreUtil.newPartitionMetadataFieldBuilder("default", "tbl",
            partitionVals, "/user/hive/warehouse/tbl/dt=2016");
    Record record = RecordCreator.create();
    record.set(newPartitionField);
    runner.runWrite(ImmutableList.of(record));

    try {
        return runner.getEventRecords();
    } finally {
        runner.runDestroy();
    }
}

From source file:Remote.java

private void buildCommands() {

    LinkedHashMap jsonHeaders = new LinkedHashMap();

    jsonHeaders.put("id", 0);
    jsonHeaders.put("jsonrpc", "2.0");

    inputUp.putAll(jsonHeaders);/*from w  w w .java2 s .  com*/
    inputUp.put("method", "Input.Up");

    inputDown.putAll(jsonHeaders);
    inputDown.put("method", "Input.Down");

    inputLeft.putAll(jsonHeaders);
    inputLeft.put("method", "Input.Left");

    inputRight.putAll(jsonHeaders);
    inputRight.put("method", "Input.Right");

    inputHome.putAll(jsonHeaders);
    inputHome.put("method", "Input.Home");

    inputBack.putAll(jsonHeaders);
    inputBack.put("method", "Input.Back");

    inputInfo.putAll(jsonHeaders);
    inputInfo.put("method", "Input.Info");

    inputContextMenu.putAll(jsonHeaders);
    inputContextMenu.put("method", "Input.ContextMenu");

    inputSelect.putAll(jsonHeaders);
    inputSelect.put("method", "Input.Select");

    guiNotify.putAll(jsonHeaders);
    guiNotify.put("method", "GUI.ShowNotification");

    playPause.putAll(jsonHeaders);
    playPause.put("method", "Player.PlayPause");
    {
        LinkedHashMap params = new LinkedHashMap();
        params.put("playerid", 1);
        playPause.put("params", params);
    }
}

From source file:com.fortify.processrunner.common.processor.AbstractBugTrackerFieldsBasedProcessor.java

/**
 * Utility method for filtering an input map based on the given array of keys.
 * @param inputMap//from   w  w  w. j  av a 2  s . co  m
 * @param keys
 * @return
 */
private LinkedHashMap<String, TemplateExpression> getFilteredMap(
        LinkedHashMap<String, TemplateExpression> inputMap, String[] keys) {
    LinkedHashMap<String, TemplateExpression> result = new LinkedHashMap<String, TemplateExpression>(
            keys.length);
    for (String key : keys) {
        result.put(key, inputMap.get(key));
    }
    return result;
}

From source file:net.sourceforge.jabm.util.CombiObjectFactory.java

public Map<ObjectFactory, Integer> getFactoryMap() {
    LinkedHashMap<ObjectFactory, Integer> result = new LinkedHashMap<ObjectFactory, Integer>();
    for (int i = 0; i < factories.size(); i++) {
        result.put(factories.get(i), numberOfObjectsPerFactory.get(i));
    }/*  w w w  .j  av a2s. c  o  m*/
    return result;
}

From source file:uk.ac.kcl.itemProcessors.BioLarkDocumentItemProcessor.java

private Document executeWithRetryIgnoringExceptions(Document doc) {
    HashMap<String, Object> newMap = new HashMap<>();
    newMap.putAll(doc.getAssociativeArray());
    doc.getAssociativeArray().forEach((k, v) -> {
        if (fieldsToBioLark.contains(k)) {
            Object json = retryTemplate.execute(new RetryCallback<Object, BiolarkProcessingFailedException>() {
                public Object doWithRetry(RetryContext context) {
                    // business logic here
                    return restTemplate.postForObject(endPoint, v, Object.class);
                }/* w  w  w  .  j  av  a  2  s .  com*/
            }, new RecoveryCallback() {
                @Override
                public Object recover(RetryContext context) throws BiolarkProcessingFailedException {
                    LOG.warn("Biolark failed on document " + doc.getDocName());
                    ArrayList<LinkedHashMap<Object, Object>> al = new ArrayList<LinkedHashMap<Object, Object>>();
                    LinkedHashMap<Object, Object> hm = new LinkedHashMap<Object, Object>();
                    hm.put(fieldName, "biolark failed");
                    al.add(hm);
                    doc.getExceptions().add(new BiolarkProcessingFailedException(
                            "Biolark failed on document " + doc.getDocName()));
                    return al;
                }
            });
            newMap.put(fieldName, json);
        }
    });
    doc.getAssociativeArray().clear();
    doc.getAssociativeArray().putAll(newMap);
    return doc;
}

From source file:com.k42b3.quantum.worker.GitHubCommitWorker.java

@Override
public Map<String, String> getParameters() {
    LinkedHashMap<String, String> parameters = new LinkedHashMap<String, String>();
    parameters.put("owner", "Owner");
    parameters.put("repo", "Repository");

    return parameters;
}