Monday, May 21, 2012

Using Regular Expressions with Oracle BPEL


Using Regular Expressions with Oracle BPEL:

Sometimes we may have to validate the data based on the Regular Expressions.

xp20:matches() is a function which can be used to compare data with regular expressions. This function returns true when the input matches the given expression.

xp20:matches(intputString, regexPattern)
  • inputString - The input string
  • regexPattern - The regular expression pattern

Validation of numeric fields :

xp20:matches(bpws:getVariableData('inputString'),'^[0-9]*$')=true()

Validation of alpha fields :

xp20:matches(bpws:getVariableData('inputString'),'^[A-Za-z]*$')=true()

Validation for list of values:

xp20:matches(bpws:getVariableData('inputString'),'^(A|B|C|D)$') =true()

The matches function returns true if inputString variable contains any one of these values (A, B, C, and D).

The expression can be replaced with other regular expressions for similar comparisons.


Important date functions in Oracle BPEL


Important date functions in Oracle BPEL:

Format-dateTime:

This function returns the formatted string of dateTime using the format provided.

xp20:format-dateTime(dateTime as string, format as string)
  •   dateTime – The dateTime to be formatted
  •    format – The format for the output
Format String:-

Format Date Time: Year

Example
Expression
2012
[Y0001]
2012
[Y]
12
[Y01]
Two Thousand and Twelve
[YWw]

Format Date Time: Month

 Example
Expression
08
[M01]
8
[M]
VIII
[MI]
August
[MNn]
AUGUST
[MN]
Aug
[MNn,*-3]
AUG
[MN,*-3]

                                      
Format Date Time: Day

Example
Expression
05
[D01]
5
[D]
5
[D1]
31st
[D1o]
Tuesday
[FNn]


Format Date Time: Hour

Example
Expression
3
[h]
9
[H]
08
[H01]

Format Date Time: Minute
Example
Expression
03
[m01]
3
[m]

Format Date Time: Second
Example
Expression
09
[s01]
9
[s]

Format Date Time: Millisecond
Example
Expression
257
[f001]

Format Date Time: AM/PM
Example
Expression
PM
[PN]
Am
[Pn]

Format Date Time: GMT
Example
Expression
GMT+02:00
[z]


Example:-

xp20:format-dateTime(xp20:current-dateTime(),"[D01]/[M01]/[Y0001] [H01]:[m01]:[s01]")



Saturday, May 19, 2012

JAXB Mapping of XML Schema Built-in Data Types

JAXB Mapping of XML Schema Built-in Data Types  


XML Schema Type
Java Data Type
xsd:string
java.lang.String
xsd:integer
java.math.BigInteger
xsd:int
int
xsd.long
long
xsd:short
short
xsd:decimal
java.math.BigDecimal
xsd:float
float
xsd:double
double
xsd:boolean
boolean
xsd:byte
byte
xsd:QName
javax.xml.namespace.QName
xsd:dateTime
java.util.Calendar
xsd:base64Binary
byte[]
xsd:hexBinary
byte[]
xsd:unsignedInt
long
xsd:unsignedShort
int
xsd:unsignedByte
short
xsd:time
java.util.Calendar
xsd:date
java.util.Calendar
xsd:anySimpleType
java.lang.String