cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving the value of attributes in JavaTask

jjfutt
Champ in-the-making
Champ in-the-making
Hello:

I am trying to find out if in the implementation class of the JavaTask, if there's a way to retrieve the value of attributes from the corresponding Java Task in Orchestration flow, without explicitly declaring corresponding 'Expressions' in the JavaDelegate implementation class.

Details: Currently, to implement custom Java Task, we define the Java Task with some attributes as shown in the screenshot below:
[attachment=1]JavaTask-InterfaceScreenshot.png[/attachment]

Then in the implementation class that implements the JavaDelegate interface, we have to declare these attributes as 'Expressions', and then retrieve the values as shown in the screenshot below:
[attachment=0]JavaTask-ImplScreenshot.png[/attachment]

Q1: Is there a way to implement the JavaDelegate in such a way that we DON'T have to DECLARE the expression. Instead, we'd like to dynamically get a list of attributes (and their values) that were set in the Orchestration Java Tasks. This will allow us to implement a generic JavaDelegate implementation that can be used for multiple JavaTask nodes in the designer palette.

Thanks in advance.
2 REPLIES 2

erny18031
Champ in-the-making
Champ in-the-making
Hi.

e.g. getting al process variables and filtering out the interesting ones?


for (Entry<String, Object> me: exe.getVariables().entrySet()) {
    if (me.getKey().startsWith("orchestra_")) {
        // do something interesting with me.getKey() and me.getValue()
    }
}

Erny

jjfutt
Champ in-the-making
Champ in-the-making
Thanks for responding erny1803.

What you described will definitely work if I was looking to get all the 'Process Variables'. However, that is not what I am after. In my case, we have created some custom Java Tasks (that show up with their own dedicated icons in the service palette in Eclipse Designer). Within these Java Tasks, we have defined some properties that an Orchestration creator can set at time of creating an Orchestration (see screenshot below). Then in the Java Implementation class that implements JavaDelegate interface, of ActivityBehavior interface, the documented way to get these values is to first define these attributes as 'Expressions', and then get their values using the APIs mentioned in my original message.

I am looking for a way to create a generic Java Delegate implementation that can be used for more than Custom Java Tasks. However, we'd still need to programmtically get the value of Task attrributes without declaring 'Expresssions' explicitly.

Any other suggestions or pointers are welcome.

[attachment=0]service-parameters.png[/attachment]