Using imported Plain Java Applications

Creating and editing of Plain Java Application types is not supported in the Modeling perspective. However you can configure this application type in the Eclipse modeler and import it to use it for modeling.

Importing a Plain Java Application

To import a plain Java application created in the Eclipse modeler, import a model containing a plain Java application and drag the application to the diagram canvas of the process where it is required. An activity with this plain Java application is created automatically.


Figure: Drag an imported plain Java application to the diagram canvas

Setting Access Points

When connecting data to the application activity, the data mapping is created automatically.


Figure:

Click on the transition to open the property dialog with Input / Output Data Path and according Access Points.

Return Value of Completion Method

The return value of the completion method, if any, will be exposed as an OUT access point returnValue.

Access Point return value
Figure: Return Value Access Point

Method Parameters

The completion method parameters are exposed as IN access points named xParamn where x is the first letter of the class name and n is a consecutive number, starting with 1.

For example using the following completion method with parameters arg1 and arg2:

public class TestAppl
{

   public TestAppl()
   {
   }
   
   public void notifyCustomer(int arg1, String arg2)
   {
   }
}

would result in the provided access points iParam1 and sParam2.

Access Point
Figure: Access Points for completion method

Note that access points for the constructor method are not provided in the Modeling perspective.

Retrieving Access Points using Annotations

Infinity provides the following two annotations that can be used to retrieve access points via parameter names:

@ParameterNames ({@ParameterName("count"), @ParameterName("name"), ...})
public int method(int arg1, String arg2);

For example, if you set the following annotations for your completion method:

import org.eclipse.stardust.common.annotations.ParameterName;
import org.eclipse.stardust.common.annotations.ParameterNames;

public class TestAppl
{

   public TestAppl()
   {
   }
   
   @ParameterNames({@ParameterName("Element Count"), @ParameterName("Customer Name")})
   public void notifyCustomer(int arg1, String arg2)
   {
   }
}

you see the annotation settings for ParameterNames in the list of access points:

Access Points with Annotation Usage
Figure: Access Points with Annotation Usage

You can also set the parameters in the parameters list directly as shown below:

import org.eclipse.stardust.common.annotations.ParameterName;

public class TestAppl
{

   public TestAppl()
   {
   }
   
   public void notifyCustomer(@ParameterName("Element Count") int arg1, @ParameterName("Customer Name") String arg2)
   {
   }
}

Using custom annotation parameter classes

Instead of importing the predefined classes org.eclipse.stardust.common.annotations.ParameterName and org.eclipse.stardust.common.annotations.ParameterNames, you have the option to create your own custom classes and import them. These classes should follow the pattern below:

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
public @interface ParameterName
{
   String value();
}

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ParameterNames
{
   ParameterName[] value();
}

For details please refer to section Using custom annotation parameter classes in chapter Plain Java Applications of the Modeling Guide. Using custom annotation parameter classes in chapter Plain Java Applications of the Documentation - Modeling Guide.