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

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


    }
    else {*/
      // it is saved as a composite column now so no need to test as above, test as composite 
      Object rowId = row2.getRowKey();
      for(TypedColumn c : result.getColumnsAsColl()) {
        DboColumnMeta colMeta = c.getColumnMeta();
        if(colMeta != null) {
          String fullName = c.getName();
          String fkcomposite = fullName.substring(fullName.indexOf(".")+1);
          Assert.assertEquals(rowId.toString(), fkcomposite);
        }
View Full Code Here


   
    //Here we have to go raw and update the index ourselves with another fake PartAccount that does
    //not exist
    NoSqlSession session = mgr.getSession();
    DboTableMeta table = mgr.find(DboTableMeta.class, "PartAccount");
    DboColumnMeta colMeta = table.getColumnMeta("businessName");
    ScanInfo info = ScanInfo.createScanInfo(colMeta, null, null);
    IndexColumn col = new IndexColumn();
    col.setColumnName("businessName");
    String key = "nonexistpk";
    byte[] pk = StandardConverters.convertToBytes(key);
View Full Code Here

    NoSqlEntityManagerFactory factory = FactorySingleton.createFactoryOnce();
    NoSqlEntityManager mgr = factory.createEntityManager();

    DboDatabaseMeta database = mgr.find(DboDatabaseMeta.class, DboDatabaseMeta.META_DB_ROWKEY);
    DboTableMeta table = database.getMeta("Activity");
    DboColumnMeta columnMeta = table.getColumnMeta("account");
    DboColumnToOneMeta toOne = (DboColumnToOneMeta) columnMeta;
    Assert.assertEquals("id", toOne.getFkToColumnFamily().getIdColumnMeta().getColumnName());
   
  }
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

    return existing;
  }

  @Override
  public DboColumnMeta getColumnMeta(DboTableMeta metaClass, String columnName) {
    DboColumnMeta colMeta = metaClass.getColumnMeta(columnName);
    if(colMeta == null) {
      DboColumnCommonMeta temp = new DboColumnCommonMeta();
      temp.setup(metaClass, columnName, String.class, true, false);
      metaClass.addColumnMeta(temp);
      colMeta = temp;
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();
        DboTableMeta entityDbCollection = scan.getEntityColFamily();

        // Here we don't bother using an index at all since there is no where clause to begin with
        // ALSO, we don't want this code to be the case if we are doing a CursorToMany which has to
        // use an index so check the column type
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(info.isJodaType())
      return;
    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

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.