org.yawlfoundation.yawl.scheduling
Class SchedulingService

java.lang.Object
  extended by org.yawlfoundation.yawl.engine.interfce.interfaceB.InterfaceBWebsideController
      extended by org.yawlfoundation.yawl.scheduling.Service
          extended by org.yawlfoundation.yawl.scheduling.SchedulingService
All Implemented Interfaces:
Constants

public class SchedulingService
extends Service

Bridge between Scheduling Service and the YAWL engine; has to be registered as YAWL service; checks out resource utilisation tasks, i.e. SOU and EOU

Version:
$Id: SchedulingService.java 23027 2010-10-22 14:02:53Z tbe $
Author:
tbe

Field Summary
 
Fields inherited from class org.yawlfoundation.yawl.scheduling.Service
_cancelledWorkitemOrCaseIds, _config, _dataMapper, _handle, _props
 
Fields inherited from class org.yawlfoundation.yawl.engine.interfce.interfaceB.InterfaceBWebsideController
_ibCache, _interfaceBClient, _logger, _report, engineLogonName, engineLogonPassword, XSD_ANYURI_TYPE, XSD_NAMESPACE, XSD_NCNAME_TYPE, XSD_STRINGTYPE
 
Fields inherited from interface org.yawlfoundation.yawl.scheduling.Constants
ADDRESS_TYPE_EMAIL, ADDRESS_TYPE_IP, ADDRESS_TYPE_SMS, CSS_BOOLEANINPUT, CSS_DATEINPUT, CSS_DURATIONINPUT, CSS_ERRORINPUT, CSS_ERRORTEXT, CSS_INTINPUT, CSS_REQUIRED, CSS_TEXTINPUT, CSS_WARNINGINPUT, CSS_WARNINGTEXT, CSV_DELIMITER, DELIMITER, LANGUAGE_ATTRIBUTE_NAME, LANGUAGE_DEFAULT, LANGUAGES, MSGREL_AFTER, MSGREL_BEFORE, RESOURCE_STATUS_AVAILABLE, RESOURCE_STATUS_NOTAVAILABLE, RESOURCE_STATUS_REQUESTED, RESOURCE_STATUS_RESERVED, RESOURCE_STATUS_UNCHECKED, RESOURCE_STATUS_UNKNOWN, UTILISATION_TYPE_BEGIN, UTILISATION_TYPE_END, UTILISATION_TYPE_PLAN, WORD_SEPARATORS, XML_ACTIVITY, XML_ACTIVITYNAME, XML_ACTIVITYTYPE, XML_ADDRESS, XML_ADDRESSTYPE, XML_CAPABILITY, XML_CASEID, XML_CATEGORY, XML_CHANNEL, XML_DUMMY, XML_DURATION, XML_ENDTASKID, XML_ERROR, XML_EVENT_RECEIVE, XML_FILTERMODEL, XML_FROM, XML_ID, XML_MAX, XML_MESSAGE_SEND, XML_MESSAGEPUSH_SEND, XML_MESSAGES, XML_MIN, XML_MSGBODY, XML_MSGDURATION, XML_MSGREL, XML_MSGTO, XML_MSGTRANSFER, XML_MSGUTILISATIONTYPE, XML_OTHERACTIVITYNAME, XML_OTHERUTILISATIONTYPE, XML_PAYLOAD, XML_REQUESTTYPE, XML_RESCHEDULING, XML_RESERVATION, XML_RESERVATIONID, XML_RESOURCE, XML_RESOURCE_TYPE, XML_ROLE, XML_RUP, XML_RUP_LIGHT, XML_STARTTASKID, XML_STATUS, XML_STATUSTOBE, XML_SUBCATEGORY, XML_TEXT, XML_THISUTILISATIONTYPE, XML_TIMESTAMP, XML_TO, XML_UNIT, XML_UTILISATION, XML_UTILISATION_TYPE, XML_UTILISATIONREL, XML_UTILISATIONTYPE, XML_WARNING, XML_WORKLOAD, XSDDatatypes_Boolean, XSDDatatypes_DateTime, XSDDatatypes_Double, XSDDatatypes_Duration, XSDDatatypes_Int, XSDDatatypes_Long, XSDDatatypes_String
 
Method Summary
 void activityStatusChange(String caseId, String activityName, String from, String to)
          call from rescheduling task in yawl engine if rescheduling of an activity was made
 void checkRelations(org.jdom.Document rup)
          check utilisation relations of rup
 void completeRupFromHistory(org.jdom.Document rup, Set<String> addedActivitiyNames)
          completes a rup with historical data of rups with same ActivityType, but only for new added activities and if data fields are empty yet
 void extendRUPFromYAWLModel(org.jdom.Document doc, Set<String> addedActivityNames)
          adds new activities from YAWL model specification to document in right order, e.g.
 List<String> getActivityTypes(String activityName, String newValue)
          retrieve a list of all activity types for showing in configuration dropdown boxes of custom form
 Set<String> getDiffActivityNames(org.jdom.Element e1, org.jdom.Element e2)
          get activity names of e2 which are not in e1
