ch.sahits.codegen.sql.model
Class ModelDataProvider

java.lang.Object
  extended by ch.sahits.codegen.sql.model.ModelDataProvider
Direct Known Subclasses:
InsertScriptWizardModel

public class ModelDataProvider
extends java.lang.Object

This class provides the model interface toward DTP

Author:
Andi Hotz

Constructor Summary
ModelDataProvider()
          Default constructor initializing the connection profiles
 
Method Summary
 IConnectionProfile getConnectionProfile(java.lang.String selectedName)
          Retrieve the connection profile by name.
protected  Database getDatabaseForProfile(IConnectionProfile profile)
          Retrieve the managed database for the given connection profile
 java.util.List<java.lang.String> getFieldNames(Table t)
          Retrieve a list of all field names
 java.util.List<java.lang.String> getOwner(IConnectionProfile profile)
          Retrieve all owner of the database
 IConnectionProfile getProfileByDatabase(Database db)
          Retrieve a connection profile based on a database
 java.util.List<java.lang.String> getRegisteredConnectionProfiles()
          Retrieve the names of the connection files
 Table getTable(IConnectionProfile profile, java.lang.String schemaName, java.lang.String tableName)
          Retrieve a table by its name
 java.util.List<java.lang.String> getTables(IConnectionProfile profile, java.lang.String schemaName)
          Retrieve the tables of a schema
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelDataProvider

public ModelDataProvider()
Default constructor initializing the connection profiles

Method Detail

getRegisteredConnectionProfiles

public final java.util.List<java.lang.String> getRegisteredConnectionProfiles()
Retrieve the names of the connection files

Returns:
list of connection profiles registered with this workbench

getConnectionProfile

public final IConnectionProfile getConnectionProfile(java.lang.String selectedName)
Retrieve the connection profile by name. If there are two connection profiles with the same name the first found is choosen.

Parameters:
selectedName -
Returns:
IConnectionProfile

getOwner

public final java.util.List<java.lang.String> getOwner(IConnectionProfile profile)
Retrieve all owner of the database

Parameters:
profile - Connection profile of the database
Returns:
List of the owners

getDatabaseForProfile

protected final Database getDatabaseForProfile(IConnectionProfile profile)
Retrieve the managed database for the given connection profile

Parameters:
profile - connection profile
Returns:
Database instance

getTables

public final java.util.List<java.lang.String> getTables(IConnectionProfile profile,
                                                        java.lang.String schemaName)
Retrieve the tables of a schema

Parameters:
profile - Connection profile
schemaName - name of the schema
Returns:
List of table names with empty entry

getTable

public final Table getTable(IConnectionProfile profile,
                            java.lang.String schemaName,
                            java.lang.String tableName)
Retrieve a table by its name

Parameters:
profile - Connection profile
schemaName - name of the schema
tableName - name of the table
Returns:
Table

getFieldNames

public final java.util.List<java.lang.String> getFieldNames(Table t)
Retrieve a list of all field names

Parameters:
t - Table
Returns:
List of field names

getProfileByDatabase

public IConnectionProfile getProfileByDatabase(Database db)
Retrieve a connection profile based on a database

Parameters:
db - database to retrieve the connection profile for
Returns:
connection profile defining the database