Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

de.danet.an.workflow.assignment
Class StandardResourceAssignmentService  view StandardResourceAssignmentService download StandardResourceAssignmentService.java

java.lang.Object
  extended byde.danet.an.workflow.assignment.StandardResourceAssignmentService
All Implemented Interfaces:
de.danet.an.workflow.spis.ras.ResourceAssignmentService, java.io.Serializable

public class StandardResourceAssignmentService
extends java.lang.Object
implements de.danet.an.workflow.spis.ras.ResourceAssignmentService, java.io.Serializable

This class implements the standard resource assignment service provided as part of the workflow package.


Field Summary
private  AssignmentService as
          The reference to the server side service implementation.
private static boolean ejbConfigured
           
private static java.util.HashMap finderCache
          A cache with activity finders for optimization.
private  de.danet.an.workflow.spis.rms.ResourceManagementService rms
          The resource management service associated with this service.
private static de.danet.an.workflow.spis.rms.ResourceManagementService rmsCache
          The resource management service associated with the factory.
private static de.danet.an.workflow.spis.rms.ResourceManagementServiceFactory rmsf
          The associated resource management service factory.
 
Constructor Summary
StandardResourceAssignmentService(AssignmentService assignSvc, de.danet.an.workflow.spis.rms.ResourceManagementServiceFactory rmsFac)
          Constructs a new resource assignment service.
 
Method Summary
 void addAssignment(de.danet.an.workflow.spis.ras.ActivityFinder finder, java.lang.String actId, de.danet.an.workflow.omgcore.WfActivity activity, de.danet.an.workflow.omgcore.WfResource resource)
          Manually assign a resource to an activity.
 de.danet.an.workflow.omgcore.WfResource asResource(java.security.Principal principal)
          Given a principal, return the workflow resource associated with this principal.
 java.util.Collection assignments(de.danet.an.workflow.spis.ras.ActivityFinder finder, java.lang.String actId, de.danet.an.workflow.omgcore.WfActivity activity)
          Return the assignments to an activity.
 void autoAssignResources(de.danet.an.workflow.spis.ras.ActivityFinder finder, java.lang.String actId, de.danet.an.workflow.omgcore.WfActivity activity, java.security.Principal principal, de.danet.an.workflow.spis.ras.Participant participant)
          Triggers the automatic assignment of resources to an activity that is about to become ready.
private  void configureEJB()
          Configure the associated EJB.
protected  long finderIndex(de.danet.an.workflow.spis.ras.ActivityFinder finder)
          Get the finder index for a finder.
private  de.danet.an.workflow.spis.rms.ResourceManagementService getRms()
          Get the resource management service.
 boolean isMemberOfWorkItems(de.danet.an.workflow.omgcore.WfResource resource, de.danet.an.workflow.omgcore.WfAssignment assignment)
          Find out if a given assignment belongs to the work items assigned to a particular resource.
 java.util.Collection knownResources()
          Returns at least the collection of all the workflow resources whom has been assigned work items, but optionally it can return the additional workflow resources who are known to the resource assignment service.
 void releaseResources(de.danet.an.workflow.spis.ras.ActivityFinder finder, java.lang.String actId, de.danet.an.workflow.omgcore.WfActivity activity, java.lang.String releaseInfo)
          Remove all assignments to an activity.
 de.danet.an.workflow.omgcore.WfResource resourceByKey(java.lang.String key)
          Given the key of a WfResource (obtained with resourceKey()>resourceKey() 55 ), return the workflow resource associated with this key.
 java.util.Collection workItems(de.danet.an.workflow.omgcore.WfResource resource)
          Return the assignments of a given resource.
private  void writeObject(java.io.ObjectOutputStream out)
          Serializing requires some preparation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

as

private AssignmentService as
The reference to the server side service implementation.


rmsf

private static de.danet.an.workflow.spis.rms.ResourceManagementServiceFactory rmsf
The associated resource management service factory.


rmsCache

private static de.danet.an.workflow.spis.rms.ResourceManagementService rmsCache
The resource management service associated with the factory.


rms

private de.danet.an.workflow.spis.rms.ResourceManagementService rms
The resource management service associated with this service.


finderCache

private static java.util.HashMap finderCache
A cache with activity finders for optimization.


ejbConfigured

private static boolean ejbConfigured
Constructor Detail

StandardResourceAssignmentService

public StandardResourceAssignmentService(AssignmentService assignSvc,
                                         de.danet.an.workflow.spis.rms.ResourceManagementServiceFactory rmsFac)
Constructs a new resource assignment service.

Method Detail

getRms

private de.danet.an.workflow.spis.rms.ResourceManagementService getRms()
Get the resource management service. This can only be done lazily, as the resource management service needs a resource assignment service and we would end up in loop if we wouldn't do it lazily.


configureEJB

