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:org.n52.sensorweb.series.policy.editor.ctrl.SimplePermissionEditorController.java

/**
 * @return permissionSets to be displayed
 *//*from   www.  j a  v a  2  s  . c  om*/
@RequestMapping(value = "/", method = RequestMethod.GET)
public ModelAndView listPermissions(HttpServletRequest request) {
    ModelAndView mav = new ModelAndView("listPermissionSets");
    mav.addObject("permissionSets", simplePermissionService.getPermissionSets());
    mav.addObject("pageTitle", "List Permission Sets");
    mav.addObject("heading", "Timeseries Permission Manager");

    LinkedHashMap<String, String> breadCrumb = new LinkedHashMap<String, String>();

    if (request != null)
        breadCrumb.put("Manager", request.getContextPath() + "/editor/");

    mav.addObject("breadCrumb", breadCrumb);
    return mav;
}

From source file:com.opengamma.analytics.financial.curve.sensitivity.ParameterSensitivity.java

/**
 * Create a copy of the sensitivity and add a given sensitivity to it.
 * @param other The sensitivity to add.//  ww w  .jav  a 2s.  c o m
 * @return The total sensitivity.
 */
public ParameterSensitivity plus(final ParameterSensitivity other) {
    ArgumentChecker.notNull(other, "Sensitivity to add");
    final MatrixAlgebra algebra = MatrixAlgebraFactory.COMMONS_ALGEBRA;
    final LinkedHashMap<Pair<String, Currency>, DoubleMatrix1D> result = new LinkedHashMap<Pair<String, Currency>, DoubleMatrix1D>();
    result.putAll(_sensitivity);
    for (final Map.Entry<Pair<String, Currency>, DoubleMatrix1D> entry : other.getSensitivities().entrySet()) {
        final Pair<String, Currency> nameCcy = entry.getKey();
        if (result.containsKey(nameCcy)) {
            result.put(nameCcy, (DoubleMatrix1D) algebra.add(result.get(nameCcy), entry.getValue()));
        } else {
            result.put(nameCcy, entry.getValue());
        }
    }
    return new ParameterSensitivity(result);
}

From source file:com.sillelien.dollar.api.types.DollarMap.java

@NotNull
@Override//w  ww.  j  ava 2  s  .c  o  m
public var $append(@NotNull var value) {
    final LinkedHashMap<var, var> newMap = new LinkedHashMap<>(toVarMap().mutable());
    newMap.put(value.$pairKey(), value.$pairValue());
    return DollarFactory.fromValue(newMap, errors(), value.errors());
}

From source file:br.com.postalis.folhapgto.service.SvcFolhaPgtoImpl.java

public boolean criarRelatorioResumoDeDifEnviadasEIncorporadas(Date dtRef) throws JRException {
    List<RelatorioDTO> lista = new ArrayList<RelatorioDTO>();
    LinkedHashMap<String, PosGpxConsignacaoPopulisIncorporada> listaIncorp = new LinkedHashMap<String, PosGpxConsignacaoPopulisIncorporada>();

    for (PosGpxConsignacaoPopulisIncorporada incorp : incorporadosRepository
            .findByDtReferenciaGroupByVerbaAndVlLancamentoAndQtLancamento(dtRef)) {
        listaIncorp.put(incorp.getCdVerba(), incorp);
    }/*from  w  ww  .  j  a v a2s.  co  m*/

    for (ConsignacaoPopulis env : consignadoRepository
            .findByDtReferenciaEnviadosGroupByCdVerbaAndDsVerba(dtRef)) {
        PosGpxConsignacaoPopulisIncorporada inc = listaIncorp.get(env.getCdVerba());
        RelatorioDTO rel;
        if (inc != null) {
            BigDecimal difValor = env.getVlVerba().subtract(inc.getVlLancamento());
            BigDecimal difQtd = env.getQtVerba().subtract(inc.getQtLancamento());
            rel = new RelatorioDTO(env.getCdVerba(), env.getDsVerba(), env.getVlVerba(), env.getQtVerba(),
                    inc.getVlLancamento(), inc.getQtLancamento(), difValor, difQtd);
        } else {
            rel = new RelatorioDTO(env.getCdVerba(), env.getDsVerba(), env.getVlVerba(), env.getQtVerba(),
                    BigDecimal.ZERO, BigDecimal.ZERO, env.getVlVerba(), env.getQtVerba());
        }

        lista.add(rel);
    }

    if (lista == null || lista.isEmpty()) {
        return false;
    }
    gerarRelatorio("Relatrio de diferenas das rbricas enviadas e incorporadas - Sinttico",
            "RelResumoDifRubEnviadasXIncorporadas", lista, dtRef);
    return true;
}

From source file:ca.sfu.federation.model.Assembly.java

/**
 * Get the local Elements./*from   ww w  . ja  v  a  2s  .  c  o  m*/
 * @return Collection of NamedObjects in this context.
 */
public Map<String, INamed> getElementMap() {
    LinkedHashMap<String, INamed> map = new LinkedHashMap<String, INamed>();
    Iterator it = this.elements.iterator();
    while (it.hasNext()) {
        INamed named = (INamed) it.next();
        map.put(named.getName(), named);
    }
    return map;
}

From source file:net.duckling.ddl.service.resource.impl.ResourcePipeAgentServiceImpl.java

