org.infoglue.cms.controllers.kernel.impl.simple
Class BaseController

java.lang.Object
  extended by org.infoglue.cms.controllers.kernel.impl.simple.BaseController
Direct Known Subclasses:
AccessRightController, AvailableServiceBindingController, CategoryController, ComponentController, ComponentPropertyDefinitionController, ContentCategoryController, ContentController, ContentStateController, ContentTypeDefinitionController, ContentVersionController, DigitalAssetController, EventController, ExtendedSearchController, GroupController, GroupControllerProxy, GroupPropertiesController, ImportController, InconsistenciesController, InfoGlueBasicAuthorizationModule, InfoGlueJDBCAuthorizationModule, InfoGluePrincipalControllerProxy, InfoGlueSettingsController, InterceptionPointController, InterceptorController, LanguageController, PageTemplateController, PropertiesCategoryController, PublicationController, QualifyerController, RedirectController, RegistryController, RepositoryController, RepositoryLanguageController, RoleController, RoleControllerProxy, RolePropertiesController, SearchController, ServerNodeController, ServiceBindingController, ServiceDefinitionController, ShortcutController, SiteNodeController, SiteNodeStateController, SiteNodeTypeDefinitionController, SiteNodeVersionController, SystemUserController, TransactionHistoryController, UpdateController, UserControllerProxy, UserPropertiesController, ValidationController, WorkflowController, WorkflowDefinitionController

public abstract class BaseController
extends java.lang.Object

BaseController.java Created on 2002-aug-28

Author:
Stefan Sik, ss@frovi.com, Mattias Bogeblad, mattias.bogeblad@sprawlsolutions.se Baseclass for ControllerClasses. Various methods to load, create and delete entities TODO: Now that all entities implements BaseEntity clear all reflection and simplify arguments... -matbog 2002-09-15: Added and modified new read-only methods for fetching a VO-object. These method must be called instead of the old ones when just fetching a entity or all entities from a table.

Constructor Summary
BaseController()
           
 
Method Summary
protected static org.exolab.castor.jdo.Database beginTransaction()
          Creates a new database and starts a transaction
protected static void beginTransaction(org.exolab.castor.jdo.Database db)
          Begins a transaction on the named database
protected static void closeDatabase(org.exolab.castor.jdo.Database db)
          Rollbacks a transaction on the named database
protected static void commitTransaction(org.exolab.castor.jdo.Database db)
          Ends a transaction on the named database
protected static java.lang.Object createEntity(java.lang.Object entity)
          Create, Delete & Update operations
protected static java.lang.Object createEntity(java.lang.Object entity, org.exolab.castor.jdo.Database db)
           
protected static org.exolab.castor.jdo.OQLQuery createQuery(org.exolab.castor.jdo.Database db, java.lang.String query, java.util.List params)
          Creates an OQLQuery for the provided Database and binds the parameters to it.
static void deleteEntity(java.lang.Class entClass, java.lang.Integer id)
           
static void deleteEntity(java.lang.Class entClass, java.lang.Integer id, org.exolab.castor.jdo.Database db)
           
static void deleteEntity(java.lang.Class entClass, java.lang.String id)
           
static void deleteEntity(java.lang.Class entClass, java.lang.String id, org.exolab.castor.jdo.Database db)
           
protected static java.util.List executeQuery(java.lang.String query)
          Executes a Query with no parameters
protected static java.util.List executeQuery(java.lang.String query, org.exolab.castor.jdo.Database db)
          Executes a Query with no parameters
protected static java.util.List executeQuery(java.lang.String query, java.util.List params)
          Executes a Query, also binds the provided parameters
protected static java.util.List executeQuery(java.lang.String query, java.util.List params, org.exolab.castor.jdo.Database db)
          Executes a Query, also binds the provided parameters
 java.util.List getAllObjects(java.lang.Class arg, java.lang.String primaryKey, org.exolab.castor.jdo.Database db)
          This method fetches all object in read only mode and returns a list of objects.
 java.util.List getAllVOObjects(java.lang.Class arg, java.lang.String primaryKey)
          This method fetches all object in read only mode and returns a list of value objects sorted on primary Key.
 java.util.List getAllVOObjects(java.lang.Class arg, java.lang.String primaryKey, org.exolab.castor.jdo.Database db)
          This method fetches all object in read only mode and returns a list of value objects.
static java.util.List getAllVOObjects(java.lang.Class arg, java.lang.String orderByAttribute, java.lang.String direction)
          This method fetches all object in read only mode and returns a list of value objects.
