public class ResourceCalendar
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ResourceCalendar.ResourceGroup |
static class |
ResourceCalendar.Status |
Modifier and Type | Method and Description |
---|---|
long |
addEntry(AbstractResource resource,
long startTime,
long endTime,
ResourceCalendar.Status status,
int workload,
java.lang.String agent,
java.lang.String comment)
Adds an entry to the Calendar table.
|
long |
addEntry(CalendarEntry entry)
Adds an entry to the Calendar table.
|
long |
addEntry(ResourceCalendar.ResourceGroup entry,
long startTime,
long endTime,
ResourceCalendar.Status status,
java.lang.String agent,
java.lang.String comment)
Adds an entry to the Calendar table.
|
long |
addTransientEntry(CalendarEntry entry) |
long |
addTransientEntry(java.lang.String id,
long startTime,
long endTime,
ResourceCalendar.Status status,
int workload,
java.lang.String agent) |
org.hibernate.Transaction |
beginTransaction() |
void |
cancel(long entryID) |
boolean |
canConfirm(long entryID) |
boolean |
canCreateEntry(AbstractResource resource,
long startTime,
long endTime,
ResourceCalendar.Status status,
int workload) |
boolean |
canCreateEntry(AbstractResource resource,
long startTime,
long endTime,
java.lang.String status,
int workload) |
boolean |
canUnconfirm(long entryID) |
boolean |
canUpdateEntry(long entryID,
ResourceCalendar.Status status) |
boolean |
canUpdateEntry(long entryID,
java.lang.String status) |
int |
clean(long priorTo)
Removes all entries from the Calendar table prior to the timestamp passed.
|
void |
commitTransaction() |
void |
confirm(long entryID) |
long |
createEntry(AbstractResource resource,
CalendarEntry entry) |
long |
createEntry(AbstractResource resource,
long startTime,
long endTime,
ResourceCalendar.Status status,
java.lang.String comment,
java.lang.String agent) |
long |
createEntry(AbstractResource resource,
long startTime,
long endTime,
java.lang.String status,
java.lang.String comment,
java.lang.String agent) |
java.util.Set<java.lang.String> |
freeResourcesForCase(java.lang.String caseID) |
java.util.List<TimeSlot> |
getAvailability(AbstractResource resource,
long startTime,
long endTime) |
java.util.List |
getEntries(AbstractResource resource)
Gets the current list of calendar entries for a resource
|
java.util.List |
getEntries(AbstractResource resource,
long from,
long to) |
java.util.List |
getEntries(AbstractResource resource,
long from,
long to,
boolean immediateCommit) |
java.util.List |
getEntries(long from,
long to) |
java.util.List |
getEntries(ResourceCalendar.ResourceGroup entry)
Gets the current list of calendar entries for a Resource Entry type
|
java.util.List |
getEntries(ResourceCalendar.ResourceGroup group,
long from,
long to) |
java.util.List |
getEntries(ResourceCalendar.ResourceGroup group,
long from,
long to,
boolean immediateCommit) |
java.util.List |
getEntries(java.lang.String id,
long from,
long to) |
java.util.List |
getEntries(java.lang.String id,
long from,
long to,
boolean immediateCommit) |
CalendarEntry |
getEntry(long entryID)
Gets the calendar entry associated with the entry identifier passed
|
java.lang.String |
getEntryString(ResourceCalendar.ResourceGroup entry)
Returns a string corresponding to the entry type
|
static ResourceCalendar |
getInstance() |
java.util.List |
getTimeSlotEntries(AbstractResource resource)
Gets the list of calendar entries for a resource.
|
java.util.List |
getTimeSlotEntries(AbstractResource resource,
long from,
long to)
Gets the list of calendar entries within a specified period for a resource.
|
java.util.List |
getTimeSlotEntries(java.lang.String resourceID,
boolean isParticipant,
long from,
long to) |
boolean |
hasStatus(long entryID,
java.lang.String status) |
boolean |
isAvailable(AbstractResource resource)
Checks if the resource is currently available.
|
boolean |
isAvailable(AbstractResource resource,
CalendarEntry entry)
Checks if the resource is available within the specified period.
|
boolean |
isAvailable(AbstractResource resource,
long from,
long to,
int workload) |
boolean |
isAvailable(java.util.Set<java.lang.Long> idsToIgnore,
AbstractResource resource,
long from,
long to)
Checks if the resource is available within the specified period.
|
boolean |
isAvailable(java.util.Set<java.lang.Long> idsToIgnore,
AbstractResource resource,
long from,
long to,
int workload)
Checks if the resource is available within the specified period.
|
java.util.List<TimeSlot> |
makeAvailable(AbstractResource resource,
long startTime,
long endTime) |
void |
makeAvailable(long entryID) |
long |
makeUnavailable(AbstractResource resource,
CalendarEntry calEntry) |
long |
makeUnavailable(AbstractResource resource,
long startTime,
long endTime,
java.lang.String agent,
java.lang.String comment) |
CalendarEntry |
reconcileEntry(AbstractResource resource,
long entryID,
long startTime,
long endTime) |
void |
removeTransientEntries(java.util.Map<java.lang.Long,java.lang.String> transientMap) |
long |
request(AbstractResource resource,
CalendarEntry calEntry) |
long |
request(AbstractResource resource,
long startTime,
long endTime,
java.lang.String agent,
java.lang.String comment) |
long |
reserve(AbstractResource resource,
CalendarEntry calEntry) |
long |
reserve(AbstractResource resource,
long startTime,
long endTime,
java.lang.String agent,
java.lang.String comment) |
void |
rollBackTransaction() |
ResourceCalendar.Status |
strToStatus(java.lang.String name) |
void |
unconfirm(long entryID) |
void |
unrequest(long entryID) |
void |
updateEntry(CalendarEntry entry)
Updates and saves an existing calendar entry
|
ResourceCalendar.Status |
updateEntry(long entryID,
ResourceCalendar.Status status) |
ResourceCalendar.Status |
updateEntry(long entryID,
java.lang.String status) |
java.lang.String |
updateTransientEntry(long entryID,
java.lang.String newStatus) |
public static ResourceCalendar getInstance()
public org.hibernate.Transaction beginTransaction()
public void commitTransaction()
public void rollBackTransaction()
public long addEntry(AbstractResource resource, long startTime, long endTime, ResourceCalendar.Status status, int workload, java.lang.String agent, java.lang.String comment) throws CalendarException
resource
- the resource to add the entry forstartTime
- the date/time when the resource's unavailability startsendTime
- the date/time when the resource's unavailability endsstatus
- the resource's schedule statusworkload
- the percentage workload (1-100)agent
- the id of the user or service that is adding the entrycomment
- an optional comment stringCalendarException
- if invalid parameters are passed, or the addition
otherwise failspublic long addEntry(ResourceCalendar.ResourceGroup entry, long startTime, long endTime, ResourceCalendar.Status status, java.lang.String agent, java.lang.String comment) throws CalendarException
entry
- an Entry value (for multiple resources)startTime
- the date/time when the resource's unavailability startsendTime
- the date/time when the resource's unavailability endsstatus
- the resource's schedule statusagent
- the id of the user or service that is adding the entrycomment
- an optional comment stringCalendarException
- if invalid parameters are passed, or the addition
otherwise failspublic CalendarEntry getEntry(long entryID)
entryID
- the entry identifierpublic java.util.List getEntries(AbstractResource resource)
resource
- the resource to get the entries forpublic java.util.List getEntries(ResourceCalendar.ResourceGroup entry)
entry
- the Entry typepublic int clean(long priorTo)
priorTo
- timestamp that marks when to delete entries up to. Note: priorTo
must be a timestamp prior to the current time.public boolean isAvailable(java.util.Set<java.lang.Long> idsToIgnore, AbstractResource resource, long from, long to)
idsToIgnore
- the primary key(s) of entries to exclude from the check. An
empty Set (or null) means exclude none, otherwise the corresponding entry is
excluded (used when updating an entry)resource
- the resource to check availability forfrom
- the start of a time range to search forto
- the end of a time range to search forpublic boolean isAvailable(AbstractResource resource)
resource
- the resource to check availability forpublic boolean isAvailable(java.util.Set<java.lang.Long> idsToIgnore, AbstractResource resource, long from, long to, int workload)
idsToIgnore
- the primary key(s) of entries to exclude from the check. An
empty Set (or null) means exclude none, otherwise the corresponding entry is
excluded (used when updating an entry)resource
- the resource to check availability forfrom
- the start of a time range to search forto
- the end of a time range to search forworkload
- the percentage workload to check for (0-100)public boolean isAvailable(AbstractResource resource, long from, long to, int workload)
public boolean isAvailable(AbstractResource resource, CalendarEntry entry)
resource
- the resource to check availability forentry
- a CalendarEntry object containing the required parameterspublic java.util.List getTimeSlotEntries(AbstractResource resource, long from, long to)
resource
- the resource to get the entries forfrom
- the start of a time range to search for (-ve value for all start times)to
- the end of a time range to search for (-ve value for all end times)public java.util.List getTimeSlotEntries(java.lang.String resourceID, boolean isParticipant, long from, long to)
public java.util.List getTimeSlotEntries(AbstractResource resource)
resource
- the resource to get the entries forpublic java.util.List getEntries(long from, long to)
public java.util.List<TimeSlot> getAvailability(AbstractResource resource, long startTime, long endTime)
public long createEntry(AbstractResource resource, long startTime, long endTime, java.lang.String status, java.lang.String comment, java.lang.String agent) throws CalendarException, ScheduleStateException
public long createEntry(AbstractResource resource, long startTime, long endTime, ResourceCalendar.Status status, java.lang.String comment, java.lang.String agent) throws CalendarException, ScheduleStateException
public long createEntry(AbstractResource resource, CalendarEntry entry) throws CalendarException, ScheduleStateException
public boolean canCreateEntry(AbstractResource resource, long startTime, long endTime, java.lang.String status, int workload) throws CalendarException
CalendarException
public boolean canCreateEntry(AbstractResource resource, long startTime, long endTime, ResourceCalendar.Status status, int workload)
public ResourceCalendar.Status updateEntry(long entryID, java.lang.String status) throws CalendarException, ScheduleStateException
public ResourceCalendar.Status updateEntry(long entryID, ResourceCalendar.Status status) throws CalendarException, ScheduleStateException
public boolean canUpdateEntry(long entryID, java.lang.String status) throws CalendarException, ScheduleStateException
public boolean canUpdateEntry(long entryID, ResourceCalendar.Status status) throws CalendarException, ScheduleStateException
public CalendarEntry reconcileEntry(AbstractResource resource, long entryID, long startTime, long endTime) throws CalendarException
CalendarException
public java.util.List<TimeSlot> makeAvailable(AbstractResource resource, long startTime, long endTime) throws ScheduleStateException
ScheduleStateException
public void makeAvailable(long entryID) throws CalendarException
CalendarException
public long makeUnavailable(AbstractResource resource, long startTime, long endTime, java.lang.String agent, java.lang.String comment) throws ScheduleStateException, CalendarException
public long makeUnavailable(AbstractResource resource, CalendarEntry calEntry) throws ScheduleStateException, CalendarException
public long reserve(AbstractResource resource, long startTime, long endTime, java.lang.String agent, java.lang.String comment) throws ScheduleStateException, CalendarException
public long reserve(AbstractResource resource, CalendarEntry calEntry) throws ScheduleStateException, CalendarException
public void cancel(long entryID) throws ScheduleStateException, CalendarException
public long request(AbstractResource resource, long startTime, long endTime, java.lang.String agent, java.lang.String comment) throws ScheduleStateException, CalendarException
public long request(AbstractResource resource, CalendarEntry calEntry) throws ScheduleStateException, CalendarException
public void unrequest(long entryID) throws ScheduleStateException, CalendarException
public void confirm(long entryID) throws ScheduleStateException, CalendarException
public void unconfirm(long entryID) throws ScheduleStateException, CalendarException
public boolean canConfirm(long entryID) throws CalendarException
CalendarException
public boolean canUnconfirm(long entryID) throws ScheduleStateException, CalendarException
public ResourceCalendar.Status strToStatus(java.lang.String name) throws CalendarException
CalendarException
public long addTransientEntry(CalendarEntry entry) throws CalendarException
CalendarException
public long addTransientEntry(java.lang.String id, long startTime, long endTime, ResourceCalendar.Status status, int workload, java.lang.String agent) throws CalendarException
CalendarException
public java.lang.String updateTransientEntry(long entryID, java.lang.String newStatus) throws CalendarException
CalendarException
public void removeTransientEntries(java.util.Map<java.lang.Long,java.lang.String> transientMap)
public java.util.Set<java.lang.String> freeResourcesForCase(java.lang.String caseID) throws CalendarException
CalendarException
public long addEntry(CalendarEntry entry) throws CalendarException
entry
- the CalendarEntry to addCalendarException
- if invalid parameters are passed, or the addition
otherwise failspublic java.util.List getEntries(java.lang.String id, long from, long to, boolean immediateCommit)
public java.util.List getEntries(java.lang.String id, long from, long to)
public java.util.List getEntries(ResourceCalendar.ResourceGroup group, long from, long to, boolean immediateCommit)
public java.util.List getEntries(ResourceCalendar.ResourceGroup group, long from, long to)
public java.util.List getEntries(AbstractResource resource, long from, long to, boolean immediateCommit)
public java.util.List getEntries(AbstractResource resource, long from, long to)
public void updateEntry(CalendarEntry entry)
entry
- the entry to updatepublic java.lang.String getEntryString(ResourceCalendar.ResourceGroup entry)
entry
- the entry typepublic boolean hasStatus(long entryID, java.lang.String status) throws CalendarException
CalendarException
Copyright © 2004-2014 The YAWL Foundation.