ch.sahits.codegen.java.generator.ast
Class CRUDOracleReference

java.lang.Object
  extended by ch.sahits.codegen.java.generator.ast.CRUDOracleReference
All Implemented Interfaces:
IDBAccess, IReferenceImplementation

public final class CRUDOracleReference
extends java.lang.Object
implements IDBAccess, IReferenceImplementation

This class is the reference implementation or template for the implementation of CRUD (Create, Read, Update, Delete) for an Oracle database. This class is not intended for productive use because of poor architecture. This class should show how a reference implementation can be done.

Since:
0.9.0
Author:
Andi Hotz

Constructor Summary
CRUDOracleReference()
          This default constructor is needed by the extension registry to create an instance.
CRUDOracleReference(IGeneratedJavaClass2 dbt)
          Constructor initializes the model
 
Method Summary
 int delete()
          Remove the record from the database indicated by the key values of this object.
 java.util.List<java.lang.Class<?>> getImports2Add()
          Get the list of the classes that are needed for this reference implementation Each list entry is unique.
 java.lang.String getPassWd()
          Retrieve the password for the user to connect to the database The access is public since this method is accessed by reflection.
 java.lang.String getTableName()
          Retrieve the table name from the model.
 java.lang.String getURL()
          Retrieve the URL string from the model.
 void initModel(IGeneratedJavaClass2 model)
          Initialize the model
 java.lang.String insertPK()
          Generate the where clause based on the primary key of the model table incl. where keyword.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CRUDOracleReference

public CRUDOracleReference()
This default constructor is needed by the extension registry to create an instance. An instance created in such a way may not be used for gerneration purpouses.


CRUDOracleReference

public CRUDOracleReference(IGeneratedJavaClass2 dbt)
Constructor initializes the model

Parameters:
dbt - DataBaseTable
Method Detail

initModel

public void initModel(IGeneratedJavaClass2 model)
Initialize the model

Specified by:
initModel in interface IReferenceImplementation
Parameters:
model - of a generatable java class

delete

@AReferenceImplementation
@AReplaceMethods(methodNames={"getTableName","insertPK"})
public int delete()
           throws java.sql.SQLException,
                  java.lang.ClassNotFoundException
Remove the record from the database indicated by the key values of this object.

Returns:
number of deleted records.
Throws:
java.sql.SQLException
java.lang.ClassNotFoundException

getTableName

@AValueProvider
public java.lang.String getTableName()
Retrieve the table name from the model. The access is public since this method is accessed by reflection

Returns:
table name

insertPK

@AValueProvider
public java.lang.String insertPK()
Generate the where clause based on the primary key of the model table incl. where keyword. The access is public since this method is accessed by reflection

Returns:
where clause.

getURL

@AValueProvider
public java.lang.String getURL()
Retrieve the URL string from the model. The access is public since this method is accessed by reflection.

Returns:
connection URL

getPassWd

@AValueProvider
public java.lang.String getPassWd()
Retrieve the password for the user to connect to the database The access is public since this method is accessed by reflection.

Returns:
password

getImports2Add

public java.util.List<java.lang.Class<?>> getImports2Add()
Get the list of the classes that are needed for this reference implementation Each list entry is unique.

Specified by:
getImports2Add in interface IReferenceImplementation
Returns:
List of classes