pt.digitalis.dif.utils.extensions.cms
Class AbstractContentManager

java.lang.Object
  extended by pt.digitalis.dif.utils.extensions.cms.AbstractContentManager
All Implemented Interfaces:
IContentManager

public abstract class AbstractContentManager
extends Object
implements IContentManager

Base implementation of a IContentManager

Author:
Pedro Viegas pviegas@digitalis.pt
Created on:
2010/10/25

Field Summary
protected static char SEPARATOR
           
 
Constructor Summary
AbstractContentManager()
           
 
Method Summary
 ContentItem addContent(ContentItem content)
          Adds a new content to the repository.
 Node addNode(Node node)
          Adds a new content to the repository
Will assign the ID internally
protected  List<ContentItem> checkContentAccessInList(List<ContentItem> listToCheck, IDIFUser user)
          Check the access in a list of content items
protected  List<Node> checkNodeAccessInList(List<Node> listToCheck, IDIFUser user)
          Check the access in a list of nodes
 boolean deleteContent(String id, IDIFUser user)
          Deletes an existing content from the repository
protected abstract  boolean deleteContentInRepository(String id, IDIFUser user)
          Deletes an existing content from the repository
 boolean deleteNode(Long id, IDIFUser user)
          Deletes an existing node from the repository
 boolean deleteNode(Long id, IDIFUser user, boolean cascadeDelete)
          Deletes an existing node from the repository.
protected abstract  boolean deleteNodeInRepository(Long nodeId, IDIFUser user, boolean cascadeDelete)
          Deletes an existing node from the repository.
protected  String determineFullPath(Node node)
          Determines the full path String base in the Node chain
 List<ContentItem> getContentByDescription(String description, IDIFUser user)
          Searches content items by description
protected abstract  List<ContentItem> getContentByDescriptionInRepository(String description, IDIFUser user)
          Searches content items by description
 ContentItem getContentById(String id, IDIFUser user)
          Searches a content item by it's unique identifier
protected abstract  ContentItem getContentByIdInRepository(String id, IDIFUser user)
          Searches an existing content by it's unique identifier
protected  ContentItem getContentByIdNoPermissions(String id, IDIFUser user)
          Searches an existing content by it's unique identifier, without access validation
protected abstract  ContentItem getContentByIdNoPermissionsInRepository(String id, IDIFUser user)
          Searches an existing content by it's unique identifier, without access validation
 List<ContentItem> getContentByName(String name, IDIFUser user)
          Searches content items by name
protected abstract  List<ContentItem> getContentByNameInRepository(String name, IDIFUser user)
          Searches content items by name
 List<ContentItem> getContentByParentNode(Long nodeId, IDIFUser user)
          Searches content items by parent node
protected abstract  List<ContentItem> getContentByParentNodeInRepository(Long nodeId, IDIFUser user)
          Searches content items by parent node
 ContentItem getContentFromNodePathByName(String nodeFullPath, String name, IDIFUser user)
          Searches content items by name and node path
protected abstract  ContentItem getContentFromNodePathByNameRepository(String nodeFullPath, String name, IDIFUser user)
          Searches content items by name and node path on the repository
 List<ACLEntry> getContentItemACL(String id)
          get content item ACL
protected abstract  List<ACLEntry> getContentItemACLInRepository(String id)
          get node ACL
 List<ACLEntry> getNodeACL(Long id)
          get node ACL
protected abstract  List<ACLEntry> getNodeACLInRepository(Long id)
          get node ACL
 Node getNodeById(Long id, IDIFUser user)
          Searches a node by unique identifier
protected abstract  Node getNodeByIdInRepository(Long id, IDIFUser user)
          Searches a node by unique identifier
protected  Node getNodeByIdNoPermissions(Long nodeID, IDIFUser user)
          Searches a node by unique identifier.
protected abstract  Node getNodeByIdNoPermissionsInRepository(Long id, IDIFUser user)
          Searches for a given node.
 Node getNodeByPath(String fullPath, IDIFUser user)
          Searches a node by path
protected abstract  Node getNodeByPathInRespository(String fullPath, IDIFUser user)
          Searches a node by path
protected  Node getNodeByPathNoPermissions(String nodePath, IDIFUser user)
          Searches a node by path.
 List<Node> getNodesByDescription(String description, IDIFUser user)
          Searches nodes by description
 List<Node> getNodesByDescription(String basePathToSearch, String description, IDIFUser user)
          Searches nodes by description
protected abstract  List<Node> getNodesByDescriptionInRepository(String description, IDIFUser user)
          Searches nodes by description
protected abstract  List<Node> getNodesByDescriptionInRepository(String basePathToSearch, String description, IDIFUser user)
          Searches nodes by description
 List<Node> getNodesByName(String name, IDIFUser user)
          Searches nodes by name
 List<Node> getNodesByName(String basePathToSearch, String name, IDIFUser user)
          Searches nodes by name
protected abstract  List<Node> getNodesByNameInRepository(String name, IDIFUser user)
          Searches nodes by name
protected abstract  List<Node> getNodesByNameInRepository(String basePathToSearch, String name, IDIFUser user)
          Searches nodes by name
 List<Node> getNodesByParentNode(Long nodeId, IDIFUser user)
          Searches nodes by parent node
protected abstract  List<Node> getNodesByParentNodeInRepository(Long nodeId, IDIFUser user)
          Searches nodes by parent node
protected  List<Node> getNodesByParentNodeNoPermissions(Long nodeId, IDIFUser user)
          Searches nodes by parent node.
protected abstract  List<Node> getNodesByParentNodeNoPermissionsInRepository(Long nodeId, IDIFUser user)
          Searches nodes by parent node.
protected abstract  String getParentFullPathInRepository(Node node)
          Gets the parent full path
 List<Node> getRootNodes(IDIFUser user)
          Searches root nodes that user has access
protected abstract  List<Node> getRootNodesInRepository(IDIFUser user)
          Searches root nodes
 boolean grantContentAccessToGroup(String contentId, String groupId)
          Grants group access to content item
