Application Integration Guide > ApplicationInterface > Objects

Object Classes

AEObject is the basic class from which other classes can be used to create and edit objects.

Creating Objects

First retrieve the client's folder structure using the class "FolderTree". As this is a request, method sendRequestAndWait is called. Now determine the folder in which the object should be created. Object names must not contain particular characters; hence they have been implemented in an extra class. Select an object name via "UC4ObjectName". The object is created via the class "CreateObject". Subsequently, call the method sendRequestAndWait in order to transfer the request to the AE system.

FolderTree tree = new FolderTree();
uc4.sendRequestAndWait(tree);
IFolder folder = tree.getFolder("/MATERIAL_MANAGEMENT/DAILY_CLOSING");

UC4ObjectName name = new UC4ObjectName("MM_CLOSING");
CreateObject create = new CreateObject(name, Template.JOBS_UNIX, folder);
uc4prod.sendRequestAndWait(create);

Creating Folders

Folders are objects and are created in the same way as all other objects.

UC4ObjectName fname= new UC4ObjectName("PRODUCTION");
CreateObject create = new CreateObject(fname, Template.FOLD, folder);
uc4.sendRequestAndWait(create);

Editing Objects

Use the class "OpenObject" to open the object to be edited. This class contains methods which can be used to query particular information. The example shown below checks whether the object is a UNIX job. If so, the class "Job" can be used to set specifications and attributes in the Job object. Note that the names of users, agents and TimeZone objects have been implemented in extra classes because different naming conventions apply to them.

After the object has been edited, it must be transferred and stored using a request. This is done via the class "SaveObject" which contains the relevant methods. Keep in mind to close the object afterwards.

OpenObject open = new OpenObject(name);
uc4.sendRequestAndWait(open);

if (open.getType().equalsIgnoreCase("JOBS_UNIX"))
{
Job job = (Job) open.getUC4Object();

job.header().setArchiveKey1("Material_Management");
job.attributes().setPriority(100);
job.attributes().setHost(new UC4HostName("UNIX01"));
job.setPostProcess(script);

AttributesUnix hostattributes = (AttributesUnix) job.hostAttributes();
hostattributes.setShell("csh");
hostattributes.setReportDatabase(true);
hostattributes.setReportErrorOnly(true);

SaveObject save = new SaveObject(job);
uc4.sendRequestAndWait(save);
uc4.sendRequestAndWait(new CloseObject(job));
}

Deleting Objects

Use the class "DeleteObject" to delete objects:

DeleteObject delete = new DeleteObject(name);
uc4.sendRequestAndWait(delete);

Searching Objects

The class "SearchObject" can be used to search for objects. Search parameters can be defined the same way as in the UserInterface. The example shown below searches for workflows whose names commence with "FIAC". The request supplies a result which can be filtered with an iterator. Information such as the object name can be retrieved for each result.

SearchObject search = new SearchObject();
search.setTypeJOBP(true);
search.setName("FIBU*");

uc4.sendRequestAndWait(search);

if(search.size() > 0)
{
Iterator it = search.resultIterator();
while(it.hasNext())
{
SearchResultItem result = (SearchResultItem) it.next();
System.out.println("Result: " + result.getName());
}
}

 

See also:

Classes for Workflows and Schedules
Classes for Activities

Classes for Statistics and Reports

Classes for the System Overview