AR System Java API programming model
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:
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();
}