Class RelationshipManager
- java.lang.Object
-
- lumis.portal.socialnetwork.relationship.RelationshipManager
-
- All Implemented Interfaces:
IRelationshipManager
public class RelationshipManager extends java.lang.Object implements IRelationshipManager
Relationship manager implementation.- Since:
- 7.0.0
- Version:
- $Revision$ $Date$
-
-
Constructor Summary
Constructors Constructor Description RelationshipManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
addNode(java.lang.String type, java.lang.String objectId)
Adds a new relatable node.java.lang.String
addRelationship(IRelatable source, IRelatable target, IRelationshipType relationshipType)
Adds a new relationship between the source and target nodes.java.lang.String
addRelationshipType(java.lang.String id, java.lang.String name, java.lang.String reverseName, java.util.Set<java.lang.String> sourceTypes, java.util.Set<java.lang.String> targetTypes, boolean bidirectional)
Adds a new type of relationship.void
deleteNode(java.lang.String id)
Removes a node.void
deleteRelationship(java.lang.String id)
Removes a relationship.void
deleteRelationshipType(java.lang.String id)
Removes a type of relationship.IRelatable
getNode(java.lang.String id)
Gets the relatable node.IRelatable
getNode(java.lang.String type, java.lang.String objectId, boolean createNode)
Gets the relatable node or creates a new node with the values in type and objectId params if the param createNode is equal to true.IRelationship
getRelationship(java.lang.String id)
Gets the relationship.IRelationshipType
getRelationshipType(java.lang.String id)
Gets the type of relationship.java.util.Set<IRelatable>
listRelationships(IRelatable source, IRelatable target, IRelationshipType relationshipType)
Lists all relatable nodes that contains a relationship with firstObject and secondObject.java.util.Set<IRelationship>
listRelationships(IRelatable source, IRelationshipType relationshipType)
Lists all relationships where the param source is the source and where the param source is the target if the relationship is bidirectional.void
updateRelationshipType(IRelationshipType relationshipType)
Updates a type of relationship.
-
-
-
Method Detail
-
addNode
public java.lang.String addNode(java.lang.String type, java.lang.String objectId) throws PortalObjectAlreadyExistsException
Description copied from interface:IRelationshipManager
Adds a new relatable node.- Specified by:
addNode
in interfaceIRelationshipManager
- Parameters:
type
- of node.objectId
- identify some kind of object.- Returns:
- the identify of node created.
- Throws:
PortalObjectAlreadyExistsException
- if exist some node with the same type and objectId.
-
addRelationship
public java.lang.String addRelationship(IRelatable source, IRelatable target, IRelationshipType relationshipType)
Description copied from interface:IRelationshipManager
Adds a new relationship between the source and target nodes.- Specified by:
addRelationship
in interfaceIRelationshipManager
- Parameters:
source
- relatable source.target
- relatable target.relationshipType
- a kind of relationship.- Returns:
- the identify of relationship created.
-
addRelationshipType
public java.lang.String addRelationshipType(java.lang.String id, java.lang.String name, java.lang.String reverseName, java.util.Set<java.lang.String> sourceTypes, java.util.Set<java.lang.String> targetTypes, boolean bidirectional)
Description copied from interface:IRelationshipManager
Adds a new type of relationship.- Specified by:
addRelationshipType
in interfaceIRelationshipManager
- Parameters:
id
- identifies the type of relationship.name
- display name to source.reverseName
- display name to target.sourceTypes
- set that contains names to type of source.targetTypes
- set that contains names to type of target.bidirectional
- true or false if the relationship is bidirectional.- Returns:
- the identify of relationshipType created.
-
deleteNode
public void deleteNode(java.lang.String id) throws PortalObjectNotFoundException
Description copied from interface:IRelationshipManager
Removes a node.- Specified by:
deleteNode
in interfaceIRelationshipManager
- Parameters:
id
- identifies the node.- Throws:
PortalObjectNotFoundException
- if the node was not found.
-
deleteRelationship
public void deleteRelationship(java.lang.String id) throws PortalObjectNotFoundException
Description copied from interface:IRelationshipManager
Removes a relationship.- Specified by:
deleteRelationship
in interfaceIRelationshipManager
- Parameters:
id
- identifies the relationship.- Throws:
PortalObjectNotFoundException
- if the relationship was not found.
-
deleteRelationshipType
public void deleteRelationshipType(java.lang.String id) throws PortalObjectNotFoundException
Description copied from interface:IRelationshipManager
Removes a type of relationship.- Specified by:
deleteRelationshipType
in interfaceIRelationshipManager
- Parameters:
id
- identifies the type of relationship.- Throws:
PortalObjectNotFoundException
- if the type of relationship was not found.
-
getNode
public IRelatable getNode(java.lang.String id)
Description copied from interface:IRelationshipManager
Gets the relatable node.- Specified by:
getNode
in interfaceIRelationshipManager
- Parameters:
id
- identifies the node.- Returns:
- a IRelatable that contains the identity equals the value passed in id param.
-
getNode
public IRelatable getNode(java.lang.String type, java.lang.String objectId, boolean createNode)
Description copied from interface:IRelationshipManager
Gets the relatable node or creates a new node with the values in type and objectId params if the param createNode is equal to true.- Specified by:
getNode
in interfaceIRelationshipManager
- Parameters:
type
- of node.objectId
- identify some kind of object.createNode
- true or false.- Returns:
- a new node or a node existing.
-
getRelationship
public IRelationship getRelationship(java.lang.String id)
Description copied from interface:IRelationshipManager
Gets the relationship.- Specified by:
getRelationship
in interfaceIRelationshipManager
- Parameters:
id
- identifies the relationship.- Returns:
- a IRelationship that contains the identity equals the value passed in id param.
-
getRelationshipType
public IRelationshipType getRelationshipType(java.lang.String id) throws PortalObjectNotFoundException
Description copied from interface:IRelationshipManager
Gets the type of relationship.- Specified by:
getRelationshipType
in interfaceIRelationshipManager
- Parameters:
id
- identifies the type of relationship.- Returns:
- a IRelationshipType that contains the identity equals the value passed in id param.
- Throws:
PortalObjectNotFoundException
- if the type of relationship was not found.
-
listRelationships
public java.util.Set<IRelationship> listRelationships(IRelatable source, IRelationshipType relationshipType)
Description copied from interface:IRelationshipManager
Lists all relationships where the param source is the source and where the param source is the target if the relationship is bidirectional.- Specified by:
listRelationships
in interfaceIRelationshipManager
- Parameters:
source
- IRelatable source.relationshipType
- IRelationship.- Returns:
- a Set
.
-
listRelationships
public java.util.Set<IRelatable> listRelationships(IRelatable source, IRelatable target, IRelationshipType relationshipType)
Description copied from interface:IRelationshipManager
Lists all relatable nodes that contains a relationship with firstObject and secondObject.- Specified by:
listRelationships
in interfaceIRelationshipManager
- Parameters:
source
- IRelatable source.target
- IRelatable source.relationshipType
- a kind of relationship.- Returns:
- a list that contains relatable nodes.
-
updateRelationshipType
public void updateRelationshipType(IRelationshipType relationshipType) throws PortalObjectNotFoundException
Description copied from interface:IRelationshipManager
Updates a type of relationship.- Specified by:
updateRelationshipType
in interfaceIRelationshipManager
- Parameters:
relationshipType
- new relationship object with the values updated.- Throws:
PortalObjectNotFoundException
- if the type of relationship was not found.
-
-