Package com.alvazan.orm.api.z8spi.action

Examples of com.alvazan.orm.api.z8spi.action.IndexColumn


  @Override
  public com.alvazan.orm.api.z8spi.iter.AbstractCursor.Holder<IndexColumn> previousImpl() {
    loadCache(true);
    if (cachedRows == null || !cachedRows.hasPrevious())
      return null;
    IndexColumn indexCol = convertToIndexColFromId(cachedRows.previous());
    return new Holder<IndexColumn>(indexCol);
  }
View Full Code Here


    IndexColumn indexCol = convertToIndexColFromId(cachedRows.previous());
    return new Holder<IndexColumn>(indexCol);
  }

  private IndexColumn convertToIndexColFromId(byte[] col) {
    IndexColumn c = new IndexColumn();
    c.setPrimaryKey(col);
    c.setIndexedValue(col);
    return c;
  }
View Full Code Here

  private void persistIndex(PersistIndex action, MetaLookup ormSession) {
    String indexCfName = action.getIndexCfName();
    Info info = lookupOrCreate2(indexCfName, ormSession);
    DBCollection table = info.getDbObj();
    byte[] rowKey = action.getRowKey();
    IndexColumn column = action.getColumn();
    byte[] key = column.getIndexedValue();
    byte[] value = column.getPrimaryKey();
    BasicDBObject doc = findIndexRow(table, rowKey, value);
    Object keyToPersist = null;
    if (indexCfName.equalsIgnoreCase("StringIndice")) {
      keyToPersist = StandardConverters.convertFromBytes(String.class, key);
    } else if ((indexCfName.equalsIgnoreCase("IntegerIndice"))) {
View Full Code Here

    if (colFamily.equalsIgnoreCase("BytesIndice"))
      return;
    Info info = fetchDbCollectionInfo(colFamily, ormSession);
    DBCollection table = info.getDbObj();
    byte[] rowKey = action.getRowKey();
    IndexColumn column = action.getColumn();
    byte[] value = column.getPrimaryKey();
    BasicDBObject doc = findIndexRow(table, rowKey, value);
    if (doc == null) {
      if (log.isInfoEnabled())
        log.info("Index: " + column.toString() + " already removed.");
    } else {
      table.remove(doc);
    }
  }
View Full Code Here

  private void fillinCache(List<IndexColumn> finalRes, Set<ByteArray> cursor) {
    if (cursor.size() == 0) {
      cachedRows = new ArrayList<IndexColumn>().listIterator();
    } else {
      for (ByteArray row : cursor) {
        IndexColumn c = convertToIndexColFromInId(row);
        finalRes.add(c);
      }
      cachedRows = finalRes.listIterator();
    }
  }
View Full Code Here

      cachedRows = finalRes.listIterator();
    }
  }

  private IndexColumn convertToIndexColFromInId(ByteArray rowKey) {
    IndexColumn c = new IndexColumn();
    c.setPrimaryKey(rowKey.getKey());
    c.setIndexedValue(rowKey.getKey());
    return c;
  }
View Full Code Here

 
  private void persistIndex(PersistIndex action, NoSqlEntityManager ormSession) {
    String colFamily = action.getIndexCfName();
    Table table = lookupColFamily(colFamily, (NoSqlEntityManager) ormSession);
    byte[] rowKey = action.getRowKey();
    IndexColumn column = action.getColumn();
    IndexedRow row = (IndexedRow) table.findOrCreateRow(rowKey);
    row.addIndexedColumn(column.copy());
  }
View Full Code Here

    if (colFamily.equalsIgnoreCase("BytesIndice"))
      return;
    Table table = lookupColFamily(colFamily, (NoSqlEntityManager) ormSession);
   
    byte[] rowKey = action.getRowKey();
    IndexColumn column = action.getColumn();
    IndexedRow row = (IndexedRow) table.findOrCreateRow(rowKey);
    row.removeIndexedColumn(column.copy());   
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  private Holder<T> buildHolder(com.netflix.astyanax.model.Column<byte[]> col) {

    if(isComposite) {
      IndexColumn c = convertToIndexCol(col, columnName);
      return new Holder<T>((T) c);
    } else {
      Object obj = col.getName();
      com.alvazan.orm.api.z8spi.action.Column c = new com.alvazan.orm.api.z8spi.action.Column();
      byte[] name = (byte[])obj;
      c.setName(name);
      c.setValue(col.getByteArrayValue());
      c.setTimestamp(col.getTimestamp());
      return new Holder<T>((T) c);
    }
  }
View Full Code Here

  }

  public static IndexColumn convertToIndexCol(com.netflix.astyanax.model.Column<byte[]> col, String colNameStr) {
    Object colName = col.getName();
    GenericComposite bigDec = (GenericComposite)colName;
    IndexColumn c = new IndexColumn();
    c.setColumnName(colNameStr);
    c.setPrimaryKey(bigDec.getPk());
    c.setIndexedValue(bigDec.getIndexedValue());
    c.setValue(col.getByteArrayValue());
    c.setTtl(col.getTtl());
    return c;
  }
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.z8spi.action.IndexColumn

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.