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:
This article describes 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 modified from the default type to other type using the plug-ins.
To change the type, do the following:
In the Actor Editor, click Add Input to add a input argument and then click> Set Editor 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"
]
}
Server/fabric/staticWeb/editors
folder. Click Submit to close the editor.
Then clickagain and switch the Link Type from Link to Const.
Broadway allows creating custom editors (plug-ins) for input argument types on a project level. In order to create a custom editor, do the following:
Create a folder called as your editor's name under the Server/fabric/staticWeb/editors
folder.
In the index.html file, implement the broadwayPluginLoad function that receives a broadwayPluginAPI object.
In the Actor Editor, click Add Input to add a input argument and then click> Set Editor in the input field to open the editor. Then modify the default to the name of your editor.
If your editor receives additional inputs, add them to the definition map in the same way as for the existing editors (see the examples above).
Note that the Server/fabric/staticWeb/editors
folder includes all the existing built-in editors. Thus even though you can modify the code of the built-in editor, it's not recommended to do so because your changes will be lost during the Fabric's version upgrade.
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:
Right click the Broadway folder in the Project tree and click New Actor.
Populate the CheckMaxVal Actor's name and click OK.
Define the Actor as follows:
Set the values of an Actor's input parameters using the Debug / Run Arguments in the Main menu toolbar and debug the Actor.
Once the debug has finished, close the Actor Editor and add the Actor to the required flow.
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:
This article describes 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 modified from the default type to other type using the plug-ins.
To change the type, do the following:
In the Actor Editor, click Add Input to add a input argument and then click> Set Editor 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"
]
}
Server/fabric/staticWeb/editors
folder. Click Submit to close the editor.
Then clickagain and switch the Link Type from Link to Const.
Broadway allows creating custom editors (plug-ins) for input argument types on a project level. In order to create a custom editor, do the following:
Create a folder called as your editor's name under the Server/fabric/staticWeb/editors
folder.
In the index.html file, implement the broadwayPluginLoad function that receives a broadwayPluginAPI object.
In the Actor Editor, click Add Input to add a input argument and then click> Set Editor in the input field to open the editor. Then modify the default to the name of your editor.
If your editor receives additional inputs, add them to the definition map in the same way as for the existing editors (see the examples above).
Note that the Server/fabric/staticWeb/editors
folder includes all the existing built-in editors. Thus even though you can modify the code of the built-in editor, it's not recommended to do so because your changes will be lost during the Fabric's version upgrade.
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:
Right click the Broadway folder in the Project tree and click New Actor.
Populate the CheckMaxVal Actor's name and click OK.
Define the Actor as follows:
Set the values of an Actor's input parameters using the Debug / Run Arguments in the Main menu toolbar and debug the Actor.
Once the debug has finished, close the Actor Editor and add the Actor to the required flow.
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"
]
}