AR System Java API programming model


Consistent with object-oriented design, the AR System Java API represents AR System server objects as Java objects. Java classes are defined for forms, fields, menus, active links, filters, escalations, and all other objects in an AR System application. Entry objects represent entries (requests) so your Java client can manipulate AR System data as well as definitions. The following sections describe the different types of objects and how exceptions are managed:

For more information, see the Java API online documentation, and the ardocVerNum.jar file listed in the AR-System-Java-API-installed-files.To access the Java API documentation:

Unzip the ardocVerNum.jar file, and then open the index.html file. The index.html file gives an overview of the entire AR System Java API documentation with links to the details.

To unzip a JAR file, use the zip utility, Java jar executable, which is in the bin directory of the Java JRE; for example, jar -xvf ardocVerNum.jar.

In the file names, the placeholder VerNum represents the version number of the release.


ARServerUser object

The ARServerUser object represents the connection between your Java client program and the AR System server. It includes session information such as user name, password, and server.

A program starts by creating an ARServerUser object with the user name, password, and server name. Using the ARServerUser instance methods, the program logs in to the AR System server. It then creates, gets, searches for, updates, deletes server objects, and logs out.

A call to a get method returns a server object. A call to a getList (search)method returns a list of object identities (For example: Names for forms or IDs for fields). A call to a getListObjects method returns a list of objects.

For more information, refer to the AR System Javadoc on the PDFs and videos page.


Server objects

The AR System Java API includes classes for all server objects such as Form, Field, View, ActiveLink, Escalation, Filter, Container, Menu, Entry, and SupportFile.

The Form, Field, Container, and Menu classes contain subclasses that represent specialized types.

For example: RegularForm, IntegerField, ApplicationContainer, and SqlMenu.

The ARServerUser create methods, create the server objects. The get and getListObjects methods return them. Each set method takes a server object parameter that specifies which object the server should update.

For example: The ARServerUser method setField takes a Field parameter.


Cloning objects

Objects in the AR System server Java API are cloneable. The clone() method performs a deep copy of the object.

A deep copy is a copy of an object that contains the complete encapsulated data of the original object, enabling it to be used independently of the original Java object. If the original Java object represents a AR System server object, the clone represents the same object.


Exception handling

Errors are modeled through the ARException class. All error messages that the AR System server returns are generated as an ARException in the AR System Java API. Warnings and informational status messages are not treated as exceptions but are available by using the getLastStatus method of the ARServerUser class.

Here is an example for using the getLastStatus method:

        try {           
login();           
int[] fields = new int[] { 1, 8, 536870914
};           
Entry entry = serverUser.getEntry("SomeForm", "ENT000000001", fields);       
//code to process entry after successful retrieval
       } catch (ARException ex) {           
List<StatusInfo> sis = ex.getLastStatus();           
boolean found = false;           
for (Iterator<StatusInfo> it = sis.iterator(); it.hasNext();) {
           StatusInfo
statusInfo = it.next();               
if (statusInfo.getMessageNum() ==
ARErrors.AR_ERROR_NO_ACCESS_TO_SCHEMA) {                   
found = true;                  
//code to process as per permission error                   
break;               
} else if (statusInfo.getMessageNum() ==
ARErrors.AR_ERROR_NO_SUCH_ENTRY) {                   
found = true;                   
//code to process as per invalid entry id or no permission to the entry                   
break;               
}           
}        
if (!found) {               
throw ex;           
}
        }
finally {           
logout();
     }

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*