Package com.draagon.meta.manager.db.defs

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


      // Create foreign keys for newly created tables
      for( BaseDef def : createdDefs )
      {
        if ( def instanceof TableDef ) {
         
          TableDef table = (TableDef) def;

            log.info( "VALIDATION - CREATING SEQUENCES FOR TABLE " + def );
          createSequences( c, dd, table );
         
            log.info( "VALIDATION - CREATING INDEXES FOR TABLE " + def );
View Full Code Here


      }     
    }
    else if ( def instanceof TableDef ) {
     
      // Check if the table exists and is valid
      TableDef table = (TableDef) def;
      if ( !dd.checkTable( c, table ) ) {
     
        // If not, then auto create it or throw a not found exception
        if ( shouldAutoCreate() ) {
          log.info( "VALIDATION - CREATING TABLE " + table );
View Full Code Here

      Object o) throws SQLException {
   
    // Check if there is table inheritence going on, and if so create the super table first
    BaseDef base = omdb.getDBDef();
    if ( base instanceof TableDef ) {
      TableDef table = (TableDef) base;
     
      InheritenceDef inheritence = table.getInheritence();
      if ( inheritence != null ) {
        ObjectMappingDB smom = (ObjectMappingDB) omdb.getSuperMapping();
       
        // Set the discriminator values
        if ( inheritence.getDiscriminatorName() != null ) {
View Full Code Here

    Expression exp = null;
   
    // Check if there is table inheritence going on, and if so delete the super table first
    BaseDef base = omdb.getDBDef();
    if ( base instanceof TableDef ) {
      TableDef table = (TableDef) base;
     
      InheritenceDef inheritence = table.getInheritence();
      if ( inheritence != null ) {

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

        // Setup the key
View Full Code Here

    throws SQLException {
       
    // Check if there is table inheritence going on, and if so delete the super table first
    BaseDef base = omdb.getDBDef();
    if ( base instanceof TableDef ) {
      TableDef table = (TableDef) base;
     
      InheritenceDef inheritence = table.getInheritence();
      if ( inheritence != null ) {
        ObjectMappingDB smom = (ObjectMappingDB) omdb.getSuperMapping();

        MetaField rf = omdb.getField( inheritence.getRefColumn() );
        Collection<MetaField> pkeys = new ArrayList<MetaField>();
View Full Code Here

      String tableStr = getProperName( base.getNameDef() );
      query.append(tableStr).append( ' ' ).append( prefix );
     
      if ( base instanceof TableDef ) {
       
        TableDef table = (TableDef) base;
        base = null;
       
        InheritenceDef idef = table.getInheritence();     
        if ( idef != null ) {
          base = idef.getRefTable();
          prefix++;
         
          query.append( " LEFT JOIN " );
View Full Code Here

      String tableStr = getProperName( base.getNameDef() );
      query.append(tableStr).append( ' ' ).append( prefix );
     
      if ( base instanceof TableDef ) {
       
        TableDef table = (TableDef) base;
        base = null;
       
        InheritenceDef idef = table.getInheritence();     
        if ( idef != null ) {
          base = idef.getRefTable();
          prefix++;
         
          query.append( " LEFT JOIN " );
View Full Code Here

  /** 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

Related Classes of com.draagon.meta.manager.db.defs.TableDef

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.