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

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


  }

  private Holder<TimeValColumn> translate(Holder<Column> item) {
    if(item == null)
      return null;
    Column col = item.getValue();
    BigInteger pk = (BigInteger) idColumnMeta.convertFromStorage2(col.getName());
    Object val = colMeta.convertFromStorage2(col.getValue());
    TimeValColumn tv = new TimeValColumn(pk, val, col.getTimestamp());
    return new Holder<TimeValColumn>(tv);
  }
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

*/
  private com.alvazan.orm.api.z8spi.iter.AbstractCursor.Holder<T> buildHolder(
      KeyValue column) {
    byte[] name = column.getQualifier();
    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

  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

  private Object translateFromToComposite(Row row, NoSqlSession session) {
    // THIS IS NOT DONE YET
    byte[] bytes = StandardConverters.convertToBytes(columnName);
    Collection<Column> columns = row.columnByPrefix(bytes);
    if (columns != null && !columns.isEmpty()) {
      Column column = columns.iterator().next();
      byte[] fullName = column.getName();
      // strip off the prefix to get the foreign key
      int pkLen = fullName.length - bytes.length;
      byte[] fk = new byte[pkLen];
      for (int i = bytes.length; i < fullName.length; i++) {
        fk[i - bytes.length] = fullName[i];
View Full Code Here

        System.arraycopy(bytes, 0, bytesandId, 0, bytes.length);
        System.arraycopy(rowid, 0, bytesandId, bytes.length, rowid.length);
        Collection<Column> columns = row.columnByPrefix(bytesandId);
        if (columns != null && !columns.isEmpty()) {
            // Id is present
            Column column = columns.iterator().next();
            byte[] fullName = column.getName();
            // strip off the prefix to get the foreign key
            int pkLen = fullName.length - bytesandrowid;
            byte[] pk = new byte[pkLen];
            for (int i = bytesandrowid; i < fullName.length; i++) {
                pk[i - bytesandrowid] = fullName[i];
View Full Code Here

      return;
    for (PROXY proxy : toBeAdded) {
      byte[] name = formTheName(proxy);
      if (name != null) {
        // rowkey is not null. i.e., NoSqlId is present
        Column idColumn = new Column();
        idColumn.setName(name);
        idColumn.setValue(null);
        row.getColumns().add(idColumn);
        byte[] idValue = translateOne(proxy);
        Field[] fieldsinClass = proxy.getClass().getDeclaredFields();
        for (Field singleField : fieldsinClass) {
          singleField.setAccessible(true);
View Full Code Here

    }
  }

  private void addColumn(PROXY proxy, Field singleField, byte[] idValue, RowToPersist row) {
    Object value = ReflectionUtil.fetchFieldValue(proxy, singleField);
    Column c = new Column();
    byte[] columnName = formTheColumnName(proxy, idValue, singleField);
    c.setName(columnName);
        if (value != null) {
            byte[] columnValue = null;
            NoSqlConverter customConv = singleField.getAnnotation(NoSqlConverter.class);
            if (customConv != null) {
                columnValue = getBytesValue(value, customConv);
            } else {
                columnValue = StandardConverters.convertToBytes(value);
            }
            c.setValue(columnValue);
        }
    row.getColumns().add(c);
  }
View Full Code Here

    return entities;
  }

  private void addColumnWithoutId(PROXY proxy, Field singleField, RowToPersist row) {
    Object value = ReflectionUtil.fetchFieldValue(proxy, singleField);
    Column c = new Column();
    //byte[] columnName = formTheColumnName(proxy, idValue, singleField);

    byte[] prefix = StandardConverters.convertToBytes(columnName);
    byte[] singleFieldName = StandardConverters.convertToBytes(singleField.getName());
    byte[] columnName = new byte[ prefix.length + singleFieldName.length];
    for (int i = 0; i < columnName.length; i++) {
      if (i < prefix.length)
        columnName[i] = prefix[i];
      else
        columnName[i] = singleFieldName[i - prefix.length];
    }
    c.setName(columnName);
    if (value != null) {
            byte[] columnValue = null;
            NoSqlConverter customConv = singleField.getAnnotation(NoSqlConverter.class);
            if (customConv != null) {
                columnValue = getBytesValue(value, customConv);
            } else {
                columnValue = StandardConverters.convertToBytes(value);
            }
            c.setValue(columnValue);
    }
    row.getColumns().add(c);
  }
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

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.