Posts

Showing posts from April, 2015

Creating Java Custom Functions

Image
You can create custom XPath functions that you can directly use in the Activity Input. These functions come very handy especially when you expect to use them repeatedly for mapping. You can do that by creating a Java Custom Function shared resource. You will have to write a Java class that has a public and static method and returns a value. The method cannot be void or explicitly throw an exception. Supposed you want to have a custom function that replaces all occurrences of a string with another string. This is, in my experience, a common function that is not readily available in TIBCO BW because it doesn't support XSLT 2.0; it's limited to XSLT 1.0. But it allows us to write a Java method and call it via XSLT! To demonstrate that, we can have a Java method that accepts three parameters: the input text, the regular expression or pattern, and the replacement text. I have named this method "replaceRegex" but it could be any descriptive name. I used the String