Example usage for com.google.common.collect LinkedHashMultimap entries

List of usage examples for com.google.common.collect LinkedHashMultimap entries

Introduction

In this page you can find the example usage for com.google.common.collect LinkedHashMultimap entries.

Prototype

@Override
public Set<Map.Entry<K, V>> entries() 

Source Link

Document

Returns a set of all key-value pairs.

Usage

From source file:com.ikanow.aleph2.data_model.utils.CrudUtils.java

protected static Stream<Tuple2<String, Object>> recursiveQueryBuilder_recurse(final String parent_field,
        final BeanTemplate<?> sub_bean) {
    final LinkedHashMultimap<String, Tuple2<Operator, Tuple2<Object, Object>>> ret_val = CrudUtils
            .allOf(sub_bean).getAll();//from   w  ww.  j a v a2 s  .  com
    //(all vs and inherited from parent so ignored here)         

    return ret_val.entries().stream()
            .map(e -> Tuples._2T(parent_field + "." + e.getKey(), e.getValue()._2()._1()));
}

From source file:org.waveprotocol.box.server.waveserver.SimpleSearchProviderImpl.java

private LinkedHashMultimap<WaveId, WaveletId> createWavesViewToFilter(final ParticipantId user,
        final boolean isAllQuery) {
    LinkedHashMultimap<WaveId, WaveletId> currentUserWavesView;
    currentUserWavesView = LinkedHashMultimap.create();
    currentUserWavesView.putAll(waveViewProvider.retrievePerUserWaveView(user));
    if (isAllQuery) {
        // If it is the "all" query - we need to include also waves view of the
        // shared domain participant.
        currentUserWavesView.putAll(waveViewProvider.retrievePerUserWaveView(sharedDomainParticipantId));
    }/* ww w.  j ava 2s . c  om*/

    if (LOG.isFineLoggable()) {
        for (Map.Entry<WaveId, WaveletId> e : currentUserWavesView.entries()) {
            LOG.fine("unfiltered view contains: " + e.getKey() + " " + e.getValue());
        }
    }

    return currentUserWavesView;
}

From source file:eu.lp0.cursus.publish.html.XSLTHTMLGenerator.java

public Map<String, ByteSource> getSplitPages() throws ExportException {
    Map<String, ByteSource> pages = new LinkedHashMap<String, ByteSource>();
    LinkedHashMultimap<ResultsXMLSplit.Type, Integer> splits = LinkedHashMultimap.create();
    String codeFile = codeDir + SPLIT_FILE;

    for (int i = 1; i <= seriesResults; i++) {
        splits.put(ResultsXMLSplit.Type.SERIES, i);
    }/*from w w  w.  j  a va  2s  .c  o m*/

    for (int i = 1; i <= eventResults; i++) {
        splits.put(ResultsXMLSplit.Type.EVENT, i);
    }

    for (int i = 1; i <= raceResults; i++) {
        splits.put(ResultsXMLSplit.Type.RACE, i);
    }

    for (Map.Entry<ResultsXMLSplit.Type, Integer> splitEntry : splits.entries()) {
        ResultsXMLSplit split = new ResultsXMLSplit(
                String.format(longNames ? SPLIT_LONG_NAME_PREFIX : SPLIT_NAME_PREFIX, fileNamePrefix),
                splitEntry.getKey(), splitEntry.getValue(), FILE_EXT);
        pages.put(split.createFileName(), new ResultsXMLFile(this, codeFile, split).toByteSource());
    }

    return ImmutableMap.copyOf(pages);
}

From source file:com.jxt.web.mapper.SpanMapper.java

@Override
public List<SpanBo> mapRow(Result result, int rowNum) throws Exception {
    if (result.isEmpty()) {
        return Collections.emptyList();
    }/*ww w  .j a va2  s  .c  om*/

    byte[] rowKey = result.getRow();
    final TransactionId transactionId = new TransactionId(rowKey, TransactionId.DISTRIBUTE_HASH_SIZE);

    final Cell[] rawCells = result.rawCells();
    List<SpanBo> spanList = new ArrayList<>();
    Map<Long, SpanBo> spanMap = new HashMap<>();
    LinkedHashMultimap<Long, SpanEventBo> spanEventBoListMap = LinkedHashMultimap.create();
    for (Cell cell : rawCells) {
        // only if family name is "span"
        if (CellUtil.matchingFamily(cell, HBaseTables.TRACES_CF_SPAN)) {

            SpanBo spanBo = new SpanBo();
            spanBo.setTraceAgentId(transactionId.getAgentId());
            spanBo.setTraceAgentStartTime(transactionId.getAgentStartTime());
            spanBo.setTraceTransactionSequence(transactionId.getTransactionSequence());
            spanBo.setCollectorAcceptTime(cell.getTimestamp());

            spanBo.setSpanId(Bytes.toLong(cell.getQualifierArray(), cell.getQualifierOffset()));
            readSpan(spanBo, cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
            if (logger.isDebugEnabled()) {
                logger.debug("read span :{}", spanBo);
            }
            spanList.add(spanBo);
            spanMap.put(spanBo.getSpanId(), spanBo);
        } else if (CellUtil.matchingFamily(cell, HBaseTables.TRACES_CF_TERMINALSPAN)) {
            SpanEventBo spanEventBo = new SpanEventBo();
            spanEventBo.setTraceAgentId(transactionId.getAgentId());
            spanEventBo.setTraceAgentStartTime(transactionId.getAgentStartTime());
            spanEventBo.setTraceTransactionSequence(transactionId.getTransactionSequence());

            // qualifier : spanId(long) + sequence(short) + asyncId(int)
            final Buffer qualifier = new OffsetFixedBuffer(cell.getQualifierArray(), cell.getQualifierOffset(),
                    cell.getQualifierLength());
            Long spanId = qualifier.readLong();

            short sequence = qualifier.readShort();
            int asyncId = -1;
            if (qualifier.hasRemaining()) {
                asyncId = qualifier.readInt();
            }
            short asyncSequence = -1;
            if (qualifier.hasRemaining()) {
                asyncSequence = qualifier.readShort();
            }
            spanEventBo.setSequence(sequence);
            spanEventBo.setAsyncId(asyncId);
            spanEventBo.setAsyncSequence(asyncSequence);

            readSpanEvent(spanEventBo, cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
            if (logger.isDebugEnabled()) {
                logger.debug("read spanEvent :{}", spanEventBo);
            }
            spanEventBoListMap.put(spanId, spanEventBo);
        }
    }
    for (Map.Entry<Long, SpanEventBo> spanBoEntry : spanEventBoListMap.entries()) {
        final Long spanId = spanBoEntry.getKey();
        SpanBo spanBo = spanMap.get(spanId);
        if (spanBo != null) {
            spanBo.addSpanEventBoList(Lists.newArrayList(spanBoEntry.getValue()));
        } else {
            if (logger.isInfoEnabled()) {
                logger.info("Span not exist spanId:{} spanEvent:{}", spanBoEntry.getKey(),
                        spanBoEntry.getValue());
            }
        }
    }
    if (annotationMapper != null) {
        Map<Long, List<AnnotationBo>> annotationMap = annotationMapper.mapRow(result, rowNum);
        addAnnotation(spanList, annotationMap);
    }

    return spanList;

}