static java.util.List getAllVOObjects(java.lang.Class arg, java.lang.String orderByField, java.lang.String direction, org.exolab.castor.jdo.Database db)
          This method fetches all object in read only mode and returns a list of value objects.
abstract  BaseEntityVO getNewVO()
           
protected static java.lang.Object getObjectWithId(java.lang.Class arg, java.lang.Integer id, org.exolab.castor.jdo.Database db)
          This method fetches one object / entity within a transaction.
protected static java.lang.Object getObjectWithId(java.lang.Class arg, java.lang.String id, org.exolab.castor.jdo.Database db)
          This method fetches one object / entity within a transaction.
protected static java.lang.Object getObjectWithIdAsReadOnly(java.lang.Class arg, java.lang.Integer id, org.exolab.castor.jdo.Database db)
          This method fetches one object / entity within a transaction.
static java.lang.Object getVOWithId(java.lang.Class arg, java.lang.Integer id)
          This method is used to fetch a ValueObject from the database.
static BaseEntityVO getVOWithId(java.lang.Class arg, java.lang.Integer id, org.exolab.castor.jdo.Database db)
          This method fetches one object in read only mode and returns it's value object.
static java.lang.Object getVOWithId(java.lang.Class arg, java.lang.String id)
          This method is used to fetch a ValueObject from the database.
static BaseEntityVO getVOWithId(java.lang.Class arg, java.lang.String id, org.exolab.castor.jdo.Database db)
          This method fetches one object in read only mode and returns it's value object.
protected  void intercept(java.util.Map hashMap, java.lang.String InterceptionPointName, InfoGluePrincipal infogluePrincipal)
          This method is called by the controllers to let interceptors listen to events.
protected  void intercept(java.util.Map hashMap, java.lang.String InterceptionPointName, InfoGluePrincipal infogluePrincipal, org.exolab.castor.jdo.Database db)
          This method is called by the controllers to let interceptors listen to events.
protected static void rollbackTransaction(org.exolab.castor.jdo.Database db)
          Rollbacks a transaction on the named database
static java.util.List toModifiableVOList(java.util.Collection baseEntities)
          This method converts a List of entities to a list of value-objects.
static java.util.List toVOList(java.util.Collection baseEntities)
          This method converts a List of entities to a list of value-objects.
static BaseEntityVO updateEntity(java.lang.Class arg, BaseEntityVO vo)
           
static BaseEntityVO updateEntity(java.lang.Class arg, BaseEntityVO vo, org.exolab.castor.jdo.Database db)
           
static BaseEntityVO updateEntity(java.lang.Class entClass, BaseEntityVO vo, java.lang.String collectionMethod, java.lang.Class manyClass, java.lang.String[] manyIds)
           
static IBaseEntity updateEntity(java.lang.Class entClass, BaseEntityVO vo, java.lang.String collectionMethod, java.lang.Class manyClass, java.lang.String[] manyIds, org.exolab.castor.jdo.Database db)
           
static ConstraintExceptionBuffer validateEntity(ValidatableEntityVO vo)
          Validation and integrity check of entities - cre 2002-09-18 / SS
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseController

public BaseController()
Method Detail

intercept

protected void intercept(java.util.Map hashMap,
                         java.lang.String InterceptionPointName,
                         InfoGluePrincipal infogluePrincipal)
                  throws ConstraintException,
                         SystemException,
                         Bug,
                         java.lang.Exception
This method is called by the controllers to let interceptors listen to events.

Parameters:
hashMap -
InterceptionPointName -
infogluePrincipal -
Throws:
ConstraintException
SystemException
Bug
java.lang.Exception

intercept

protected void intercept(java.util.Map hashMap,
                         java.lang.String InterceptionPointName,
                         InfoGluePrincipal infogluePrincipal,
                         org.exolab.castor.jdo.Database db)
                  throws ConstraintException,
                         SystemException,
                         Bug,
                         java.lang.Exception
This method is called by the controllers to let interceptors listen to events.

Parameters:
hashMap -
InterceptionPointName -
infogluePrincipal -
Throws:
ConstraintException
SystemException
Bug
java.lang.Exception

createEntity

protected static java.lang.Object createEntity(java.lang.Object entity)
                                        throws SystemException,
                                               Bug
Create, Delete & Update operations

Throws:
SystemException
Bug

createEntity

protected static java.lang.Object createEntity(java.lang.Object entity,
                                               org.exolab.castor.jdo.Database db)
                                        throws SystemException,
                                               Bug,
                                               java.lang.Exception
Throws:
SystemException
Bug
java.lang.Exception

deleteEntity

