The data payloads of the request and response messages that are sent or
received by the Java client are in the form of a collection of Java objects.
You need to create a class for each Vocabulary entity that is used by the
rules you want to call. You will create get and set methods within each class file. Then
you will export the code to a JAR file, and place it in a location where it can be accessed
by Corticon Server at run-time.
Switch to the Java Perspective in Corticon Studio
Click on the Java option in the top right of your Corticon Studio
screen. If you have not previously opened this perspective, choose:
And then choose Java:
Create Java ‘get’ and ‘set’ methods in a library
You need to create a class for each Vocabulary entity that will be used
by the rules you want to call. In this tutorial, you will create a class for just one
entity – Cargo.
Click File > New > Java Project.
Name the project cargoLibrary.
Accept all the default values, and click Finish.
In the New module-info.java dialog, click Don't Create:
In the Package Explorer, expand cargoLibrary, right-click on
src, and then choose New > Package. Name the package cargoLibrary, and then click Finish.
Right-click on the cargoLibrary package, and
then choose New > Class. Name the class Cargo, and then click Finish. (The class name and the
entity name must match exactly, and they are case-sensitive.) The Java editor opens,
ready for your text.
Declare the entity’s attributes as variables with the appropriate
data type in get and set methods. (The variable and the attribute names must match
exactly, and they are case-sensitive, as shown:
package cargoLibrary;
public class Cargo {
public String container;
public String manifestNumber;
public Boolean needsRefrigeration;
public long volume;
public long weight;
public String getContainer() {
return container;
}
public void setContainer(String container) {
this.container = container;
}
public String getManifestNumber() {
return manifestNumber;
}
public void setManifestNumber(String manifestNumber) {
this.manifestNumber = manifestNumber;
}
public Boolean getNeedsRefrigeration() {
return needsRefrigeration;
}
public void setNeedsRefrigeration(Boolean needsRefrigeration) {
this.needsRefrigeration = needsRefrigeration;
}
public long getVolume() {
return volume;
}
public void setVolume(long volume) {
this.volume = volume;
}
public long getWeight() {
return weight;
}
public void setWeight(long weight) {
this.weight = weight;
}
}
Save the file.
Select the project cargoLibrary.
Choose Export, and then
Java > JAR file.
Select cargoLibrary and its related
files
Name the JAR file Cargo.
Save the JAR file at a temporary location. It is a good idea to save
it in the project.