protected abstract  boolean grantContentAccessToGroupInRepository(ContentItem contentItemParam, String groupId)
          Grants group access to content item
 boolean grantContentAccessToUser(String contentId, IDIFUser user)
          Grants user access to content item
protected abstract  boolean grantContentAccessToUserInRepository(ContentItem contentItemParam, IDIFUser user)
          Grants user access to content item
 boolean grantNodeAccessToGroup(Long nodeId, String groupId)
          Grants group access to node
protected abstract  boolean grantNodeAccessToGroupInRepository(Node nodeParam, String groupId)
          Grants group access to node
 boolean grantNodeAccessToUser(Long nodeId, IDIFUser user)
          Grants user access to node
 boolean grantNodeAccessToUser(String nodePath, IDIFUser user)
          Grants user access to node
protected abstract  boolean grantNodeAccessToUserInRepository(Node nodeParam, IDIFUser user)
          Grants user access to node
 boolean hasContentAccessGroup(ContentItem contentItem, String groupId)
          Checks if group has access to the content
 boolean hasContentAccessGroup(String contentId, String groupId)
          Checks if group has access to the content
 boolean hasContentAccessGroups(ContentItem contentItem, Set<String> groups)
          Checks if one of the group in the list has access to the content
protected abstract  boolean hasContentAccessGroupsInRepository(String contentId, Set<String> groups)
          Checks if one of the groups has access to the content
 boolean hasContentAccessUser(ContentItem contentItem, IDIFUser user)
          Checks if user has access to the content
 boolean hasContentAccessUser(String contentId, IDIFUser user)
          Checks if user has access to the content
protected abstract  boolean hasContentAccessUserInRepository(String contentId, IDIFUser user)
          Checks if group has access to thentent
 boolean hasNodeAccessGroups(Long nodeId, Set<String> groups)
          Checks if one of the group has access to the node
protected abstract  boolean hasNodeAccessGroupsInRepository(Long nodeId, Set<String> groups)
          Checks if one of the groups has access to the node
 boolean hasNodeAccessUser(Long nodeId, IDIFUser user)
          Checks if user has access to the node
 boolean hasNodeAccessUser(Node node, IDIFUser user)
          Checks if user has access to the node
protected abstract  boolean hasNodeAccessUserInRespository(Long nodeId, IDIFUser user)
          Checks if user has access to the node
protected abstract  ContentItem mergeContentInRepository(ContentItem contentParam, IDIFUser user)
          Updates a content item
protected abstract  Node mergeNodeInRepository(Node nodeParam, IDIFUser user)
          Updates a node
 boolean moveContent(String contentID, Long destinationNodeId, IDIFUser user)
          Moves content to another node
protected abstract  ContentItem moveContentInRepository(ContentItem contentParam, Node nodeParam, IDIFUser user)
          Moves content to another node
 boolean moveNode(Long nodeID, Long destinationNodeId, IDIFUser user)
          Moves a node to another parent node
protected abstract  Node moveNodeInRepository(Node node, IDIFUser user)
          Moves node to another parent node
protected  boolean nodeExists(Long id, IDIFUser user)
          Searches a node by unique identifier.
protected abstract  boolean nodeExistsInRepository(Long id, IDIFUser user)
          Searches a node by unique identifier in the repository.
protected abstract  ContentItem persistContentInRepository(ContentItem content, IDIFUser user)
          Adds a new content to repository.
protected abstract  Node persistNodeInRepository(Node node, IDIFUser user)
          Adds a new content to repository.
 boolean revokeContentAccessToGroup(String contentId, String groupId)
          Revokes group access to content item
protected abstract  boolean revokeContentAccessToGroupInRepository(String contentId, String groupId)
          Revokes group access to content item
 boolean revokeContentAccessToUser(String contentId, IDIFUser user)
          Revokes user access to content item
protected abstract  boolean revokeContentAccessToUserInRepository(String contentId, IDIFUser user)
          Revokes user access to content item
 boolean revokeNodeAccessToGroup(Long nodeId, String groupId)
          Revokes group access to node
protected abstract  boolean revokeNodeAccessToGroupInRepository(Long nodeId, String groupId)
          Revokes group access to node
 boolean revokeNodeAccessToUser(Long nodeId, IDIFUser user)
          Revokes user access to node
protected abstract  boolean revokeNodeAccessToUserInRepository(Long nodeId, IDIFUser user)
          Revokes user access to node
 ContentItem updateContent(ContentItem content)
          Updates content in the repository
 Node updateNode(Node node)
          Updates content in the repository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface pt.digitalis.dif.utils.extensions.cms.IContentManager
beginTransaction, commitTransaction, rollbackTransaction
 

Field Detail

SEPARATOR

protected static char SEPARATOR
Constructor Detail

AbstractContentManager

public AbstractContentManager()
Method Detail

addContent

public ContentItem addContent(ContentItem content)
                       throws ContentManagerException
Description copied from interface: IContentManager
Adds a new content to the repository.
Will assign the ID internally

Specified by:
addContent in interface IContentManager
Parameters:
content - the content to add in the repository
Returns:
the updated content
Throws:
InvalidParentNodeException
NodeNotFoundException
NoAccessException
ContentItemWithDuplicateNameAndParentNodeException
ContentManagerException
See Also:
IContentManager.addContent(pt.digitalis.dif.utils.extensions.cms.ContentItem)

addNode

public Node addNode(Node node)
             throws ContentManagerException
Description copied from interface: IContentManager
Adds a new content to the repository
Will assign the ID internally

Specified by:
addNode in interface IContentManager
Parameters:
node - the node to add
Returns:
the added node
Throws:
InvalidPathException
InvalidNameException
NoAccessException
InvalidParentNodeException
NodeNotFoundException
NodeWithDuplicatePathException
ContentManagerException
See Also:
IContentManager.addNode(pt.digitalis.dif.utils.extensions.cms.Node)

checkContentAccessInList

