User Tools

Site Tools


Creating Custom Objects

There are specific types of custom objects that you can create within the EASA API and the structure and content of your custom code will be dictated in large part by which custom object you are creating.

The types of custom objects available in the EASA API are as follows:

The first six (6) custom object types and their required methods are covered in detail on this page, while the final five (5) types are described under Advanced Configuration of EASA.

The four custom objects covered on this page in EASA all must implement the Java interface called CustomObject. The documentation for this interface can be seen in the EASA Java API documentation or javadocs under the package com.easa.rules. To view this documentation, you select the View interface documentation link located on the Custom Code page under the Configure tab in Administrator mode. The CustomObject interface itself has four methods as shown in the table below. These methods are used to add parameters to the object, which are then made available to the custom code.


Note: If you do not have new additional parameters that need to be set, then these methods can return ‘null’.


Return Type Method
java.lang.String getComment()
This method returns the default comment that the object will display on the tree when loaded into EASAP Builder.
java.util.List getEssentialParameters()
Returns a list of new essential parameters that should appear in the author tree for this object.
java.util.List getOptionalParameters()
Returns a list of new optional parameters that should appear in the author tree for this object.
java.util.Map getParameterTypes()
A map of parameters types that will be used with the new parameters using getEssentialParameters() and getOptionalParameters().

CUSTOM SCALAR

A CUSTOM SCALAR is a way of creating a SCALAR value that otherwise is not available in EASA. CUSTOM SCALAR has a corresponding object in the EASAP tree under DATA PROCESSING in EASAP Builder.

The SCALAR value is then associated with the object name given to the CUSTOM SCALAR object in EASAP Builder. When writing your new class to define your CUSTOM SCALAR, you must do one of two things:

  • implement the interface com.easa.dor.CustomScalar
  • extend the abstract class com.easa.dor.DORAdapter

Both of these items are defined in the package com.easa.dor in the Java interfaces documentation. The required method of CUSTOM SCALAR is shown in the table below. This method has a DOREvaluator instance passed into it. This allows the custom code to get the values of other DORs.

For instance, this may be useful when creating new mathematical operations using other object values. See the javadocs for details on com.easa.dor.DOREvaluator.

Return Type Method
java.util.Object getValue(DOR Evaluator dorEval) – Returns an object that represents the SCALAR value.

CUSTOM SCALAR Examples

As examples of custom objects, a set of Java source code files is available for review within EASA. To access these examples, you select the Browse examples link located on the Custom Code page under the Configure tab in Administrator mode. The table below is provided to help you find the CUSTOM SCALAR examples.

Folder File Description
dor/ BetaFunction.java Computes Beta function on two inputs.
dor/ Factorial.java Computes a Factorial.
dor/ GammaFunction.java Computes Gamma function on one input.
dor/ RandomScalar.java Creates a random number.
soap/scalar/ GetConversion.java Uses a web service to return a currency conversion between two countries.
soap/scalar/ GetQuote.java Uses a web service to return stock market quote for a stock on the US market.
soap/scalar/ GetTranslation.java Attempts to use a web service to complete a translation of a string from one language to another.

CUSTOM LIST

A CUSTOM LIST is a way of creating a LIST that otherwise is not available in EASA. CUSTOM LIST has a corresponding object in the EASAP tree under Data Processing in EASAP Builder (See CUSTOM LIST). The list of values is then associated with a CUSTOM LIST in EASAP Builder.

When writing a new class to define a CUSTOM LIST, we must do one of the following:

  • implement the interface com.easa.dor.CustomList
  • extend the abstract class com.easa.dor.DORAdapter

Both of these items are defined in the package com.easa.dor in the javadocs.

The required method of a CUSTOM LIST is shown in the table below. This method has a DOREvaluator instance passed into it. This allows the custom code to get the values of other DORs. See the javadocs for details on com.easa.dor.DOREvaluator.

Return Type Method
java.util.List getValues(DOR Evaluator dorEval)
Returns a java.util.List object that represents the values of the list.

CUSTOM LIST Examples

