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

Difference between revisions of "Stardust/Knowledge Base/Modeling/String to SDT conversion and individual extraction and processing"

Line 7: Line 7:
 
[[Image: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.<br>
 
[[Image: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.<br>
  
== POJO and SDTs ==
+
== POJO and SDTs ==
 +
 
 +
[[Image: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:
 +
 
 +
[[Image:Stardust_Modeling_String_to_SDT_conversion_SDT.png]]

Revision as of 06:22, 11 October 2012

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

Back to the top