public static class BaseRelationships.ReadWrite<BE> extends Traversal<BE,Relationship> implements Relationships.ReadWrite
| Constructor and Description |
|---|
ReadWrite(TraversalContext<BE,Relationship> context,
Class<? extends Entity<?,?>> originEntityType) |
| 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.
|
default Single |
linkWith(Relationships.WellKnown name,
CanonicalPath targetOrSource,
Map<String,Object> properties) |
Relationships.Single |
linkWith(String name,
CanonicalPath targetOrSource,
Map<String,Object> 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)
Updates the provided relationship on the current position in the inventory traversal.
|
getSingle, isApplicable, mutating, readOnlypublic ReadWrite(TraversalContext<BE,Relationship> context, Class<? extends Entity<?,?>> originEntityType)
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, CanonicalPath targetOrSource, Map<String,Object> 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,
incorporates) for restrictions of usage,
especially what restrictions the relationships impose when deleting entities.
name - the name 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 traversalpublic Single linkWith(Relationships.WellKnown name, CanonicalPath targetOrSource, Map<String,Object> properties) throws IllegalArgumentException
IllegalArgumentExceptionlinkWith(String, CanonicalPath, Map)Copyright © 2015 Red Hat, Inc.. All rights reserved.