Understanding com.sas.metadata.remote Interfaces and Classes |
The AssociationList class provides methods to manage the associations between metadata objects. A SAS Open Metadata Interface metadata object instance is defined by its properties. Attributes describe the characteristics of the object instance, and associations describe the object's relationships with other object instances. All associations on the SAS Metadata Server are bidirectional. An AssociationList object is required to represent each association name.
An AssociationList object is created by submitting a getAssociationName method on the metadata object on the SAS Metadata Server. When using this method, substitute a valid association name for AssociationName. The following is an example of a getAssociationName request:
AssociationList columns = tableObject.getColumns(); columns.add(columnObject);
The first statement specifies to get from the SAS Metadata Server for object tableObject a list of all the objects in the Columns association. If a Columns association does not exist, then an AssociationList object is created on the client, but it is empty.
The second statement adds object columnObject to the Columns AssociationList that was retrieved or created.
Whenever you create an AssociationList object for a specified association name, the SAS Java Metadata Interface automatically creates an AssociationList object that represents the reverse association. For example, for each column listed by the getColumns method, the SAS Java Metadata Interface creates AssociationList objects in the object store representing the reverse association. So, for the preceding example, the columnObject.setTable(tableObject) is performed for the user by the SAS Java Metadata Interface.
If you want to clear the contents of an association, you can use the clear method from the AssociationList class. For the preceding example, you would issue the following:
columns.clear();
The clear method removes all Java objects representing both sides of the bidirectional association.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.