we’d like to use a business calendar (BC) in our services. BCs are created and edited in MWS. There is an API fro working with them. The API even seems to be available in IS – in the sense that I can create a java service and compile it against the API.
But should such service work? Because, in my view, an IS is a different runtime environment than the MWS and hence might not have access to resources (database etc.) the MWS works with.
AFAIK, there is no publicly available API from SAG for accessing Business calendars on MWS. They provide API’s to work with Tasks (BPM) but nothing specific to Calendars in MWS.
You are better off creating your own Framework by using custom config files holding the dates. These config files effectively become your “Calendars”.
That was a quite interesting thread and i completely missed it before posting a reply here. I was looking for documentation on the API’s and couldn’t find any. Were you able to create the Java service for fetching Business Calendars information?
Did you use the classes from com.webMethods.sc.calendar or from com.webMethods.caf.faces.data.calendar?
I agree with Holger about documentation for this API. This will can be a very useful feature within ESB or EAI. I am surprised that SAG did not put this in any Service development help documentation.
This is not about how difficult it is to use API but a reference about this API feature in the documentation will help a lot of folks.
Holger, i created a feature request in Brainstorm for this. 04773.
For other folks who are wondering how this can be done, below is a sample. I could not make it work using the Central Users JDBC connection pool so i used the connection settings directly to MWS database like we do with CDS API.
Create a Business calendar in MWS with the days and start\end times as business hours.
Use an appropriate name for calendars for Looking them up from IS.
Use below service and that will get the working days and start\end times from MWS Business calendars.
Note:
This is not a production level code and this lists out a single operation which will get all the calendar information from MWS in to IS. You can easily modify this code to either find out if current time is within Business hours or other operations like finding if a given day is a working day or not.
The Holiday class does not provide as many methods as the Workday class. You can use the code posted in this thread to determine if the current time is a workday, if it is not then you can mark it as either a holiday or after hours. In this way it addresses both the requirements(Holiday and workday).