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

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


  }

  private ColumnFamilyDefinition addRowKeyValidation(DboTableMeta cf,
      ColumnFamilyDefinition def2) {
    ColumnFamilyDefinition def = def2;
    DboColumnMeta idColumnMeta = cf.getIdColumnMeta();
    StorageTypeEnum rowKeyType = idColumnMeta.getStorageType();
    switch (rowKeyType) {
    case STRING:
      def = def.setKeyValidationClass("UTF8Type");
      break;
    case INTEGER:
View Full Code Here


  @Override
  public AbstractCursor<IndexColumn> scanIndex(ScanInfo scan, Key from,
      Key to, Integer batchSize, BatchListener l, MetaLookup mgr) {
    byte[] rowKey = scan.getRowKey();
    String indexTableName = scan.getIndexColFamily();
    DboColumnMeta colMeta = scan.getColumnName();
    CursorOfHbaseIndexes cursor = new CursorOfHbaseIndexes(rowKey, batchSize, l, indexTableName, from, to);
    cursor.setupMore(hTable, colMeta);
    if (!scan.getEntityColFamily().isVirtualCf() && from == null
        && to == null
        && !(scan.getColumnName() instanceof DboColumnToManyMeta)
View Full Code Here

    } catch (InstantiationException e) {
      throw new UnsupportedOperationException("There is some problem in creating the proxy");
    } catch (IllegalAccessException e) {
      throw new UnsupportedOperationException("There is some problem in creating the proxy");
    }
    DboColumnMeta colMeta = this.getMetaDbo();
    if (classMeta.getIdField() != null && (rowKey!=null)) {
      // first fill the id
      DboColumnEmbedMeta embedMeta = (DboColumnEmbedMeta) colMeta;
            Object idValue = null;
            MetaField<PROXY> metaFieldId = classMeta.getIdField();
            NoSqlConverter customConvId = metaFieldId.getField().getAnnotation(NoSqlConverter.class);
            byte[] idBytes = null;
            if (customConvId != null) {
                idValue = getValue(rowKey, customConvId);
                idBytes = getBytesValue(idValue, customConvId);
            } else {
                idValue = embedMeta.getFkToColumnFamily().getIdColumnMeta().getStorageType().convertFromNoSql(rowKey);
                idBytes = StandardConverters.convertToBytes(idValue);
            }
            if (metaFieldId != null)
                ReflectionUtil.putFieldValue(newproxy, metaFieldId.getField(),idValue);

      // Now extract other columns
      byte[] prefix = StandardConverters.convertToBytes(getColumnName());
      byte[] embedColumn = new byte[prefix.length + idBytes.length];
        System.arraycopy(prefix,0,embedColumn,0         ,prefix.length);
        System.arraycopy(idBytes,0,embedColumn,prefix.length,idBytes.length);
      Collection<Column> columnsInRow = row.columnByPrefix(embedColumn);
      for (Column colInRow : columnsInRow) {
        byte[] fullNameCol = colInRow.getName();
        int colLen = fullNameCol.length - embedColumn.length;
        byte[] fk = new byte[colLen];
        for (int i = embedColumn.length; i < fullNameCol.length; i++) {
          fk[i - embedColumn.length] = fullNameCol[i];
        }

                Object colVal = colMeta.convertFromStorage2(fk);
                String colName = colMeta.convertTypeToString(colVal);

                Object columnValue = null;
                MetaField<PROXY> metaField = classMeta.getMetaFieldByCol(null, colName);
                if(metaField == null)
                  continue; //skip this field sice we don't know this column
View Full Code Here

      throw new IllegalArgumentException("parameter='" + name
          + "' is not found in the query="+meta.getQuery());
    } else if(typeInfo.getConstantType() != null)
      throw new UnsupportedOperationException("not done here yet, need to validate constant type");

    DboColumnMeta metaFieldDbo = typeInfo.getColumnInfo();
    String colFamily = metaFieldDbo.getOwner().getColumnFamily();
    String columnName = metaFieldDbo.getColumnName();
    MetaClass metaClass = metaInfo.getMetaClass(colFamily);
    MetaField metaField = metaClass.getMetaFieldByCol(targetSubclass, columnName);
   
    Field field = metaField.getField();
    Class fieldType = field.getType();
View Full Code Here

  public DirectCursor<IndexColumnInfo> getResultListImpl(Set<ViewInfo> alreadyJoinedViews, String indexedColumn) {
    ExpressionNode root = spiMeta.getASTTree();
    if(root == null) {
      ViewInfoImpl tableInfo = (ViewInfoImpl) spiMeta.getTargetViews().get(0);
      DboTableMeta tableMeta = tableInfo.getTableMeta();
      DboColumnMeta metaCol = tableMeta.getAnyIndex(indexedColumn);
      ScanInfo scanInfo = createScanInfo(tableInfo, metaCol);

      alreadyJoinedViews.add(tableInfo);
      AbstractCursor<IndexColumn> scan = session.scanIndex(scanInfo, null, null, batchSize);
      return processKeys(tableInfo, null, scan);
View Full Code Here

  private ScanInfo createScanInfo(ViewInfoImpl tableInfo, DboColumnMeta metaCol) {
    PartitionMeta partitionMeta = tableInfo.getPartition();
    String partitionBy = null;
    String partitionId = null;
    if(partitionMeta != null) {
      DboColumnMeta colMeta = partitionMeta.getPartitionColumn();
      partitionBy = colMeta.getColumnName();
      byte[] partId = retrieveValue(colMeta, (ExpressionNode) partitionMeta.getNode());
      Object partIdObj = colMeta.convertFromStorage2(partId);
      partitionId = colMeta.convertTypeToString(partIdObj);
    }

    ScanInfo scanInfo = ScanInfo.createScanInfo(metaCol, partitionBy, partitionId);
    return scanInfo;
  }
View Full Code Here

    if(joinType == JoinType.INNER || joinType == JoinType.LEFT_OUTER) {
      //We need to proxy the right results to translate to the same primary key as the
      //left results and our And and Or Cursor can then take care of the rest
      JoinInfo joinInfo = root.getJoinMeta().getPrimaryJoinInfo();
      ViewInfoImpl newView = joinInfo.getPrimaryTable();
      DboColumnMeta col = joinInfo.getPrimaryCol();
      ScanInfo scanInfo = createScanInfo(newView, col);
      //FROM an ORM perspective, we join to smaller tables in general as we don't want to blow out memory so do the
      //join first(ie. we process left sides first in and and or cursors)
      CursorForJoin temp = new CursorForJoin(newView, leftView, leftResults, joinType);
      temp.setColMeta(col);
View Full Code Here

      attr = (StateAttribute) grandChild.getState();
    } else {
      attr = (StateAttribute) root.getChild(ChildSide.LEFT).getState();
    }
   
    DboColumnMeta info = attr.getColumnInfo();
    ViewInfoImpl viewInfo = attr.getViewInfo();   
    ScanInfo scanInfo = createScanInfo(viewInfo, info);
    alreadyJoinedViews.add(viewInfo);
   
    if(info.isIndexed()) {
      //its an indexed column
      return processIndexColumn(root, scanInfo, viewInfo, info);
    } else if (info.getOwner().getIdColumnMeta().getColumnName().equals(info.getColumnName())) {
      //its a non-indexed primary key
      return  processPrimaryKey(root, scanInfo, viewInfo, info);
    } else
      throw new IllegalArgumentException("You cannot have '"+info.getColumnName() + "' in your sql query since "+info.getColumnName()+" is neither a Primary Key nor a column with @Index annotation on the field in the entity");     
  }
View Full Code Here

    session.put(metaClass, virtualKey, cols);
  }
 
  @Override
  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();
   
View Full Code Here

    col.setIndexedValue(pt.getRawIndexedValue());
    col.setPrimaryKey(pt.getRawKey());
    session.removeFromIndex(cf, indColFamily, rowKey, col);
  }
  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();
   
View Full Code Here

TOP

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

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.