Richard Gu [
http://community.jboss.org/people/gujade] created the discussion
"Help with Custom Business Calendar"
To view the discussion, visit:
http://community.jboss.org/message/561705#561705
--------------------------------------------------------------
Hi,
I need some help with getting custom business calendar to work in my application using
jbpm 4.4.
I have implemented a custom business calendar as follows
public class MercedBusinessCalendarImpl extends BusinessCalendarImpl implements
BusinessCalendar
{
public MercedBusinessCalendarImpl()
{
super();
}
public class MyBusinessCalendarImpl extends BusinessCalendarImpl implements
BusinessCalendar
{
public MercedBusinessCalendarImpl()
{
super();
}
public Date add(Date date, String duration)
{
...
}
}
I have configured the custom business calendar in the jbpm.cfg.xml as directed by
http://docs.jboss.com/jbpm/v4/devguide/html_single/#businesscalendar
http://docs.jboss.com/jbpm/v4/devguide/html_single/#businesscalendar
<?xml version="1.0" encoding="UTF-8"?>
<jbpm-configuration>
<import resource="jbpm.default.cfg.xml" />
<import resource="jbpm.businesscalendar.cfg.xml" />
<import resource="jbpm.tx.hibernate.cfg.xml" />
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.bpmn.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
<!-- Job executor is excluded for running the example test cases. -->
<!-- To enable timers and messages in production use, this should be included.
-->
<import resource="jbpm.jobexecutor.cfg.xml" />
<jbpm-context>
<service name='logging'
factory='org.jbpm.logging.db.DbLoggingServiceFactory' />
</jbpm-context>
<process-engine-context>
<job-executor threads="4" idle="30000"
idle-max="600000" lock="3600000" />
</process-engine-context>
<process-engine-context>
<object class="my.test.MyBusinessCalendarImpl" />
</process-engine-context>
</jbpm-configuration>
I tried to access the business calendar in my code
Configuration jbpmCfg = new Configuration();
ProcessEngine processEngine = jbpmCfg.buildProcessEngine();
BusinessCalendar bizCal = processEngine.get(BusinessCalendar.class);
System.out.println(bizCal.class);
And the result I get is org.jbpm.pvm.internal.cal.BusinessCalendarImpl instead of
my.test.MyBusinessCalendarImpl. I would expect the calendar getting back is an instance of
MyBusinessCalendarImpl.
So I am wonder what I have done wrong? Or can someone help me with the correct way to
get an instance of MyBusinessCalendarImpl working with the process engine.
Thanks in advance for your time and help!
--------------------------------------------------------------
Reply to this message by going to Community
[
http://community.jboss.org/message/561705#561705]
Start a new discussion in jBPM Development at Community
[
http://community.jboss.org/choose-container!input.jspa?contentType=1&...]