Example usage for java.util NavigableMap keySet

List of usage examples for java.util NavigableMap keySet

Introduction

In this page you can find the example usage for java.util NavigableMap keySet.

Prototype

Set<K> keySet();

Source Link

Document

Returns a Set view of the keys contained in this map.

Usage

From source file:org.apache.phoenix.coprocessor.ScanRegionObserver.java

/**
 * In case we are supporting exposing dynamic columns for wildcard queries, which is based on
 * the client-side config/*from w w w .  ja  va 2  s .c o m*/
 * {@link org.apache.phoenix.query.QueryServices#WILDCARD_QUERY_DYNAMIC_COLS_ATTRIB},
 * we previously set attributes on the Put mutations where the key is the column family and
 * the value is the serialized list of dynamic columns.
 * Here we iterate over all Put mutations and add metadata for the list of dynamic columns for
 * each column family in its own cell under reserved qualifiers. See PHOENIX-374
 * @param miniBatchOp batch of mutations getting applied to region
 * @param tableName Name of table served by region
 * @throws IOException If an I/O error occurs when parsing protobuf
 */
private void preBatchMutateWithExceptions(MiniBatchOperationInProgress<Mutation> miniBatchOp, String tableName)
        throws IOException {
    for (int i = 0; i < miniBatchOp.size(); i++) {
        Mutation m = miniBatchOp.getOperation(i);
        // There is at max 1 extra Put (for dynamic column shadow cells) per original Put
        Put dynColShadowCellsPut = null;
        if (m instanceof Put
                && Bytes.equals(m.getAttribute(DYNAMIC_COLUMN_METADATA_STORED_FOR_MUTATION), TRUE_BYTES)) {
            if (LOG.isDebugEnabled()) {
                LOG.debug("Adding dynamic column metadata for table: " + tableName + ". Put :" + m.toString());
            }
            NavigableMap<byte[], List<Cell>> famCellMap = m.getFamilyCellMap();
            for (byte[] fam : famCellMap.keySet()) {
                byte[] serializedDynColsList = m.getAttribute(Bytes.toString(fam));
                if (serializedDynColsList == null) {
                    // There are no dynamic columns for this column family
                    continue;
                }
                List<PTableProtos.PColumn> dynColsInThisFam = DynamicColumnMetaDataProtos.DynamicColumnMetaData
                        .parseFrom(serializedDynColsList).getDynamicColumnsList();
                if (dynColsInThisFam.isEmpty()) {
                    continue;
                }
                if (dynColShadowCellsPut == null) {
                    dynColShadowCellsPut = new Put(m.getRow());
                }
                for (PTableProtos.PColumn dynColProto : dynColsInThisFam) {
                    // Add a column for this dynamic column to the metadata Put operation
                    dynColShadowCellsPut.addColumn(fam, getQualifierForDynamicColumnMetaDataCell(dynColProto),
                            dynColProto.toByteArray());
                }
            }
        }
        if (dynColShadowCellsPut != null) {
            miniBatchOp.addOperationsFromCP(i, new Mutation[] { dynColShadowCellsPut });
        }
    }
}

From source file:org.apache.tajo.storage.hbase.HBaseScanner.java

private Datum getDatum(Result result, int fieldId) throws IOException {
    byte[] value = null;
    if (isRowKeyMappings[fieldId]) {
        value = result.getRow();//from w w  w . ja  va  2  s  .c om
        if (!isBinaryColumns[fieldId] && rowKeyFieldIndexes[fieldId] >= 0) {
            int rowKeyFieldIndex = rowKeyFieldIndexes[fieldId];

            byte[][] rowKeyFields = BytesUtils.splitPreserveAllTokens(value, rowKeyDelimiter,
                    columnMapping.getNumColumns());

            if (rowKeyFields.length < rowKeyFieldIndex) {
                return NullDatum.get();
            } else {
                value = rowKeyFields[rowKeyFieldIndex];
            }
        }
    } else {
        if (isColumnKeys[fieldId]) {
            NavigableMap<byte[], byte[]> cfMap = result.getFamilyMap(mappingColumnFamilies[fieldId][0]);
            if (cfMap != null) {
                Set<byte[]> keySet = cfMap.keySet();
                if (keySet.size() == 1) {
                    try {
                        return HBaseTextSerializerDeserializer.deserialize(schemaColumns[fieldId],
                                keySet.iterator().next());
                    } catch (Exception e) {
                        LOG.error(e.getMessage(), e);
                        throw new RuntimeException(e.getMessage(), e);
                    }
                } else {
                    StringBuilder sb = new StringBuilder();
                    sb.append("[");
                    int count = 0;
                    for (byte[] eachKey : keySet) {
                        if (count > 0) {
                            sb.append(", ");
                        }
                        Datum datum = HBaseTextSerializerDeserializer.deserialize(schemaColumns[fieldId],
                                eachKey);
                        sb.append("\"").append(datum.asChars()).append("\"");
                        count++;
                        if (count > MAX_LIST_SIZE) {
                            break;
                        }
                    }
                    sb.append("]");
                    return new TextDatum(sb.toString());
                }
            }
        } else if (isColumnValues[fieldId]) {
            NavigableMap<byte[], byte[]> cfMap = result.getFamilyMap(mappingColumnFamilies[fieldId][0]);
            if (cfMap != null) {
                Collection<byte[]> valueList = cfMap.values();
                if (valueList.size() == 1) {
                    try {
                        return HBaseTextSerializerDeserializer.deserialize(schemaColumns[fieldId],
                                valueList.iterator().next());
                    } catch (Exception e) {
                        LOG.error(e.getMessage(), e);
                        throw new RuntimeException(e.getMessage(), e);
                    }
                } else {
                    StringBuilder sb = new StringBuilder();
                    sb.append("[");
                    int count = 0;
                    for (byte[] eachValue : valueList) {
                        if (count > 0) {
                            sb.append(", ");
                        }
                        Datum datum = HBaseTextSerializerDeserializer.deserialize(schemaColumns[fieldId],
                                eachValue);
                        sb.append("\"").append(datum.asChars()).append("\"");
                        count++;
                        if (count > MAX_LIST_SIZE) {
                            break;
                        }
                    }
                    sb.append("]");
                    return new TextDatum(sb.toString());
                }
            }
        } else {
            if (mappingColumnFamilies[fieldId][1] == null) {
                NavigableMap<byte[], byte[]> cfMap = result.getFamilyMap(mappingColumnFamilies[fieldId][0]);
                if (cfMap != null && !cfMap.isEmpty()) {
                    int count = 0;
                    String delim = "";

                    if (cfMap.size() == 0) {
                        return NullDatum.get();
                    } else if (cfMap.size() == 1) {
                        // If a column family is mapped without column name like "cf1:" and the number of cells is one,
                        // return value is flat format not json format.
                        NavigableMap.Entry<byte[], byte[]> entry = cfMap.entrySet().iterator().next();
                        byte[] entryKey = entry.getKey();
                        byte[] entryValue = entry.getValue();
                        if (entryKey == null || entryKey.length == 0) {
                            try {
                                if (isBinaryColumns[fieldId]) {
                                    return HBaseBinarySerializerDeserializer.deserialize(schemaColumns[fieldId],
                                            entryValue);
                                } else {
                                    return HBaseTextSerializerDeserializer.deserialize(schemaColumns[fieldId],
                                            entryValue);
                                }
                            } catch (Exception e) {
                                LOG.error(e.getMessage(), e);
                                throw new RuntimeException(e.getMessage(), e);
                            }
                        }
                    }
                    StringBuilder sb = new StringBuilder();
                    sb.append("{");
                    for (NavigableMap.Entry<byte[], byte[]> entry : cfMap.entrySet()) {
                        byte[] entryKey = entry.getKey();
                        byte[] entryValue = entry.getValue();

                        String keyText = new String(entryKey);
                        String valueText = null;
                        if (entryValue != null) {
                            try {
                                if (isBinaryColumns[fieldId]) {
                                    valueText = HBaseBinarySerializerDeserializer
                                            .deserialize(schemaColumns[fieldId], entryValue).asChars();
                                } else {
                                    valueText = HBaseTextSerializerDeserializer
                                            .deserialize(schemaColumns[fieldId], entryValue).asChars();
                                }
                            } catch (Exception e) {
                                LOG.error(e.getMessage(), e);
                                throw new RuntimeException(e.getMessage(), e);
                            }
                        }
                        sb.append(delim).append("\"").append(keyText).append("\":\"").append(valueText)
                                .append("\"");
                        delim = ", ";
                        count++;
                        if (count > MAX_LIST_SIZE) {
                            break;
                        }
                    } //end of for
                    sb.append("}");
                    return new TextDatum(sb.toString());
                } else {
                    value = null;
                }
            } else {
                value = result.getValue(mappingColumnFamilies[fieldId][0], mappingColumnFamilies[fieldId][1]);
            }
        }
    }

    if (value == null) {
        return NullDatum.get();
    } else {
        try {
            if (isBinaryColumns[fieldId]) {
                return HBaseBinarySerializerDeserializer.deserialize(schemaColumns[fieldId], value);
            } else {
                return HBaseTextSerializerDeserializer.deserialize(schemaColumns[fieldId], value);
            }
        } catch (Exception e) {
            LOG.error(e.getMessage(), e);
            throw new RuntimeException(e.getMessage(), e);
        }
    }
}

From source file:org.apache.vysper.storage.hbase.roster.HBaseRosterManager.java

@Override
protected Roster retrieveRosterInternal(Entity bareJid) {
    final Result entityRow = hBaseStorage.getEntityRow(bareJid, COLUMN_FAMILY_NAME_CONTACT,
            COLUMN_FAMILY_NAME_ROSTER);//from w  ww. j a  v a  2  s .  c  o  m

    MutableRoster roster = new MutableRoster();

    final NavigableMap<byte[], byte[]> contacts = entityRow.getFamilyMap(COLUMN_FAMILY_NAME_CONTACT_BYTES);
    if (contacts == null)
        return roster;

    for (byte[] contactBytes : contacts.keySet()) {
        String contactAsString = null;
        EntityImpl contactJID = null;
        try {
            contactAsString = new String(contactBytes, "UTF-8");
            contactJID = EntityImpl.parse(contactAsString);
        } catch (Exception e) {
            LOG.warn("failed to read contact identified by '{}' for user {}", bareJid, contactAsString);
            continue;
        }

        final NavigableMap<byte[], byte[]> contactDetails = entityRow
                .getFamilyMap(COLUMN_FAMILY_NAME_ROSTER_BYTES);
        String name = toStr(contactDetails.get(asBytes(COLUMN_PREFIX_NAME + contactAsString)));
        String typeString = toStr(contactDetails.get(asBytes(COLUMN_PREFIX_TYPE + contactAsString)));
        String askTypeString = toStr(contactDetails.get(asBytes(COLUMN_PREFIX_ASKTYPE + contactAsString)));

        SubscriptionType subscriptionType = null;
        try {
            subscriptionType = SubscriptionType.valueOf(typeString == null ? "NONE" : typeString.toUpperCase());
        } catch (IllegalArgumentException e) {
            LOG.warn("when loading roster for user " + bareJid + ", contact " + contactJID
                    + " misses a subscription type");
        }

        AskSubscriptionType askSubscriptionType = AskSubscriptionType.NOT_SET;
        try {
            if (StringUtils.isNotBlank(askTypeString)) {
                askSubscriptionType = AskSubscriptionType.valueOf(askTypeString);
            }
        } catch (IllegalArgumentException e) {
            LOG.warn("when loading roster for user " + bareJid.getFullQualifiedName() + ", contact "
                    + contactJID.getFullQualifiedName() + ", the ask subscription type '" + askTypeString
                    + "' is unparsable. skipping!");
            continue; // don't return it, don't set a default!
        }

        List<RosterGroup> groups = new ArrayList<RosterGroup>();
        int i = 1;
        while (true) {
            String columnName = COLUMN_PREFIX_GROUP + i + ":" + contactAsString;
            String groupName = toStr(contactDetails.get(asBytes(columnName)));
            if (groupName == null)
                break;

            groups.add(new RosterGroup(groupName));
            i++;
        }

        RosterItem item = new RosterItem(contactJID, name, subscriptionType, askSubscriptionType, groups);
        LOG.info("item loaded for " + bareJid.getFullQualifiedName() + ": " + item.toString());
        roster.addItem(item);
    }
    return roster;
}

From source file:org.cloudgraph.hbase.mutation.GraphMutationWriter.java

private void debugRowValues(Row row) {
    if (row instanceof Mutation) {
        Mutation mutation = (Mutation) row;
        NavigableMap<byte[], List<Cell>> map = mutation.getFamilyCellMap();
        StringBuilder buf = new StringBuilder();
        Iterator<byte[]> iter = map.keySet().iterator();
        buf.append("[");
        int i = 0;
        while (iter.hasNext()) {
            if (i > 0)
                buf.append(", ");
            byte[] family = iter.next();
            List<Cell> list = map.get(family);
            for (Cell cell : list) {
                buf.append(Bytes.toString(family));
                buf.append(":");
                byte[] qual = CellUtil.cloneQualifier(cell);
                buf.append(Bytes.toString(qual));
                buf.append("=");
                byte[] value = CellUtil.cloneValue(cell);
                buf.append(Bytes.toString(value));
            }/*from  ww w . j  a v  a  2 s  .  com*/
        }
        buf.append("]");
        log.debug("values: " + buf.toString());
    }
}

From source file:org.hbasene.index.HBaseTermPositions.java

@Override
public void seek(Term term) throws IOException {
    final String rowKey = term.field() + "/" + term.text();
    this.currentRow = Bytes.toBytes(rowKey);
    Result result = this.getRowWithTermVectors();
    NavigableMap<byte[], byte[]> map = result.getFamilyMap(HBaseneConstants.FAMILY_TERMVECTOR);

    this.documents = new ArrayList<byte[]>(map.keySet());
    this.currentIndex = -1;
}

From source file:org.hbasene.index.search.HBaseTopFieldCollector.java

private void doAppendToPQ(final Map<byte[], SortFieldDoc> docMap, final PriorityQueue<SortFieldDoc> outputPq,
        final String sortField, final int sortIndex) throws IOException {
    HTableInterface table = this.tablePool.getTable(this.indexName);
    final String sortFieldPrefix = sortField + "/"; // separator
    try {// w w  w.  j a  va2s.c om
        byte[] row = Bytes.toBytes(sortFieldPrefix);
        Result priorToFirstTerm = table.getRowOrBefore(row, FAMILY_TERMVECTOR);
        ResultScanner scanner = table
                .getScanner(this.createScan((priorToFirstTerm != null) ? priorToFirstTerm.getRow() : null));
        try {
            int index = 0;
            Result result = scanner.next();
            while (result != null) {
                String currentRow = Bytes.toString(result.getRow());
                if (currentRow.startsWith(sortFieldPrefix)) {
                    ++index;
                    NavigableMap<byte[], byte[]> columnQualifiers = result.getFamilyMap(FAMILY_TERMVECTOR);
                    SetView<byte[]> intersectionSet = Sets.intersection(columnQualifiers.keySet(),
                            docMap.keySet());
                    for (final byte[] commonDocId : intersectionSet) {
                        SortFieldDoc next = docMap.get(commonDocId);
                        next.indices[sortIndex] = index;
                        outputPq.add(next);
                    }
                    //Method works best if the ratio between the unique number of elements 
                    // in the field to be sorted is small compared to the total 
                    // number of documents in the list
                    docMap.keySet().removeAll(intersectionSet);
                    LOG.info("Docs Size after  " + currentRow + " is " + docMap.size());
                    if (docMap.isEmpty()) {
                        break;
                    }
                }
                result = scanner.next();
            }
        } finally {
            scanner.close();
        }
    } finally {
        this.tablePool.putTable(table);
    }
}

From source file:org.kiji.schema.tools.LsTool.java

/**
 * Prints cell data from the <code>row</code> for each column specified on the
 * <code>request</code>./* www.  j a  v  a  2 s  .c  o m*/
 *
 * @param row The row to read from.
 * @param mapTypeFamilies The map type families to print.
 * @param groupTypeColumns The group type columns to print.
 * @throws IOException if there is an error retrieving data from the KijiRowData.
 */
private void printRow(KijiRowData row, Map<FamilyLayout, List<String>> mapTypeFamilies,
        Map<FamilyLayout, List<ColumnLayout>> groupTypeColumns) throws IOException {

    // Unpack and print result for the map type families.
    for (Entry<FamilyLayout, List<String>> entry : mapTypeFamilies.entrySet()) {
        final FamilyLayout family = entry.getKey();
        if (family.getDesc().getMapSchema().getType() == SchemaType.COUNTER) {
            // If this map family of counters has no qualifiers, print entire family.
            if (entry.getValue().isEmpty()) {
                for (String key : row.getQualifiers(family.getName())) {
                    KijiCounter counter = row.getCounter(family.getName(), key);
                    if (null != counter) {
                        printCell(row.getEntityId(), counter.getTimestamp(), family.getName(), key,
                                Long.valueOf(counter.getValue()));
                    }
                }
                // If this map family of counters has been qualified, print only the given columns.
            } else {
                for (String key : entry.getValue()) {
                    KijiCounter counter = row.getCounter(family.getName(), key);
                    if (null != counter) {
                        printCell(row.getEntityId(), counter.getTimestamp(), family.getName(), key,
                                Long.valueOf(counter.getValue()));
                    }
                }
            }
        } else {
            // If this map family of non-counters has no qualifiers, print entire family.
            if (entry.getValue().isEmpty()) {
                NavigableMap<String, NavigableMap<Long, Object>> keyTimeseriesMap = row
                        .getValues(family.getName(), (Schema) null);
                for (String key : keyTimeseriesMap.keySet()) {
                    for (Entry<Long, Object> timestampedCell : keyTimeseriesMap.get(key).entrySet()) {
                        long timestamp = timestampedCell.getKey();
                        printCell(row.getEntityId(), timestamp, family.getName(), key,
                                timestampedCell.getValue());
                    }
                }
                // If this map family of non-counters has been qualified, print only the given columns.
            } else {
                for (String key : entry.getValue()) {
                    NavigableMap<Long, Object> timeseriesMap = row.getValues(family.getName(), key,
                            (Schema) null);
                    for (Entry<Long, Object> timestampedCell : timeseriesMap.entrySet()) {
                        long timestamp = timestampedCell.getKey();
                        printCell(row.getEntityId(), timestamp, family.getName(), key,
                                timestampedCell.getValue());
                    }
                }
            }
        }
    }

    // Unpack and print result for the group type families.
    for (Entry<FamilyLayout, List<ColumnLayout>> entry : groupTypeColumns.entrySet()) {
        String familyName = entry.getKey().getName();
        for (ColumnLayout column : entry.getValue()) {
            final KijiColumnName colName = new KijiColumnName(familyName, column.getName());
            if (column.getDesc().getColumnSchema().getType() == SchemaType.COUNTER) {
                final KijiCounter counter = row.getCounter(colName.getFamily(), colName.getQualifier());
                if (null != counter) {
                    printCell(row.getEntityId(), counter.getTimestamp(), colName.getFamily(),
                            colName.getQualifier(), Long.valueOf(counter.getValue()));
                }
            } else {
                for (Entry<Long, Object> timestampedCell : row
                        .getValues(colName.getFamily(), colName.getQualifier(), (Schema) null).entrySet()) {
                    long timestamp = timestampedCell.getKey();
                    printCell(row.getEntityId(), timestamp, colName.getFamily(), colName.getQualifier(),
                            timestampedCell.getValue());
                }
            }
        }
    }
    getPrintStream().println("");
}

From source file:org.kiji.schema.tools.ToolUtils.java

/**
 * Prints cell data from the <code>row</code> for each column specified on the
 * <code>request</code>./*from  www  . j a  v  a  2  s .  c  o  m*/
 *
 * @param row The row to read from.
 * @param mapTypeFamilies The map type families to print.
 * @param groupTypeColumns The group type columns to print.
 * @param printStream The stream to print to.
 * @throws IOException if there is an error retrieving data from the KijiRowData.
 */
public static void printRow(KijiRowData row, Map<FamilyLayout, List<String>> mapTypeFamilies,
        Map<FamilyLayout, List<ColumnLayout>> groupTypeColumns, PrintStream printStream) throws IOException {

    // Unpack and print result for the map type families.
    for (Entry<FamilyLayout, List<String>> entry : mapTypeFamilies.entrySet()) {
        final FamilyLayout family = entry.getKey();
        if (family.getDesc().getMapSchema().getType() == SchemaType.COUNTER) {

            // If this map family of counters has no qualifiers, print entire family.
            if (entry.getValue().isEmpty()) {
                for (String key : row.getQualifiers(family.getName())) {
                    KijiCell<Long> counter = row.getMostRecentCell(family.getName(), key);
                    if (null != counter) {
                        printCell(row.getEntityId(), counter, printStream);
                    }
                }
                // If this map family of counters has been qualified, print only the given columns.
            } else {
                for (String key : entry.getValue()) {
                    KijiCell<Long> counter = row.getMostRecentCell(family.getName(), key);
                    if (null != counter) {
                        printCell(row.getEntityId(), counter, printStream);
                    }
                }
            }
        } else {
            // If this map family of non-counters has no qualifiers, print entire family.
            if (entry.getValue().isEmpty()) {
                NavigableMap<String, NavigableMap<Long, Object>> keyTimeseriesMap = row
                        .getValues(family.getName());
                for (String key : keyTimeseriesMap.keySet()) {
                    for (Entry<Long, Object> timestampedCell : keyTimeseriesMap.get(key).entrySet()) {
                        long timestamp = timestampedCell.getKey();
                        printCell(row.getEntityId(), timestamp, family.getName(), key,
                                timestampedCell.getValue(), printStream);
                    }
                }
                // If this map family of non-counters has been qualified, print only the given columns.
            } else {
                for (String key : entry.getValue()) {
                    NavigableMap<Long, Object> timeseriesMap = row.getValues(family.getName(), key);
                    for (Entry<Long, Object> timestampedCell : timeseriesMap.entrySet()) {
                        long timestamp = timestampedCell.getKey();
                        printCell(row.getEntityId(), timestamp, family.getName(), key,
                                timestampedCell.getValue(), printStream);
                    }
                }
            }
        }
    }

    // Unpack and print result for the group type families.
    for (Entry<FamilyLayout, List<ColumnLayout>> entry : groupTypeColumns.entrySet()) {
        String familyName = entry.getKey().getName();
        for (ColumnLayout column : entry.getValue()) {
            final KijiColumnName colName = KijiColumnName.create(familyName, column.getName());
            if (column.getDesc().getColumnSchema().getType() == SchemaType.COUNTER) {
                final KijiCell<Long> counter = row.getMostRecentCell(colName.getFamily(),
                        colName.getQualifier());
                if (null != counter) {
                    printCell(row.getEntityId(), counter, printStream);
                }
            } else {
                for (Entry<Long, Object> timestampedCell : row
                        .getValues(colName.getFamily(), colName.getQualifier()).entrySet()) {
                    long timestamp = timestampedCell.getKey();
                    printCell(row.getEntityId(), timestamp, colName.getFamily(), colName.getQualifier(),
                            timestampedCell.getValue(), printStream);
                }
            }
        }
    }
    printStream.println("");
}

From source file:org.lilyproject.tools.recordrowvisualizer.RecordRowVisualizer.java

@Override
public int run(CommandLine cmd) throws Exception {
    int result = super.run(cmd);
    if (result != 0) {
        return result;
    }/*ww  w  .  jav  a 2 s  .  c  o m*/

    String recordIdString = cmd.getOptionValue(recordIdOption.getOpt());
    if (recordIdString == null) {
        System.out.println("Specify record id with -" + recordIdOption.getOpt());
        return 1;
    }

    String tableName;
    if (cmd.hasOption(tableOption.getOpt())) {
        tableName = cmd.getOptionValue(tableOption.getOpt());
    } else {
        tableName = Table.RECORD.name;
    }

    IdGenerator idGenerator = new IdGeneratorImpl();
    RecordId recordId = idGenerator.fromString(recordIdString);

    recordRow = new RecordRow();
    recordRow.recordId = recordId;

    // HBase record table
    Configuration conf = HBaseConfiguration.create();
    conf.set("hbase.zookeeper.quorum", zkConnectionString);
    HTableInterface table = new HTable(conf, tableName);

    // Type manager
    zk = new StateWatchingZooKeeper(zkConnectionString, zkSessionTimeout);
    typeMgr = new HBaseTypeManager(idGenerator, conf, zk, new HBaseTableFactoryImpl(conf));

    Get get = new Get(recordId.toBytes());
    get.setMaxVersions();
    Result row = table.get(get);

    NavigableMap<byte[], NavigableMap<byte[], NavigableMap<Long, byte[]>>> root = row.getMap();

    readColumns(root.get(RecordCf.DATA.bytes));

    byte[][] treatedColumnFamilies = { RecordCf.DATA.bytes };

    for (byte[] cf : root.keySet()) {
        if (!isInArray(cf, treatedColumnFamilies)) {
            recordRow.unknownColumnFamilies.add(Bytes.toString(cf));
        }
    }

    executeTemplate("recordrow2html.ftl", Collections.<String, Object>singletonMap("row", recordRow),
            System.out);

    return 0;
}

From source file:org.mahasen.util.SearchUtil.java

/**
 * @param propertyTreeId/* w  w w .  j av a2s.  c  om*/
 * @param initialValue
 * @param lastValue
 * @return
 * @throws InterruptedException
 * @throws MahasenException
 */
private Vector<Id> getResourceIdVector(Id propertyTreeId, String initialValue, String lastValue)
        throws InterruptedException, MahasenException {

    Vector<Id> resultantIds = new Vector<Id>();
    TreeMap propertyTree = mahasenManager.lookupPropertyTreeDHT(propertyTreeId);

    if (propertyTree == null) {
        throw new MahasenException("Property not found");
    } else {

        if (propertyTree.firstKey() instanceof String) {

            System.out.println("this is the property tree " + propertyTree);
            NavigableMap<String, Vector<Id>> resultMap = propertyTree.subMap(initialValue.toLowerCase(), true,
                    lastValue.toLowerCase(), true);

            Iterator keys = resultMap.keySet().iterator();

            while (keys.hasNext()) {
                resultantIds.addAll(resultMap.get(keys.next()));
            }

        } else if (propertyTree.firstKey() instanceof Integer) {

            System.out.println("this is the property tree " + propertyTree);
            NavigableMap<Integer, Vector<Id>> resultMap = propertyTree.subMap(Integer.valueOf(initialValue),
                    true, Integer.valueOf(lastValue), true);

            Iterator keys = resultMap.keySet().iterator();

            while (keys.hasNext()) {
                resultantIds.addAll(resultMap.get(keys.next()));
            }
        }
    }

    return resultantIds;
}