User Extensions provide an ability to extend the standard command library-set available in AACCELQ. 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. Following annotations are expected, which are explained in a 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’. Import process will error out in case this annotation is missing. Following attributes belong to this annotation
- tags(): This is an optional attribute. 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 Java method level and identifies a given method as a Command that is exposed in action logic editor.
Note that all the arguments of this method must be of type, ‘String’ and return type must be ‘void’, ‘String’ or any other Java primitive types.
Following attributes are supported for this annotation:
- displayName(): This attribute defines the Command’s display name in the logic editor. 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 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. Content of this attribute matches against 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. Following attributes are supported.
- name(): This attribute defines the name of the command parameter. 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 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 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.