Wednesday, July 18, 2012

3 New Date/Time Comparison Extension Funtions for Netbeans BPEL 2.0 Editor



Originally posted on: 
Checkout 3 new BPEL Extension functions for date/time comparisons. These functions are implemented as extension functions as BPEL 2.0 (which uses XPath 1.0) standard function list does not include these. The syntax and definition for these is derived from XPath 2.0 spec (http://www.w3.org/TR/xquery-operators/). These new functions being -

sxxf:dateTime-less-than  (Less-than comparison on xs:dateTime values)
sxxf:date-less-than      (Less-than comparison on xs:date values)
sxxf:time-less-than      (Less-than comparison on xs:time values)
Where the namespace prefix sxxf stands for "http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/XPathFunctions" which need to be defined in the process definition.

Note that these functions can either take literal value (corresponding to  xs:dateTime, xs:date or xs:time representation) or BPEL Variable of appropriate time.

A test case to showcase example usage of these function is checked in driver tests. Check out BPEL Project and Composite Application from https://open-jbi-components.dev.java.net/source/browse/open-jbi-components/driver-tests/bpelse/xpathfunctions/DateTimeComparison/.
Copying from the test case-

sxxf:dateTime-less-than($NewWSDLOperationIn.dateTime1, $NewWSDLOperationIn.dateTime2)
sxxf:date-less-than($NewWSDLOperationIn.date1, $NewWSDLOperationIn.date2)
sxxf:time-less-than($NewWSDLOperationIn.time1, $NewWSDLOperationIn.time2)

sxxf:dateTime-less-than('2008-09-29T17:15:43.68-08:00', '2008-09-29T17:15:43.67-08:00')
sxxf:date-less-than('2008-09-28', '2008-09-29')
sxxf:time-less-than('17:15:43.68-08:00', '17:15:43.67-08:00')

No comments: