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

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


  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


    byte[] byteVal = translateValue(value);
    byte[] colBytes = StandardConverters.convertToBytes(columnName);
    col.setName(colBytes);
    col.setValue(byteVal);
   
    StorageTypeEnum storageType = metaDbo.getStorageType();
    addIndexInfo(info, value, byteVal, storageType);
    removeIndexInfo(info, value, byteVal, storageType);
  }
View Full Code Here

      c = Character.class;
    return c;
  }

  public static StorageTypeEnum getStorageType(Class fieldType) {
    StorageTypeEnum type = StandardConverters.getStorageType(fieldType);
    if(type == null)
      return StorageTypeEnum.BYTES;
    return type;
  }
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

  }

  @SuppressWarnings("unchecked")
  protected void removingThisEntity(InfoForIndex<TypedRow> info,
      List<IndexData> indexRemoves, byte[] pk) {
    StorageTypeEnum storageType = getStorageType();
    Map<Field, Object> fieldToValue = info.getFieldToValue();
    Object valueInDatabase = fieldToValue.get(columnName);
    byte[] oldIndexedVal = convertToStorage2(valueInDatabase);

    addToIndexList(info, oldIndexedVal, storageType, pk, indexRemoves);
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  protected void addIndexInfo(InfoForIndex<TypedRow> info, Object value,
      byte[] byteVal) {
    StorageTypeEnum storageType = this.getStorageType();
    TypedRow entity = info.getEntity();
    RowToPersist row = info.getRow();
    Map<Field, Object> fieldToValue = info.getFieldToValue();

    if (!isIndexed())
View Full Code Here

    if(colNamePrefixType == null) {
      this.colNamePrefixType = null;
      return;
    }
   
    StorageTypeEnum storedType = colNamePrefixType.getStoredType();
    this.colNamePrefixType = storedType.getDbValue();
  }
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){
      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

      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

          name[i] = colBytes[i];
        else
          name[i] = byteVal[i-colBytes.length];
      }
      col.setName(name);
      StorageTypeEnum storageType = getStorageType();
      Object primaryKey = classMeta.fetchId(value);
      addIndexInfo(info, primaryKey, byteVal, storageType);
      removeIndexInfo(info, primaryKey, byteVal, storageType);
    }
    else {
      col.setName(colBytes);
      col.setValue(byteVal);
      StorageTypeEnum storageType = getStorageType();
      Object primaryKey = classMeta.fetchId(value);
      addIndexInfo(info, primaryKey, byteVal, storageType);
      removeIndexInfo(info, primaryKey, byteVal, storageType);
    }
  }
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.