org.yawlfoundation.yawl.elements.data.external
Class AbstractExternalDBGateway

java.lang.Object
  extended by org.yawlfoundation.yawl.elements.data.external.AbstractExternalDBGateway
Direct Known Subclasses:
SimpleExternalDBGatewayImpl

public abstract class AbstractExternalDBGateway
extends Object

Author: Michael Adams Creation Date: 8/07/2009


Field Summary
protected  HibernateEngine _dbEngine
           
protected  org.apache.log4j.Logger _log
           
 
Constructor Summary
AbstractExternalDBGateway()
           
 
Method Summary
protected  void configureSession(String propertiesFileName, List<Class> classes)
          Configures the engine to the database specified in a properties file
protected  void configureSession(String dialect, String driver, String url, String username, String password, List<Class> classes)
          Configures the engine to the database specified.
abstract  String getDescription()
           
abstract  org.jdom.Element populateCaseData(YSpecificationID specID, String caseID, List<YParameter> inputParams, List<YVariable> localVars, org.jdom.Element caseDataTemplate)
          Populates the case data template passed with values selected from a database.
abstract  org.jdom.Element populateTaskParameter(YTask task, YParameter param, org.jdom.Element caseData)
          Populates the task parameter passed with a value selected from a database.
 String toXML()
           
abstract  void updateFromCaseData(YSpecificationID specID, String caseID, List<YParameter> outputParams, org.jdom.Element updatingData)
          Update the database with the case's values.
abstract  void updateFromTaskCompletion(String paramName, org.jdom.Element outputData, org.jdom.Element caseData)
          Update the database with the workitem's values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected org.apache.log4j.Logger _log

_dbEngine

protected HibernateEngine _dbEngine
Constructor Detail

AbstractExternalDBGateway

public AbstractExternalDBGateway()
Method Detail

configureSession

protected void configureSession(String dialect,
                                String driver,
                                String url,
                                String username,
                                String password,
                                List<Class> classes)
Configures the engine to the database specified. Examples given are for postgres.

Parameters:
dialect - the database dialect (e.g. "org.hibernate.dialect.PostgreSQLDialect")
driver - the database driver (e.g. "org.postgresql.Driver")
url - the database url (e.g. "jdbc:postgresql:yawl")
username - the logon name for the database
password - the logon password
classes - a list of classes for Hibernate to use to converse with the underlying tables (can be null if no classes are involved)

configureSession

protected void configureSession(String propertiesFileName,
                                List<Class> classes)
Configures the engine to the database specified in a properties file

Parameters:
propertiesFileName - the full path & name of the properties file

toXML

public String toXML()

getDescription

public abstract String getDescription()
Returns:
a user-understandable description of the use of the particular extending class, which will be seen in a list in the editor and from which the user can choose the class.

populateTaskParameter

public abstract org.jdom.Element populateTaskParameter(YTask task,
                                                       YParameter param,
                                                       org.jdom.Element caseData)
Populates the task parameter passed with a value selected from a database. Called by the engine to populate a workitem when the workitem starts.

Parameters:
task - the task template for the starting workitem.
param - the name of the parameter that requires values.
caseData - the current set of case variables and values.
Returns:
an Element named after the param (use param.getName()), populated with the appropriate value.

updateFromTaskCompletion

public abstract void updateFromTaskCompletion(String paramName,
                                              org.jdom.Element outputData,
                                              org.jdom.Element caseData)
Update the database with the workitem's values. Called by the engine when the workitem completes.

Parameters:
paramName - the name of the task of which this workitem is an instance.
outputData - the datalist from which the corresponding database values are to be updated.
caseData - the current set of case variables and values.

populateCaseData

public abstract org.jdom.Element populateCaseData(YSpecificationID specID,
                                                  String caseID,
                                                  List<YParameter> inputParams,
                                                  List<YVariable> localVars,
                                                  org.jdom.Element caseDataTemplate)
Populates the case data template passed with values selected from a database. Called by the engine to populate the case-level variables when the case starts. Note that the the returned Element MUST be correctly populated with a value for each input parameter. Local variables are passed so that their initial values may (optionally) be changed, if required; to do so, change the value directly within each variable - local variable values are NOT to be included in the returned Element.

Parameters:
specID - the specification identifier of the case.
caseID - the case identifier.
inputParams - the input parameters that require values.
localVars - the local variables (optionally change their initial values).
caseDataTemplate - the data structure that requires values.
Returns:
an Element of the same structure as 'caseDataTemplate', with populated values.

updateFromCaseData

public abstract void updateFromCaseData(YSpecificationID specID,
                                        String caseID,
                                        List<YParameter> outputParams,
                                        org.jdom.Element updatingData)
Update the database with the case's values. Called by the engine when the case completes.

Parameters:
specID - the specification identifier of the case.
caseID - the case identifier.
outputParams - the output parameters for the case.
updatingData - the datalist from which the corresponding database values are to be updated.


Copyright © 2004-2012 The YAWL Foundation.