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

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


  @Override
  public void translateFromColumn(Row row, OWNER entity, NoSqlSession session) {
    if( row.getColumns().isEmpty() )
      ReflectionUtil.putFieldValue(entity, field, new Integer(0));
    else {
      Column col = row.getColumns().iterator().next();
      ReflectionUtil.putFieldValue(entity, field, col.getTtl());
    }
  }
View Full Code Here


  @Override
  public void translateToColumn(InfoForIndex<TypedRow> info) {
    TypedRow entity = info.getEntity();
    RowToPersist row = info.getRow();
    Column col = new Column();
    TypedColumn column = entity.getColumn(getColumnName());

    byte[] byteVal = convertToStorage2(column.getValue());
    byte[] prefix = StandardConverters.convertToBytes(getColumnName());

    byte[] pkData = byteVal;
    byte[] name = new byte[prefix.length + pkData.length];
    for(int i = 0; i < name.length; i++) {
      if(i < prefix.length)
        name[i] = prefix[i];
      else
        name[i] = pkData[i-prefix.length];
    }
    col.setName(name);
    row.getColumns().add(col);
    Object primaryKey = column.getValue();
    addIndexInfo(info, primaryKey, byteVal);
    removeIndexInfo(info, primaryKey, byteVal);
  }
View Full Code Here

    }

    private List<Column> createColumns(int i, DboTableMeta table2) {
      List<Column> cols = new ArrayList<Column>();
      for(DboColumnMeta colMeta : table2.getAllColumns()) {
        Column c = new Column();
        byte[] name = colMeta.getColumnNameAsBytes();
        c.setName(name);
        long val = r.nextLong();
        byte[] value = colMeta.convertToStorage2(val);
        c.setValue(value);
        cols.add(c);
      }
      return cols;
    }
View Full Code Here

          Integer.class, name);
      flippedNumber ^= (1 << 31);
      name = Bytes.toBytes(flippedNumber);
    }
    byte[] val = column.getValue();
    Column c = new Column();
    c.setName(name);
    if (val.length != 0)
      c.setValue(val);
    return new Holder<T>((T) c);
  }
View Full Code Here

  public String toString() {
    return "MetaCommonField [field='" + field.getDeclaringClass().getName()+"."+field.getName()+"(field type=" +field.getType()+ "), columnName=" + columnName + "]";
  }
 
  public void translateFromColumn(Row row, OWNER entity, NoSqlSession session) {
    Column column = row.getColumn(metaDbo.getColumnNameAsBytes());
   
    if(column == null) {
      column = new Column();
    }
   
    Object value = converter.convertFromNoSql(column.getValue());
    ReflectionUtil.putFieldValue(entity, field, value);
  }
View Full Code Here

  @Override
  public void translateToColumn(InfoForIndex<OWNER> info) {
    OWNER entity = info.getEntity();
    RowToPersist row = info.getRow();
   
    Column col = new Column();
    row.getColumns().add(col);

    Object value = ReflectionUtil.fetchFieldValue(entity, field);
    byte[] byteVal = translateValue(value);
    byte[] colBytes = StandardConverters.convertToBytes(columnName);
    col.setName(colBytes);
    col.setValue(byteVal);
   
    StorageTypeEnum storageType = metaDbo.getStorageType();
    addIndexInfo(info, value, byteVal, storageType);
    removeIndexInfo(info, value, byteVal, storageType);
  }
View Full Code Here

  private Holder<T> buildHolder(DBObject col) {
    Set<String> singleKey = col.keySet();
    String colName = singleKey.iterator().next();
    byte[] name = StandardConverters.convertFromString(byte[].class, colName);
    byte[] val = StandardConverters.convertToBytes(col.get(colName));
    Column c = new Column();
    c.setName(name);
    if (val.length != 0)
      c.setValue(val);
    return new Holder<T>((T) c);

  }
View Full Code Here

      com.netflix.astyanax.model.Row<byte[], byte[]> row, Row r) {
    for(com.netflix.astyanax.model.Column<byte[]> col : row.getColumns()) {
      byte[] name = col.getName();
      byte[] val = col.getByteArrayValue();
      long timestamp = col.getTimestamp();
      Column c = new Column();
      c.setName(name);
      if(val.length != 0)
        c.setValue(val);
      c.setTimestamp(timestamp);
      c.setTtl(col.getTtl());

      r.put(c);
    }
  }
View Full Code Here

  private void processColumns(List<org.apache.hadoop.hbase.KeyValue> hKeyValue, Row r) {
    for (org.apache.hadoop.hbase.KeyValue col : hKeyValue) {
      r.setKey(col.getRow());
      byte[] name = col.getQualifier();
      byte[] val = col.getValue();
      Column c = new Column();
      c.setName(name);
      if (val.length != 0)
        c.setValue(val);
      r.put(c);
    }
  }
View Full Code Here

  private Object translateFromSingleEntity(Row row, NoSqlSession session) {
    Object proxy = null;
    String columnName = getColumnName();
    byte[] colBytes = StandardConverters.convertToBytes(columnName);
    Column column = row.getColumn(colBytes);
    if (column == null) {
      column = new Column();
    }
    if (field.getType().equals(ToOneProvider.class)) {
      // THIS IS NOT DONE YET
      proxy = translateFromToComposite(row, session);
    } else {
View Full Code Here

TOP

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

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.