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

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


    if(keys == null)
      throw new IllegalArgumentException("keys list cannot be null");
    DboTableMeta meta = cachedMeta.getMeta(colFamily);
    if(meta == null)
      throw new IllegalArgumentException("Meta for columnfamily="+colFamily+" was not found");
    DboColumnMeta idMeta = meta.getIdColumnMeta();
    Iterable<byte[]> noSqlKeys = new IterableTypedProxy<Object>(idMeta, keys);
    return findAllImpl2(meta, keys, noSqlKeys, null, batchSize);
  }
View Full Code Here


  public Cursor<IndexPoint> indexView(String columnFamily, String column,
      String partitionBy, String partitionId) {
    DboTableMeta meta = cachedMeta.getMeta(columnFamily);
    if(meta == null)
      throw new IllegalArgumentException("columnFamily="+columnFamily+" not found");
    DboColumnMeta colMeta = meta.getColumnMeta(column);
    if(colMeta == null)
      throw new IllegalArgumentException("Column="+column+" not found on meta info for column family="+columnFamily);
    else if(!colMeta.isIndexed())
      throw new IllegalArgumentException("Column="+column+" is not an indexed column");
    else if(meta.getPartitionedColumns().size() > 1 && partitionBy == null)
      throw new IllegalArgumentException("Must supply partitionBy parameter BECAUSE this column family="+columnFamily+" is partitioned multiple ways");
   
    ScanInfo info = ScanInfo.createScanInfo(colMeta, partitionBy, partitionId);
View Full Code Here

  public int count(String columnFamily, String indexedColName, Object value) {
    DboTableMeta meta = cachedMeta.getMeta(columnFamily);
    if(meta == null)
      throw new IllegalArgumentException("columnFamily="+columnFamily+" not found");
    DboColumnMeta colMeta = meta.getColumnMeta(indexedColName);
    if(colMeta == null)
      throw new IllegalArgumentException("Column="+indexedColName+" not found on meta info for column family="+columnFamily);
    else if(!colMeta.isIndexed())
      throw new IllegalArgumentException("Column="+indexedColName+" is not an indexed column");
    String query = "SELECT * FROM " +  columnFamily + " WHERE " + indexedColName + " = ";
    String valueString = new String();
    if (value != null) {
      if (value instanceof String)
View Full Code Here

  public void addMetaField(MetaField<T> field) {
    if(field == null)
      throw new IllegalArgumentException("field cannot be null");
    columnNameToField.put(field.getColumnName(), field);
   
    DboColumnMeta metaCol = field.getMetaDbo();
    if(metaCol.isIndexed())
      indexedColumns.add(field);
   
    if(metaCol.isPartitionedByThisColumn())
      partitionColumns.add(field);
  }
View Full Code Here

    String alias = aliasNode.getText();
    String newAlias = newAliasNode.getText();
   
    ViewInfoImpl tableInfo = wiring.getInfoFromAlias(alias);
    DboTableMeta tableMeta = tableInfo.getTableMeta();
    DboColumnMeta columnMeta = facade.getFkMetaIfExist(tableMeta, column);
    if(!(columnMeta instanceof DboColumnToOneMeta))
      throw new IllegalArgumentException("Column="+column+" on table="+tableMeta.getColumnFamily()+" is NOT a OneToOne NOR ManyToOne relationship according to our meta data");
    else if(!columnMeta.isIndexed())
      throw new IllegalArgumentException("Column="+column+" on table="+tableMeta.getColumnFamily()+" is not indexed.  Add @NoSqlIndex or map/reduce a new index in place and add annotation");
    DboColumnToOneMeta toOne = (DboColumnToOneMeta) columnMeta;
    DboTableMeta fkTableMeta = toOne.getFkToColumnFamily();

    ViewInfoImpl existing = wiring.getInfoFromAlias(newAlias);
View Full Code Here

    if(info == null)
      throw new IllegalArgumentException("In your PARTITIONS clause, you have an alias='"+alias+"' that is not found in your FROM clause");
    else if(info.getPartition() != null)
      throw new IllegalArgumentException("In your PARTITIONS clause, you define a partition for alias='"+alias+"' twice.  you can only define it once");
   
    DboColumnMeta partitionColumn;
    DboTableMeta tableMeta = info.getTableMeta();
    List<DboColumnMeta> partitionedColumns = tableMeta.getPartitionedColumns();
    if(partitionedColumns.size() == 0)
      throw new IllegalArgumentException("The meta data contains no partitions for table="+tableMeta.getColumnFamily()+" so your alias="+alias+" in your query should not be in the PARTITIONS clause.  Delete it!!!!");
    else if(child.getChildCount() > 1) {
View Full Code Here

    }
    return null;
  }

  private static void validateTypes(InfoForWiring wiring, StorageTypeEnum constantType, TypeInfo typeInfo) {
    DboColumnMeta info = typeInfo.getColumnInfo();
    if(info instanceof DboColumnToManyMeta)
      throw new IllegalArgumentException("Cannot use column="+info.getColumnName()+" since that is a toMany relationship");
    else if(constantType == StorageTypeEnum.NULL)
      return; //null is any type so no need to match
    else if(constantType != info.getStorageType())
      throw new IllegalArgumentException("Types do not match in namedquery="+wiring.getQuery()+" for column="+info.getColumnName()+" type1="+constantType+" type2="+info.getStorageType());
  }
View Full Code Here

            +textInSql+" has no alias and from clause only has tables with alias");
    }
   
    DboTableMeta metaClass = tableInfo.getTableMeta();
    //At this point, we have looked up the metaClass associated with the alias
    DboColumnMeta colMeta = facade.getColumnMeta(metaClass, columnName);
    if (colMeta == null) {
      //okay, there is no column found, but maybe the column name for the id matches(id is a special case)
      colMeta = metaClass.getIdColumnMeta();
      if(!colMeta.getColumnName().equals(columnName)) {
        List<String> names = metaClass.getColumnNameList();
        throw new IllegalArgumentException("There is no column=" + columnName + " that exists for table "
            + metaClass.getColumnFamily()+" potential columns are="+names+"  rowkey col="+colMeta.getColumnName());
      }
    }
   
    wiring.addEagerlyJoinedView(tableInfo);
    StateAttribute attr = new StateAttribute(tableInfo, colMeta, textInSql);
    attributeNode2.setState(attr, textInSql);
    wiring.incrementAttributesCount(textInSql);
   
    TypeInfo typeInfo = new TypeInfo(colMeta);
   
    if(otherSideType == null)
      return typeInfo;
   
    if(otherSideType.getConstantType() != null) {
      validateTypes(wiring, otherSideType.getConstantType(), typeInfo);
    } else {
      Class<?> classType = otherSideType.getColumnInfo().getClassType();
      if(!classType.equals(colMeta.getClassType()))
        throw new IllegalArgumentException("Types are not the same for query="+wiring.getQuery()+" types="+classType+" and "+colMeta.getClassType());
    }

    return null;
  }
View Full Code Here

  }

  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

  public DirectCursor<IndexColumnInfo> getResultListImpl(Set<ViewInfo> alreadyJoinedViews) {
    ExpressionNode root = spiMeta.getASTTree();
    if(root == null) {
      ViewInfoImpl tableInfo = (ViewInfoImpl) spiMeta.getTargetViews().get(0);
      DboTableMeta tableMeta = tableInfo.getTableMeta();
      DboColumnMeta metaCol = tableMeta.getAnyIndex();
      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

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.