public static class EmptyInventory.RelationshipsReadWrite extends Object implements Relationships.ReadWrite
| Constructor and Description |
|---|
RelationshipsReadWrite() |
| 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.
|
Relationships.Single |
get(String id)
Tries to find a single relationship in the current position in the inventory traversal.
|
Relationships.Multiple |
getAll(RelationFilter... filters)
Returns access interface to all relationships conforming to provided filters in the current position in the
inventory traversal.
|
Relationships.Single |
linkWith(Relationships.WellKnown name,
Entity targetOrSource,
Map<String,String> properties)
Creates a new relationship at the current position in the inventory traversal.
|
Relationships.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.
|
public Relationships.Multiple named(String name)
named in interface Relationships.ReadWritepublic Relationships.Multiple named(Relationships.WellKnown name)
named in interface Relationships.ReadWritepublic Relationships.Single get(String id) throws EntityNotFoundException, RelationNotFoundException
id - the id of the relationship to find in the current traversal positionEntityNotFoundExceptionRelationNotFoundExceptionpublic Relationships.Multiple getAll(RelationFilter... filters)
filters - the (possibly empty) list of relationship filters to apply.public Relationships.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)public Relationships.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 nullpublic void 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 databasepublic void 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.