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

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


    }

    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


                r.setKey(cqlRowKey);
                byte[] name = StandardConverters.convertFromString(byte[].class, cqlRow.getString("colname"));
                ByteBuffer data = cqlRow.getBytes("colvalue");
                byte[] val = new byte[data.remaining()];
                data.get(val);
                Column c = new Column();
                c.setName(name);
                if (val.length != 0)
                    c.setValue(val);
                r.put(c);

                kv.setValue(r);
                ByteArray b = new ByteArray(cqlRowKey);
                map.put(b, kv);
View Full Code Here

  public void basicPutTest() {

    TreeMap<ByteArray, Column> map = new TreeMap<ByteArray, Column>(new Utf8Comparator());
    RowImpl row = new RowImpl(map);
   
    Column c1 = creteColumn("6e756d526f6f6d73", (byte) 1);
    Column c2 = creteColumn("6275696c64696e67", (byte) 2);
    Column c3 = creteColumn("6e616d65", (byte) 3);
    Column c4 = creteColumn("5f686973746f72790000013caaa1b98d5f7374617465", (byte) 4);
    Column c5 = creteColumn("5f686973746f72790000013caaa1b98d6275696c64696e67", (byte) 5);
    Column c6 = creteColumn("5f686973746f72790000013caaa1b98d6e756d526f6f6d73", (byte) 6);
    Column c7 = creteColumn("5f686973746f72790000013caaa1b9ba6275696c64696e67", (byte) 7);
    Column c8 = creteColumn("5f686973746f72790000013caaa1b9ba6e756d526f6f6d73", (byte) 8);
   
    row.put(c1);
    Assert.assertEquals(1, row.getColumns().size());
    row.put(c2);
    Assert.assertEquals(2, row.getColumns().size());
View Full Code Here

  }

  private Column creteColumn(String hex, byte i) {
    byte[] name = StandardConverters.convertFromString(byte[].class, hex);
    byte[] value = new byte[] { i };
    Column c = new Column(name, value);
    return c;
  }
View Full Code Here

    private com.alvazan.orm.api.z8spi.iter.AbstractCursor.Holder<T> buildHolder(com.datastax.driver.core.Row column) {
        byte[] name = StandardConverters.convertFromString(byte[].class, column.getString("colname"));
        ByteBuffer data = column.getBytes("colvalue");
        byte[] val = new byte[data.remaining()];
        data.get(val);
        Column c = new Column();
        c.setName(name);
        if (val.length != 0)
            c.setValue(val);
        return new Holder<T>((T) c);
    }
View Full Code Here

    MetaClassSingle<T> metaClassSingle = retrieveMeta(row);
    return metaClassSingle.translateFromRow(row, session);
  }

  private MetaClassSingle<T> retrieveMeta(Row row) {
    Column column = row.getColumn(discColAsBytes);
   
    String type = StandardConverters.convertFromBytes(String.class, column.getValue());
    MetaClassSingle<T> metaClassSingle = this.dbTypeToMeta.get(type);
    return metaClassSingle;
  }
View Full Code Here

    String type = classToType.get(clazz.getName());
    MetaClassSingle<T> metaClassSingle = dbTypeToMeta.get(type);
    RowToPersist translateToRow = metaClassSingle.translateToRow(entity);
   
    byte[] value = StandardConverters.convertToBytes(type);
    Column typeCol = new Column();
    typeCol.setName(discColAsBytes);
    typeCol.setValue(value);
    translateToRow.getColumns().add(typeCol);
    return translateToRow;
  }
View Full Code Here

   
    byte[] rowKey = StandardConverters.convertToBytes("myone_index");
   
    List<Column> columns = new ArrayList<Column>();
   
    columns.add(new Column(toDecBytes(5000.5), new byte[0]));
    columns.add(new Column(toDecBytes(20.333), new byte[0]));
    columns.add(new Column(toDecBytes(200.1111111111111), new byte[0]));
    columns.add(new Column(toDecBytes(10.9999999999999999999999999), new byte[0]));
    columns.add(new Column(toDecBytes(60.5), new byte[0]));
    columns.add(new Column(toDecBytes(700), new byte[0]));
    columns.add(new Column(toDecBytes(500023432430.44), new byte[0]));
    columns.add(new Column(toDecBytes(550.32), new byte[0]));
    columns.add(new Column(toDecBytes(340), new byte[0]));
    columns.add(new Column(toDecBytes(40.5), new byte[0]));
    columns.add(new Column(toDecBytes(-40.8888888888888888), new byte[0]));
    columns.add(new Column(toDecBytes(-200.23), new byte[0]));
    columns.add(new Column(toDecBytes(-500), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("123000111222333444555666.66666666")), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("-123000111222333444555666.888888")), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("3")), new byte[0]));
    columns.add(new Column(toDecBytes(new BigDecimal("-3")), new byte[0]));
   
    session.put(tableMeta, rowKey, columns);
    session.flush();

    byte[] from = toDecBytes(-250);
    byte[] to = toDecBytes(12);
    Cursor<Column> results = session.columnSlice(tableMeta, rowKey, from, to, 2, BigDecimal.class);//(scanInfo, from, to, 2);
   
    int counter = 0;
    while(results.next()) {
      Column col = results.getCurrent();
      if(counter == 0) {
        Assert.assertEquals(-200.23, toDouble(col.getName()).doubleValue());
      }
      counter++;
    }
    Assert.assertEquals(5, counter);   
  }
View Full Code Here

   
    byte[] rowKey = StandardConverters.convertToBytes("myone_index");
   
    List<Column> columns = new ArrayList<Column>();
   
    columns.add(new Column(toIntBytes(500), new byte[0]));
    columns.add(new Column(toIntBytes(20), new byte[0]));
    columns.add(new Column(toIntBytes(200), new byte[0]));
    columns.add(new Column(toIntBytes(10), new byte[0]));
    columns.add(new Column(toIntBytes(60), new byte[0]));
    columns.add(new Column(toIntBytes(700), new byte[0]));
    columns.add(new Column(toIntBytes(500023432430L), new byte[0]));
    columns.add(new Column(toIntBytes(550), new byte[0]));
    columns.add(new Column(toIntBytes(340), new byte[0]));
    columns.add(new Column(toIntBytes(40), new byte[0]));
    columns.add(new Column(toIntBytes(-40), new byte[0]));
    columns.add(new Column(toIntBytes(-200), new byte[0]));
    columns.add(new Column(toIntBytes(-500), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("123000111222333444555666")), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("-123000111222333444555666")), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("3")), new byte[0]));
    columns.add(new Column(toIntBytes(new BigInteger("-3")), new byte[0]));
   
    session.put(tableMeta, rowKey, columns);
    session.flush();

    byte[] from = toIntBytes(-250);
    byte[] to = toIntBytes(50);
    Cursor<Column> results = session.columnSlice(tableMeta, rowKey, from, to, 2, BigInteger.class);
   
    int counter = 0;
    while(results.next()) {
      Column col = results.getCurrent();
      if(counter == 0)
        Assert.assertEquals(-200L, toLong(col.getName()).longValue());
      counter++;
    }
    Assert.assertEquals(7, counter);
  }
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

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.