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 = MongoDbUtil.convertToIndexCol(cachedRows.previous());
    return new Holder<IndexColumn>(indexCol);
  }
View Full Code Here


  }

  public static IndexColumn convertToIndexCol(DBObject col) {
    Object indValue = col.get("k");
    Object pk = col.get("v");
    IndexColumn c = new IndexColumn();
    // c.setColumnName(columnName); Will we ever need this now?
    if (pk != null) {
      c.setPrimaryKey((byte[]) pk);
    }
    if (indValue != null) {
      c.setIndexedValue(StandardConverters.convertToBytes(indValue));
    }

    c.setValue(null);
    return c;
  }
View Full Code Here

        batchListener.afterFetchingNextBatch(cursor.count());

      List<IndexColumn> finalRes = new ArrayList<IndexColumn>();
      while (cursor.hasNext()) {
        DBObject mdbrow = cursor.next();
        IndexColumn indexCol = MongoDbUtil.convertToIndexCol(mdbrow);
        finalRes.add(indexCol);
      }
      cachedRows = finalRes.listIterator();
      needToGetBatch = false;
      if(reverse) {
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

    Holder<IndexColumnInfo> next = cursor.nextImpl();
    if(next == null)
      return null;
    IndexColumnInfo info = next.getValue();
    Wrapper wrapper = info.getIndexNode(view);
    IndexColumn indNode = wrapper.getCol();
    byte[] key = indNode.getPrimaryKey();
    if(key == null)
      throw new IllegalArgumentException("key was null, index data seems corrupt on view="+view+" col="
          +wrapper.getColMeta()+" some value is tied to a null primary key.  Should" +
              " never happen even in face of eventual consistent, should never happen");
    return new Holder<byte[]>(key);
View Full Code Here

    Holder<IndexColumnInfo> prev = cursor.previousImpl();
    if(prev == null)
      return null;
    IndexColumnInfo info = prev.getValue();
    Wrapper wrapper = info.getIndexNode(view);
    IndexColumn indNode = wrapper.getCol();
    byte[] key = indNode.getPrimaryKey();
    if(key == null)
      throw new IllegalArgumentException("key was null, index data seems corrupt on view="+view+" col="
          +wrapper.getColMeta()+" some value is tied to a null primary key.  Should" +
              " never happen even in face of eventual consistent, should never happen");
    return new Holder<byte[]>(key);
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();
    col.setIndexedValue(pt.getRawIndexedValue());
    col.setPrimaryKey(pt.getRawKey());
    session.persistIndex(cf, indColFamily, rowKey, col);
  }
View Full Code Here

  }
  public byte[] getPrimaryKeyRaw(ViewInfo info) {
    Wrapper wrapper = colNameToValue.get(info);
    if(wrapper == null)
      return null;
    IndexColumn col = colNameToValue.get(info).getCol();
    return col.getPrimaryKey();
  }
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.