pt.digitalis.dif.utils.extensions.cms
Interface IContentManager

All Known Implementing Classes:
AbstractContentManager

public interface IContentManager

Author:
Pedro Viegas pviegas@digitalis.pt
Created on:
Jun 5, 2009

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
 void beginTransaction()
          Begins a Content Manager transaction
 void commitTransaction()
          Commit's a Content Manager transaction
 boolean deleteContent(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.
 List<ContentItem> getContentByDescription(String description, IDIFUser user)
          Searches content items by description
 ContentItem getContentById(String id, IDIFUser user)
          Searches a content item by it's unique identifier
 List<ContentItem> getContentByName(String name, IDIFUser user)
          Searches content items by name
 List<ContentItem> getContentByParentNode(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
 List<ACLEntry> getContentItemACL(String id)
          get content item ACL
 List<ACLEntry> getNodeACL(Long id)
          get node ACL
 Node getNodeById(Long id, IDIFUser user)
          Searches a node by unique identifier
 Node getNodeByPath(String fullPath, 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
 List<Node> getNodesByName(String name, IDIFUser user)
          Searches nodes by name
 List<Node> getNodesByName(String basePathToSearch, String name, IDIFUser user)
          Searches nodes by name
 List<Node> getNodesByParentNode(Long nodeId, IDIFUser user)
          Searches nodes by parent node
 List<Node> getRootNodes(IDIFUser user)
          Searches root nodes that user has access
 boolean grantContentAccessToGroup(String contentId, String groupId)
          Grants group access to content item
 boolean grantContentAccessToUser(String contentId, IDIFUser user)
          Grants user access to content item
 boolean grantNodeAccessToGroup(Long nodeId, 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
 boolean hasContentAccessGroup(String contentId, String groupId)
          Checks if group has access to the content
 boolean hasContentAccessUser(ContentItem content, IDIFUser user)
          Checks if user has access to the content
 boolean hasContentAccessUser(String contentId, IDIFUser user)
          Checks if user has access to the content
 boolean hasNodeAccessGroups(Long nodeId, Set<String> groups)
          Checks if one of the group has access to the node
 boolean hasNodeAccessUser(Long nodeId, IDIFUser user)
          Checks if user has access to the node
 boolean moveContent(String contentID, Long destinationNodeId, IDIFUser user)
          Moves content to another node
 boolean moveNode(Long nodeID, Long destinationNodeId, IDIFUser user)
          Moves a node to another parent node
 boolean revokeContentAccessToGroup(String contentId, String groupId)
          Revokes group access to content item
 boolean revokeContentAccessToUser(String contentId, IDIFUser user)
          Revokes user access to content item
 boolean revokeNodeAccessToGroup(Long nodeId, String groupId)
          Revokes group access to node
 boolean revokeNodeAccessToUser(Long nodeId, IDIFUser user)
          Revokes user access to node
 void rollbackTransaction()
          Roll back the a Content Manager transaction
 ContentItem updateContent(ContentItem content)
          Updates content in the repository
 Node updateNode(Node node)
          Updates content in the repository
 

Method Detail

addContent

ContentItem addContent(ContentItem content)
                       throws InvalidParentNodeException,
                              NodeNotFoundException,
                              NoAccessException,
                              ContentItemWithDuplicateNameAndParentNodeException,
                              ContentManagerException
Adds a new content to the repository.
Will assign the ID internally

Parameters:
content - the content to add in the repository
Returns:
the updated content
Throws:
InvalidParentNodeException
NodeNotFoundException
NoAccessException
ContentItemWithDuplicateNameAndParentNodeException
ContentManagerException

addNode

Node addNode(Node node)
             throws InvalidPathException,
                    InvalidNameException,
                    NoAccessException,
                    InvalidParentNodeException,
                    NodeNotFoundException,
                    NodeWithDuplicatePathException,
                    ContentManagerException
Adds a new content to the repository
Will assign the ID internally

Parameters:
node - the node to add
Returns:
the added node
Throws:
InvalidPathException
InvalidNameException
NoAccessException
InvalidParentNodeException
NodeNotFoundException
NodeWithDuplicatePathException
ContentManagerException

beginTransaction

void beginTransaction()
Begins a Content Manager transaction


commitTransaction

void commitTransaction()
Commit's a Content Manager transaction


deleteContent

boolean deleteContent(String id,
                      IDIFUser user)
                      throws ContentItemNotFoundException,
                             NodeNotFoundException,
                             NoAccessException,
                             ContentManagerException
Deletes an existing content from the repository

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

deleteNode

boolean deleteNode(Long id,
                   IDIFUser user)
                   throws NodeNotFoundException,
                          NoAccessException,
                          NodeWithNodesException,
                          ContentManagerException
Deletes an existing node from the repository

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

deleteNode

boolean deleteNode(Long id,
                   IDIFUser user,
                   boolean cascadeDelete)
                   throws NodeNotFoundException,
                          NoAccessException,
                          NodeWithNodesException,
                          ContentManagerException
Deletes an existing node from the repository.
Will launch an exception if the node is not empty

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

getContentByDescription

List<ContentItem> getContentByDescription(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

ContentItem getContentById(String id,
                           IDIFUser user)
                           throws ContentItemNotFoundException,
                                  NoAccessException,
                                  NodeNotFoundException,
                                  ContentManagerException
Searches a content item by it's unique identifier

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

getContentByName

List<ContentItem> getContentByName(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

List<ContentItem> getContentByParentNode(Long nodeId,
                                         IDIFUser user)
                                         throws NodeNotFoundException,
                                                ContentManagerException
Searches content items by parent node

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

getContentFromNodePathByName

ContentItem getContentFromNodePathByName(String nodeFullPath,
                                         String name,
                                         IDIFUser user)
                                         throws ContentItemNotFoundException,
                                                NodeNotFoundException,
                                                NoAccessException,
                                                ContentManagerException
Searches content items by name and node path

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

getContentItemACL

List<ACLEntry> getContentItemACL(String id)
                                 throws ContentManagerException
get content item ACL

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

getNodeACL

List<ACLEntry> getNodeACL(Long id)
                          throws ContentManagerException
get node ACL

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

getNodeById

Node getNodeById(Long id,
                 IDIFUser user)
                 throws NodeNotFoundException,
                        NoAccessException,
                        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:
NodeNotFoundException
NoAccessException
ContentManagerException

getNodeByPath

Node getNodeByPath(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

getNodesByDescription

List<Node> getNodesByDescription(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

getNodesByDescription

List<Node> getNodesByDescription(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

List<Node> getNodesByName(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 all existing root nodes. May exist with same name in different parent nodes
Throws:
ContentManagerException

getNodesByName

List<Node> getNodesByName(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

List<Node> getNodesByParentNode(Long nodeId,
                                IDIFUser user)
                                throws NodeNotFoundException,
                                       ContentManagerException
Searches nodes by parent node

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

getRootNodes

List<Node> getRootNodes(IDIFUser user)
                        throws ContentManagerException
Searches root nodes that user has access

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

grantContentAccessToGroup

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

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:
ContentItemNotFoundException
ContentManagerException

grantContentAccessToUser

boolean grantContentAccessToUser(String contentId,
                                 IDIFUser user)
                                 throws ContentItemNotFoundException,
                                        ContentManagerException
Grants user access to content item

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

grantNodeAccessToGroup

boolean grantNodeAccessToGroup(Long nodeId,
                               String groupId)
                               throws NodeNotFoundException,
                                      ContentManagerException
Grants group access to node

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

grantNodeAccessToUser

boolean grantNodeAccessToUser(Long nodeId,
                              IDIFUser user)
                              throws NodeNotFoundException,
                                     ContentManagerException
Grants user access to node

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

grantNodeAccessToUser

boolean grantNodeAccessToUser(String nodePath,
                              IDIFUser user)
                              throws ContentManagerException
Grants user access to node

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

hasContentAccessGroup

boolean hasContentAccessGroup(String contentId,
                              String groupId)
                              throws ContentItemNotFoundException,
                                     NodeNotFoundException,
                                     ContentManagerException
Checks if group has access to the content

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

hasContentAccessUser

boolean hasContentAccessUser(ContentItem content,
                             IDIFUser user)
                             throws ContentItemNotFoundException,
                                    NodeNotFoundException,
                                    ContentManagerException
Checks if user has access to the content

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

hasContentAccessUser

boolean hasContentAccessUser(String contentId,
                             IDIFUser user)
                             throws ContentItemNotFoundException,
                                    NodeNotFoundException,
                                    ContentManagerException
Checks if user has access to the content

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

hasNodeAccessGroups

boolean hasNodeAccessGroups(Long nodeId,
                            Set<String> groups)
                            throws NodeNotFoundException,
                                   ContentManagerException
Checks if one of the group 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:
NodeNotFoundException
ContentManagerException

hasNodeAccessUser

boolean hasNodeAccessUser(Long nodeId,
                          IDIFUser user)
                          throws NodeNotFoundException,
                                 ContentManagerException
Checks if user has access to the node

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

moveContent

boolean moveContent(String contentID,
                    Long destinationNodeId,
                    IDIFUser user)
                    throws ContentItemNotFoundException,
                           NodeNotFoundException,
                           NoAccessException,
                           ContentManagerException
Moves content to another node

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

moveNode

boolean moveNode(Long nodeID,
                 Long destinationNodeId,
                 IDIFUser user)
                 throws NodeNotFoundException,
                        NoAccessException,
                        ContentManagerException
Moves a node to another parent node

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

revokeContentAccessToGroup

boolean revokeContentAccessToGroup(String contentId,
                                   String groupId)
                                   throws ContentItemNotFoundException,
                                          ContentManagerException
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.
Throws:
ContentItemNotFoundException
ContentManagerException

revokeContentAccessToUser

boolean revokeContentAccessToUser(String contentId,
                                  IDIFUser user)
                                  throws ContentItemNotFoundException,
                                         ContentManagerException
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.
Throws:
ContentItemNotFoundException
ContentManagerException

revokeNodeAccessToGroup

boolean revokeNodeAccessToGroup(Long nodeId,
                                String groupId)
                                throws NodeNotFoundException,
                                       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:
NodeNotFoundException
ContentManagerException

revokeNodeAccessToUser

boolean revokeNodeAccessToUser(Long nodeId,
                               IDIFUser user)
                               throws NodeNotFoundException,
                                      ContentManagerException
Revokes user access to node

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

rollbackTransaction

void rollbackTransaction()
Roll back the a Content Manager transaction


updateContent

ContentItem updateContent(ContentItem content)
                          throws ContentItemNotFoundException,
                                 NodeNotFoundException,
                                 NoAccessException,
                                 ContentItemWithDuplicateNameAndParentNodeException,
                                 ContentManagerException
Updates content in the repository

Parameters:
content - the content to update in the repository
Returns:
the updated content
Throws:
ContentItemNotFoundException
NodeNotFoundException
NoAccessException
ContentItemWithDuplicateNameAndParentNodeException
ContentManagerException

updateNode

Node updateNode(Node node)
                throws NodeNotFoundException,
                       NoAccessException,
                       ContentManagerException
Updates content in the repository

Parameters:
node - the node to update in the repository
Returns:
the updated content
Throws:
NodeNotFoundException
NoAccessException
ContentManagerException


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