skip to main content
Programmers documentation > Business objects and data sources > Links > Link bundles
 
Link bundles
Link bundle class
Link bundles are predefined business objects of the class IltLinkBundle used to represent a container with an overview object and a set of detail objects. They can hold any number of links that all start at the same IltObject instance and all end at the same other IltObject instance.
You can collapse a link bundle to show only a single link. The single link has an icon that, when you click it, causes the link bundle to expand and show the child links
The default overview object has the normal link representation, with the same start object and the same end object.
Here is how a link bundle looks in its collapsed state:
Collapsed link bundle
Here is how a link bundle looks in its expandedstate:
Expanded link bundle
The IltLinkBundle class does not define any specific attribute. However, any attribute defined in business class IltLink can be set in link bundle instances and will be graphically represented in the link bundle overview.
You can retrieve the class IltLinkBundle using its GetIlpClass method. You can handle its instances as simple IlpObject instances and set and get its attributes with the generic methods getAttributeValue and setAttributeValue.
Loading a link bundle defined in XML
This section shows how to load a link bundle from an XML file in a data source. For detailed information about data sources, see Data sources.
All you have to do is create a data source using the data source default implementation defined by IltDefaultDataSource and pass the XML file to the parse method of the data source, as shown below:
 
dataSource = new IltDefaultDataSource();
dataSource.parse("LinkBundleXMLFile.xml");
How to define a link bundle in XML
The following is an example of a link bundle defined in XML format. For details about the XML elements used in this example, see Elements in an XML data file .
 
<addObject id="Link1">
  <class>ilog.tgo.model.IltLink</class>
  <link> <from>Paris</from> <to>Berlin</to> </link>
  <attribute name="name">1</attribute>
  <attribute name="objectState" javaClass="ilog.tgo.model.IltSONETObjectState">
    <state>
      Active
    </state>
  </attribute>
</addObject>
 
<addObject id="Link2">
  <class>ilog.tgo.model.IltLink</class>
  <link> <from>Paris</from> <to>Berlin</to> </link>
  <attribute name="name">2</attribute>
  <attribute name="objectState" javaClass="ilog.tgo.model.IltSONETObjectState">
    <state>
      Active
    </state>
  </attribute>
</addObject>
 
<addObject id="linkBundle">
  <class>ilog.tgo.model.IltLinkBundle</class>
  <attribute name="name">Bundle</attribute>
  <link>
    <from>Paris</from>
    <to>Berlin</to>
  </link>
  <children>
    <child>Link1</child>
    <child>Link2</child>
  </children>
</addObject>
The figure below shows the link bundle displayed in a network component:
Link bundle displayed in a network component
The following example shows you how to create a link bundle and set states that are graphically represented when the link bundle is collapsed:
 
<addObject id="linkBundle">
  <class>ilog.tgo.model.IltLinkBundle</class>
  <attribute name="objectState" javaClass="ilog.tgo.model.IltSONETObjectState">
    <state>
      Active
    </state>
  </attribute>
  <link>
    <from>Oslo</from>
    <to>Berlin</to>
  </link>
  <children>
    <child>Link1</child>
    <child>Link2</child>
  </children>
</addObject>
Creating a link bundle with the API
This section shows how to create a link bundle through the API and how to add it to a data source.
How to create a link bundle with the API
 
IltLink link1 = new IltLink(new IltSONETObjectState(IltSONET.State.Active),
   "1", null);
IltLink link2 = new IltLink(new IltSONETObjectState(IltSONET.State.Active),
   "2", null);
IltLinkBundle bundle = new IltLinkBundle();
bundle.setName("Bundle");
List objects = new ArrayList();
objects.add(paris);
objects.add(berlin);
objects.add(link1);
objects.add(link2);
objects.add(bundle);
dataSource.setLink(link1.getIdentifier(), paris.getIdentifier(),
   berlin.getIdentifier());
dataSource.setLink(link2.getIdentifier(), paris.getIdentifier(),
   berlin.getIdentifier());
dataSource.setLink(bundle.getIdentifier(), paris.getIdentifier(),
   berlin.getIdentifier());
dataSource.setParent(link1.getIdentifier(), bundle.getIdentifier());
dataSource.setParent(link2.getIdentifier(), bundle.getIdentifier());
dataSource.addObjects(objects);
The result looks like this:
Link bundle displayed in a network component

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.