org.yawlfoundation.yawl.resourcing.calendar
Class ResourceScheduler

java.lang.Object
  extended by org.yawlfoundation.yawl.resourcing.calendar.ResourceScheduler

public class ResourceScheduler
extends Object

The implementation of server side of the calendar gateway (Interface S).

Author:
Michael Adams
Created/Last Date:
2/11/2010

Method Summary
 List<TimeSlot> getAvailability(String resourceXML, long from, long to)
          Gets the available time slots for a datetime range for each resource referenced within the given resource XML record.
 List<TimeSlot> getAvailability(UtilisationResource uResource, long from, long to)
          Gets the available time slots for a datetime range for each resource referenced within the given resource XML record.
protected  List getCalendarEntriesForCase(String caseID)
          Gets a list of all calendar entries for a case
protected  Set<Long> getCalendarEntryIDsForCase(String caseID)
          Gets the set of all calendar entry ids for a case
static ResourceScheduler getInstance()
          Gets an instance of this ResourceScheduler object
 String getReservations(String resourceXML, long from, long to)
          Gets all the utilisation plans in which a resource is involved for the specified period
 Set<UtilisationPlan> getReservations(UtilisationResource uResource, long from, long to)
          Gets the set of utilisation plans in which a resource is involved for the specified period
protected  void notifyStatusChange(CalendarEntry calEntry)
          Builds an appropriate data set and announces a status change for a calendar record.
protected  boolean reassignEntryIfPossible(CalendarEntry entry, boolean updating)
          Seeks another AbstractResource that meets the original UtilisationResource parameters and is available, and if found reassigns the calendar entry to the found resource.
 String saveReservations(String planXML, String agent, boolean checkOnly)
          Saves and/or updates the reservations contained in a utilisation plan
 UtilisationPlan saveReservations(UtilisationPlan plan, String agent, boolean checkOnly)
          Saves and/or updates the reservations contained in a utilisation plan
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ResourceScheduler getInstance()
Gets an instance of this ResourceScheduler object

Returns:
this ResourceScheduler instance

saveReservations

public String saveReservations(String planXML,
                               String agent,
                               boolean checkOnly)
Saves and/or updates the reservations contained in a utilisation plan

Parameters:
planXML - an XML reresentation of a utilisation plan
agent - the user id of the user or service that generated the plan
checkOnly - if true, checks if the reservations would succeed only, makes no changes
Returns:
an XML representation of the updated plan

saveReservations

public UtilisationPlan saveReservations(UtilisationPlan plan,
                                        String agent,
                                        boolean checkOnly)
Saves and/or updates the reservations contained in a utilisation plan

Parameters:
plan - the utilisation plan
agent - the user id of the user or service that generated the plan
checkOnly - if true, checks if the reservations would succeed only, makes no changes
Returns:
the updated plan

getReservations

public String getReservations(String resourceXML,
                              long from,
                              long to)
Gets all the utilisation plans in which a resource is involved for the specified period

Parameters:
resourceXML - an XML representation of a utilisation resource object, containing reference(s) to the resources to get plans for
from - the start of the date/time range
to - the end of the date/time range
Returns:
an XML representation of the matching utilisation plans

getReservations

public Set<UtilisationPlan> getReservations(UtilisationResource uResource,
                                            long from,
                                            long to)
Gets the set of utilisation plans in which a resource is involved for the specified period

Parameters:
uResource - a utilisation resource object, containing references to the resource(s) to get plans for
from - the start of the date/time range
to - the end of the date/time range
Returns:
the set of matching utilisation plans

getAvailability

public List<TimeSlot> getAvailability(String resourceXML,
                                      long from,
                                      long to)
Gets the available time slots for a datetime range for each resource referenced within the given resource XML record.

Parameters:
resourceXML - an XML String equivalent of a UtilisationResource record
from - the start of the date/time range
to - the end of the date/time range
Returns:
a consolidated list of timeslots when the resources are available

getAvailability

public List<TimeSlot> getAvailability(UtilisationResource uResource,
                                      long from,
                                      long to)
Gets the available time slots for a datetime range for each resource referenced within the given resource XML record.

Parameters:
uResource - a UtilisationResource record referencing resource(s)
from - the start of the date/time range
to - the end of the date/time range
Returns:
a consolidated list of timeslots when the resources are available

reassignEntryIfPossible

protected boolean reassignEntryIfPossible(CalendarEntry entry,
                                          boolean updating)
Seeks another AbstractResource that meets the original UtilisationResource parameters and is available, and if found reassigns the calendar entry to the found resource.

Parameters:
entry - the CalendarEntry containing a reference to a resource that is no longer available, but may be replaced by another resource of the same role, capability or category
updating - true if the caller is updating an existing calendar entry, false if it is a new entry
Returns:
true if the resource has been reassigned

getCalendarEntryIDsForCase

protected Set<Long> getCalendarEntryIDsForCase(String caseID)
Gets the set of all calendar entry ids for a case

Parameters:
caseID - the id of case to get the entry ids for
Returns:
the set of ids

getCalendarEntriesForCase

protected List getCalendarEntriesForCase(String caseID)
Gets a list of all calendar entries for a case

Parameters:
caseID - the id of case to get the entry ids for
Returns:
the list of calendar entries

notifyStatusChange

protected void notifyStatusChange(CalendarEntry calEntry)
Builds an appropriate data set and announces a status change for a calendar record.

Parameters:
calEntry - the calendar record that has had a status change


Copyright © 2004-2012 The YAWL Foundation.