org.enhydra.shark
Class WfResourceImpl

java.lang.Object
  extended by org.enhydra.shark.WfResourceImpl
All Implemented Interfaces:
PersistenceInterface, WfResourceInternal

public class WfResourceImpl
extends java.lang.Object
implements WfResourceInternal

WfResourceImpl - Workflow Resource Object implementation. Some methods are doubled. One version is used by the client, and when he executes it, the object is persisted, and the other is used by the persistence layer.

Version:
1.0.1
Author:
Sasa Bojanic, Vladimir Puskas

Field Summary
protected  java.util.Map assignments
           
protected  boolean isAssignmentMapValid
           
protected  boolean justCreated
           
protected  java.lang.String resourceKey
           
protected  java.lang.String resourceName
           
 
Constructor Summary
protected WfResourceImpl(ResourcePersistenceObject po)
          Used to create object when restoring it from database.
protected WfResourceImpl(WMSessionHandle shandle, java.lang.String resourceKey)
          Creates a new WfResource.
 
Method Summary
 void addAssignment(WMSessionHandle shandle, WfAssignmentInternal ass)
           
protected  ResourcePersistenceObject createAndFillPersistentObject()
           
 void delete(WMSessionHandle shandle)
           
 boolean equals(java.lang.Object obj)
          It is assumed that there can't be two or more resources that have the same resource key.
protected  void fillPersistentObject(ResourcePersistenceObject po)
           
 WfAssignmentInternal getAssignment(WMSessionHandle shandle, java.lang.String procId, java.lang.String actId)
           
 java.util.List getAssignments(WMSessionHandle shandle)
           
protected  java.util.Map getAssignmentsMap(WMSessionHandle shandle)
           
 int hashCode()
           
 void persist(WMSessionHandle shandle)
           
 void release(WMSessionHandle shandle, WfAssignmentInternal from_assigment, java.lang.String release_info)
          Releases the resource from the assignment.
 void removeAssignment(WMSessionHandle shandle, java.lang.String procId, java.lang.String actId)
           
 void removeAssignmentsForProcesses(WMSessionHandle shandle, java.util.Collection processIds, boolean invalidateMap)
           
 java.lang.String resource_key(WMSessionHandle shandle)
          Gets the resource username.
 java.lang.String resource_name(WMSessionHandle shandle)
          Gets the resource name.
protected  void restore(ResourcePersistenceObject po)
           
 void restoreAssignment(WMSessionHandle shandle, java.lang.String mgrName, java.lang.String procId, java.lang.String actId, boolean isAccepted)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

resourceKey

protected java.lang.String resourceKey

resourceName

protected java.lang.String resourceName

assignments

protected java.util.Map assignments

justCreated

protected boolean justCreated

isAssignmentMapValid

protected boolean isAssignmentMapValid
Constructor Detail

WfResourceImpl

protected WfResourceImpl(WMSessionHandle shandle,
                         java.lang.String resourceKey)
                  throws java.lang.Exception
Creates a new WfResource.

Parameters:
resourceKey - uniquely identifies the resource, it's a username for logging on engine.
Throws:
java.lang.Exception

WfResourceImpl

protected WfResourceImpl(ResourcePersistenceObject po)
Used to create object when restoring it from database.

Method Detail

resource_key

public java.lang.String resource_key(WMSessionHandle shandle)
                              throws java.lang.Exception
Gets the resource username.

Specified by:
resource_key in interface WfResourceInternal
Throws:
java.lang.Exception

resource_name

public java.lang.String resource_name(WMSessionHandle shandle)
                               throws java.lang.Exception
Gets the resource name.

Specified by:
resource_name in interface WfResourceInternal
Throws:
java.lang.Exception

release

public void release(WMSessionHandle shandle,
                    WfAssignmentInternal from_assigment,
                    java.lang.String release_info)
             throws java.lang.Exception,
                    NotAssigned
Releases the resource from the assignment.

Specified by:
release in interface WfResourceInternal
Throws:
java.lang.Exception
NotAssigned

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addAssignment

public void addAssignment(WMSessionHandle shandle,
                          WfAssignmentInternal ass)
                   throws java.lang.Exception
Specified by:
addAssignment in interface WfResourceInternal
Throws:
java.lang.Exception

removeAssignment

public void removeAssignment(WMSessionHandle shandle,
                             java.lang.String procId,
                             java.lang.String actId)
                      throws java.lang.Exception
Specified by:
removeAssignment in interface WfResourceInternal
Throws:
java.lang.Exception

removeAssignmentsForProcesses

public void removeAssignmentsForProcesses(WMSessionHandle shandle,
                                          java.util.Collection processIds,
                                          boolean invalidateMap)
                                   throws java.lang.Exception
Specified by:
removeAssignmentsForProcesses in interface WfResourceInternal
Throws:
java.lang.Exception

restoreAssignment

public void restoreAssignment(WMSessionHandle shandle,
                              java.lang.String mgrName,
                              java.lang.String procId,
                              java.lang.String actId,
                              boolean isAccepted)
                       throws java.lang.Exception
Specified by:
restoreAssignment in interface WfResourceInternal
Throws:
java.lang.Exception

getAssignmentsMap

protected java.util.Map getAssignmentsMap(WMSessionHandle shandle)
                                   throws java.lang.Exception
Throws:
java.lang.Exception

getAssignments

public java.util.List getAssignments(WMSessionHandle shandle)
                              throws java.lang.Exception
Specified by:
getAssignments in interface WfResourceInternal
Throws:
java.lang.Exception

getAssignment

public WfAssignmentInternal getAssignment(WMSessionHandle shandle,
                                          java.lang.String procId,
                                          java.lang.String actId)
                                   throws java.lang.Exception
Specified by:
getAssignment in interface WfResourceInternal
Throws:
java.lang.Exception

equals

public boolean equals(java.lang.Object obj)
It is assumed that there can't be two or more resources that have the same resource key.

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

persist

public void persist(WMSessionHandle shandle)
             throws java.lang.Exception
Specified by:
persist in interface PersistenceInterface
Throws:
java.lang.Exception

delete

public void delete(WMSessionHandle shandle)
            throws java.lang.Exception
Specified by:
delete in interface PersistenceInterface
Throws:
java.lang.Exception

createAndFillPersistentObject

protected ResourcePersistenceObject createAndFillPersistentObject()

fillPersistentObject

protected void fillPersistentObject(ResourcePersistenceObject po)

restore

protected void restore(ResourcePersistenceObject po)