Skip to content

Coded Service

Johannes Heucher edited this page Oct 12, 2022 · 3 revisions

Figure 1: Coded Service Figure 2: Modeling a Coded Service

A Coded Service is an XMOM Object and can be used as a Modeling Block of a Workflow. It is part of a Service Group and is a Java implementation of a Service in contrast to a realization as a Workflow.

Table of Contents

Distinguish from an Instance Service

Both the Coded Service and the Instance Service can be implemented as Java code, while the Instance Service can also be implemented as a Workflow or abstract and is part of and works on a Data Type. If implemented as Java code the Instance Service can be modeled the same way as the Coded Service. In the text below only Coded Services are mentioned, but most of the points can be adopted to Java-based Intance Services.

Create a Coded Service

In order to model new Coded Services in Xyna Process Modeller (cf. fig. 2), the following steps have to be executed:

Create an Empty Coded Service

In order to create a Coded Service, one must first create a new Service Group or open an existing one. Inside the Service Group Modeller, a new Coded Service is created by clicking the plus Icon next to Services.

Name the Service

In the header region of the new Coded Service, you can set the Label of the service. The label should be given as an user-friendly and functional name.

Add Input and Output Parameters

Arbitrary Parameters can be assigned to the Service by dragging them into the Input Parameter or Output Parameter box. If you need a Parameter to be a list, open its context menu (double or right click on it) and select Convert into list (Convert into single, respectively).

Add Throws Parameter

Existing modeled Exception Types can be assigned to the Service by dragging them into the ''Throws Parameter'' box. By doing so the modeling user expresses that this kind of Exception might occur during execution of this Coded Service. This provides an opportunity for Error Handling if this Coded Service is used as Modeling Block inside a Workflow. Therefore these exceptions can be catched and handled by an separate process.

Specify a Code Snippet

The Code Snippet specifies the behavior of the Service during runtime.

Usually the implementation of the Service Group should be used. To generate a corresponding Code Snippet, click on Template Call. This generates a fitting Code Snippet automatically, e.g. xprv.XCtx.SubscriberProvisioningImpl.confirmSubscriber(subscriberID);

Please note: For minimalistic Services or for testing and demonstration purposes, a short snippet of Java code may be entered, which is executed during process execution. However the Code Snippet is not designed for implementing complex functionality in the Service. A complete implementation of the Service outside of the Code Snippet is recommended, e.g. by using an external Integrated development environment (IDE) e.g. Eclipse (Import Java Template into Eclipse).

Make the Service Abortable

The check mark at Is abortable marks a Coded Service as abortable. This means that the downloaded Java Template for implementing the Service includes a method to define the behavior of the Service when aborted during runtime.

Deploy the Service

To store the Coded Service and to make changes taking effect, deploy the Service using the Deployment symbol in the left icon bar. The Deployment can only be executed successfully, if the library used in the Code Snippet of the Service was uploaded to the Service Group.

Please note: Deploying a single Coded Service actually deploys the whole Service Group, the Coded Service is defined in.

Edit a Coded Service

You can open Coded Services from nearly wherever they are displayed, e.g. from inside of a Workflow, out of the Factory Navigation or the Search area of the Xyna Process Modeller. To open and edit a Coded Service, open its context menu (double or right click on it) and select Open in new Tab.

Services with multiple output values return a Container Object. Use XynaObjectList for list entries.

Example: To create a List of Text Objects: XynaObjectList listOfText = new XynaObjectList(Text.class);

Move or Rename a Coded Service

A Coded Service can be renamed from inside the Factory Navigation by using the Service's context menu and choosing Move/Rename. The following dialog will guide through this process.

With this action, all references to the moved object will be adjusted.

Remove a Coded Service

To remove a Coded Service, you have to open its service group and press the icon next to it.

See Also

Clone this wiki locally