public static class EmptyInventory.ResourcesReadAssociate extends Object implements Resources.ReadAssociate
| Constructor and Description |
|---|
ResourcesReadAssociate() |
| Modifier and Type | Method and Description |
|---|---|
Relationship |
associate(Path id)
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 id)
Removes the
Relationships.WellKnown.isParentOf relationship between the
two resources. |
Resources.Single |
get(Path id)
Tries to find a single entity in the current position in the inventory traversal.
|
Resources.Multiple |
getAll(Filter[][] filters)
Returns access interface to all entities conforming to the provided filters in the current position in the
inventory traversal.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdescendgetAllpublic Relationship associate(Path id) 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).
id - the path to a pre-existing entity to be related to the entity on the current position in the
inventory traversal.EntityNotFoundExceptionRelationAlreadyExistsExceptionpublic Relationship disassociate(Path id) throws EntityNotFoundException, IllegalArgumentException
Resources.ReadAssociateRelationships.WellKnown.isParentOf relationship between the
two resources.disassociate in interface Resources.ReadAssociateid - the id of the entity to remove from the relation with the current entity.EntityNotFoundException - if a resource with given id doesn't existIllegalArgumentException - if the resource with the supplied path is existentially bound to its parent
resourcefor explanation of how the current entity and the relation is determined.public 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 determinedpublic Resources.Multiple getAll(Filter[][] filters)
ResolvingToMultipleThe filters parameter is actually composed of individual sets of filters each of which is applied to the "source" entities. Each set can have multiple filters that are then applied one after another on their intermediate results. This becomes useful when you want to filter by sources having some kind of relationships with other entities and in addition filter on the sources themselves, too. E.g.:
inventory.tenants().getAll(new Filter[][]{{Related.by("myRel"), With.type(ResourceType.class)},
{With.id("asf")}}).entities();
The filter above would first check that the tenants in question have a relationship called "myRel" with some
resource types and then would also check if the tenant has ID "asf".getAll in interface ResolvingToMultiple<Resources.Multiple>filters - the sets of filters to applypublic Resources.Single get(Path id) throws EntityNotFoundException
ResolvingToSingleget in interface ResolvingToSingle<Resources.Single,Path>id - the identification of sorts of the entity to find in the current traversal positionEntityNotFoundExceptionCopyright © 2015 Red Hat, Inc.. All rights reserved.