public static void deleteEntity(java.lang.Class entClass,
                                java.lang.Integer id)
                         throws Bug,
                                SystemException
Throws:
Bug
SystemException

deleteEntity

public static void deleteEntity(java.lang.Class entClass,
                                java.lang.String id)
                         throws Bug,
                                SystemException
Throws:
Bug
SystemException

deleteEntity

public static void deleteEntity(java.lang.Class entClass,
                                java.lang.String id,
                                org.exolab.castor.jdo.Database db)
                         throws Bug,
                                SystemException,
                                java.lang.Exception
Throws:
Bug
SystemException
java.lang.Exception

deleteEntity

public static void deleteEntity(java.lang.Class entClass,
                                java.lang.Integer id,
                                org.exolab.castor.jdo.Database db)
                         throws Bug,
                                SystemException
Throws:
Bug
SystemException

updateEntity

public static BaseEntityVO updateEntity(java.lang.Class arg,
                                        BaseEntityVO vo)
                                 throws Bug,
                                        SystemException
Throws:
Bug
SystemException

updateEntity

public static BaseEntityVO updateEntity(java.lang.Class arg,
                                        BaseEntityVO vo,
                                        org.exolab.castor.jdo.Database db)
                                 throws Bug,
                                        SystemException
Throws:
Bug
SystemException

updateEntity

public static BaseEntityVO updateEntity(java.lang.Class entClass,
                                        BaseEntityVO vo,
                                        java.lang.String collectionMethod,
                                        java.lang.Class manyClass,
                                        java.lang.String[] manyIds)
                                 throws ConstraintException,
                                        SystemException
Throws:
ConstraintException
SystemException

updateEntity

public static IBaseEntity updateEntity(java.lang.Class entClass,
                                       BaseEntityVO vo,
                                       java.lang.String collectionMethod,
                                       java.lang.Class manyClass,
                                       java.lang.String[] manyIds,
                                       org.exolab.castor.jdo.Database db)
                                throws ConstraintException,
                                       SystemException,
                                       java.lang.Exception
Throws:
ConstraintException
SystemException
java.lang.Exception

getObjectWithId

protected static java.lang.Object getObjectWithId(java.lang.Class arg,
                                                  java.lang.Integer id,
                                                  org.exolab.castor.jdo.Database db)
                                           throws SystemException,
                                                  Bug
This method fetches one object / entity within a transaction.

Throws:
SystemException
Bug

getObjectWithIdAsReadOnly

protected static java.lang.Object getObjectWithIdAsReadOnly(java.lang.Class arg,
                                                            java.lang.Integer id,
                                                            org.exolab.castor.jdo.Database db)
                                                     throws SystemException,
                                                            Bug
This method fetches one object / entity within a transaction.

Throws:
SystemException
Bug

getObjectWithId

protected static java.lang.Object getObjectWithId(java.lang.Class arg,
                                                  java.lang.String id,
                                                  org.exolab.castor.jdo.Database db)
                                           throws SystemException,
                                                  Bug
This method fetches one object / entity within a transaction.

Throws:
SystemException
Bug

toVOList

public static java.util.List toVOList(java.util.Collection baseEntities)
                               throws SystemException,
                                      Bug
This method converts a List of entities to a list of value-objects.

Throws:
SystemException
Bug

toModifiableVOList

public static java.util.List toModifiableVOList(java.util.Collection baseEntities)
                                         throws SystemException,
                                                Bug
This method converts a List of entities to a list of value-objects.

Throws:
SystemException
Bug

getVOWithId

public static java.lang.Object getVOWithId(java.lang.Class arg,
                                           java.lang.Integer id)
                                    throws SystemException,
                                           Bug
This method is used to fetch a ValueObject from the database.

Throws:
SystemException
Bug

getVOWithId

public static BaseEntityVO getVOWithId(java.lang.Class arg,
                                       java.lang.Integer id,
                                       org.exolab.castor.jdo.Database db)
                                throws SystemException,
                                       Bug
This method fetches one object in read only mode and returns it's value object.

Throws:
SystemException
Bug

getVOWithId

public static java.lang.Object getVOWithId(java.lang.Class arg,
                                           java.lang.String id)
                                    throws SystemException,
                                           Bug
This method is used to fetch a ValueObject from the database.

Throws:
SystemException
Bug

getVOWithId

public static BaseEntityVO getVOWithId(java.lang.Class arg,
                                       java.lang.String id,
                                       org.exolab.castor.jdo.Database db)
                                throws SystemException,
                                       Bug
This method fetches one object in read only mode and returns it's value object.

Throws:
SystemException
Bug

getAllVOObjects