static SchedulingService getInstance()
           
 String getLastSaveMsg()
           
 long getLastSaveTime()
           
 List<org.jdom.Document> getRupList(List<Case> cases)
           
 void handleCancelledCaseEvent(String caseID)
          Receives notification from the engine that an active case has been cancelled.
 void handleCompleteCaseEvent(String caseID, String casedata)
          Receives notification from the engine that an active case has been completed.
 void handleEngineInitialisationCompletedEvent()
          the SS and the RS will get the event at the same time, so the SS will need to delay the call to the RS by 10 seconds while the RS gets the credentials from the engine
 Case loadCase(String caseId)
           
 List<org.jdom.Element> loadReservations(String caseId, String activityName)
          resource service retrieves reservations for given case and task to utilise them
 Set<String> optimizeAndSaveRup(org.jdom.Document rup, String savedBy, String errorMsg, boolean resourceChange)
          TODO@tbe: was wenn RUP gerade angezeigt/konfiguriert wird?
 void processCachedMappingsTask()
          ************************************************************************************** task methods and inner classes ***************************************************************************************
protected  void processMappingChild(Mapping mapping)
          process work item depending on task type check back into the engine remove the mapping for successful processed work items updates the mapping continuously
 void registerMessageReceiveServlet()
          Register the MessageReceiveServlet with the Resource Service TODO@tbe: better to use our own IP and figure out the port number
 void reservationStatusChange(String caseId, String activityName, Long reservationId, String statusNew)
          call from resource service about unavailabilities of resources (if Admin change availability of resource and PLANNING_STATUS was changed to PLANNING_STATUS_NOTAVAILABLE)
 void resourceUtilisationChange(String taskID, String caseId, String activityName, String utilisationType, String timeStampXML)
          call from utilisation task in yawl engine if (de)utilisation for all resources of an activity have to made
 void saveRupToDatabase(String caseId, String savedBy, org.jdom.Document rup, String msg)
           
 void sendPushMessage(String address, String addressType, String msg, String caseId)
           
 void startMessageTransfers(String caseId, org.jdom.Document rup)
          extract message transfers from rup and find/create job group for this rup and update/create job for each message transfer item
 void updateRunningRups(String savedBy)
          call from JobRUPCheck, sets TO time of running activities to actual time and calculate new DURATION value
 
Methods inherited from class org.yawlfoundation.yawl.scheduling.Service
checkInWorkItem, checkOutWorkItem, getChildren, getDataListFromWorkItem, getHandle, getOutputData, getSpecificationForCase, getWorkItemFromCache, handleCancelledWorkItemEvent, handleEnabledWorkItemEvent, isCancelledWorkitem, processMapping, sort
 
Methods inherited from class org.yawlfoundation.yawl.engine.interfce.interfaceB.InterfaceBWebsideController
checkConnection, checkInWorkItem, checkInWorkItem, checkInWorkItem, checkOut, checkOutAllInstancesOfThisTask, connect, describeRequiredParams, destroy, doGet, getAuthenticationConfig, getCachedWorkItem, getChildren, getEngineStoredWorkItem, getIBCache, getModel, getResourcingSpecs, getSpecificationData, getSpecificationData, getSpecificationPrototypesList, getTaskInformation, getTaskInformation, handleCaseResumedEvent, handleCaseSuspendedEvent, handleCaseSuspendingEvent, handleStartCaseEvent, handleTimerExpiryEvent, handleWorkItemStatusChangeEvent, logContactError, prepareReplyRootElement, setEngineLogonName, setEngineLogonPassword, setRemoteAuthenticationDetails, setUpInterfaceBClient, successful
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SchedulingService getInstance()

getLastSaveTime

public long getLastSaveTime()

getLastSaveMsg

public String getLastSaveMsg()

processMappingChild

protected void processMappingChild(Mapping mapping)
                            throws Exception
process work item depending on task type check back into the engine remove the mapping for successful processed work items updates the mapping continuously

Specified by:
processMappingChild in class Service
Parameters:
mapping - : contained work item is child
Throws:
Exception

handleCancelledCaseEvent

public void handleCancelledCaseEvent(String caseID)
Description copied from class: InterfaceBWebsideController
Receives notification from the engine that an active case has been cancelled. Override this method to take any necessary action.

Overrides:
handleCancelledCaseEvent in class Service
Parameters:
caseID - the id of the case that has been cancelled

handleCompleteCaseEvent

public void handleCompleteCaseEvent(String caseID,
                                    String casedata)
Description copied from class: InterfaceBWebsideController
Receives notification from the engine that an active case has been completed. By overriding this method a service can process case completion events as required.

