Package com.draagon.meta

Examples of com.draagon.meta.MetaField


          throw new IllegalArgumentException( "Malformed template field name parameter [" + param + "]" );

        if ( type.length() == 0 )
          throw new IllegalArgumentException( "Malformed template field type parameter [" + param + "]" );

        MetaField mf = null;
        if ( type.equals( "int" ))
          mf = new IntegerField();
        else if ( type.equals( "long" ))
          mf = new LongField();
        else if ( type.equals( "short" ))
          mf = new ShortField();
        else if ( type.equals( "byte" ))
          mf = new ByteField();
        else if ( type.equals( "boolean" ))
          mf = new BooleanField();
        else if ( type.equals( "float" ))
          mf = new FloatField();
        else if ( type.equals( "double" ))
          mf = new DoubleField();
        else if ( type.equals( "date" ))
          mf = new DateField();
        else
          mf = new StringField();

        mf.setName( field );

        mc.addMetaField( mf );
      }

      return mc;
View Full Code Here


    int x = n;

    String type = null;
    String name = null;

    MetaField field = null;

    boolean quoted = false;

    while( x < str.length() )
    {
View Full Code Here

  public static void main( String [] args ) throws ExpressionParseError
  {
    MetaClass mc = new BeanMetaClass();
    mc.setName( "test" );
    MetaField a = new LongField();
    a.setName( "id" );
    MetaField b = new StringField();
    b.setName( "name" );
    MetaField c = new IntegerField();
    c.setName( "value" );
    MetaField d = new DateField();
    d.setName( "time" );
    mc.addMetaField( a );
    mc.addMetaField( b );
    mc.addMetaField( c );
    mc.addMetaField( d );
View Full Code Here

    fieldMapping.put( arg.getName(), mf );
    nameMapping.put( mf.getName(), arg );
  }

  public MetaField getField( String argName ) {
    MetaField mf = fieldMapping.get( argName );
    if ( mf == null && superMap != null ) {
      return superMap.getField( argName );
    }
    return mf;
 
View Full Code Here

      if ( inheritence != null ) {
        ObjectMappingDB smom = (ObjectMappingDB) omdb.getSuperMapping();
       
        // Set the discriminator values
        if ( inheritence.getDiscriminatorName() != null ) {
          MetaField df = omdb.getField( inheritence.getDiscriminatorName() );
          df.setString( o, inheritence.getDiscriminatorValue() );
        }
       
        // Create the super classes table entry
        if ( !create( c, mc, smom, o )) {
          throw new SQLException( "Super table entry could not be created for mapping [" + smom + "]" );
        }
       
        // Set the mapping field
        MetaField rf = omdb.getField( inheritence.getRefColumn() );
        MetaField f = omdb.getField( inheritence.getColumnName() );
        f.setObject( o, rf.getObject( o ));
      }
    }
   
    // Now create the entry for this object
    PreparedStatement s = getInsertStatement(c, mc, omdb, o);
View Full Code Here

      if ( inheritence != null ) {

        ObjectMappingDB smom = (ObjectMappingDB) omdb.getSuperMapping();

        // Setup the key
        MetaField rf = omdb.getField( inheritence.getRefColumn() );
        Collection<MetaField> pkeys = new ArrayList<MetaField>();
        pkeys.add( rf );
       
        // Create the super classes table entry
        if ( !update( c, mc, smom, o, fields, pkeys, dirtyField, dirtyValue )) {
          return false;
          // throw new SQLException( "Super table entry could not be updated for mapping [" + smom + "]" );
        }
       
        // Set the mapping field
        MetaField f = omdb.getField( inheritence.getColumnName() );
       
        // Set the expression to delete
        exp = new Expression( f.getName(), rf.getObject( o ));
       
        // Can only have dirty fields on the highest level of inheritence
        dirtyField = null;
        dirtyValue = null;
      }
View Full Code Here

     
      InheritenceDef inheritence = table.getInheritence();
      if ( inheritence != null ) {
        ObjectMappingDB smom = (ObjectMappingDB) omdb.getSuperMapping();

        MetaField rf = omdb.getField( inheritence.getRefColumn() );
        Collection<MetaField> pkeys = new ArrayList<MetaField>();
        pkeys.add( rf );

        // Set the mapping field
        MetaField f = omdb.getField( inheritence.getColumnName() );
       
        // Set the expression to delete
        Expression exp = new Expression( f.getName(), rf.getObject( o ));

        // Delete the higher level table first
        boolean result = executeDelete( c, mc, omdb, exp );
       
        // Return a false if it was not deleteable
View Full Code Here

    while (order != null) {
     
      if (first) first = false;
      else b.append(", ");

      MetaField mf = mc.getMetaField(order.getField());
     
      char prefix = 'A';
      ColumnDef colDef = (ColumnDef) omdb.getArgDef(mf);
      if (colDef == null) {
        throw new MetaException( "MetaField [" + mf + "] has no column mapping for [" + omdb + "]" );
      }

      if (mf.getType() == MetaField.STRING) {
        b.append("UPPER(");
        b.append( prefix ).append( "." );
        b.append(colDef.getName());
        b.append(')');
      } else {
View Full Code Here

      set.append(getExpressionString(mc, omdb, oper.getExpressionB(), args, prefix ));
    } else if (exp.isSpecial()) {
      throw new IllegalArgumentException(
          "Unsupported Special Expression [" + exp + "]");
    } else {
      MetaField f = mc.getMetaField(exp.getField());

      ColumnDef colDef = (ColumnDef) omdb.getArgDef(f);
      if (colDef == null) {
        throw new MetaException( "MetaField [" + f + "] has no column mapping defined for [" + omdb + "]" );
      }
View Full Code Here

    }

    if (where != null) {
      for ( SQLArg arg : args ) {
       
        MetaField f = arg.getMetaField();
        Object value = arg.getValue();

        if ( log.isDebugEnabled() && index > 1 ) {
          valStr.append(", ");
        }
View Full Code Here

TOP

Related Classes of com.draagon.meta.MetaField

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.