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

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


    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


    keyList = new ArrayList<byte[]>();
    while(true) {
      Holder<IndexColumn> holder = cursor.nextImpl();
      if(holder == null)
        break;
      IndexColumn val = holder.getValue();
      //NOTE: Here the indCol.getPrimaryKey is our owning entities primary key
      // and the indexedValue is the actual foreign key to the other table
      byte[] indexedValue = val.getIndexedValue();
      keyList.add(indexedValue);
      T proxy = convertIdToProxy(indexedValue, session);
      proxyList.add(proxy);
      if(proxyList.size() > batchSize)
        break;
View Full Code Here

    keyList = new ArrayList<byte[]>();
    while(true) {
      Holder<IndexColumn> holder = cursor.previousImpl();
      if(holder == null)
        break;
      IndexColumn val = holder.getValue();
      //NOTE: Here the indCol.getPrimaryKey is our owning entities primary key
      // and the indexedValue is the actual foreign key to the other table
      byte[] indexedValue = val.getIndexedValue();
      keyList.add(0, indexedValue);
      T proxy = convertIdToProxy(indexedValue, session);
      proxyList.add(0, proxy);
      if(proxyList.size() > batchSize)
        break;
View Full Code Here

    //not exist
    NoSqlSession session = mgr.getSession();
    DboTableMeta table = mgr.find(DboTableMeta.class, "PartAccount");
    DboColumnMeta colMeta = table.getColumnMeta("businessName");
    ScanInfo info = ScanInfo.createScanInfo(colMeta, null, null);
    IndexColumn col = new IndexColumn();
    col.setColumnName("businessName");
    String key = "nonexistpk";
    byte[] pk = StandardConverters.convertToBytes(key);
    byte[] value = StandardConverters.convertToBytes(acc.getBusinessName());
    col.setIndexedValue(value);
    col.setPrimaryKey(pk);
    session.persistIndex(table, info.getIndexColFamily(), info.getRowKey(), col);
   
    mgr.flush();
   
    Iterable<KeyValue<PartAccount>> all = PartAccount.findWithBizName(mgr, acc.getBusinessName());
View Full Code Here

            indValue = row.getFloat("colname");
        }
        ByteBuffer data = row.getBytes("colvalue");
        byte[] val = new byte[data.remaining()];
        data.get(val);
    IndexColumn c = new IndexColumn();
    // c.setColumnName(columnName); Will we ever need this now?
    if (val != null) {
      c.setPrimaryKey(val);
    }
    if (indValue != null) {
      c.setIndexedValue(StandardConverters.convertToBytes(indValue));
    }

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

    @Override
    public com.alvazan.orm.api.z8spi.iter.AbstractCursor.Holder<IndexColumn> nextImpl() {
        loadCache(false);
        if (cachedRows == null || !cachedRows.hasNext())
            return null;
        IndexColumn indexCol = Cql3Util.convertToIndexCol(cachedRows.next(), indTable);
        return new Holder<IndexColumn>(indexCol);
    }
View Full Code Here

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

    private void persistIndex(PersistIndex action, MetaLookup ormSession) {
        String indexCfName = action.getIndexCfName();
        String table = lookupOrCreate(indexCfName, ormSession);
        byte[] rowKey = action.getRowKey();
        IndexColumn column = action.getColumn();
        byte[] key = column.getIndexedValue();
        byte[] value = column.getPrimaryKey();

        try {
            Object keyObject = null;
            if (key != null) {
                PreparedStatement statement = session.prepare("INSERT INTO " + keys + "." + table + "(id, colname, colvalue) VALUES (?, ?, ?)");
View Full Code Here

        if (colFamily.equalsIgnoreCase("BytesIndice"))
            return;

        String table = lookupOrCreate(colFamily, ormSession);
        String rowKey = StandardConverters.convertFromBytes(String.class, action.getRowKey());
        IndexColumn column = action.getColumn();
        byte[] fk = column.getPrimaryKey();
        byte[] indexedValue = action.getColumn().getIndexedValue();
        Object indValue = null;
        if (table.equalsIgnoreCase("StringIndice"))
            indValue = StandardConverters.convertFromBytes(String.class, indexedValue);
        else if (table.equalsIgnoreCase("IntegerIndice"))
            indValue = StandardConverters.convertFromBytes(Long.class, indexedValue);
        else if (table.equalsIgnoreCase("DecimalIndice"))
            indValue = StandardConverters.convertFromBytes(Float.class, indexedValue);
        boolean exists = findIndexRow(table, rowKey, fk, indValue);
        if (!exists) {
            if (log.isInfoEnabled())
                log.info("Index: " + column.toString() + " already removed.");
        } else {
            Clause eqClause = QueryBuilder.eq("id", rowKey);
            Clause indClause = null;
            if (indValue != null) {
                indClause = QueryBuilder.eq("colname", indValue);
View Full Code Here

  @Override
  public com.alvazan.orm.api.z8spi.iter.AbstractCursor.Holder<IndexColumn> nextImpl() {
    loadCache(false);
    if (cachedRows == null || !cachedRows.hasNext())
      return null;
    IndexColumn indexCol = MongoDbUtil.convertToIndexCol(cachedRows.next());
    return new Holder<IndexColumn>(indexCol);
  }
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.