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

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


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

    if(isComposite) {
      IndexColumn c = convertToIndexCol(col);
      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) {
    Object colName = col.getName();
    GenericComposite bigDec = (GenericComposite)colName;
    IndexColumn c = new IndexColumn();
    c.setColumnName(columnName);
    c.setPrimaryKey(bigDec.getPk());
    c.setIndexedValue(bigDec.getIndexedValue());
    c.setValue(col.getByteArrayValue());
    return c;
  }
View Full Code Here

  @Override
  public Holder<IndexColumnInfo> nextImpl() {
    Holder<IndexColumn> holder = cursor.nextImpl();
    if(holder == null)
      return null;
    IndexColumn indCol = holder.getValue();
    if(indCol == null)
      return new Holder<IndexColumnInfo>(null);
    IndexColumnInfo info = new IndexColumnInfo();
    info.putIndexNode(viewInfo, indCol, colMeta);
    return new Holder<IndexColumnInfo>(info);
View Full Code Here

        value = one.convertFromStorage2(column.getCompositeSubName());
      }
      if(!valuesEqual(pt.getIndexedValue(), value)) {
        System.out.println("Entity with rowkey="+pt.getKeyAsString()+" has extra incorrect index point with value="+pt.getIndexedValueAsString()+" correct value should be= "+value);
        s.removeIndexPoint(pt, data.getPartitionBy(), data.getPartitionId());
        IndexColumn col = new IndexColumn();
        col.setColumnName(colName);
        col.setPrimaryKey(pt.getRawKey());
        byte[] indValue = StandardConverters.convertToBytes(value);
        col.setIndexedValue(indValue);
        IndexPoint newPoint = new IndexPoint(pt.getRowKeyMeta(), col,data.getColumnMeta());
        s.addIndexPoint(newPoint, data.getPartitionBy(), data.getPartitionId());
        return true;
      }
    }
View Full Code Here

    ScanInfo info = ScanInfo.createScanInfo(colMeta, partitionBy, partitionId);
    byte[] rowKey = info.getRowKey();
    String indColFamily = info.getIndexColFamily();
    DboTableMeta cf = info.getEntityColFamily();
   
    IndexColumn col = new IndexColumn();
    col.setIndexedValue(pt.getRawIndexedValue());
    col.setPrimaryKey(pt.getRawKey());
    session.removeFromIndex(cf, indColFamily, rowKey, col);
  }
View Full Code Here

    ScanInfo info = ScanInfo.createScanInfo(colMeta, partitionBy, partitionId);
    byte[] rowKey = info.getRowKey();
    String indColFamily = info.getIndexColFamily();
    DboTableMeta cf = info.getEntityColFamily();
   
    IndexColumn col = new IndexColumn();
    if(colMeta != null)
      col.setColumnName(colMeta.getColumnName());
    col.setIndexedValue(pt.getRawIndexedValue());
    col.setPrimaryKey(pt.getRawKey());
    session.persistIndex(cf, indColFamily, rowKey, col);
  }
View Full Code Here

  @Override
  public Holder<IndexColumnInfo> previousImpl() {
    Holder<IndexColumn> holder = cursor.previousImpl();
    if(holder == null)
      return null;
    IndexColumn indCol = holder.getValue();
    if(indCol == null)
      return new Holder<IndexColumnInfo>(null);
    IndexColumnInfo info = new IndexColumnInfo();
    info.putIndexNode(viewInfo, indCol, colMeta);
    return new Holder<IndexColumnInfo>(info);
View Full Code Here

    if(holder == null)
      return null;
    KeyValue<Row> pkCol = holder.getValue();
    if(pkCol == null)
      return new Holder<IndexColumnInfo>(null);
    IndexColumn c = new IndexColumn();
    byte[] pk = null;
    if (pkCol.getValue() == null)
      return new Holder<IndexColumnInfo>(null);
    else
      pk = pkCol.getValue().getKey();
    if (pk != null) {
      c.setPrimaryKey(colMeta.getOwner().getIdColumnMeta().unformVirtRowKey(pk));
      c.setIndexedValue(colMeta.getOwner().getIdColumnMeta().unformVirtRowKey(pk));
      c.setColumnName(colMeta.getOwner().getIdColumnMeta().getColumnName());
      c.setValue(pk);
    }
    IndexColumnInfo info = new IndexColumnInfo();
    info.putIndexNode(viewInfo, c, colMeta);
    return new Holder<IndexColumnInfo>(info);
  }
View Full Code Here

   
  }

  private Holder<IndexColumnInfo> createResult(
      com.alvazan.orm.api.z8spi.iter.AbstractCursor.Holder<IndexColumn> next) {
    IndexColumn indCol = next.getValue();
    IndexColumnInfo info = new IndexColumnInfo();   
   
    if(cachedFromRightResults.hasNext()) {
      //We need to compare lastCachedRightSide with our incoming to make see if they pair up
      //or else move to the next right side answer.
      ByteArray pkOfRightView = lastCachedRightSide.getPrimaryKey(rightView);
      ByteArray valueOfLeft = new ByteArray(indCol.getIndexedValue());
      if(!valueOfLeft.equals(pkOfRightView)) {
        lastCachedRightSide = cachedFromRightResults.next();
      }   
 
      info.mergeResults(lastCachedRightSide);
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

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.