public static java.util.List getAllVOObjects(java.lang.Class arg,
                                             java.lang.String orderByAttribute,
                                             java.lang.String direction)
                                      throws SystemException,
                                             Bug
This method fetches all object in read only mode and returns a list of value objects.

Throws:
SystemException
Bug

getAllVOObjects

public static java.util.List getAllVOObjects(java.lang.Class arg,
                                             java.lang.String orderByField,
                                             java.lang.String direction,
                                             org.exolab.castor.jdo.Database db)
                                      throws SystemException,
                                             Bug
This method fetches all object in read only mode and returns a list of value objects.

Throws:
SystemException
Bug

getAllVOObjects

public java.util.List getAllVOObjects(java.lang.Class arg,
                                      java.lang.String primaryKey)
                               throws SystemException,
                                      Bug
This method fetches all object in read only mode and returns a list of value objects sorted on primary Key.

Throws:
SystemException
Bug

getAllVOObjects

public java.util.List getAllVOObjects(java.lang.Class arg,
                                      java.lang.String primaryKey,
                                      org.exolab.castor.jdo.Database db)
                               throws SystemException,
                                      Bug
This method fetches all object in read only mode and returns a list of value objects.

Throws:
SystemException
Bug

getAllObjects

public java.util.List getAllObjects(java.lang.Class arg,
                                    java.lang.String primaryKey,
                                    org.exolab.castor.jdo.Database db)
                             throws SystemException,
                                    Bug
This method fetches all object in read only mode and returns a list of objects.

Throws:
SystemException
Bug

executeQuery

protected static java.util.List executeQuery(java.lang.String query)
                                      throws SystemException
Executes a Query with no parameters

Parameters:
query - An OQL Query
Returns:
A VO list of the query results
Throws:
SystemException - If an error occurs

executeQuery

protected static java.util.List executeQuery(java.lang.String query,
                                             org.exolab.castor.jdo.Database db)
                                      throws SystemException
Executes a Query with no parameters

Parameters:
query - An OQL Query
Returns:
A VO list of the query results
Throws:
SystemException - If an error occurs

executeQuery

protected static java.util.List executeQuery(java.lang.String query,
                                             java.util.List params)
                                      throws SystemException
Executes a Query, also binds the provided parameters

Parameters:
query - An OQL Query
params - A List of paramters
Returns:
A VO list of the query results
Throws:
SystemException - If an error occurs

executeQuery

protected static java.util.List executeQuery(java.lang.String query,
                                             java.util.List params,
                                             org.exolab.castor.jdo.Database db)
                                      throws SystemException
Executes a Query, also binds the provided parameters

Parameters:
query - An OQL Query
params - A List of paramters
db - A transaction object
Returns:
A VO list of the query results
Throws:
SystemException - If an error occurs

createQuery

protected static org.exolab.castor.jdo.OQLQuery createQuery(org.exolab.castor.jdo.Database db,
                                                            java.lang.String query,
                                                            java.util.List params)
                                                     throws org.exolab.castor.jdo.PersistenceException
Creates an OQLQuery for the provided Database and binds the parameters to it.

Parameters:
db - The Database to create the OQLQuery on
query - The String OQL query
params - A List of Objects to bind to the query sequentially
Returns:
An OQLQuery instance that can be executer
Throws:
org.exolab.castor.jdo.PersistenceException

validateEntity

public static ConstraintExceptionBuffer validateEntity(ValidatableEntityVO vo)
Validation and integrity check of entities - cre 2002-09-18 / SS


beginTransaction

protected static org.exolab.castor.jdo.Database beginTransaction()
                                                          throws SystemException
Creates a new database and starts a transaction

Returns:
A reference to a castor database with a new transaction
Throws:
SystemException - if a database error occurs.

beginTransaction

protected static void beginTransaction(org.exolab.castor.jdo.Database db)
                                throws SystemException
Begins a transaction on the named database

Throws:
SystemException

commitTransaction

protected static void commitTransaction(org.exolab.castor.jdo.Database db)
                                 throws SystemException
Ends a transaction on the named database

Throws:
SystemException

rollbackTransaction

protected static void rollbackTransaction(org.exolab.castor.jdo.Database db)
                                   throws SystemException
Rollbacks a transaction on the named database

Throws:
SystemException

closeDatabase

protected static void closeDatabase(org.exolab.castor.jdo.Database db)
                             throws SystemException
Rollbacks a transaction on the named database

Throws:
SystemException

getNewVO

public abstract BaseEntityVO getNewVO()


Copyright © 2005 InfoGlue.org All Rights Reserved.