Package com.alvazan.orm.api.z8spi.conv

Examples of com.alvazan.orm.api.z8spi.conv.StorageTypeEnum


 
  private ColumnFamilyDefinition setColumnNameCompareType(DboTableMeta cf,
      StorageTypeEnum type, ColumnFamilyDefinition def2) {
    ColumnFamilyDefinition def = def2;
    if(type == null) {
      StorageTypeEnum t = cf.getNameStorageType();
      if(t == StorageTypeEnum.STRING)
        def = def.setComparatorType("UTF8Type");
      else if(t == StorageTypeEnum.DECIMAL)
        def = def.setComparatorType("DecimalType");
      else if(t == StorageTypeEnum.INTEGER)
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

    if(colNamePrefixType == null) {
      this.colNamePrefixType = null;
      return;
    }
   
    StorageTypeEnum storedType = colNamePrefixType.getStoredType();
    this.colNamePrefixType = storedType.getDbValue();
  }
View Full Code Here

      throw new IllegalStateException("Column family='"+colFamily+"' was not found AND we looked up meta data for this column" +
          " family to create it AND we could not find that data so we can't create it for you");
    }

    SortType sortType;
    StorageTypeEnum prefixType = cf.getColNamePrefixType();
    if(prefixType == null) {
      switch (cf.getNameStorageType()) {
      case BYTES:
        sortType = SortType.BYTES;
        break;
View Full Code Here

      indexList.add(data);
    }
  }
 
  protected void removingThisEntity(InfoForIndex<OWNER> info, List<IndexData> indexRemoves, byte[] pk) {
    StorageTypeEnum storageType = getMetaDbo().getStorageType();
    Map<Field, Object> fieldToValue = info.getFieldToValue();
    Object valueInDatabase = fieldToValue.get(field);
    byte[] oldIndexedVal = translateValue(valueInDatabase);
   
    addToList(info, oldIndexedVal, storageType, pk, indexRemoves);
View Full Code Here

    if(colNamePrefixType == null) {
      this.colNamePrefixType = null;
      return;
    }
   
    StorageTypeEnum storedType = colNamePrefixType.getStoredType();
    this.colNamePrefixType = storedType.getDbValue();
  }
View Full Code Here

@SuppressWarnings("rawtypes")
public class ConverterUtil {
  protected static HashMap<String, Class> loadedClasses = new HashMap<String, Class>();

  public static StorageTypeEnum getStorageType(Class fieldType) {
    StorageTypeEnum type = StandardConverters.getStorageType(fieldType);
    if(type == null)
      return StorageTypeEnum.BYTES;
    return type;
  }
View Full Code Here

  }

  private static TypeInfo processConstant(ExpressionNode node, InfoForWiring wiring, TypeInfo typeInfo) {
    String constant = node.getASTNode().getText();
   
    StorageTypeEnum ourType;
    if(node.getType() == NoSqlLexer.DECIMAL || node.getType() == NoSqlLexer.DEC_VAL){
      ourType = StorageTypeEnum.DECIMAL;
      BigDecimal dec = new BigDecimal(constant);
      node.setState(dec, constant);
    } else if(node.getType() == NoSqlLexer.STR_VAL){
      String withoutQuotes = constant.substring(1, constant.length()-1);   
      ourType = StorageTypeEnum.STRING;
      node.setState(withoutQuotes, constant);
    } else if(node.getType() == NoSqlLexer.INT_VAL){
      ourType = StorageTypeEnum.INTEGER;
      BigInteger bigInt = new BigInteger(constant);
      node.setState(bigInt, constant);
    } else if(node.getType() == NoSqlLexer.BOOL_VAL) {
      ourType = StorageTypeEnum.BOOLEAN;
      boolean boolVal = Boolean.parseBoolean(constant);
      node.setState(boolVal, constant);
    } else if(node.getType() == NoSqlLexer.NULL) {
      ourType = StorageTypeEnum.NULL;
      node.setState(null, constant);
    }
     
    else
      throw new RuntimeException("bug, not supported type(please fix)="+node.getType());
   
    if(typeInfo == null) //no types to check against so return...
      return new TypeInfo(ourType);

    //we must compare type info so this next stuff is pure validation
    if(typeInfo.getColumnInfo() != null) {
      validateTypes(wiring, ourType, typeInfo);
    } else {
      StorageTypeEnum constantType = typeInfo.getConstantType();
      if(constantType != ourType)
        throw new IllegalArgumentException("Types do not match in namedquery="+wiring.getQuery());
    }
    return null;
  }
View Full Code Here

  }

  @Override
  public StorageTypeEnum getStorageType() {
    Class storageTypeClass = ConverterUtil.classForName(itemType);
    StorageTypeEnum storageType = ConverterUtil.getStorageType(storageTypeClass);
    return storageType;
  }
View Full Code Here

  public abstract void translateToColumn(InfoForIndex<TypedRow> info);

  @SuppressWarnings("unchecked")
  protected void removeIndexInfo(InfoForIndex<TypedRow> info, Object value, byte[] byteVal) {
    StorageTypeEnum storageType = getStorageType();
    Map<String, Object> fieldToValue = info.getFieldToValue();
    if (!isIndexed())
      return;
    else if (storageType == StorageTypeEnum.BYTES)
      throw new IllegalArgumentException(
View Full Code Here

TOP

Related Classes of com.alvazan.orm.api.z8spi.conv.StorageTypeEnum

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.