[jboss-user] [jBPM] - Custom BusinessCalendar

Marco Baroetto do-not-reply at jboss.com
Mon Aug 30 10:54:53 EDT 2010


Marco Baroetto [http://community.jboss.org/people/H4rLoCk] replied to the discussion

"Custom BusinessCalendar"

To view the discussion, visit: http://community.jboss.org/message/559563#559563

--------------------------------------------------------------
I think the jBPM Develpers Guide is not correct in 2.1.2 Business Calendar:

 For example: 
public class CustomBusinessCalendar implements BusinessCalendar {
  
  public Date add(Date date, String duration) {
    if ("my next birthday".equals(duration)) {
      GregorianCalendar gregorianCalendar = new GregorianCalendar();
      gregorianCalendar.set(Calendar.MONTH, Calendar.JULY);
      gregorianCalendar.set(Calendar.DAY_OF_MONTH, 21);
      return gregorianCalendar.getTime();
    }
    return null;
  }
}     





To configure the jBPM engine to use this custom business calendar, just add      the following line to your jbpm.cfg.xml: 



<process-engine-context>
    <object  class="org.jbpm.test.custombusinesscalendarimpl.CustomBusinessCalendar"

/>
</process-engine-context>   



 

 Take a look at the       

org.jbpm.test.custombusinesscalendarimpl.CustomBusinessCalendarImplTest for more information. 




1) org.jbpm.test.custombusinesscalendarimpl.CustomBusinessCalendarImplTest doesn't exist

2) To add your EL expression in timers (at least for task's duedate) you have to:

 - Write my.own.MyNextBirthday extends Date (or Calendar,GregorianCalendar...) and is equals to the date you want.
 - Add to your cfg the following:

 <object name="myNextBirthday" class="my.own.MyNextBirthday" />



3) Write your jpdl as follows:

<task name="TaskTransaction2_step1"  duedate="#{myNextBirthday} +3 days" candidate-groups="user">

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/559563#559563]

Start a new discussion in jBPM at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2034]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100830/c7515032/attachment-0001.html 


More information about the jboss-user mailing list