Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Stardust/Knowledge Base/Modeling/String to SDT conversion and individual extraction and processing

Introduction

Given a single string input (possible from an external system) with a delimiter of your choice, you are required to extract each individual string and perform additional processing on it. All the artifacts referenced in this article may be downloaded from here.

Model

Stardust Modeling String to SDT conversion model.png In the model above, a manual activity accepts a string input from the user. This could possible be replaced by a POJO or Web Service/JMS which integrates with an external system and passes in the input to the process.Thereafter, the process invokes a POJO which is responsible for individual string extraction based on the delimiter of choice (" " in this example) and creating an SDT to hold the list of strings. The SDT data and size of the list are set as process data outputs by the POJO. Thereafter a decision split is encountered. A counter variable ("Counter") which is initialized to 0 is used to iterate through the SDT string list and extract each individual string for display. The user could choose to do additional processing as desired after the string is extracted. Finally, the counter is incremented before the loop completes and the the decision split is revisited. The POJO and SDT types are discussed next.

POJO and SDTs

Stardust Modeling String to SDT conversion POJO new.png

The "extractSubStrings" method of the POJO is invoked by the activity "Split Source String" and the string input is passed in as a parameter. This method is responsible for splitting up the string using the delimiter of choice and writing out the resultant string list to a map with the key "StringsHolder". Note that each element of this map itself happens to be a map with a single element having the key "myString". This structure is required to match the SDT definitions as shown below:

Stardust Modeling String to SDT conversion SDT.png

MTA for Individual String Extraction

Stardust Modeling String to SDT conversion MTA.png

The MTA shown above is invoked by the activity "Extract individual string" (see process model above). The application takes in 2 inputs viz. the current counter value ('Counter") and the SDT data ("SplitStrings") containing the string list. The above transformation is then applied to extract each individual string in turn. This string is written out as the process data "CurrentString" and then used in subsequent activities.

Back to the top