private LinkedHashMap<String, MeePoMeta> sortMeta(Map<String, MeePoMeta> meta) {
    List<String> keyList = new ArrayList<String>();
    for (String key : meta.keySet()) {
        MeePoMeta item = meta.get(key);//from www .j  a  v  a2  s.c  o  m
        if (item.isDir) {
            keyList.add(key);
        }
    }
    Collections.sort(keyList);

    LinkedHashMap<String, MeePoMeta> folderMeta = new LinkedHashMap<String, MeePoMeta>();
    for (String key : keyList) {
        folderMeta.put(key, meta.get(key));
    }

    return folderMeta;
}

From source file:com.streamsets.pipeline.lib.salesforce.PushTopicRecordCreator.java

@Override
@SuppressWarnings("unchecked")
public Record createRecord(String sourceId, Object source) throws StageException {
    Pair<PartnerConnection, Map<String, Object>> pair = (Pair<PartnerConnection, Map<String, Object>>) source;
    Map<String, Object> data = pair.getRight();
    Map<String, Object> event = (Map<String, Object>) data.get("event");
    Map<String, Object> sobject = (Map<String, Object>) data.get("sobject");

    Record rec = context.createRecord(sourceId);

    // sobject data becomes fields
    LinkedHashMap<String, Field> map = new LinkedHashMap<>();

    for (Map.Entry<String, Object> entry : sobject.entrySet()) {
        String key = entry.getKey();
        Object val = entry.getValue();
        com.sforce.soap.partner.Field sfdcField = getFieldMetadata(sobjectType, key);
        Field field = createField(val, sfdcField);
        if (conf.createSalesforceNsHeaders) {
            setHeadersOnField(field, getFieldMetadata(sobjectType, key));
        }//from w w  w .  jav a 2s.c o m
        map.put(key, field);
    }

    rec.set(Field.createListMap(map));

    // event data becomes header attributes
    // of the form salesforce.cdc.createdDate,
    // salesforce.cdc.type
    Record.Header recordHeader = rec.getHeader();
    for (Map.Entry<String, Object> entry : event.entrySet()) {
        recordHeader.setAttribute(HEADER_ATTRIBUTE_PREFIX + entry.getKey(), entry.getValue().toString());
        if ("type".equals(entry.getKey())) {
            int operationCode = SFDC_TO_SDC_OPERATION.get(entry.getValue().toString());
            recordHeader.setAttribute(OperationType.SDC_OPERATION_TYPE, String.valueOf(operationCode));
        }
    }
    recordHeader.setAttribute(SOBJECT_TYPE_ATTRIBUTE, sobjectType);

    return rec;
}

From source file:ch.rasc.wampspring.security.WampMessageSecurityMetadataSourceRegistry.java

/**
 * Allows subclasses to create creating a {@link MessageSecurityMetadataSource}.
 *
 * <p>/*  w w  w  .j a v a 2  s  .c om*/
 * This is not exposed so as not to confuse users of the API, which should never
 * invoke this method.
 * </p>
 *
 * @return the {@link MessageSecurityMetadataSource} to use
 */
protected MessageSecurityMetadataSource createMetadataSource() {
    LinkedHashMap<MessageMatcher<?>, String> mte = new LinkedHashMap<>();
    for (Map.Entry<MatcherBuilder, String> entry : this.matcherToExpression.entrySet()) {
        mte.put(entry.getKey().build(), entry.getValue());
    }
    return ExpressionBasedMessageSecurityMetadataSourceFactory.createExpressionMessageMetadataSource(mte);
}

From source file:com.spankingrpgs.scarletmoon.loader.EventLoader.java

/**
 * Hydrates the character's choices. These are choices the player makes explicitly to move through the Event
 * tree./*w  w w .  j  a  va  2  s .  c om*/
 *
 * @param choices  The JSON Object containing the available choices
 *
 * @return A mapping from the text displayed to the player to the names of the Events that describe the consequences
 * of making a particular choice
 */
private LinkedHashMap<EventDescription, String> hydrateChoices(JsonNode choices) {
    if (choices == null) {
        return new LinkedHashMap<>();
    }
    Iterator<String> choicesText = choices.fieldNames();
    LinkedHashMap<EventDescription, String> hydratedChoices = new LinkedHashMap<>();
    String newLine = parser == JSON_PARSER ? TextParser.NEW_LINE_MARKER : "\n";
    while (choicesText.hasNext()) {
        String playerChoiceText = choicesText.next();
        hydratedChoices.put(TextParser.parse(playerChoiceText, newLine),
                choices.get(playerChoiceText).asText());
    }
    return hydratedChoices;
}

From source file:com.ctb.prism.report.api.CustomReportServlet.java

protected void putReportStatusResult(HttpServletResponse response, JasperPrintAccessor printAccessor,
        LinkedHashMap<String, Object> result) throws JRException {
    ReportExecutionStatus reportStatus = printAccessor.getReportStatus();
    result.put("partialPageCount", reportStatus.getCurrentPageCount());

    String status;/*from   ww w  .  j a v a  2  s . co m*/
    switch (reportStatus.getStatus()) {
    case FINISHED:
        status = "finished";
        Integer totalPageCount = reportStatus.getTotalPageCount();
        result.put("totalPages", totalPageCount);

        if (log.isDebugEnabled()) {
            log.debug("report finished " + totalPageCount + " pages");
        }
        break;
    case ERROR:
        status = "error";
        handleReportUpdateError(response, reportStatus);
        break;
    case CANCELED:
        status = "canceled";

        if (log.isDebugEnabled()) {
            log.debug("report canceled");
        }
        break;
    case RUNNING:
    default:
        status = "running";

        if (log.isDebugEnabled()) {
            log.debug("report running");
        }
        break;
    }

    result.put("status", status);
}