As examples of custom objects, a set of Java source code files is available for review within EASA. To access these examples, you select the Browse examples link located on the Custom Code page under the Configure tab in Administrator mode. The table shows where to find CUSTOM LIST examples.

Folder File Description
dor/ RandomList.java Creates a list of random numbers.
dor/ ReverseList.java Reverses the order of the values in a list.
soap/list/ GetConversions.java Uses a web service to return currency conversions for the countries: “Euro”, “US”, “UK”, “France”, “Germany”, “Japan”, “Australia”, “Canada” in US Dollars
soap/list/ GetQuotes.java Uses a web service to return stock market quotes for the stocks: “IBM”, “SUNW”, “MSFT”, “INTC”, “ORCL” on the US market.

CUSTOM MULTI-LIST

A CUSTOM MULTI-LIST is a way of creating a set of LIST's that otherwise are not available in EASA. A CUSTOM MULTI-LIST has a corresponding object in the EASAP Tree under DATA PROCESSING in EASAP Builder (See CUSTOM MULTI-LIST).

When writing a new class to define a CUSTOM MULTI-LIST, we must do one of the following:

  • implement the interface com.easa.dor.CustomMultiList
  • extend the abstract class com.easa.dor.MultiDORAdapter

Both of these items are defined in the package com.easa.dor in the javadocs.

The required methods of CUSTOM MULTI-LIST are shown in the table below. These methods have a DOREvaluator instance passed into it. This allows the custom code to get the values of other DORs. For details, see the documentation on com.easa.dor.DOREvaluator.

Return Type Method
java.util.Set getNames(DOR Evaluator dorEval)
Returns a set of the object names for new objects that will be created by this CUSTOM MULTI-LIST.
java.util.Map getValues(DOR Evaluator dorEval)
Returns a map of the new list objects created by this CUSTOM MULTI-LIST.

Since CUSTOM MULTI-LIST's create new object names, these names should be checked with dorEval.checkName(Object name). This method will throw an exception if the object name is not allowed.


Note: Existing objects can also be over written by CUSTOM MULTI-LIST object code, so care should be taken when choosing the object names that the code will produce.


When creating CUSTOM MULTI-LIST code that is intended to be distributed and used by different authors, the overwriting of object names could become a problem. To solve this problem, you can allow the author to control the names of the lists produced by providing a parameter, in which the object names that will be created are specified via a comma separated list of names.

CUSTOM MULTI-LIST Examples

As examples of custom objects, a set of Java source code files is available for review within EASA. To access these examples, you select the Browse examples link located on the Custom Code page under the Configure tab in Administrator mode. The table below is provided to help you find CUSTOM MULTI-LIST examples.

Folder File Description
reader/ ExtractColumnsFromCSV.java Extracts selected columns from a comma separated values (CSV) file.
soap/multilist/ GetQuotesAndConversions.java Uses web services to return both stock quotes and conversion rates for the same lists returned by GetConversions and GetQuotes located under /soap/list/.

CUSTOM ACTION

CUSTOM ACTION's are custom code that may be executed on the client. CUSTOM ACTION has a corresponding ACTION in the EASAP tree under EVENT PROCESSING in EASAP Builder (See [wiki:guides:authors:objects:custom_action]]). Therefore, CUSTOM ACTION's are executed when the corresponding ACTION is triggered after an associated EVENT has happened.

For instance, an Author could create a BUTTON in the user interface of an EASAP, and then create an EVENT PROCESSING. Under the EVENT, a BUTTON PRESSED is created pointing to the BUTTON, and under the ACTION, a CUSTOM ACTION is created to perform an action when the button is pressed by a user.

When writing a new class to define a CUSTOM ACTION, we must do one of two things:

  • implement the interface com.easa.action.CustomAction
  • extend the abstract class com.easa.action.ActionAdapter

Both of these items are defined in the package com.easa.action in the javadocs. The required method of a CUSTOM ACTION is shown in the table below.

