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 get
AssociationName 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 get
AssociationName 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 empty AssociationList object is created on
the client.
-
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 SAS Metadata Model metadata objects representing both sides of
the bidirectional association.