Package org.eclipse.graphiti.internal.services.impl

# Class LinkServiceImpl

java.lang.Object
org.eclipse.graphiti.internal.services.impl.LinkServiceImpl

All Implemented Interfaces:
  `ILinkService`

public final class LinkServiceImpl extends Object implements ILinkService

## Constructor Summary

Constructors
Constructor
Description
`LinkServiceImpl()`

## Method Summary

Modifier and Type
Method
Description
`org.eclipse.emf.ecore.EObject[]`
`getAllBusinessObjectsForLinkedPictogramElement(PictogramElement pictogramElement)`
Returns all business objects which are linked to the given pictogram element.
`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.
`List<PictogramElement>`
`getPictogramElements(Diagram diagram, List<org.eclipse.emf.ecore.EObject> eObjects, boolean onlyActive)`
Gets the pictogram elements.
`List<PictogramElement>`
`getPictogramElements(Diagram diagram, org.eclipse.emf.ecore.EObject eObject)`
get all pictogram elements which references the given eObject.
`boolean`
`hasLinkProperty(PictogramElement pictogramElement, String propertyValue)`
Checks existence and value of the link property to a given pictogram element.
`void`
`setLinkProperty(PictogramElement pictogramElement, String propertyValue)`
Adds or modifies the link property to a given pictogram element.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LinkServiceImpl

public LinkServiceImpl()

## Method Details

### getAllBusinessObjectsForLinkedPictogramElement

public org.eclipse.emf.ecore.EObject[] getAllBusinessObjectsForLinkedPictogramElement(PictogramElement pictogramElement)
Returns all business objects which are linked to the given pictogram element.

Specified by:
  `getAllBusinessObjectsForLinkedPictogramElement` in interface `ILinkService`
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

public 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
invalid reference

    #getAllBusinessObjectsForPictogramElement(PictogramElement)

, because in many use cases only a single business object is linked.

Specified by:
  `getBusinessObjectForLinkedPictogramElement` in interface `ILinkService`
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

public PictogramLink getLinkForPictogramElement(PictogramElement pictogramElement)
Returns the pictogram link referencing the given pictogram element.

Specified by:
  `getLinkForPictogramElement` in interface `ILinkService`
Parameters:
  `pictogramElement` - the pictogram element
Returns:
  the pictogram link referencing the given pictogram element

### getPictogramElements

public List<PictogramElement> getPictogramElements(Diagram diagram, org.eclipse.emf.ecore.EObject eObject)
get all pictogram elements which references the given eObject.

Specified by:
  `getPictogramElements` in interface `ILinkService`
Parameters:
  `diagram` - the diagram
  `eObject` - the ref object
Returns:
  the pictogram elements

### getPictogramElements

public List<PictogramElement> getPictogramElements(Diagram diagram, List<org.eclipse.emf.ecore.EObject> eObjects, boolean onlyActive)
Gets the pictogram elements.

Specified by:
  `getPictogramElements` in interface `ILinkService`
Parameters:
  `diagram` - the diagram
  `eObjects` - 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

public boolean hasLinkProperty(PictogramElement pictogramElement, 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 distinguish multiple pictogram elements linked to same domain model object.

Specified by:
  `hasLinkProperty` in interface `ILinkService`
Parameters:
  `pictogramElement` - the pictogram element
  `propertyValue` - the value to check against the property
Returns:
  true if link property exists and has the given value; false if not

### setLinkProperty

public void setLinkProperty(PictogramElement pictogramElement, String propertyValue)
Adds or modifies the link property to a given pictogram element. It is intended to use this property to be able to distinguish multiple pictogram elements linked to same domain model object.

Specified by:
  `setLinkProperty` in interface `ILinkService`
Parameters:
  `pictogramElement` - the pictogram element
  `propertyValue` - the new value for the link property

### getLinkProperty

public Property getLinkProperty(PictogramElement pictogramElement)
Gets the link property to a given pictogram element.

Specified by:
  `getLinkProperty` in interface `ILinkService`
Parameters:
  `pictogramElement` - the pictogram element
Returns:
  the link property