Created
May 18, 2014 12:05
-
-
Save StanAngeloff/1d826613f0d116e8f0a0 to your computer and use it in GitHub Desktop.
BPELUnit Date arithmetic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<unit:condition> | |
<unit:template><![CDATA[( | |
## Since XPath 1.0 does not support date manipulation functions, | |
## we rely on Velocity's DateTool to perform the arithmetic involved. | |
## | |
## The substring(..) calls build a number from an ISO 8601 string. | |
## The resulting number is subtracted from the current date/time built using Velocity. | |
## | |
## The result of the operation is the duration between the two dates, in seconds. | |
( | |
number('$date.get("yMMddHHmmss")') - | |
number( | |
concat( | |
substring(//xpath/expression, 1, 4), | |
substring(//xpath/expression, 6, 2), | |
substring(//xpath/expression, 9, 2), | |
substring(//xpath/expression, 12, 2), | |
substring(//xpath/expression, 15, 2), | |
substring(//xpath/expression, 18, 2) | |
) | |
) | |
) < (30 * 60) | |
)]]></unit:template> | |
<unit:value>true()</unit:value> | |
</unit:condition> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment