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

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


      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);
     
      r.put(c);
    }
  }
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

    Class fieldType = getClassType();
    return getStorageType(fieldType);
  }

  public void translateFromColumn(Row row, TypedRow entity) {
    Column column = row.getColumn(getColumnNameAsBytes());
    if(column == null) {
      return;
    }

    Long timestamp = column.getTimestamp();
    entity.addColumn(this, getColumnNameAsBytes(), column.getValue(), timestamp);
  }
View Full Code Here

    TypedColumn typedCol = typedRow.getColumn(getColumnName());
    Object value = null;
    byte[] byteVal = null;
    if(typedCol != null) {
      Column col = new Column();
      row.getColumns().add(col);
     
      value = typedCol.getValue();
      byteVal = convertToStorage2(value);
      col.setName(getColumnNameAsBytes());
      col.setValue(byteVal);
    }   
    addIndexInfo(info, value, byteVal);
    removeIndexInfo(info, value, byteVal);
  }
View Full Code Here

      DboColumnMeta colMeta = col.getColumnMeta();
      if(colMeta != null)
        continue;
     
      List<Column> columns = row.getColumns();
      Column c = new Column();
      c.setName(col.getNameRaw());
      c.setValue(col.getValueRaw());
      columns.add(c);
    }
   
    for(byte[] name : typedRow.getColumnsToRemove()) {
      row.addEntityToRemove(name);
View Full Code Here

  public void translateFromColumn(Row row, TypedRow entity) {
    String columnName = getColumnName();
    byte[] namePrefix = StandardConverters.convertToBytes(columnName);
    Collection<Column> columns = row.columnByPrefix(namePrefix);
    if (columns != null && !columns.isEmpty()) {
      Column column = columns.iterator().next();
      byte[] value = column.getValue();
      byte[] fullName = column.getName();
      //strip off the prefix to get the foreign key
      int pkLen = fullName.length-namePrefix.length;
      byte[] fk = new byte[pkLen];
      for(int i = namePrefix.length; i < fullName.length; i++) {
        fk[i-namePrefix.length] =  fullName[i];
      }
      entity.addColumn(this, fullName, namePrefix, fk, value, column.getTimestamp());
    }
    else {
         //Check if the column exists in old way
      Column column = row.getColumn(getColumnNameAsBytes());
      if(column == null)
        return;
      byte[] value = column.getValue();
      entity.addColumn(this, getColumnNameAsBytes(), value, column.getTimestamp());
    }
  }
View Full Code Here

  @Override
  public void translateToColumn(InfoForIndex<TypedRow> info) {
    TypedRow entity = info.getEntity();
    RowToPersist row = info.getRow();

    Column col = new Column();
    row.getColumns().add(col);

    TypedColumn column = entity.getColumn(getColumnName());
    if (column != null) {
      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);
      Object primaryKey = column.getValue();
      addIndexInfo(info, primaryKey, byteVal);
      removeIndexInfo(info, primaryKey, byteVal)
    } else {
      byte[] prefix = StandardConverters.convertToBytes(getColumnName());
      col.setName(prefix);
    }
  }
View Full Code Here

    for(Object key : toBeAdded.keySet()) {
      Object value = toBeAdded.get(key);
     
      byte[] name = formTheName(key);
      byte[] byteVal = valueConverter.convertToNoSql(value);
      Column c = new Column();
      c.setName(name);
      c.setValue(byteVal);
     
      row.getColumns().add(c);
    }
  }
View Full Code Here

   
    //now process all the existing columns (we can add same entity as many times as we like and it does not
    //get duplicated)
    for(T val : toBeAdded) {
      byte[] name = formTheName(val);
      Column c = new Column();
      c.setName(name);
     
      row.getColumns().add(c);
    }
  }
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

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.