Using a Java Code Activity in BusinessWorks 5.x

Until now, I didn’t think that a post about how to use properly the Java Code Activity has any value for any of my readers. But, now, after a few questions I’ve received by mail I think it could be useful because the TIBCO AMX BW doesn’t have the same user profile than I used to think. So, let me put this in other way.

I have a strong technicak background with my C.S Bachelor and I am a full-stack developer in different languages (Java, Python, C++, Scala..) so in my vision explain how to use this kind of activities is not worth it. But, that’s because I used to forget that the TIBCO AMX BW is a high-level tool that can be used by people with full technical background or with people with a little background. For the seconds group could be difficult to understand how to use this kind of activities that have almost nothing in common with the other ones.

The Java Code activity is one of the ways we have to extend the features that product provide us (we have many other’s like Java Method, custom XSLT.. and so on) but this is the most common and easy way to do it, because it allows us to only put our logic in Java inside a white box the TIBCO Designer gave it to us, like you can see here:



In the other tabs of the activity we can specify the input parameters and output parameters our method is going to have. And that’s an important word to understand how this activity works. The important word is “method”. The Java Code Activity offers you a Java body method to put your code. So, you are limited by the limits of the Java method so:

  • You cannot define new methods inside the box, because you are inside one.
  • You cannot use external libraries that are not included by the TIBCO AMX BW product.

So, you have to think like you only have a method to put your code, and you can see this clear, if you press the Edit Class button you can see in the activity, because it is going to show you the full Java class that is going to own your method logic:


Ok, there you can see it clearly! But, if you think about this box… one question is maybe in your head… Could I modify this Java class? The answer is yes, you can. And with these method you can overpass the limits I said earlier in this post:

You can import more packages that are going to be available for your code, modifying the import section:

package FibonacciIterative;
import java.util.*;
public class FibonacciIterativeJavaCode{

You can add new methods and use it inside your code, as you can see here:

java3And that’s almost everything. I’m going to leave you the code of this two TIBCO BW processes for you if you want to take a look of them and you can ask so many questions as you want. Download.



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s