Package com.alvazan.orm.api.z8spi.meta

Examples of com.alvazan.orm.api.z8spi.meta.DboTableMeta


    return session;
  }

  @Override
  public void put(String colFamily, TypedRow typedRow) {
    DboTableMeta metaClass = cachedMeta.getMeta(colFamily);
    if(metaClass == null)
      throw new IllegalArgumentException("DboTableMeta for colFamily="+colFamily+" was not found");

    RowToPersist row = metaClass.translateToRow(typedRow);
   
    //This is if we need to be removing columns from the row that represents the entity in a oneToMany or ManyToMany
    //as the entity.accounts may have removed one of the accounts!!!
    if(row.hasRemoves())
      session.remove(metaClass, row.getKey(), row.getColumnNamesToRemove());
View Full Code Here


  public void removeIndexPoint(IndexPoint pt, String partitionBy, String partitionId) {
    DboColumnMeta colMeta = pt.getColumnMeta();
    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

  public void addIndexPoint(IndexPoint pt, String partitionBy, String partitionId) {
    DboColumnMeta colMeta = pt.getColumnMeta();
    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

    session.persistIndex(cf, indColFamily, rowKey, col);
  }
 
  @Override
  public void remove(String colFamily, TypedRow row) {
    DboTableMeta metaDbo = cachedMeta.getMeta(colFamily);
    if(metaDbo == null)
      throw new IllegalArgumentException("DboTableMeta for colFamily="+colFamily+" was not found");
   
    TypedRow proxy = row;
    Object rowKey = row.getRowKey();
    DboColumnIdMeta idMeta = metaDbo.getIdColumnMeta();
    byte[] byteKey = idMeta.convertToStorage2(rowKey);
    byte[] virtualKey = idMeta.formVirtRowKey(byteKey);
    if(!metaDbo.hasIndexedField()) {
      session.remove(metaDbo, virtualKey);
      return;
    } else if(!(row instanceof NoSqlTypedRowProxy)) {
      //then we don't have the database information for indexes so we need to read from the database
      proxy = find(metaDbo.getColumnFamily(), rowKey);
    }
   
    List<IndexData> indexToRemove = metaDbo.findIndexRemoves((NoSqlTypedRowProxy)proxy, byteKey);
   
    //REMOVE EVERYTHING HERE, we are probably removing extra and could optimize this later
    for(IndexData ind : indexToRemove) {
      session.removeFromIndex(metaDbo, ind.getColumnFamilyName(), ind.getRowKeyBytes(), ind.getIndexColumn());
    }
View Full Code Here

 
  @Override
  public Cursor<KeyValue<TypedRow>> createFindCursor(String colFamily, Iterable<Object> keys, int batchSize) {
    if(keys == null)
      throw new IllegalArgumentException("keys list cannot be null");
    DboTableMeta meta = cachedMeta.getMeta(colFamily);
    if(meta == null)
      throw new IllegalArgumentException("Meta for columnfamily="+colFamily+" was not found");
    DboColumnMeta idMeta = meta.getIdColumnMeta();
    DirectCursor<byte[]> noSqlKeys = new TypedProxyWrappingCursor<Object>(idMeta, new IterableWrappingCursor<Object>(keys));
    return findAllImpl2(meta, keys, noSqlKeys, null, batchSize);
  }
View Full Code Here

  }

  @Override
  public Cursor<IndexPoint> indexView(String columnFamily, String column,
      String partitionBy, String partitionId) {
    DboTableMeta meta = cachedMeta.getMeta(columnFamily);
    if(meta == null)
      throw new IllegalArgumentException("columnFamily="+columnFamily+" not found");
    DboColumnMeta colMeta = meta.getColumnMeta(column);
    if(colMeta == null)
      throw new IllegalArgumentException("Column="+column+" not found on meta info for column family="+columnFamily);
    else if(!colMeta.isIndexed())
      throw new IllegalArgumentException("Column="+column+" is not an indexed column");
    else if(meta.getPartitionedColumns().size() > 1 && partitionBy == null)
      throw new IllegalArgumentException("Must supply partitionBy parameter BECAUSE this column family="+columnFamily+" is partitioned multiple ways");
   
    ScanInfo info = ScanInfo.createScanInfo(colMeta, partitionBy, partitionId);
    AbstractCursor<IndexColumn> indCol = session.scanIndex(info, null, null, null);
    AbstractCursor<IndexPoint> results = new CursorToIndexPoint(meta.getIdColumnMeta(), colMeta, indCol);
    return results;
  }
View Full Code Here

    return impl;
  }

  @Override
  public TypedRow createTypedRow(String colFamily) {
    DboTableMeta metaClass = cachedMeta.getMeta(colFamily);
    if(metaClass == null)
      throw new IllegalArgumentException("DboTableMeta for colFamily="+colFamily+" was not found");
   
    TypedRow r = new TypedRow(null, metaClass);
    return r;
View Full Code Here

  }

  private void updateRow(List<TypedRow> joinedRow, List<TypedColumn> updateList) {
    for(TypedRow r: joinedRow) {
      ViewInfo view = r.getView();
      DboTableMeta meta = view.getTableMeta();
      for(TypedColumn c : r.getColumnsAsColl()) {
        for (TypedColumn columnforUpdate : updateList ) {
          if (columnforUpdate.getName().equals(c.getName())) {
            Object value = columnforUpdate.getValue();
            c.setValue(value);
          }
        }
      }
      put(meta.getColumnFamily(), r)
    }
  }
View Full Code Here

  }

  private void deleteRow(List<TypedRow> typeRowList) {
    for (TypedRow r : typeRowList) {
      ViewInfo view = r.getView();
      DboTableMeta meta = view.getTableMeta();
      remove(meta.getColumnFamily(), r);
    }
  }
View Full Code Here

  }

  private boolean deleteColumn(List<TypedRow> typeRowList, List<TypedColumn> deleteList) {
    for (TypedRow r : typeRowList) {
      ViewInfo view = r.getView();
          DboTableMeta metaClass = view.getTableMeta();
          for(TypedColumn c : r.getColumnsAsColl()) {
            for (TypedColumn columnforDelete : deleteList ) {
              if (columnforDelete.getName().equals(c.getName())) {
                session.removeColumn(metaClass, StandardConverters.convertToBytes(r.getRowKey()), c.getNameRaw());
                return true;
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.z8spi.meta.DboTableMeta

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.