LREL methods supply information about object relationships. Objects with relationships have a left-hand side (lhs) and right-hand side (rhs) definition to describe many-to-many relationships. Some examples of many-to-many relationships include the following:
When working with LREL methods, the BREL or LREL attribute describe many-to-many relationships. The BREL attribute replaces the LREL attribute to define many-to-many relationships. However, the LREL attribute remains backward compatible with previous releases. You declare each relationship in a .maj file and then your code uses the LREL methods, such as CreateLrelRelationship(), with the existing web service client code.
Note: When working with group object management, you can use the special web methods to define a member that belongs to a group.
You declare the relationship using the BREL attribute to define relationships in majic files. For example, the following statement declares a many-to-many relationship for the Change Order (chg) object in change.maj:
asset BREL lrel_asset_chgnr chg {LREL nr;};
The BREL attribute for the change order named, "asset" is a list of all associated configuration items. The optional, LREL flag is an attribute that describes a set of owned resources. The corresponding majic definition of the Configuration Item (nr) includes the following:
chgnr BREL lrel_asset_chgnr nr {LREL chg;};
The chgnr attribute is a list of all change orders for a configuration item.
In your code, you can discover how many configuration items are associated with a change order, call getLrelLength() with the following parameters:
getLrelLength(sid, ChangeHandle, "asset")
You use the sid parameter for the Service ID from a login method. The ChangeHandle parameter is a string handle to a particular change order. Similarly, the following statement describes how to get the names of all configuration items that are related to a change order:
String attrs[] = {"name"};
getLrelValues(sid, ChangeHandle, "asset", 0, -1, attrs);
The getLrelValues() method provides the relationships in the attrs array.
Note: For more information about LREL tables and objects, see the Data Element Dictionary and Objects and Attributes.
|
Copyright © 2013 CA.
All rights reserved.
|
|