public static interface Relationships.ReadWrite
| Modifier and Type | Method and Description |
|---|---|
void |
delete(String id)
Deletes an relationship with the provided id from the current position in the inventory traversal.
|
Single |
get(String id)
Tries to find a single relationship in the current position in the inventory traversal.
|
Multiple |
getAll(RelationFilter... filters)
Returns access interface to all relationships conforming to provided filters in the current position in the
inventory traversal.
|
Single |
linkWith(Relationships.WellKnown name,
Entity targetOrSource,
Map<String,String> properties)
Creates a new relationship at the current position in the inventory traversal.
|
Single |
linkWith(String name,
Entity targetOrSource,
Map<String,String> properties)
Creates a new relationship at the current position in the inventory traversal.
|
Relationships.Multiple |
named(Relationships.WellKnown name) |
Relationships.Multiple |
named(String name) |
void |
update(String id,
Relationship.Update update)
Persists the provided relationship on the current position in the inventory traversal.
|
Relationships.Multiple named(String name)
Relationships.Multiple named(Relationships.WellKnown name)
Single get(String id) throws EntityNotFoundException, RelationNotFoundException
id - the id of the relationship to find in the current traversal positionEntityNotFoundExceptionRelationNotFoundExceptionMultiple getAll(RelationFilter... filters)
filters - the (possibly empty) list of relationship filters to apply.Single linkWith(String name, Entity targetOrSource, Map<String,String> properties) throws IllegalArgumentException
Note that there are limitations when working with
well-known relationships. See
linkWith(Relationships.WellKnown, Entity, Map)
for details.
name - the name of the relationship (label)targetOrSource - the the source/target entity (based on the chosen relationship direction) that the current
entity (based on the position in the inventory traversal) will be in the relationship withproperties - the properties of the newly created relationship or null if none specifiedIllegalArgumentException - if any of the parameters (but properties) is nulllinkWith(Relationships.WellKnown, Entity, Map)Single linkWith(Relationships.WellKnown name, Entity targetOrSource, Map<String,String> properties) throws IllegalArgumentException
It is possible to have multiple relationships with the same name between 2 entities. These relationships will differ in their ids and can have different properties.
Note: please review the comments on the individual well-known relationships (
contains,
defines,
owns) for restrictions of usage, especially what
restrictions the relationships impose when deleting entities.
name - the well known name (Relationships.WellKnown) of the relationshiptargetOrSource - the the source/target entity (based on the chosen relationship direction) that the current
entity (based on the position in the inventory traversal) will be in the relationship withproperties - the properties of the newly created relationship or null if none specifiedIllegalArgumentException - if any of the parameters is nullvoid update(String id, Relationship.Update update) throws RelationNotFoundException
id - the id of the relationship to updateupdate - the updateRelationNotFoundException - if the relationship is not found in the databaseIllegalArgumentException - if the source/target entity (based on the chosen relationship
direction) doesn't correspond with the current position in the inventory traversal or if the name of the
relationship doesn't correspond to what's in the databasevoid delete(String id) throws RelationNotFoundException
id - the id of the relationship to deleteRelationNotFoundException - if the relation with given id doesn't exist on the
current position in the inventory traversalCopyright © 2015 Red Hat, Inc.. All rights reserved.