User Extensions provide an ability to extend the standard command library set available in ACCELQ. Based on your specific need, you can upload multiple libraries. Once the library is imported, all the extension commands become available in the Action logic editor just like standard ACCELQ commands.
Annotations for User Extension
User Extension is like any standard Java source file with some ACCELQ-specific annotations expected to be provided in the Java source file. The following annotations are expected, which are explained in great detail in subsequent sections:
- @UserLibrary
- @Command
- @Parameter
Import the following packages in the Java class to resolve these annotations
- com.accelq.common.library.annotations.UserLibrary
- com.accelq.common.library.annotations.Command
- com.accelq.common.library.annotations.Parameter
Annotation: @UserLibrary
This annotation is used to declare a Java class as a ‘User Library’. The import process will error in case this annotation is missing. The following attributes belong to this annotation
- tags(): This is an optional attribute. The content of this attribute matches against all the commands belonging to this library. Multiple tags are separated with a ";" delimiter.
Example
@UserLibrary(tags = "multiselect;option;dropdown")
Annotation: @Command
This annotation is marked at the Java method level and identifies a given method as a Command that is exposed in the Action logic editor.
Note that all the arguments of this method must be of the type, ‘String’, and the return type must be ‘void’, ‘String’, or any other Java primitive type.
The following attributes are supported for this annotation:
- displayName(): This attribute defines the Command’s display name in the logic editor. The display name must be unique across all the commands in one library. It is a good practice to keep it unique across all the user libraries to avoid confusion, but that is not a requirement.
- templateStr(): This attribute defines the ‘Natural Language’ statement that appears in the code editor when a command is selected. This statement should clearly define the purpose of this Command. Parameters for the command should be included in the statement in the format, <param1>, <param2> etc. Note that the parameter count starts from 1.
- developerNote(): This is an optional attribute. It is displayed as part of the help text for the command.
- tags(): This is an optional attribute. The content of this attribute matches the command. Multiple tags are specified with a ";" delimiter.
Example
@Command(displayName = "Verify PNR is valid",
templateStr = "Verify if the PNR, <param1> is valid in the user's itinerary list.",
developerNote = "Verifies if the given alphanumeric PNR is valid in the current user's
itinerary list, by checking against the GDS.",
tags = "PNR;ticket;GDS")
Annotation: @Parameter
All the method arguments of the command must be declared with @Parameter annotation. The following attributes are supported.
- name(): This attribute defines the name of the command parameter. The template string in the logic editor uses this name to represent the parameter.
- enumValues(): This argument allows providing a fixed set of possible value options for a command parameter from which the user must select one. These value options are comma (,) separated strings enclosed in curly brackets ‘{…}’.
- description(): This is an optional argument. It describes the parameter for the help text.
Examples
@Parameter(name = "PNR", description = "PNR number to validate")
@Parameter(name = "GDS", enumValues = {"Sabre,Amadeus"}, description = "Name of GDS")
Comments
0 comments
Article is closed for comments.