protected List<ContentItem> checkContentAccessInList(List<ContentItem> listToCheck,
                                                     IDIFUser user)
Check the access in a list of content items

Parameters:
listToCheck - the content list to check
user - the user who's searching
Returns:
the list with the contents with access

checkNodeAccessInList

protected List<Node> checkNodeAccessInList(List<Node> listToCheck,
                                           IDIFUser user)
Check the access in a list of nodes

Parameters:
listToCheck - the node list to check
user - the user who's searching
Returns:
the list with the contents with access

deleteContent

public boolean deleteContent(String id,
                             IDIFUser user)
                      throws ContentManagerException
Description copied from interface: IContentManager
Deletes an existing content from the repository

Specified by:
deleteContent in interface IContentManager
Parameters:
id - the content to delete
user - the user that is deleting the content
Returns:
T if all went well
Throws:
ContentItemNotFoundException
NodeNotFoundException
NoAccessException
ContentManagerException
See Also:
IContentManager.deleteContent(java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

deleteContentInRepository

protected abstract boolean deleteContentInRepository(String id,
                                                     IDIFUser user)
                                              throws ContentManagerException
Deletes an existing content from the repository

Parameters:
id - the id of the content to delete
user - the user id that is deleting the content
Returns:
T if all went well
Throws:
ContentManagerException

deleteNode

public boolean deleteNode(Long id,
                          IDIFUser user)
                   throws ContentManagerException
Description copied from interface: IContentManager
Deletes an existing node from the repository

Specified by:
deleteNode in interface IContentManager
Parameters:
id - the node to delete
user - the user that is deleting the node
Returns:
T if all went well
Throws:
NodeNotFoundException
NoAccessException
NodeWithNodesException
ContentManagerException
See Also:
IContentManager.deleteNode(java.lang.Long, pt.digitalis.dif.controller.security.objects.IDIFUser)

deleteNode

public boolean deleteNode(Long id,
                          IDIFUser user,
                          boolean cascadeDelete)
                   throws ContentManagerException
Description copied from interface: IContentManager
Deletes an existing node from the repository.
Will launch an exception if the node is not empty

Specified by:
deleteNode in interface IContentManager
Parameters:
id - the node to delete
user - the user that is deleting the node
cascadeDelete - if T will delete all inner nodes and content, if F will launch an exception if the node is not empty
Returns:
T if all went well
Throws:
NodeNotFoundException
NoAccessException
NodeWithNodesException
ContentManagerException
See Also:
IContentManager.deleteNode(java.lang.Long, pt.digitalis.dif.controller.security.objects.IDIFUser, boolean)

deleteNodeInRepository

protected abstract boolean deleteNodeInRepository(Long nodeId,
                                                  IDIFUser user,
                                                  boolean cascadeDelete)
                                           throws NodeNotFoundException,
                                                  NodeWithNodesException,
                                                  ContentManagerException
Deletes an existing node from the repository.
Will launch an exception if the node is not empty

Parameters:
nodeId - the node to delete
user - the user that's deleting the node
cascadeDelete - if T will delete all inner nodes and content, if F will launch an exception if the node is not empty
Returns:
T if all went well
Throws:
NodeNotFoundException
NodeWithNodesException
ContentManagerException

determineFullPath

protected String determineFullPath(Node node)
                            throws ContentManagerException
Determines the full path String base in the Node chain

Parameters:
node - node to convert
Returns:
the node converted
Throws:
ContentManagerException

getContentByDescription

public List<ContentItem> getContentByDescription(String description,
                                                 IDIFUser user)
                                          throws ContentManagerException
Description copied from interface: IContentManager
Searches content items by description

Specified by:
getContentByDescription in interface IContentManager
Parameters:
description - the content id
user - the user who's searching
Returns:
the content list
Throws:
ContentManagerException
See Also:
IContentManager.getContentByDescription(java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

getContentByDescriptionInRepository

protected abstract List<ContentItem> getContentByDescriptionInRepository(String description,
                                                                         IDIFUser user)
                                                                  throws ContentManagerException
Searches content items by description

Parameters:
description - the content id
user - the user who's searching
Returns:
the content list
Throws:
ContentManagerException

getContentById

public ContentItem getContentById(String id,
                                  IDIFUser user)
                           throws ContentManagerException
Description copied from interface: IContentManager
Searches a content item by it's unique identifier

Specified by:
getContentById in interface IContentManager
Parameters:
id - the content id
user - the user who's searching
Returns:
the content
Throws:
ContentItemNotFoundException
NoAccessException
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.getContentById(java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

getContentByIdInRepository

protected abstract ContentItem getContentByIdInRepository(String id,
                                                          IDIFUser user)
                                                   throws ContentItemNotFoundException,
                                                          NoAccessException,
                                                          NodeNotFoundException,
                                                          ContentManagerException
Searches an existing content by it's unique identifier

Parameters:
id - the content id
user - the user who's searching
Returns:
the content
Throws:
ContentItemNotFoundException
NoAccessException
NodeNotFoundException
ContentManagerException

getContentByIdNoPermissions

protected ContentItem getContentByIdNoPermissions(String id,
                                                  IDIFUser user)
                                           throws ContentManagerException
Searches an existing content by it's unique identifier, without access validation

Parameters:
id - the content id
user - current user
Returns:
the content
Throws:
ContentManagerException

getContentByIdNoPermissionsInRepository

protected abstract ContentItem getContentByIdNoPermissionsInRepository(String id,
                                                                       IDIFUser user)
                                                                throws ContentItemNotFoundException,
                                                                       ContentManagerException
Searches an existing content by it's unique identifier, without access validation

Parameters:
id - the content id
user - current user
Returns:
the content
Throws:
ContentItemNotFoundException
ContentManagerException

getContentByName

public List<ContentItem> getContentByName(String name,
                                          IDIFUser user)
                                   throws ContentManagerException
Description copied from interface: IContentManager
Searches content items by name

Specified by:
getContentByName in interface IContentManager
Parameters:
name - the content id
user - the user who's searching
Returns:
the content list
Throws:
ContentManagerException
See Also:
IContentManager.getContentByName(java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

getContentByNameInRepository

protected abstract List<ContentItem> getContentByNameInRepository(String name,
                                                                  IDIFUser user)
                                                           throws ContentManagerException
Searches content items by name

Parameters:
name - the content id
user - the user who's searching
Returns:
the content list
Throws:
ContentManagerException

getContentByParentNode

public List<ContentItem> getContentByParentNode(Long nodeId,
                                                IDIFUser user)
                                         throws ContentManagerException
Description copied from interface: IContentManager
Searches content items by parent node

Specified by:
getContentByParentNode in interface IContentManager
Parameters:
nodeId - the parent node id
user - the user who's searching
Returns:
the content list
Throws:
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.getContentByParentNode(java.lang.Long, pt.digitalis.dif.controller.security.objects.IDIFUser)

getContentByParentNodeInRepository

protected abstract List<ContentItem> getContentByParentNodeInRepository(Long nodeId,
                                                                        IDIFUser user)
                                                                 throws ContentManagerException
Searches content items by parent node

Parameters:
nodeId - the parent id
user - the user who's searching
Returns:
the content list
Throws:
ContentManagerException

getContentFromNodePathByName

public ContentItem getContentFromNodePathByName(String nodeFullPath,
                                                String name,
                                                IDIFUser user)
                                         throws ContentManagerException
Description copied from interface: IContentManager
Searches content items by name and node path

Specified by:
getContentFromNodePathByName in interface IContentManager
Parameters:
nodeFullPath - the node fullPath from the content will be retrieve
name - the content id
user - the user who's searching
Returns:
the content object
Throws:
ContentItemNotFoundException
NodeNotFoundException
NoAccessException
ContentManagerException
See Also:
IContentManager.getContentFromNodePathByName(java.lang.String, java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

getContentFromNodePathByNameRepository

protected abstract ContentItem getContentFromNodePathByNameRepository(String nodeFullPath,
                                                                      String name,
                                                                      IDIFUser user)
                                                               throws ContentManagerException
Searches content items by name and node path on the repository

Parameters:
nodeFullPath - the node fullPath from the content will be retrieve
name - the content id
user - the user who's searching
Returns:
the content object
Throws:
ContentManagerException

getContentItemACL

public List<ACLEntry> getContentItemACL(String id)
                                 throws ContentManagerException
Description copied from interface: IContentManager
get content item ACL

Specified by:
getContentItemACL in interface IContentManager
Parameters:
id - the content item ID
Returns:
the ACL
Throws:
ContentManagerException
See Also:
IContentManager.getContentItemACL(java.lang.String)

getContentItemACLInRepository

protected abstract List<ACLEntry> getContentItemACLInRepository(String id)
                                                         throws ContentManagerException
get node ACL

Parameters:
id - the content item ID
Returns:
the ACL
Throws:
ContentManagerException

getNodeACL

public List<ACLEntry> getNodeACL(Long id)
                          throws ContentManagerException
Description copied from interface: IContentManager
get node ACL

Specified by:
getNodeACL in interface IContentManager
Parameters:
id - the node ID
Returns:
the ACL
Throws:
ContentManagerException
See Also:
IContentManager.getNodeACL(java.lang.Long)

getNodeACLInRepository

protected abstract List<ACLEntry> getNodeACLInRepository(Long id)
                                                  throws ContentManagerException
get node ACL

Parameters:
id - the node ID
Returns:
the ACL
Throws:
ContentManagerException

getNodeById

public Node getNodeById(Long id,
                        IDIFUser user)
                 throws ContentManagerException
Description copied from interface: IContentManager
Searches a node by unique identifier

Specified by:
getNodeById in interface IContentManager
Parameters:
id - the node ID
user - the user who's searching
Returns:
a list of all existing root nodes
Throws:
NodeNotFoundException
NoAccessException
ContentManagerException
See Also:
IContentManager.getNodeById(java.lang.Long, pt.digitalis.dif.controller.security.objects.IDIFUser)

getNodeByIdInRepository

protected abstract Node getNodeByIdInRepository(Long id,
                                                IDIFUser user)
                                         throws ContentManagerException
Searches a node by unique identifier

Parameters:
id - the node ID
user - the user who's searching
Returns:
a list of all existing root nodes
Throws:
ContentManagerException

getNodeByIdNoPermissions

protected Node getNodeByIdNoPermissions(Long nodeID,
                                        IDIFUser user)
                                 throws ContentManagerException
Searches a node by unique identifier. Permission checks are ignored

Parameters:
nodeID - the node ID
user - the currentUser
Returns:
a list of all existing root nodes
Throws:
ContentManagerException

getNodeByIdNoPermissionsInRepository

protected abstract Node getNodeByIdNoPermissionsInRepository(Long id,
                                                             IDIFUser user)
                                                      throws NodeNotFoundException,
                                                             ContentManagerException
Searches for a given node. Permissions are not checked

Parameters:
id - the node ID
user - current user
Returns:
a list of all existing root nodes
Throws:
NodeNotFoundException
ContentManagerException

getNodeByPath

public Node getNodeByPath(String fullPath,
                          IDIFUser user)
                   throws ContentManagerException
Description copied from interface: IContentManager
Searches a node by path

Specified by:
getNodeByPath in interface IContentManager
Parameters:
fullPath - the full path of the node the node ID
user - the user who's searching
Returns:
a list of all existing root nodes
Throws:
NodeNotFoundException
NoAccessException
ContentManagerException
See Also:
IContentManager.getNodeByPath(java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

getNodeByPathInRespository

protected abstract Node getNodeByPathInRespository(String fullPath,
                                                   IDIFUser user)
                                            throws NodeNotFoundException,
                                                   NoAccessException,
                                                   ContentManagerException
Searches a node by path

Parameters:
fullPath - the full path of the node the node ID
user - the user who's searching
Returns:
a list of all existing root nodes
Throws:
NodeNotFoundException
NoAccessException
ContentManagerException

getNodeByPathNoPermissions

protected Node getNodeByPathNoPermissions(String nodePath,
                                          IDIFUser user)
                                   throws ContentManagerException
Searches a node by path. Permission checks are ignored

Parameters:
nodePath - the node path
user - the currentUser
Returns:
a list of all existing root nodes
Throws:
ContentManagerException

getNodesByDescription

public List<Node> getNodesByDescription(String description,
                                        IDIFUser user)
                                 throws ContentManagerException
Description copied from interface: IContentManager
Searches nodes by description

Specified by:
getNodesByDescription in interface IContentManager
Parameters:
description - the description of the node to search
user - the user who's searching
Returns:
a list of all existing nodes with the description
Throws:
ContentManagerException
See Also:
IContentManager.getNodesByDescription(java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

getNodesByDescription

public List<Node> getNodesByDescription(String basePathToSearch,
                                        String description,
                                        IDIFUser user)
                                 throws ContentManagerException
Description copied from interface: IContentManager
Searches nodes by description

Specified by:
getNodesByDescription in interface IContentManager
Parameters:
basePathToSearch - the path to search from
description - the name of the node to search
user - the user who's searching
Returns:
a list of all existing nodes with the description
Throws:
ContentManagerException
See Also:
IContentManager.getNodesByDescription(java.lang.String, java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

getNodesByDescriptionInRepository

protected abstract List<Node> getNodesByDescriptionInRepository(String description,
                                                                IDIFUser user)
                                                         throws ContentManagerException
Searches nodes by description

Parameters:
description - the description of the node to search
user - the user who's searching
Returns:
a list of all existing nodes with the description
Throws:
ContentManagerException

getNodesByDescriptionInRepository

protected abstract List<Node> getNodesByDescriptionInRepository(String basePathToSearch,
                                                                String description,
                                                                IDIFUser user)
                                                         throws ContentManagerException
Searches nodes by description

Parameters:
basePathToSearch - the path to search from
description - the name of the node to search
user - the user who's searching
Returns:
a list of all existing nodes with the description
Throws:
ContentManagerException

getNodesByName

public List<Node> getNodesByName(String name,
                                 IDIFUser user)
                          throws ContentManagerException
Description copied from interface: IContentManager
Searches nodes by name

Specified by:
getNodesByName in interface IContentManager
Parameters:
name - the name of the node to search
user - the user who's searching
Returns:
a list of all existing root nodes. May exist with same name in different parent nodes
Throws:
ContentManagerException
See Also:
IContentManager.getNodesByName(java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

getNodesByName

public List<Node> getNodesByName(String basePathToSearch,
                                 String name,
                                 IDIFUser user)
                          throws ContentManagerException
Description copied from interface: IContentManager
Searches nodes by name

Specified by:
getNodesByName in interface IContentManager
Parameters:
basePathToSearch - the path to search from
name - the name of the node to search
user - the user who's searching
Returns:
a list of all existing root nodes. May exist with same name in different parent nodes
Throws:
ContentManagerException
See Also:
IContentManager.getNodesByName(java.lang.String, java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

getNodesByNameInRepository

protected abstract List<Node> getNodesByNameInRepository(String name,
                                                         IDIFUser user)
                                                  throws ContentManagerException
Searches nodes by name

Parameters:
name - the name of the node to search
user - the user who's searching
Returns:
a list of nodes with the same name. May exist with same name in different parent nodes
Throws:
ContentManagerException

getNodesByNameInRepository

protected abstract List<Node> getNodesByNameInRepository(String basePathToSearch,
                                                         String name,
                                                         IDIFUser user)
                                                  throws ContentManagerException
Searches nodes by name

Parameters:
basePathToSearch - the path to search from
name - the name of the node to search
user - the user who's searching
Returns:
a list of all existing root nodes. May exist with same name in different parent nodes
Throws:
ContentManagerException

getNodesByParentNode

public List<Node> getNodesByParentNode(Long nodeId,
                                       IDIFUser user)
                                throws ContentManagerException
Description copied from interface: IContentManager
Searches nodes by parent node

Specified by:
getNodesByParentNode in interface IContentManager
Parameters:
nodeId - the parent node id
user - the user who's searching
Returns:
the content list
Throws:
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.getNodesByParentNode(java.lang.Long, pt.digitalis.dif.controller.security.objects.IDIFUser)

getNodesByParentNodeInRepository

protected abstract List<Node> getNodesByParentNodeInRepository(Long nodeId,
                                                               IDIFUser user)
                                                        throws ContentManagerException
Searches nodes by parent node

Parameters:
nodeId - the parent node id
user - the user who's searching
Returns:
the content list
Throws:
ContentManagerException

getNodesByParentNodeNoPermissions

protected List<Node> getNodesByParentNodeNoPermissions(Long nodeId,
                                                       IDIFUser user)
                                                throws ContentManagerException
Searches nodes by parent node. Permission checks are ignored.

Parameters:
nodeId - the parent node id
user - current user
Returns:
the content list
Throws:
ContentManagerException

getNodesByParentNodeNoPermissionsInRepository

protected abstract List<Node> getNodesByParentNodeNoPermissionsInRepository(Long nodeId,
                                                                            IDIFUser user)
                                                                     throws ContentManagerException
Searches nodes by parent node. Permission checks are ignored.

Parameters:
nodeId - the parent node id
user - current user
Returns:
the content list
Throws:
ContentManagerException

getParentFullPathInRepository

protected abstract String getParentFullPathInRepository(Node node)
                                                 throws InvalidParentNodeException,
                                                        ContentManagerException
Gets the parent full path

Parameters:
node - node to determine full path
Returns:
the node converted
Throws:
InvalidParentNodeException
ContentManagerException

getRootNodes

public List<Node> getRootNodes(IDIFUser user)
                        throws ContentManagerException
Description copied from interface: IContentManager
Searches root nodes that user has access

Specified by:
getRootNodes in interface IContentManager
Parameters:
user - the user who's searching
Returns:
a list of all existing root nodes
Throws:
ContentManagerException
See Also:
IContentManager.getRootNodes(pt.digitalis.dif.controller.security.objects.IDIFUser)

getRootNodesInRepository

protected abstract List<Node> getRootNodesInRepository(IDIFUser user)
                                                throws ContentManagerException
Searches root nodes

Parameters:
user - the user who's searching
Returns:
a list of all existing root nodes
Throws:
ContentManagerException

grantContentAccessToGroup

public boolean grantContentAccessToGroup(String contentId,
                                         String groupId)
                                  throws ContentManagerException
Grants group access to content item

Specified by:
grantContentAccessToGroup in interface IContentManager
Parameters:
contentId - the id of the content to grant access
groupId - the group to grant access
Returns:
T if access was granted, F otherwise.
Throws:
ContentManagerException
ContentItemNotFoundException

grantContentAccessToGroupInRepository

protected abstract boolean grantContentAccessToGroupInRepository(ContentItem contentItemParam,
                                                                 String groupId)
                                                          throws ContentManagerException
Grants group access to content item

Parameters:
contentItemParam - the content to grant access
groupId - the group to grant access
Returns:
T if access was granted, F otherwise.
Throws:
ContentManagerException

grantContentAccessToUser

public boolean grantContentAccessToUser(String contentId,
                                        IDIFUser user)
                                 throws ContentManagerException
Description copied from interface: IContentManager
Grants user access to content item

Specified by:
grantContentAccessToUser in interface IContentManager
Parameters:
contentId - the id of the content to grant access
user - the group to grant access
Returns:
T if access was granted, F otherwise.
Throws:
ContentItemNotFoundException
ContentManagerException
See Also:
IContentManager.grantContentAccessToUser(java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

grantContentAccessToUserInRepository

protected abstract boolean grantContentAccessToUserInRepository(ContentItem contentItemParam,
                                                                IDIFUser user)
                                                         throws ContentManagerException
Grants user access to content item

Parameters:
contentItemParam - the content to grant access
user - the group to grant access
Returns:
T if access was granted, F otherwise.
Throws:
ContentManagerException

grantNodeAccessToGroup

public boolean grantNodeAccessToGroup(Long nodeId,
                                      String groupId)
                               throws ContentManagerException
Description copied from interface: IContentManager
Grants group access to node

Specified by:
grantNodeAccessToGroup in interface IContentManager
Parameters:
nodeId - the id of the node to grant access
groupId - the group to grant access
Returns:
T if access was granted, F otherwise.
Throws:
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.grantNodeAccessToGroup(java.lang.Long, java.lang.String)

grantNodeAccessToGroupInRepository

protected abstract boolean grantNodeAccessToGroupInRepository(Node nodeParam,
                                                              String groupId)
                                                       throws ContentManagerException
Grants group access to node

Parameters:
nodeParam - the node to grant access
groupId - the group to grant access
Returns:
T if access was granted, F otherwise.
Throws:
ContentManagerException

grantNodeAccessToUser

public boolean grantNodeAccessToUser(Long nodeId,
                                     IDIFUser user)
                              throws ContentManagerException
Description copied from interface: IContentManager
Grants user access to node

Specified by:
grantNodeAccessToUser in interface IContentManager
Parameters:
nodeId - the id of the node to grant access
user - the user to grant access
Returns:
T if access was granted, F otherwise.
Throws:
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.grantNodeAccessToUser(java.lang.Long, pt.digitalis.dif.controller.security.objects.IDIFUser)

grantNodeAccessToUser

public boolean grantNodeAccessToUser(String nodePath,
                                     IDIFUser user)
                              throws ContentManagerException
Description copied from interface: IContentManager
Grants user access to node

Specified by:
grantNodeAccessToUser in interface IContentManager
Parameters:
nodePath - the path of the node to grant access
user - the user to grant access
Returns:
T if access was granted, F otherwise.
Throws:
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.grantNodeAccessToUser(java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

grantNodeAccessToUserInRepository

protected abstract boolean grantNodeAccessToUserInRepository(Node nodeParam,
                                                             IDIFUser user)
                                                      throws ContentManagerException
Grants user access to node

Parameters:
nodeParam - the node to grant access
user - the group to grant access
Returns:
T if access was granted, F otherwise.
Throws:
ContentManagerException

hasContentAccessGroup

public boolean hasContentAccessGroup(ContentItem contentItem,
                                     String groupId)
                              throws ContentManagerException
Checks if group has access to the content

Parameters:
contentItem - the content to check access
groupId - the group to check access
Returns:
T if group has access, F otherwise.
Throws:
ContentManagerException

hasContentAccessGroup

public boolean hasContentAccessGroup(String contentId,
                                     String groupId)
                              throws ContentManagerException
Description copied from interface: IContentManager
Checks if group has access to the content

Specified by:
hasContentAccessGroup in interface IContentManager
Parameters:
contentId - the id of the content to check access
groupId - the group to check access
Returns:
T if group has access, F otherwise.
Throws:
ContentItemNotFoundException
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.hasContentAccessGroup(java.lang.String, java.lang.String)

hasContentAccessGroups

public boolean hasContentAccessGroups(ContentItem contentItem,
                                      Set<String> groups)
                               throws ContentManagerException
Checks if one of the group in the list has access to the content

Parameters:
contentItem - the content to check access
groups - the group to check access
Returns:
T if group has access, F otherwise.
Throws:
ContentManagerException

hasContentAccessGroupsInRepository

protected abstract boolean hasContentAccessGroupsInRepository(String contentId,
                                                              Set<String> groups)
                                                       throws ContentManagerException
Checks if one of the groups has access to the content

Parameters:
contentId - the id of the content to check access
groups - the group list to check access
Returns:
T if group has access, F otherwise.
Throws:
ContentManagerException

hasContentAccessUser

public boolean hasContentAccessUser(ContentItem contentItem,
                                    IDIFUser user)
                             throws ContentManagerException
Description copied from interface: IContentManager
Checks if user has access to the content

Specified by:
hasContentAccessUser in interface IContentManager
Parameters:
contentItem - the content to check access
user - the user to check access
Returns:
T if user has access, F otherwise.
Throws:
ContentItemNotFoundException
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.hasContentAccessUser(pt.digitalis.dif.utils.extensions.cms.ContentItem, pt.digitalis.dif.controller.security.objects.IDIFUser)

hasContentAccessUser

public boolean hasContentAccessUser(String contentId,
                                    IDIFUser user)
                             throws ContentManagerException
Description copied from interface: IContentManager
Checks if user has access to the content

Specified by:
hasContentAccessUser in interface IContentManager
Parameters:
contentId - the id of the content to check access
user - the user to check access
Returns:
T if user has access, F otherwise.
Throws:
ContentItemNotFoundException
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.hasContentAccessUser(java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

hasContentAccessUserInRepository

protected abstract boolean hasContentAccessUserInRepository(String contentId,
                                                            IDIFUser user)
                                                     throws ContentManagerException
Checks if group has access to thentent

Parameters:
contentId - the id of the content to check access
user - the group to check access
Returns:
T if user has access, F otherwise.
Throws:
ContentManagerException

hasNodeAccessGroups

public boolean hasNodeAccessGroups(Long nodeId,
                                   Set<String> groups)
                            throws ContentManagerException
Description copied from interface: IContentManager
Checks if one of the group has access to the node

Specified by:
hasNodeAccessGroups in interface IContentManager
Parameters:
nodeId - the id of the node to check access
groups - the group list to check access
Returns:
T if group has access, F otherwise.
Throws:
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.hasNodeAccessGroups(java.lang.Long, java.util.Set)

hasNodeAccessGroupsInRepository

protected abstract boolean hasNodeAccessGroupsInRepository(Long nodeId,
                                                           Set<String> groups)
                                                    throws ContentManagerException
Checks if one of the groups has access to the node

Parameters:
nodeId - the id of the node to check access
groups - the group list to check access
Returns:
T if group has access, F otherwise.
Throws:
ContentManagerException

hasNodeAccessUser

public boolean hasNodeAccessUser(Long nodeId,
                                 IDIFUser user)
                          throws ContentManagerException
Description copied from interface: IContentManager
Checks if user has access to the node

Specified by:
hasNodeAccessUser in interface IContentManager
Parameters:
nodeId - the id of the node to check access
user - the user to check access
Returns:
T if user has access, F otherwise.
Throws:
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.hasNodeAccessUser(java.lang.Long, pt.digitalis.dif.controller.security.objects.IDIFUser)

hasNodeAccessUser

public boolean hasNodeAccessUser(Node node,
                                 IDIFUser user)
                          throws ContentManagerException
Checks if user has access to the node

Parameters:
node - the node to check access
user - the user to check access
Returns:
T if user has access, F otherwise.
Throws:
ContentManagerException

hasNodeAccessUserInRespository

protected abstract boolean hasNodeAccessUserInRespository(Long nodeId,
                                                          IDIFUser user)
                                                   throws ContentManagerException
Checks if user has access to the node

Parameters:
nodeId - the id of the node to check access
user - the group to check access
Returns:
T if user has access, F otherwise.
Throws:
ContentManagerException

mergeContentInRepository

protected abstract ContentItem mergeContentInRepository(ContentItem contentParam,
                                                        IDIFUser user)
                                                 throws ContentItemNotFoundException,
                                                        ContentItemWithDuplicateNameAndParentNodeException,
                                                        ContentManagerException
Updates a content item

Parameters:
contentParam - the content to update in the repository
user - current user
Returns:
the updated content
Throws:
ContentItemNotFoundException
ContentItemWithDuplicateNameAndParentNodeException
ContentManagerException

mergeNodeInRepository

protected abstract Node mergeNodeInRepository(Node nodeParam,
                                              IDIFUser user)
Updates a node

Parameters:
nodeParam - the node to update in the repository
user - current user
Returns:
the updated content

moveContent

public boolean moveContent(String contentID,
                           Long destinationNodeId,
                           IDIFUser user)
                    throws ContentManagerException
Description copied from interface: IContentManager
Moves content to another node

Specified by:
moveContent in interface IContentManager
Parameters:
contentID - the content ID to move
destinationNodeId - the destination node to move to
user - the user request the move
Returns:
T if all went well
Throws:
ContentItemNotFoundException
NodeNotFoundException
NoAccessException
ContentManagerException
See Also:
IContentManager.moveContent(java.lang.String, java.lang.Long, pt.digitalis.dif.controller.security.objects.IDIFUser)

moveContentInRepository

protected abstract ContentItem moveContentInRepository(ContentItem contentParam,
                                                       Node nodeParam,
                                                       IDIFUser user)
                                                throws ContentItemNotFoundException,
                                                       ContentManagerException
Moves content to another node

Parameters:
contentParam - the content to update in the repository
nodeParam - the node to move to
user - the current user
Returns:
the updated content
Throws:
ContentItemNotFoundException
ContentManagerException

moveNode

public boolean moveNode(Long nodeID,
                        Long destinationNodeId,
                        IDIFUser user)
                 throws ContentManagerException
Description copied from interface: IContentManager
Moves a node to another parent node

Specified by:
moveNode in interface IContentManager
Parameters:
nodeID - the original node id
destinationNodeId - the destination node id
user - the user requesting the move operation
Returns:
T if all went well
Throws:
NodeNotFoundException
NoAccessException
ContentManagerException
See Also:
IContentManager.moveNode(java.lang.Long, java.lang.Long, pt.digitalis.dif.controller.security.objects.IDIFUser)

moveNodeInRepository

protected abstract Node moveNodeInRepository(Node node,
                                             IDIFUser user)
Moves node to another parent node

Parameters:
node - the node to update in the repository
user - the current user
Returns:
the updated content

nodeExists

protected boolean nodeExists(Long id,
                             IDIFUser user)
                      throws ContentManagerException
Searches a node by unique identifier.

Parameters:
id - the node ID
user - the current User
Returns:
a list of all existing root nodes
Throws:
ContentManagerException

nodeExistsInRepository

protected abstract boolean nodeExistsInRepository(Long id,
                                                  IDIFUser user)
                                           throws ContentManagerException
Searches a node by unique identifier in the repository.

Parameters:
id - the node ID
user - the currentUser
Returns:
a list of all existing root nodes
Throws:
ContentManagerException

persistContentInRepository

protected abstract ContentItem persistContentInRepository(ContentItem content,
                                                          IDIFUser user)
                                                   throws ContentItemWithDuplicateNameAndParentNodeException,
                                                          ContentManagerException
Adds a new content to repository.
Will assign the ID internally

Parameters:
content - the content to update in the repository
user -
Returns:
the updated content
Throws:
ContentItemWithDuplicateNameAndParentNodeException
ContentManagerException

persistNodeInRepository

protected abstract Node persistNodeInRepository(Node node,
                                                IDIFUser user)
                                         throws NodeWithDuplicatePathException,
                                                ContentManagerException
Adds a new content to repository.
Will assign the ID internally

Parameters:
node - node to update in the repository
user - the user persisting the node
Returns:
the updated content
Throws:
NodeWithDuplicatePathException
ContentManagerException

revokeContentAccessToGroup

public boolean revokeContentAccessToGroup(String contentId,
                                          String groupId)
                                   throws ContentManagerException
Description copied from interface: IContentManager
Revokes group access to content item

Specified by:
revokeContentAccessToGroup in interface IContentManager
Parameters:
contentId - the id of the content to revoke access
groupId - the group to revoke access
Returns:
T if access was revoked, F otherwise.
Throws:
ContentItemNotFoundException
ContentManagerException
See Also:
IContentManager.revokeContentAccessToGroup(java.lang.String, java.lang.String)

revokeContentAccessToGroupInRepository

protected abstract boolean revokeContentAccessToGroupInRepository(String contentId,
                                                                  String groupId)
Revokes group access to content item

Parameters:
contentId - the id of the content to revoke access
groupId - the group to revoke access
Returns:
T if access was revoked, F otherwise.

revokeContentAccessToUser

public boolean revokeContentAccessToUser(String contentId,
                                         IDIFUser user)
                                  throws ContentManagerException
Description copied from interface: IContentManager
Revokes user access to content item

Specified by:
revokeContentAccessToUser in interface IContentManager
Parameters:
contentId - the id of the content to revoke access
user - the group to revoke access
Returns:
T if access was revoked, F otherwise.
Throws:
ContentItemNotFoundException
ContentManagerException
See Also:
IContentManager.revokeContentAccessToUser(java.lang.String, pt.digitalis.dif.controller.security.objects.IDIFUser)

revokeContentAccessToUserInRepository

protected abstract boolean revokeContentAccessToUserInRepository(String contentId,
                                                                 IDIFUser user)
Revokes user access to content item

Parameters:
contentId - the id of the content to revoke access
user - the group to revoke access
Returns:
T if access was revoked, F otherwise.

revokeNodeAccessToGroup

public boolean revokeNodeAccessToGroup(Long nodeId,
                                       String groupId)
                                throws ContentManagerException
Description copied from interface: IContentManager
Revokes group access to node

Specified by:
revokeNodeAccessToGroup in interface IContentManager
Parameters:
nodeId - the id of the node to revoke access
groupId - the group to revoke access
Returns:
T if access was revoked, F otherwise.
Throws:
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.revokeNodeAccessToGroup(java.lang.Long, java.lang.String)

revokeNodeAccessToGroupInRepository

protected abstract boolean revokeNodeAccessToGroupInRepository(Long nodeId,
                                                               String groupId)
                                                        throws ContentManagerException
Revokes group access to node

Parameters:
nodeId - the id of the node to revoke access
groupId - the group to revoke access
Returns:
T if access was revoked, F otherwise.
Throws:
ContentManagerException

revokeNodeAccessToUser

public boolean revokeNodeAccessToUser(Long nodeId,
                                      IDIFUser user)
                               throws ContentManagerException
Description copied from interface: IContentManager
Revokes user access to node

Specified by:
revokeNodeAccessToUser in interface IContentManager
Parameters:
nodeId - the id of the node to revoke access
user - the user to revoke access
Returns:
T if access was revoked, F otherwise.
Throws:
NodeNotFoundException
ContentManagerException
See Also:
IContentManager.revokeNodeAccessToUser(java.lang.Long, pt.digitalis.dif.controller.security.objects.IDIFUser)

revokeNodeAccessToUserInRepository

protected abstract boolean revokeNodeAccessToUserInRepository(Long nodeId,
                                                              IDIFUser user)
                                                       throws ContentManagerException
Revokes user access to node

Parameters:
nodeId - the id of the node to revoke access
user - the group to revoke access
Returns:
T if access was revoked, F otherwise.
Throws:
ContentManagerException

updateContent

public ContentItem updateContent(ContentItem content)
                          throws ContentManagerException
Description copied from interface: IContentManager
Updates content in the repository

Specified by:
updateContent in interface IContentManager
Parameters:
content - the content to update in the repository
Returns:
the updated content
Throws:
ContentItemNotFoundException
NodeNotFoundException
NoAccessException
ContentItemWithDuplicateNameAndParentNodeException
ContentManagerException
See Also:
IContentManager.updateContent(pt.digitalis.dif.utils.extensions.cms.ContentItem)

updateNode

public Node updateNode(Node node)
                throws ContentManagerException
Description copied from interface: IContentManager
Updates content in the repository

Specified by:
updateNode in interface IContentManager
Parameters:
node - the node to update in the repository
Returns:
the updated content
Throws:
NodeNotFoundException
NoAccessException
ContentManagerException
See Also:
IContentManager.updateNode(pt.digitalis.dif.utils.extensions.cms.Node)


Copyright © 2014 Digitalis Informática Lda. All Rights Reserved.