The adapter

The equipment adapter converts business objects into representation objects of type equipment node. It is defined by the class IlpEquipmentAdapter.
Equipment adapters retrieve structural information (that is, parent/child relationship) about business objects from the associated data source and determine whether an object should appear as a root representation object by examining a list of origins. See Setting a list of origins for details.
The following figure shows equipment adapter classes:
tgo_equipment_adapter.png
Equipment adapter classes
Nodes are created with an IlpEquipmentNodeFactory. By default, this factory is an instance of the class IlpDefaultEquipmentNodeFactory which creates IlpDefaultEquipmentNode instances.
Similarly, links are created with an IlpEquipmentLinkFactory. By default, this factory is an instance of the class IlpDefaultEquipmentLinkFactory which creates IlpDefaultEquipmentLink instances.
The equipment adapter supports the concept of position or shape of objects. By default, it interprets every object attribute with name position as the position of that object. You can specify any other attribute instead, for all instances of a given IlpClass, through the method setPositionAttribute of the class IlpAbstractNodeAdapter.
You can create an equipment adapter implicitly by instantiating the IlpEquipment component as shown in the following example.

How to create an equipment adapter by instantiating an equipment component

IlpEquipment ilpEquipment = new IlpEquipment();
IlpDataSource dataSource = new IlpDefaultDataSource();
ilpEquipment.setDataSource(dataSource);
If you want to configure the adapter, to set its origin for example, you must first retrieve it from the equipment component and then set it to the data source.

How to configure an equipment adapter

IlpEquipment ilpEquipment = new IlpEquipment();
IlpDataSource dataSource = new IlpDefaultDataSource();
// configure the adapter, for example set an origin
IlpEquipmentAdapter adapter = ilpEquipment.getAdapter();
adapter.setOrigins(Collections.singletonList("origin"),false);
adapter.setDataSource(dataSource);
The equipment adapter supports temporary representation objects. For more information, see Creating a temporary representation object.

Creating a temporary representation object

The equipment adapter supports temporary representation objects. These objects are placeholders that can be used in place of permanent representation objects for editing purposes and, more specifically, when new objects are created in the equipment view. When a business object corresponding to the temporary representation object is added to the data source, this temporary representation object is removed and replaced by the permanent representation of the business object. A filter, defined by IlpFilter, is used to determine when the representation object of a business object added to the data source is a candidate to replace the temporary representation object. Filtering criteria can be of any kind.
The following example shows how to add a temporary representation object to an equipment adapter.

How to add a temporary representation object to an equipment adapter

First you create the temporary representation object, like this:
IlpDefaultEquipmentNode temp=
          new IlpDefaultEquipmentNode(new IlpDefaultAttributeGroup());
Then you add it to the adapter along with the filtering criteria using the method storeTemporaryRepresentationObject:
adapter.storeTemporaryRepresentationObject(temp, null,new IlpFilter() {
  public boolean accept(Object o) {
   IlpObject ilpO = (IlpObject)o;
   return ilpO.getIdentifier().equals("right one");
   }
};
The temporary representation object will be replaced by a permanent representation object as soon as a business object satisfying the filtering criteria is added to the data source.