de.danet.an.workflow.spis.rms
Class DefaultResource

java.lang.Object
  extended byde.danet.an.workflow.spis.rms.DefaultResource
All Implemented Interfaces:
java.io.Serializable, WfObject, WfResource
Direct Known Subclasses:
DefaultGroupResource, DefaultRoleResource, DefaultUserResource

public class DefaultResource
extends java.lang.Object
implements WfResource, java.io.Serializable

This class provides a default implementation of the WfResource's methods workItems, isMemberOfWorkItems and release. The implementation is based on the methods of a ResourceAssignmentContext passed to the constructor.

See Also:
Serialized Form

Constructor Summary
DefaultResource(ResourceAssignmentContext cbh, java.lang.String key, java.lang.String name)
          The constructor.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean isMemberOfWorkItems(WfAssignment assignment)
          Checks if a given WfAssignment is associated with this resource.
 void release(WfAssignment fromAssignment, java.lang.String releaseInfo)
          Signals to the resource that it is no longer needed for a specific assignment.
 java.lang.String resourceKey()
          Retrieve the key of a resource.
 java.lang.String resourceName()
          Retrieve the name of a resource.
 java.util.Collection workItems()
          This method returns the WfAssignmentss associated with a resource.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultResource

public DefaultResource(ResourceAssignmentContext cbh,
                       java.lang.String key,
                       java.lang.String name)
The constructor. It ensures that a valid factory exists.

Parameters:
key - the resource's key
name - the resource's name
Method Detail

resourceKey

public java.lang.String resourceKey()
                             throws java.rmi.RemoteException
Retrieve the key of a resource.

Specified by:
resourceKey in interface WfResource
Returns:
key of resource
Throws:
java.rmi.RemoteException - problems accessing resource

resourceName

public java.lang.String resourceName()
                              throws java.rmi.RemoteException
Retrieve the name of a resource.

Specified by:
resourceName in interface WfResource
Returns:
name of resource
Throws:
java.rmi.RemoteException - problems accessing resource

workItems

public java.util.Collection workItems()
                               throws java.rmi.RemoteException,
                                      java.lang.IllegalStateException
This method returns the WfAssignmentss associated with a resource.

Specified by:
workItems in interface WfResource
Returns:
the associated WfAssignmentss.
Throws:
java.rmi.RemoteException - if a system-level error occurs.
java.lang.IllegalStateException - if the resource has become invalid. This is actually a remapping of the NoSuchResourceException thrown by ResourceAssignmentService.workItems(). It must be remapped because this method's signature is specified by WfResource.workItems().

isMemberOfWorkItems

public boolean isMemberOfWorkItems(WfAssignment assignment)
                            throws java.rmi.RemoteException,
                                   java.lang.IllegalStateException
Checks if a given WfAssignment is associated with this resource.

Specified by:
isMemberOfWorkItems in interface WfResource
Parameters:
assignment - the assignment in question.
Returns:
true if the association exists.
Throws:
java.rmi.RemoteException - if a system-level error occurs. This is actually a remapping of the NoSuchResourceException thrown by ResourceAssignmentService.isMemberOfWorkItems(...). It must be remapped because this method's signature is specified by WfResource.isMemberOfWorkItems(...).
java.lang.IllegalStateException - if the resource has become invalid.

release

public void release(WfAssignment fromAssignment,
                    java.lang.String releaseInfo)
             throws java.rmi.RemoteException,
                    NotAssignedException
Signals to the resource that it is no longer needed for a specific assignment. The default implementation calls removeAssignment on the activity.

Specified by:
release in interface WfResource
Parameters:
fromAssignment - the specific assignment.
releaseInfo - specifies additional information on the reason for realizing the resource as input.
Throws:
NotAssignedException - if the resource is not associated with the given assignment.
java.rmi.RemoteException - if a system-level error occurs.

hashCode

public int hashCode()

equals

public boolean equals(java.lang.Object obj)