org.mycore.frontend.workflow
Class MCRSimpleWorkflowManager

java.lang.Object
  extended by org.mycore.frontend.workflow.MCRSimpleWorkflowManager

public class MCRSimpleWorkflowManager
extends Object

This class holds methods to manage the workflow file system of MyCoRe.

Version:
$Revision: 15604 $ $Date: 2009-07-24 09:48:26 +0200 (Fri, 24 Jul 2009) $
Author:
Jens Kupferschmidt

Field Summary
(package private) static Logger logger
           
(package private) static String sender
           
protected static MCRSimpleWorkflowManager singleton
          The link table manager singleton
 
Constructor Summary
protected MCRSimpleWorkflowManager()
          The constructor of this class.
 
Method Summary
 boolean commitDerivateObject(MCRObjectID ID)
          The method commit a derivate object with update method from the workflow to the data store.
 boolean commitMetadataObject(MCRObjectID ID)
          The method commit a metadata object with all referenced derivate objects from the workflow to the data store.
 MCRDerivate createDerivate(MCRObjectID ID, MCRObjectID DD)
          The method create a new MCRDerivate and store them to the directory of the workflow that correspons with the type of the given object MCRObjectID with the name of itseslf.
 void deleteDerivateObject(MCRObjectID ID, MCRObjectID DID)
          The method removes a derivate object from the workflow.
 void deleteMetadataObject(MCRObjectID ID)
          The method removes a metadata object with all referenced derivate objects from the workflow.
 ArrayList<String> getAllDerivateFileNames(String base)
          The method return a ArrayList of file names form derivates they are under .../workflow/ type/...derivate....
 ArrayList<String> getAllObjectFileNames(String base)
          The method return a ArrayList of file names from objects they are under .../workflow/ type/...type....
 File getDirectoryPath(String base)
          The method return the workflow directory path for a given MCRObjectID type.
 List<String> getMailAddress(String base, String todo)
          The method return the information mail address for a given MCRObjectID type.
 String getMailSender()
          The method return the mail sender adress form the configuration.
 MCRObjectID getNextDrivateID(MCRObjectID ID)
          The method return the next free derivate ID.
 Element getRuleFromFile(MCRObjectID mcrid, String permission)
          The method return the conditione XML tree from a XML file in the workflow for a given permission.
 String getWorkflowFile(String pagedir, String base)
          The method return page name of the next URL of the workflow.
static MCRSimpleWorkflowManager instance()
          Returns the workflow manager singleton.
 boolean isDerivateOfObject(String filename, MCRObjectID ID)
          The method read a derivate file with name filename in the workflow directory of type and check that this derivate reference the given ID.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singleton

protected static MCRSimpleWorkflowManager singleton
The link table manager singleton


logger

static Logger logger

sender

static String sender
Constructor Detail

MCRSimpleWorkflowManager

protected MCRSimpleWorkflowManager()
The constructor of this class.

Method Detail

instance

public static MCRSimpleWorkflowManager instance()
Returns the workflow manager singleton.


getDirectoryPath

public final File getDirectoryPath(String base)
The method return the workflow directory path for a given MCRObjectID type.

Parameters:
type - the MCRObjectID type
Returns:
the string of the workflow directory path

getMailAddress

public final List<String> getMailAddress(String base,
                                         String todo)
The method return the information mail address for a given MCRObjectID type.

Parameters:
base - the MCRObjectID base or MCRObjectID type
todo - the todo action String from the workflow.
Returns:
the List of the information mail addresses

getMailSender

public final String getMailSender()
The method return the mail sender adress form the configuration.

Returns:
the mail sender adress

getAllObjectFileNames

public final ArrayList<String> getAllObjectFileNames(String base)
The method return a ArrayList of file names from objects they are under .../workflow/ type/...type....

Parameters:
base - the MCRObjectID base attribute
Returns:
an ArrayList of file names

getAllDerivateFileNames

public final ArrayList<String> getAllDerivateFileNames(String base)
The method return a ArrayList of file names form derivates they are under .../workflow/ type/...derivate....

Parameters:
type - the MCRObjectID type attribute
Returns:
an ArrayList of file names

isDerivateOfObject

public final boolean isDerivateOfObject(String filename,
                                        MCRObjectID ID)
The method read a derivate file with name filename in the workflow directory of type and check that this derivate reference the given ID.

Parameters:
filename - the file name of the derivate
ID - the MCRObjectID of the metadata object
Returns:
true if the derivate refernce the metadata object, else return false

deleteMetadataObject

public final void deleteMetadataObject(MCRObjectID ID)
The method removes a metadata object with all referenced derivate objects from the workflow.

Parameters:
ID - the MCRObjectID of the metadata object

deleteDerivateObject

public final void deleteDerivateObject(MCRObjectID ID,
                                       MCRObjectID DID)
The method removes a derivate object from the workflow.

Parameters:
ID - the MCRObjectID type of the metadata object
DID - the MCRObjectID of the derivate object as String

commitMetadataObject

public final boolean commitMetadataObject(MCRObjectID ID)
                                   throws MCRActiveLinkException
The method commit a metadata object with all referenced derivate objects from the workflow to the data store.

Parameters:
ID - the ID of the metadata object
Throws:
MCRActiveLinkException - if links to the object exist prior loading

commitDerivateObject

public final boolean commitDerivateObject(MCRObjectID ID)
The method commit a derivate object with update method from the workflow to the data store.

Parameters:
ID - the MCRObjectID as String of the derivate object

getNextDrivateID

public final MCRObjectID getNextDrivateID(MCRObjectID ID)
The method return the next free derivate ID. It looks in the current workflow directory and in the server.


createDerivate

public final MCRDerivate createDerivate(MCRObjectID ID,
                                        MCRObjectID DD)
The method create a new MCRDerivate and store them to the directory of the workflow that correspons with the type of the given object MCRObjectID with the name of itseslf. Also ti create a ne directory with the same new name. This new derivate ID was returned.

Parameters:
ID - the MCRObjectID of the related object
DD - the MCRObjectID of the related derivate
Returns:
the MCRObjectID of the derivate

getRuleFromFile

public final Element getRuleFromFile(MCRObjectID mcrid,
                                     String permission)
The method return the conditione XML tree from a XML file in the workflow for a given permission.

Parameters:
id - the MCRObjectID
permission - the permission for the ACL system
Returns:
the XML tree of the condition or null if the permission is not defined

getWorkflowFile

public final String getWorkflowFile(String pagedir,
                                    String base)
The method return page name of the next URL of the workflow.

Parameters:
pagedir - the base directory of the WEB application
base - the MCRObjectID base ID
Returns:
the workflow URL