Examples of TableDef


Examples of com.draagon.meta.manager.db.defs.TableDef

  /** Get the table mapping */
  protected ObjectMappingDB getTableMapping( MetaClass mc ) {

    // Create the table definition
    TableDef t = new TableDef( NameDef.parseName( getTableRef( mc )));
   
    // Get all the possible metafields for this metaclass
    Collection<MetaField> fields = mc.getMetaFields();
   
    // Create the mapping
    ObjectMappingDB mapping = new ObjectMappingDB( t );
   
    // See if there is a referenced table
    InheritanceRef iref = getInheritanceDefinition( mc );
    if ( iref != null ) {
     
      // Load the table mapping for the super class
      ObjectMappingDB superMap = getTableMapping( iref.getSuperClass() );
     
      // Sets the parent mapping
      mapping.setSuperMapping( superMap );

      // NOTE:  Kind of shady to grab this here and later grab again, prone to bugs on implementation changes...
      String coln = getColumnRef( iref.getJoinerField() );
     
      // Create the inheritence definition
      InheritenceDef inheritence = new InheritenceDef(
          coln,
          (TableDef) superMap.getDBDef(),
          (ColumnDef) superMap.getArgDef( iref.getSuperJoinerField() ),
          getColumnRef( iref.getDiscriminatorField() ),
          iref.getDiscriminatorValue() );
     
      // Add it to the current table
      t.setInheritence( inheritence );
     
      // Remove the fields found in the superclass
      fields = new ArrayList<MetaField>();
      for( MetaField mf2 : mc.getMetaFields() ) {
        boolean found = false;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.