Business Objects and Data Sources > Introducing Business Objects and Data Sources > Predefined Business Classes

Predefined business objects include telecommunication network managed objects such as:

Figure 1.28 provides the complete hierarchy for business object classes. For a detailed description of each of these object classes, see the subsequent sections in this documentation.

Predefined business object classes are subclasses of IltObject, which is itself a subclass of IlpDefaultObject. For each class deriving from IltObject, there is an instance of IltObjectInfo that is a subclass of IlpDefaultClass.

The following diagram shows the relationship between these classes.

images/tgo_predefined_object_architecture30.png

Figure 1.27 IltObject Inheritance Path

For details on IlpDefaultObject and IlpDefaultClass, see Business Model API.

The following figure shows the inheritance tree of predefined business classes.

images/tgo_predefined_business_classes31.png

Figure 1.28 Inheritance Tree of Predefined Business Classes

All predefined business object classes can be retrieved using the method GetIlpClass, which is declared in each one of these classes; for example, IltNetworkElement.GetIlpClass. Every business class contains specific attributes that you can set using their particular API, for example, IltNetworkElement.setFamily(value), or the generic IlpObject API, for example, setAttributeValue(IltNetworkElement.FamilyAttribute,value). See Business Model API.

Instances of predefined business classes hold two types of data: structural data and states and alarms.

Attributes of Predefined Business Objects

By default, the IltObject class defines several attributes that are present in all its subclasses. These attributes are the following:

Computed Attributes Based on the Object State

The IltObject business class includes a number of predefined attributes that make it possible to represent the state of the object in the table component. However, you might want to display other information that is contained in the object state in a table column. To do so, you can define a new computed attribute based on the object state.

The following example shows how to define a new computed attribute that returns the number of major new alarms.

How to Define a New Computed Attribute
IlpAttribute NewMajorAlarmAttribute =
  new IltComputedAttribute("newMajorAlarmAttribute",
                           String.class) {
    public Object getValue (IlpAttributeValueHolder h) {
      IltObjectState oState =
         (IltObjectState)h.getAttributeValue(IltObject.ObjectStateAttribute);
      IltAlarm.State alarmState = oState == null
        ? null : (IltAlarm.State)oState.getAlarmState();
      if ( alarmState == null ) return null;
        return alarmState.getNewAlarmCount(IltAlarm.Severity.Major);
    }
 
    public boolean isDependentOn (IlpAttribute a) {
      return a.getName().equals(ObjectStateAttribute.getName());
    }
  };

Extending Predefined Business Classes

To extend a predefined business class dynamically, you can:

Creating a Subclass of a Predefined Business Class Dynamically

The following example demonstrates how to create a subclass of a predefined business class in XML.

How to Create a Subclass of a Predefined Business Object in XML
<class>
    <name>Element</name>
    <superClass>ilog.tgo.model.IltNetworkElement</superClass>
    <attribute>
      <name>throughput</name>
      <javaClass>java.lang.Integer</javaClass>
    </attribute>
</class>

The syntax is the same as for creating a regular class with XML. See Defining the Business Model in XML.

The newly created class extends the IltNetworkElement predefined business class and has an additional attribute (throughput).

This class is an instance of both the IlpClass Element and the Java class ilog.tgo.model.IltNetworkElement.

As shown in the following figure, an instance of Element derives from two class hierarchies: the dynamic class hierarchy and the Java class hierarchy.

images/tgo_predefined_class_inheritance32.png

Figure 1.29 Deriving Instances from the Dynamic and the Java Class Hierarchies

If you create an instance of the IlpClass Element with XML or with the API, the created object will be an instance of the Java class IltNetworkElement.

For example:

How to Extend Predefined Business Object Classes for Use with the Java API
IlpClass elementClass =
  classManager.getClass("Element");
IlpObject element = elementClass.newInstance("element 1", true);

The method newInstance is available in business classes to create new instances. This method has two arguments:

Creating a Java Subclass of a Predefined Business Class

Creating a Java subclass of a predefined business class is similar to what is described in Adding Predefined Business Objects with the following differences:

public MyClass (Object identifier) {
  super(identifier);
}
and
public MyClass (IlpClass ilpclass, Object identifier) {
  super(ilpclass, identifier);
}

The following example illustrate the implementation of a new business object class that inherits from IltNetworkElement. This new business class contains a new attribute, called THROUGHPUT.

How to Create a New Business Class from a Predefined Business Class
public class CustomNetworkElement extends IltNetworkElement {
 
  // Create the business class 
  static IltObjectInfo metainfo = new IltObjectInfo(CustomNetworkElement.class,
      "CustomNetworkElement");
 
  // Create the business attribute and register in the class
  public static final IlpAttribute THROUGHPUT = new IltAttribute("throughput",
                                                                 Integer.class, 
                                                                 metainfo,
                                                                 new
                                                                 Integer(0));
  // Register the new attribute in this business class
  static {
    metainfo.addAttribute(THROUGHPUT);
  }
 
  // Implement method GetIlpClass so that this class is automatically
  // recognized as a business class by the Class Manager service
  public static IltObjectInfo GetIlpClass() {
    return metainfo;
  }
 
  // Implement the class constructor
  public CustomNetworkElement (Object identifier) {
    super(identifier);
  }
 
  // Implement the class constructor
  public CustomNetworkElement (IlpClass clazz, Object identifier) {
    super(clazz, identifier);
  }
 
  public int getThroughput() {
    Object v = getAttributeValue(THROUGHPUT);
    if (v == ilog.cpl.model.IlpAttributeValueHolder.VALUE_NOT_SET)
      return 0;
    else
      return ((Integer)v).intValue();
  }
 
  public void setThroughput(int throughput) {
    setAttributeValue(THROUGHPUT, new Integer(throughput));
  }
}