net.sf.dc.wf
Class WorkFlow

java.lang.Object
  extended bynet.sf.dc.wf.WorkFlow

public class WorkFlow
extends java.lang.Object

This is the layer between the UI and the database. Checks for data integrity and checks on bussiness rules are done here

Since:
1.3
Version:
DC0.50
Author:
Robert-Jan van der Waals

Constructor Summary
WorkFlow()
           
 
Method Summary
 boolean checkUniqueness(DCObject o, boolean bUpdate)
          Checks if the object is unique
static java.util.LinkedList createDataCrowObjectArray(java.sql.ResultSet result)
          Converts a resultset to a DataCrowObject Vector
 void deleteCollection(DCCollection collection, RequestorCollection requestors)
          Deletes a collection of data crow objects from the database
 void deleteValues(DCObject o, RequestorCollection requestors)
          Deletes teh object.
 void displayResults(java.util.LinkedList data, RequestorCollection requestorObjects, boolean qryWasSuccess)
          Passes requests thru to the UI (MainFrame)
static void initDatabase()
          Initializes the database
 void insertCollection(DCCollection collection, RequestorCollection requestors)
          Inserts a collection of data crow objects into the database
 void insertValues(DCObject o, RequestorCollection requestors)
          Inserts new values.
 void runQuery(java.lang.String sQuery, RequestorCollection requestors)
          Runs a predefined query
 java.util.LinkedList runQueryDirect(DCObject o)
          Runs a query directly, bypassing the query queue
 java.util.LinkedList runQueryDirect(Query query)
          Does not put the query in a queue but executes it immediately.
 java.util.LinkedList runQueryDirect(java.lang.String sQuery)
          Does not put the query in a queue but executes it immediately.
 java.sql.ResultSet runQueryDirectUnclosed(java.lang.String sQuery)
          Does not put the query in a queue but executes it immediately.
 void searchValues(DCObject o, QueryOptions queryOptions, RequestorCollection requestors)
          Searches for values.
 void updateCollection(DCCollection collection, RequestorCollection requestors)
          Updates a collection of data crow objects
 void updateValues(DCObject o, RequestorCollection requestors)
          Updates values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WorkFlow

public WorkFlow()
Method Detail

initDatabase

public static void initDatabase()
Initializes the database


updateCollection

public void updateCollection(DCCollection collection,
                             RequestorCollection requestors)
Updates a collection of data crow objects

Parameters:
collection - data crow object collection
requestors - requests to be executed after update

insertCollection

public void insertCollection(DCCollection collection,
                             RequestorCollection requestors)
Inserts a collection of data crow objects into the database

Parameters:
collection - data crow object collection
requestors - requests to be executed after insert

deleteCollection

public void deleteCollection(DCCollection collection,
                             RequestorCollection requestors)
Deletes a collection of data crow objects from the database

Parameters:
collection - data crow object collection
requestors - requests to be executed after delete

runQuery

public void runQuery(java.lang.String sQuery,
                     RequestorCollection requestors)
Runs a predefined query

Parameters:
sQuery - query statement
requestors - requests to the UI

searchValues

public void searchValues(DCObject o,
                         QueryOptions queryOptions,
                         RequestorCollection requestors)
Searches for values. The query is put in the query queue. The results are past to the caller by using the RequestorCollection

Parameters:
o - the object which is used as the condition
requestors - requestors for the result of the query (UI)

insertValues

public void insertValues(DCObject o,
                         RequestorCollection requestors)
Inserts new values. The query is put in the query queue. Actions are past to the caller by using the RequestorCollection

Parameters:
o - the object to be inserted
requestors - requestors which depend on the outcome of the query

updateValues

public void updateValues(DCObject o,
                         RequestorCollection requestors)
Updates values. The query is put in the query queue. Actions are past to the caller by using the RequestorCollection

Parameters:
o - the object to be updated
requestors - requestors which depend on the outcome of the query

deleteValues

public void deleteValues(DCObject o,
                         RequestorCollection requestors)
Deletes teh object. The query is put in the query queue. Actions are past to the caller by using the RequestorCollection

Parameters:
o - the object to be updated
requestors - requestors which depend on the outcome of the query

runQueryDirect

public java.util.LinkedList runQueryDirect(DCObject o)
Runs a query directly, bypassing the query queue

Parameters:
o - Data Crow object

runQueryDirect

public java.util.LinkedList runQueryDirect(Query query)
Does not put the query in a queue but executes it immediately. Errors are returned to the caller (not thrown)


runQueryDirectUnclosed

public java.sql.ResultSet runQueryDirectUnclosed(java.lang.String sQuery)
                                          throws java.lang.Exception
Does not put the query in a queue but executes it immediately. Does not close the resultset!

Parameters:
sQuery - query statement
Throws:
java.lang.Exception

runQueryDirect

public java.util.LinkedList runQueryDirect(java.lang.String sQuery)
Does not put the query in a queue but executes it immediately.

Parameters:
sQuery - query statement

displayResults

public void displayResults(java.util.LinkedList data,
                           RequestorCollection requestorObjects,
                           boolean qryWasSuccess)
Passes requests thru to the UI (MainFrame)

Parameters:
requestorObjects - collection of requests

checkUniqueness

public boolean checkUniqueness(DCObject o,
                               boolean bUpdate)
Checks if the object is unique

Parameters:
o - object to be checked
bUpdate - specifies if the object exists already in the database or not

createDataCrowObjectArray

public static java.util.LinkedList createDataCrowObjectArray(java.sql.ResultSet result)
Converts a resultset to a DataCrowObject Vector

Parameters:
result - result set from a query