About Transformer Development

Transformers make it possible to transform data between different formats to adapt it to the current needs. Read more about transformers here

Contents

Transformer Types

Transformers can be divided based on their implementation:

How to develop a Transformer

Transformers can be developed in several ways. XSL and Java transformers that can transform Strings can be developed using IFS Developer Studio. XSL transformers can also be developed using different types of third party tools that allow creation of XSL or XSLT files.

Java transformers, both text and binary, can also be developed using an arbitrary tool for Java development. Simply create a new Java class implementing one of the interfaces: ifs.fnd.connect.xml.Transformer or ifs.fnd.connect.xml.BinaryTransformer. Both interfaces are located in the IFS Connect framework, so you have to include the ifs-fnd-connect.jar library to you Java project. You may also need to include libraries ifs-fnd-base.jar and/or ifs-fnd-common.jar with JSF specific classes that IFS Connect may require. Of course, you have to include all the jar libraries that your transformer may require.

Note that the transformer class has to be located in the default package, i.e. do not put it in any specific Java package:

import ifs.fnd.base.IfsException;
import ifs.fnd.connect.xml.Transformer;

public class MyStringTransformer implements Transformer {

   @Override
   public void init() throws IfsException {
   }

   @Override
   public String transform(String str) throws IfsException {
      return str;
   }
}

Both interfaces require you to implement two functions:

The only difference between the two mentioned interfaces is the signature of the transform() method. For the Transformer interface the method takes a String as argument and returns a String (the example above), while for the BinaryTransformer it takes byte array as argument and returns byte array:

   @Override
   public byte[] transform(byte[] data) throws IfsException {
      return data;
   }

Your Java transformer can be compiled to a single class file or build to a jar library. The first option is useful if everything your transformer needs for performing the transformation can be encapsulated within one single Java class and does not rely on any third-party code that is not available during run-time (you can still use framework classes and third-party libraries supplied with IFS Applications).

But if your transformer needs other third-party libraries or the code cannot be kept within a single class, you will need to create a jar file. The file has to include all other classes together with any third-party ones. The jar file has to include a manifest file MANIFEST.MF located in subfolder META-INF with an attribute with name Transformer-class defining the class implementing one of the transformer interfaces.

Examples

There two complete NetBeans example projects available that you can use when creating your own Java transformer:

Developing Transformers with IFS Developer Studio

With IFS Developer Studio it is currently possible to develop only text transformers, i.e. XSL transformers and Java transformers that implement the ifs.fnd.connect.xml.Transformer interface. IFS Developer Studio does not currently support development of transformers based on the ifs.fnd.connect.xml.BinaryTransformer interface.

Follow the guidelines below to develop a transformer using IFS Developer Studio: