Package com.adobe.granite.socialgraph
Interface GraphNode
The
GraphNode
represents a user in the social graph.-
Nested Class Summary
-
Method Summary
Modifier and TypeMethodDescriptioncreateRelationshipTo
(GraphNode other, String type) Creates a relationship to the given node.void
delete()
Deletes this graph node and all outgoing relationships.<T> T
Get a named property and convert it into the given type.<T> T
Get a named property and convert it into the given type.getId()
Returns the id of this node.getRelationship
(Direction dir, GraphNode node, String type) Returns the relationship between this and the give node in the specified direction and type.getRelationships
(Direction dir, String... types) Returns the relationships attached to this node of the specific type and direction.Returns the resource of object addressed by id ornull
if it does not exist.boolean
Deprecated.virtual nodes are no longer supported.Methods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Method Details
-
getId
String getId()Returns the id of this node.- Returns:
- the id.
-
getResource
Resource getResource()Returns the resource of object addressed by id ornull
if it does not exist.- Returns:
- the resource.
-
isVirtual
Deprecated.virtual nodes are no longer supported.Specifies tha this node is virtual and is not (and will never be) backed by a persistence object.- Returns:
true
if this node is virtual.
-
createRelationshipTo
Creates a relationship to the given node.- Parameters:
other
- the other nodetype
- the type of the relationship- Returns:
- the relationship
- Throws:
IllegalArgumentException
- if the relationship already existsSocialGraphException
- if an error during this operation occurs.
-
delete
void delete()Deletes this graph node and all outgoing relationships. TODO: specify what should happen to incoming relationships -
getRelationships
Returns the relationships attached to this node of the specific type and direction.- Parameters:
dir
- the directiontypes
- the types of relationships to return.- Returns:
- a collection of relationships
-
getRelationship
Returns the relationship between this and the give node in the specified direction and type. Example: if A --[follows]--> B, then B.getRelationShip(Direction.OUTGOING, A, "follows") and, A.getRelationShip(Direction.INCOMING, B, "follows") Both return the same relationship defined above.- Parameters:
dir
- direction of the relationship to returnnode
- the other nodetype
- the type of relationship- Returns:
- the desired relationship or
null
-
get
Get a named property and convert it into the given type.- Type Parameters:
T
- the type- Parameters:
name
- The name of the propertytype
- The class of the type- Returns:
- Return named value converted to type T or
null
if non existing or can't be converted.
-
get
Get a named property and convert it into the given type.- Type Parameters:
T
- the type- Parameters:
name
- The name of the propertydefaultValue
- The default value to use if the named property does not exist or cannot be converted to the requested type. The default value is also used to define the type to convert the value to. If this isnull
any existing property is not converted.- Returns:
- Return named value converted to type T or the default value if non existing or can't be converted.
-