Actor Editor is a tool which enables creation of new Actors either based on an existing Actor or from scratch, based on your own Java class.
The Actor Editor is displayed as a dummy flow with one Actor that can be setup / modified using the extended Actor's Properties window.
When creating a new Actor, you need to do the following:
The Actor Editor can be used to create a new inherited Actor or modify an existing one via its [Actor Name].actor file. The Actor must inherit either from another Actor or from an Inner Flow that has been saved as an Actor.
To create a new Actor, do the following:
To modify an Actor, do the following:
Broadway enables you to create an Actor that inherits its properties and behaviors from a custom Java class rather than from another Actor.
To create a new Actor from scratch, do the following:
Create your own Java class: Right click the Java folder in the Project tree either in the Shared Object or under the Logical Unit. Then click New Java File.
Define the class as follows to inherit the core Actor's properties and behaviors:
public class <class_name> implements Actor {
}
Or
public class <class_name> extends <core_actor_name> {
}
@Override
public void action(Data input, Data output) throws Exception {
final String caseId = input.string("caseId");
try {
//your logic ....
output.put ("status", "OK");
} catch (Exception e){
handleError(e, output);
}
}
If the Actor maintains a state, implement a close method to reset it.
Since the Actors are serialized when running in Recovery mode and their input/output values are serialized to be displayed in the Data Viewer, make sure that Actor, its members and input/output fields are either serializable or transient.
Once this new Java class is ready, create a new Actor. Right click the Broadway folder and click New Actor.
Populate the Class with your Java class's path. For example, when the Java class is located under the Logical Unit, the class is:
com.k2view.cdbms.usercode.lu.<lu_name>.<class_name>
The Actor's input argument type can be changed from the default to other type using the built-in plug-ins.
To change the type, do the following:
Click Add Input to add a input argument and then click> Advanced in the input field to open the editor.
Modify the default to one of the following types as follows:
{
"id": "com.k2view.dropdown",
"options": [
"1",
"2"
]
}
{
"id": "com.k2view.innerflow"
}
{
"id": "com.k2view.logicalUnit",
"addEmptyEntry": true
}
{
"id": "com.k2view.interface",
"interfaceType": [
"database"
]
}
Click Submit to close the editor.
Then clickagain and switch the Link Type from Link to Const.
New Actor Which Inherits from Existing Actor
Let's create a new CheckMaxVal Actor that inherits its properties and behaviors from a JavaScript Actor: It receives two integers and returns their maximum value. Do the following:
New Actor Which Inherits from Custom Java Class
When creating a new Actor which inherits from custom Java class, do all the steps until the selection of Parent. Instead, populate the Class with your customer Java class name.
Then define the required input and output arguments and run the Actor to debug it.
If an input field should be different than default, click> Advanced in the input field and change the type in the editor. For example, as follows:
{
"id": "com.k2view.dropdown",
"options": [
"1",
"2",
"3",
"4",
"5"
]
}
Actor Editor is a tool which enables creation of new Actors either based on an existing Actor or from scratch, based on your own Java class.
The Actor Editor is displayed as a dummy flow with one Actor that can be setup / modified using the extended Actor's Properties window.
When creating a new Actor, you need to do the following:
The Actor Editor can be used to create a new inherited Actor or modify an existing one via its [Actor Name].actor file. The Actor must inherit either from another Actor or from an Inner Flow that has been saved as an Actor.
To create a new Actor, do the following:
To modify an Actor, do the following:
Broadway enables you to create an Actor that inherits its properties and behaviors from a custom Java class rather than from another Actor.
To create a new Actor from scratch, do the following:
Create your own Java class: Right click the Java folder in the Project tree either in the Shared Object or under the Logical Unit. Then click New Java File.
Define the class as follows to inherit the core Actor's properties and behaviors:
public class <class_name> implements Actor {
}
Or
public class <class_name> extends <core_actor_name> {
}
@Override
public void action(Data input, Data output) throws Exception {
final String caseId = input.string("caseId");
try {
//your logic ....
output.put ("status", "OK");
} catch (Exception e){
handleError(e, output);
}
}
If the Actor maintains a state, implement a close method to reset it.
Since the Actors are serialized when running in Recovery mode and their input/output values are serialized to be displayed in the Data Viewer, make sure that Actor, its members and input/output fields are either serializable or transient.
Once this new Java class is ready, create a new Actor. Right click the Broadway folder and click New Actor.
Populate the Class with your Java class's path. For example, when the Java class is located under the Logical Unit, the class is:
com.k2view.cdbms.usercode.lu.<lu_name>.<class_name>
The Actor's input argument type can be changed from the default to other type using the built-in plug-ins.
To change the type, do the following:
Click Add Input to add a input argument and then click> Advanced in the input field to open the editor.
Modify the default to one of the following types as follows:
{
"id": "com.k2view.dropdown",
"options": [
"1",
"2"
]
}
{
"id": "com.k2view.innerflow"
}
{
"id": "com.k2view.logicalUnit",
"addEmptyEntry": true
}
{
"id": "com.k2view.interface",
"interfaceType": [
"database"
]
}
Click Submit to close the editor.
Then clickagain and switch the Link Type from Link to Const.
New Actor Which Inherits from Existing Actor
Let's create a new CheckMaxVal Actor that inherits its properties and behaviors from a JavaScript Actor: It receives two integers and returns their maximum value. Do the following:
New Actor Which Inherits from Custom Java Class
When creating a new Actor which inherits from custom Java class, do all the steps until the selection of Parent. Instead, populate the Class with your customer Java class name.
Then define the required input and output arguments and run the Actor to debug it.
If an input field should be different than default, click> Advanced in the input field and change the type in the editor. For example, as follows:
{
"id": "com.k2view.dropdown",
"options": [
"1",
"2",
"3",
"4",
"5"
]
}