Overrides:
handleCompleteCaseEvent in class Service
Parameters:
caseID - the id of the completed case.
casedata - the set of net-level data for the case when it completes

checkRelations

public void checkRelations(org.jdom.Document rup)
                    throws org.jdom.JDOMException
check utilisation relations of rup

Parameters:
rup -
Throws:
org.jdom.JDOMException

saveRupToDatabase

public void saveRupToDatabase(String caseId,
                              String savedBy,
                              org.jdom.Document rup,
                              String msg)
                       throws org.jdom.JDOMException,
                              SQLException,
                              IOException
Parameters:
caseId -
savedBy -
rup -
Throws:
org.jdom.JDOMException
SQLException
IOException

loadCase

public Case loadCase(String caseId)
              throws SQLException
Throws:
SQLException

extendRUPFromYAWLModel

public void extendRUPFromYAWLModel(org.jdom.Document doc,
                                   Set<String> addedActivityNames)
                            throws Exception
adds new activities from YAWL model specification to document in right order, e.g. if another worklet with new activities was started update times of all activities beginning at last activity which has a time TODO@tbe: returns false also, if order of activities was changed

Parameters:
doc -
Throws:
Exception

getDiffActivityNames

public Set<String> getDiffActivityNames(org.jdom.Element e1,
                                        org.jdom.Element e2)
get activity names of e2 which are not in e1

Parameters:
e1 -
e2 -
Returns:

completeRupFromHistory

public void completeRupFromHistory(org.jdom.Document rup,
                                   Set<String> addedActivitiyNames)
completes a rup with historical data of rups with same ActivityType, but only for new added activities and if data fields are empty yet

Parameters:
rup -
addedActivitiyNames -

getRupList

public List<org.jdom.Document> getRupList(List<Case> cases)

loadReservations

public List<org.jdom.Element> loadReservations(String caseId,
                                               String activityName)
                                        throws SchedulingException
resource service retrieves reservations for given case and task to utilise them

Parameters:
caseId -
activityName -
Returns:
List
Throws:
SchedulingException

activityStatusChange

public void activityStatusChange(String caseId,
                                 String activityName,
                                 String from,
                                 String to)
                          throws SchedulingException
call from rescheduling task in yawl engine if rescheduling of an activity was made

Throws:
SchedulingException

resourceUtilisationChange

public void resourceUtilisationChange(String taskID,
                                      String caseId,
                                      String activityName,
                                      String utilisationType,
                                      String timeStampXML)
                               throws SchedulingException
call from utilisation task in yawl engine if (de)utilisation for all resources of an activity have to made

Parameters:
timeStampXML - yyyy-MM-ddTHH:mm:ss.SSS
Throws:
SchedulingException

reservationStatusChange

public void reservationStatusChange(String caseId,
                                    String activityName,
                                    Long reservationId,
                                    String statusNew)
call from resource service about unavailabilities of resources (if Admin change availability of resource and PLANNING_STATUS was changed to PLANNING_STATUS_NOTAVAILABLE)


updateRunningRups

public void updateRunningRups(String savedBy)
                       throws Exception
call from JobRUPCheck, sets TO time of running activities to actual time and calculate new DURATION value

Throws:
Exception

optimizeAndSaveRup

public Set<String> optimizeAndSaveRup(org.jdom.Document rup,
                                      String savedBy,
                                      String errorMsg,
                                      boolean resourceChange)
                               throws Exception
TODO@tbe: was wenn RUP gerade angezeigt/konfiguriert wird?

Parameters:
rup -
errorMsg -
Throws:
Exception

sendPushMessage

public void sendPushMessage(String address,
                            String addressType,
                            String msg,
                            String caseId)

handleEngineInitialisationCompletedEvent

public void handleEngineInitialisationCompletedEvent()
Description copied from class: Service
the SS and the RS will get the event at the same time, so the SS will need to delay the call to the RS by 10 seconds while the RS gets the credentials from the engine

Overrides:
handleEngineInitialisationCompletedEvent in class Service

registerMessageReceiveServlet

public void registerMessageReceiveServlet()
Register the MessageReceiveServlet with the Resource Service TODO@tbe: better to use our own IP and figure out the port number


getActivityTypes

public List<String> getActivityTypes(String activityName,
                                     String newValue)
                              throws ResourceGatewayException,
                                     IOException
retrieve a list of all activity types for showing in configuration dropdown boxes of custom form

Throws:
YAWLException
ResourceGatewayException
IOException

startMessageTransfers

public void startMessageTransfers(String caseId,
                                  org.jdom.Document rup)
extract message transfers from rup and find/create job group for this rup and update/create job for each message transfer item

Parameters:
rup -

processCachedMappingsTask

public void processCachedMappingsTask()
************************************************************************************** task methods and inner classes ***************************************************************************************



Copyright © 2004-2012 The YAWL Foundation.