private void configureEJB()
                   throws java.rmi.RemoteException
Configure the associated EJB. Configuration currently consists of setting the resource management service. This can't be done in the constructor as we need the resource management service in order to do so. The resource management service must, however, be created lazily as stated in getRms 55 .


writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
Serializing requires some preparation. We do not assume that service factories are serializable. Therefore we cannot transfer rmsf (that's why it is declared transient). If we have not obtained the service before serialization, we can therefore no longer obtain it after deserialization. So just make sure we have it now.


finderIndex

protected long finderIndex(de.danet.an.workflow.spis.ras.ActivityFinder finder)
                    throws java.rmi.RemoteException
Get the finder index for a finder.


asResource

public de.danet.an.workflow.omgcore.WfResource asResource(java.security.Principal principal)
                                                   throws java.rmi.RemoteException,
                                                          de.danet.an.workflow.spis.ras.NoSuchResourceException
Given a principal, return the workflow resource associated with this principal. This implementation simply delegates the request to the resource management service.

Specified by:
asResource in interface de.danet.an.workflow.spis.ras.ResourceAssignmentService

resourceByKey

public de.danet.an.workflow.omgcore.WfResource resourceByKey(java.lang.String key)
                                                      throws de.danet.an.workflow.spis.ras.NoSuchResourceException,
                                                             java.rmi.RemoteException
Given the key of a WfResource (obtained with resourceKey()>resourceKey() 55 ), return the workflow resource associated with this key.

This method is implemented by simply calling resourceByKey>resourceByKey 55 of the underlying resource management service.

Specified by:
resourceByKey in interface de.danet.an.workflow.spis.ras.ResourceAssignmentService

autoAssignResources

public void autoAssignResources(de.danet.an.workflow.spis.ras.ActivityFinder finder,
                                java.lang.String actId,
                                de.danet.an.workflow.omgcore.WfActivity activity,
                                java.security.Principal principal,
                                de.danet.an.workflow.spis.ras.Participant participant)
                         throws java.rmi.RemoteException
Triggers the automatic assignment of resources to an activity that is about to become ready.

If resSel is of type string, the following cases are handled by the assignment service:

!:currentUser
Assigns the current user.
In all other cases the parameter resSel is simply passed through to the resource selection service 55 .

Specified by:
autoAssignResources in interface de.danet.an.workflow.spis.ras.ResourceAssignmentService

addAssignment

public void addAssignment(de.danet.an.workflow.spis.ras.ActivityFinder finder,
                          java.lang.String actId,
                          de.danet.an.workflow.omgcore.WfActivity activity,
                          de.danet.an.workflow.omgcore.WfResource resource)
                   throws java.rmi.RemoteException,
                          de.danet.an.workflow.spis.ras.NoSuchResourceException
Manually assign a resource to an activity.

Specified by:
addAssignment in interface de.danet.an.workflow.spis.ras.ResourceAssignmentService

releaseResources

public void releaseResources(de.danet.an.workflow.spis.ras.ActivityFinder finder,
                             java.lang.String actId,
                             de.danet.an.workflow.omgcore.WfActivity activity,
                             java.lang.String releaseInfo)
                      throws java.rmi.RemoteException
Remove all assignments to an activity.

Specified by:
releaseResources in interface de.danet.an.workflow.spis.ras.ResourceAssignmentService

assignments

public java.util.Collection assignments(de.danet.an.workflow.spis.ras.ActivityFinder finder,
                                        java.lang.String actId,
                                        de.danet.an.workflow.omgcore.WfActivity activity)
                                 throws java.rmi.RemoteException
Return the assignments to an activity.

Specified by:
assignments in interface de.danet.an.workflow.spis.ras.ResourceAssignmentService

workItems

public java.util.Collection workItems(de.danet.an.workflow.omgcore.WfResource resource)
                               throws java.rmi.RemoteException
Return the assignments of a given resource.

Specified by:
workItems in interface de.danet.an.workflow.spis.ras.ResourceAssignmentService

isMemberOfWorkItems

public boolean isMemberOfWorkItems(de.danet.an.workflow.omgcore.WfResource resource,
                                   de.danet.an.workflow.omgcore.WfAssignment assignment)
                            throws java.rmi.RemoteException,
                                   de.danet.an.workflow.spis.ras.NoSuchResourceException
Find out if a given assignment belongs to the work items assigned to a particular resource.

Specified by:
isMemberOfWorkItems in interface de.danet.an.workflow.spis.ras.ResourceAssignmentService

knownResources

public java.util.Collection knownResources()
                                    throws java.rmi.RemoteException
Returns at least the collection of all the workflow resources whom has been assigned work items, but optionally it can return the additional workflow resources who are known to the resource assignment service.

Specified by:
knownResources in interface de.danet.an.workflow.spis.ras.ResourceAssignmentService