The ActionObject passed into the method doAction() allows objects to be retrieved and their values set. Additionally, the ActionObject allows the main Frame of EASA Client to be retrieved, which allows custom GUIs to be produced. It also allows for EASAP files to be downloaded from the server. See the com.easa.action.ActionObject in the javadocs for more information.


Note: If the doAction() method within your custom code returns a value of ‘false’, then no more ACTION's located under the same ACTION as the CUSTOM ACTION will be executed.


Return Type Method
boolean doAction(ActionObject objectAction)
Executes when called by an EVENT PROCESSING.

Note: If the CUSTOM ACTION is to set explicit DORs it should implement CustomDORAction, which extends CustomAction and has the additional method getDORs() which indicates the DOR names and types generated.


CUSTOM ACTION Examples

As examples of CUSTOM objects, a set of Java source code files is available for review within EASA. To access these examples, you select the Browse examples link located on the Custom Code page under the Configure tab in Administrator mode. The table below is provided to help you find CUSTOM ACTION examples.

Folder File Description
action/ CalendarAction.java Allows the user to choose from a date displayed in a calendar-like dialog box.
action/ GetFileAction.java Allows custom actions to get files from the server, which can then be used in custom processes etc. on the client.
action/ NameAndAddressAction.java Displays a dialog containing the widgets for setting the values of four SCALAR's: surname, first name, address and postal code.
action/ OpenBrowserAction.java Opens a browser to a specified URL.
action/ PrintMessageAction.java Prints a message to the EASA server log file.
action/ RunCommandAction.java Runs a system command and can be used to do various things on the client machine.
action/ SetListAction.java Used to set the values of an existing List object.
action/ SetScalarAction.java Used to set the value of an existing SCALAR.
action/ TableAction.java Displays a dialog containing a JTable where the values of four list objects may be specified.
action/ WriteFileAction.java Writes the values of objects to a file.

CUSTOM PROCESS ACTION

CUSTOM PROCESS ACTION's are custom code that may be executed on the EASA Server, between other PROCESS's and ACTION's. When writing a new class to define a CUSTOM PROCESS ACTION, you implement the interface com.easa.action.CustomProcessAction defined in the package com.easa.action in the javadocs. The required methods of a CUSTOM PROCESS ACTION are shown in the table below. The CustomProcessContextServer passed into the method doAction() allows objects to be retrieved and their values set. See the com.easa.action in the javadocs for more information.


Note: If the doAction() method within your custom code throws an exception and the onError method on the authored object is set to stop then further ACTION's on the PROCESSES branch will not be run.


Return Type Method
boolean
Map getDORs()
A map with keys being the DOR names generated, and values being the corresponding type, either com.easa.dor.types.SCALAR or com.easa.dor.types.LIST

CUSTOM PROCESS ACTION Example

As examples of custom objects, a set of Java source code files is available for review within EASA. To access these examples, you select the Browse examples link located on the Custom Code page under the Configure tab in Administrator mode. The table shows where to find CUSTOM PROCESS ACTION examples.

Folder File Description
process action/ CopyFileProcessAction.java Example which copies a results file to an author specified location on the server.

CUSTOM GUI

A CUSTOM GUI is a way to create a new user interface component to be displayed on the graphical user interface of an EASAP opened using the EASA Client. CUSTOM GUI has a corresponding object in the EASAP Tree within TABBED PANE's under the USER INTERFACE branch in EASAP Builder.

To write a CUSTOM GUI, extend the abstract class com.easa.action.AbstractGUIObject. This item is defined in the package com.easa.gui in the javadocs.


Note: CUSTOM GUI is a complex custom object and is intended to be used only with the help of the EASA development team. If you would like to use CUSTOM GUI, please contact your local EASA Support Representative or send an E-mail to: support@easasoftware.com.


CUSTOM GUI Examples

As examples of custom objects, a set of Java source code files is available for review within EASA. To access these examples, you select the Browse examples link located on the Custom Code page under the Configure tab in Administrator mode. The table below is provided to help you find CUSTOM GUI examples.

Folder File Description
gui/ EvaluatingTextBoxImpl.java Creates a text box.
gui/ LogicBoxImpl.java Creates a logic box.

Page Tools