How to get ITSM Application information using the ARSystem Java API
The Remedy Java API can be used to get a lot of information. We typically either get information from Forms, or we get configuration information from the server itself. In this example we’ll be looking at how to get application information back from the ARSystem.
For that we use the SHARE:Application_Properties Form. This form stores all information about installed BMC applications. It is typically installed if you install ITSM 7.x (It is standard installed on ARSystem 7.5)
The entries in this form are not stored and readable in a very user friendly way. Sometimes we just want to information at a glance about which applications are installed, which patch level we’re at and which languages are there. What our Java application does is it will query the form, get the separate entries that belong to the same application together and print it on the screen.
Let’s have a look first at how we get the information from the ARSystem form. First we define which fields we want to get back. For this we create an array of integers of the field id’s:
int[] fieldsFromShareApp = new int[2];
fieldsFromShareApp[0] = 400081800; // Property Value
fieldsFromShareApp[1] = 400081600; // Application ID
Then we create a QualifierInfo object, which is our query that we will run. The easiest way to creat an object like this is to use the following syntax:
QualifierInfo qualSearch = context.parseQualification(“SHARE:Application_Properties” , “‘Property Name’ = “Name”");
We call the parseQualification function and give it two parameters: the Form name and the qualification as we would put it in the form. Here we use the Database names for the fields, we can also use the field labels. In that case we would use the ParseQualification() function with three parameters: Form name, View Name and Qualification.
Once we have the QualifierInfo object we use it to run the search:
List<Entry> foundAppNames = context.getListEntryObjects(“SHARE:Application_Properties” , qualSearch, 0, 0, null, fieldsFromShareApp, false, null);
This will give us a List of Entry objects that match the qualification. For us these are all entries where the Property Name field holds the value Name. For the other options that we can specify here please consult the ARS Java API Javadoc documentation.
We can see how entries are returned by using the .size() function of the List<Entry> object:
System.out.println(foundAppNames.size() + ” Applications in SHARE:Application_Properties”);
We repeat this step to also retrieve the version, patches and languages installed on the server.
Then we loop through our applications to match up the names with versions, patches and languages:
for (int i = 0; i < foundAppNames.size(); i++)
{
Entry foundApp = foundAppNames.get(i);
String appName = foundApp.get(400081800).toString();
String appID = foundApp.get(400081600).toString();
<……….>
In the above function we browse through the Entry Objects that we have and set the appID String to hold the application InstanceID. We use this ID to compare it to the Application Instance ID in the version information.
// now find the versions
for (int v = 0; v < foundAppVersions.size(); v++) {
Entry foundAppVersion = foundAppVersions.get(v);
String appIDVersion = foundAppVersion.get(400081600).toString();
if (appIDVersion.equals(appID)) {appVersion = foundAppVersion.get(400081800).toString();
}
}// end for loop versions
At the end we display the information in a readable format for the user:
System.out.print(appName + ” Version: ” + appVersion);
if (appPatch != null) {
System.out.print(” Patch ” + appPatch);
}
if (appLanguagepack != null) {
System.out.print(” ” + appLanguagepack);
}
System.out.println();
} // end for loop appNames
You can find the full source code to the application here: arsystemapplicationinfo
Recent Comments