Package org.eclipse.graphiti.services

## Interface ILinkService

All Known Implementing Classes:
  `LinkServiceImpl`

    public interface ILinkService

The interface ILinkService provides services for the link handling between the graphical representation (pictogram elements) and the domain model (business objects).

### Method Summary

All Methods Instance Methods Abstract Methods

`org.eclipse.emf.ecore.EObject[]`

`getAllBusinessObjectsForLinkedPictogramElement​(PictogramElement pictogramElement)`

Returns all business objects which are linked to the given pictogram element.
Note: Identity of domain or business objects is determined by default using the method `EcoreUtil.equals(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)` , which relies on the compared EMF objects having different IDs or attributes.

`org.eclipse.emf.ecore.EObject` `getBusinessObjectForLinkedPictogramElement​(PictogramElement pictogramElement)` Returns the first of possibly several business objects which are linked to the given pictogram element.
`PictogramLink` `getLinkForPictogramElement​(PictogramElement pictogramElement)` Returns the pictogram link referencing the given pictogram element.
`Property` `getLinkProperty​(PictogramElement pictogramElement)` Gets the link property to a given pictogram element.

`java.util.List<PictogramElement>`

`getPictogramElements​(Diagram diagram, java.util.List<org.eclipse.emf.ecore.EObject> eObjects, boolean onlyActive)`

Gets all pictogram elements which references at least one of the given business objects.
Note: Identity of domain or business objects is determined by default using the method `EcoreUtil.equals(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)` , which relies on the compared EMF objects having different IDs or attributes.

`java.util.List<PictogramElement>`

`getPictogramElements​(Diagram diagram, org.eclipse.emf.ecore.EObject eObject)`

Gets all pictogram elements which references the given business object.
Note: Identity of domain or business objects is determined by default using the method `EcoreUtil.equals(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)` , which relies on the compared EMF objects having different IDs or attributes.

`boolean` `hasLinkProperty​(PictogramElement pictogramElement, java.lang.String propertyValue)` Checks existence and value of the link property to a given pictogram element.
`void` `setLinkProperty​(PictogramElement pictogramElement, java.lang.String propertyValue)` Adds or modifies the link property to a given pictogram element.

### Method Detail

#### getAllBusinessObjectsForLinkedPictogramElement

    org.eclipse.emf.ecore.EObject[] getAllBusinessObjectsForLinkedPictogramElement​(PictogramElement pictogramElement)

Returns all business objects which are linked to the given pictogram element.
Note: Identity of domain or business objects is determined by default using the method `EcoreUtil.equals(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)` , which relies on the compared EMF objects having different IDs or attributes. The way Graphiti used to compare EMF business objects can be changed by overriding `IToolBehaviorProvider.equalsBusinessObjects(Object, Object)`.

Parameters:
  `pictogramElement` - The pictogram element for which to return the business objects.
Returns:
  The business objects which are linked to the given pictogram element. Can be empty but not null.

#### getBusinessObjectForLinkedPictogramElement

    org.eclipse.emf.ecore.EObject getBusinessObjectForLinkedPictogramElement​(PictogramElement pictogramElement)

Returns the first of possibly several business objects which are linked to the given pictogram element. This is a convenience method for `getAllBusinessObjectsForLinkedPictogramElement(PictogramElement)` , because in many use cases only a single business object is linked.
Note: Identity of domain or business objects is determined by default using the method `EcoreUtil.equals(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)` , which relies on the compared EMF objects having different IDs or attributes. The way Graphiti used to compare EMF business objects can be changed by overriding `IToolBehaviorProvider.equalsBusinessObjects(Object, Object)`.

Parameters:
  `pictogramElement` - The pictogram element for which to return the business objects.
Returns:
  The first of possibly several business objects which are linked to the given pictogram element. Can be null.

#### getLinkForPictogramElement

    PictogramLink getLinkForPictogramElement​(PictogramElement pictogramElement)

Returns the pictogram link referencing the given pictogram element.

Parameters:
  `pictogramElement` - the pictogram element
Returns:
  the pictogram link referencing the given pictogram element

#### getPictogramElements

    java.util.List<PictogramElement> getPictogramElements​(Diagram diagram,
                                                          org.eclipse.emf.ecore.EObject eObject)

Gets all pictogram elements which references the given business object.
Note: Identity of domain or business objects is determined by default using the method `EcoreUtil.equals(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)` , which relies on the compared EMF objects having different IDs or attributes. The way Graphiti used to compare EMF business objects can be changed by overriding `IToolBehaviorProvider.equalsBusinessObjects(Object, Object)`.

Parameters:
  `diagram` - the diagram
  `eObject` - the referenced business object
Returns:
  all pictogram elements in the diagram which references the given business object

#### getPictogramElements

    java.util.List<PictogramElement> getPictogramElements​(Diagram diagram,
                                                          java.util.List<org.eclipse.emf.ecore.EObject> eObjects,
                                                          boolean onlyActive)

Gets all pictogram elements which references at least one of the given business objects.
Note: Identity of domain or business objects is determined by default using the method `EcoreUtil.equals(org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject)` , which relies on the compared EMF objects having different IDs or attributes. The way Graphiti used to compare EMF business objects can be changed by overriding `IToolBehaviorProvider.equalsBusinessObjects(Object, Object)`.

Parameters:
  `diagram` - the diagram
  `eObjects` - the referenced business objects
  `onlyActive` - if true, then only active pictogram elements of the diagram will be considered; if false all pictogram elements will be considered
Returns:
  all (active) pictogram elements in the diagram which have at least one reference to one of the business objects

#### hasLinkProperty

    boolean hasLinkProperty​(PictogramElement pictogramElement,
                            java.lang.String propertyValue)

Checks existence and value of the link property to a given pictogram element. It is intended to use this property to be able to disinguish multiple pictogram elements linked to same domain model object.

Parameters:
  `pictogramElement` - the pictogram element
  `propertyValue` - the value to check against the property
Returns:
  true if link property exists an has the given value; false if not

#### setLinkProperty

    void setLinkProperty​(PictogramElement pictogramElement,
                         java.lang.String propertyValue)

Adds or modifies the link property to a given pictogram element. It is intended to use this property to be able to disinguish multiple pictogram elements linked to same domain model object.

Parameters:
  `pictogramElement` - the pictogram element
  `propertyValue` - the new value for the link property

#### getLinkProperty

    Property getLinkProperty​(PictogramElement pictogramElement)

Gets the link property to a given pictogram element.

Parameters:
  `pictogramElement` - the pictogram element
Returns:
  the link property