public static interface MetricTypes.ReadAssociate extends MetricTypes.Read
| Modifier and Type | Method and Description |
|---|---|
Relationship |
associate(Path path)
Adds a pre-existing entity into the relation with the current entity.
|
Relationship |
associationWith(Path path)
Finds the relationship with the entity with the provided id.
|
Relationship |
disassociate(Path path)
Removes an entity from the relation with the current entity.
|
getgetAll, getAllRelationship associate(Path path) throws EntityNotFoundException, RelationAlreadyExistsException
inventory.tenants().get(tenantId).environments().get(envId).resources().get(rId).metrics().associate(
RelativePath.to().up().metric(metricId));
In here the associate method will add a new metric (identified by the metricId) to the
resource identified by the rId.
The provided path can be a RelativePath (as in the above example)
which is evaluated against the current position in the graph - the
up() call will move up the path from the resource
to the environment and the metric() call will the move to a metric in that environment.
The provided path can also be a CanonicalPath in which case it is
fully evaluated and the entity on that path is associated (provided the path points to the correct type of
entity and all the rules specific for the association of the two types of entities are fulfilled).
path - the path to a pre-existing entity to be related to the entity on the current position in the
inventory traversal.EntityNotFoundExceptionRelationAlreadyExistsExceptionRelationship disassociate(Path path) throws EntityNotFoundException
path - the id of the entity to remove from the relation with the current entity.EntityNotFoundExceptionfor explanation of how the current entity and the relation is determined.Relationship associationWith(Path path) throws RelationNotFoundException
path - the id of the entity to find the relation withRelationNotFoundException - if a relation with an entity of given id doesn't existfor the discussion of how the entity and the relationship is determinedCopyright © 2015 Red Hat, Inc.. All rights reserved.