public class ContentDAO extends AbstractLogEnabled implements Serviceable, Component, Contextualizable
Modifier and Type | Class and Description |
---|---|
static class |
ContentDAO.TagMode
The mode for tag edition
|
Modifier and Type | Field and Description |
---|---|
protected ContentHelper |
_contentHelper
Content helper
|
protected ContentTypeExtensionPoint |
_contentTypeEP
Content-type extension point
|
protected ContentWorkflowHelper |
_contentWorkflowHelper
Workflow helper component
|
protected Context |
_context
Cocoon context
|
protected ContentTypesHelper |
_cTypesHelper
Content types helper
|
protected CurrentUserProvider |
_currentUserProvider
Component to get current user
|
protected HierarchicalReferenceTablesHelper |
_hierarchicalSimpleContentsHelper
The helper component for hierarchical simple contents
|
protected LockContentManager |
_lockManager
Component to manager lock
|
protected ModifiableContentHelper |
_modifiableContentHelper
The modifiable content helper
|
protected ObservationManager |
_observationManager
Ametys observation manger
|
protected AmetysObjectResolver |
_resolver
Ametys resolver
|
protected RightManager |
_rightManager
Rights manager
|
protected TagProviderExtensionPoint |
_tagProvider
Component to get tags
|
protected UserHelper |
_userHelper
Helper for users
|
protected UserManager |
_usersManager
The user manager
|
protected WorkflowProvider |
_workflowProvider
Workflow component
|
static String |
ROLE
Avalon Role
|
Constructor and Description |
---|
ContentDAO() |
Modifier and Type | Method and Description |
---|---|
private boolean |
_addOrRemoveReaction(Content content,
UserIdentity userIdentity,
ReactionableObject.ReactionType reactionType,
boolean remove) |
protected void |
_copyACL(Content srcContent,
Content targetContent)
Copy the ACL of a content
|
protected Map<String,Object> |
_getEventParametersForDeletion(Content content)
Get parameters for content deleted
Event |
protected boolean |
_isContentReferenced(Content content)
Test if content is still referenced before removing it
|
boolean |
_isTagValid(String tagName,
Map<String,Object> contextualParameters)
Is the tag a content tag
|
protected void |
_notifyContentCopied(Content content,
boolean waitAsyncObservers)
Notify observers that the content has been created
|
private void |
_removeAllTagsInReplaceMode(TaggableAmetysObject mContent,
ContentDAO.TagMode tagMode,
Set<String> oldTags) |
boolean |
canDelete(Content content)
Dertermines if the current user has right to delete the content
|
void |
contextualize(Context context) |
ModifiableContent |
copy(DefaultContent originalContent,
ModifiableTraversableAmetysObject parent,
String name,
int initWorkflowActionId)
Copy a content.
|
ModifiableContent |
copy(DefaultContent originalContent,
ModifiableTraversableAmetysObject parent,
String name,
String lang,
int initWorkflowActionId)
Copy a content.
|
ModifiableContent |
copy(DefaultContent originalContent,
ModifiableTraversableAmetysObject parent,
String name,
String lang,
int initWorkflowActionId,
boolean notifyObservers,
boolean waitAsyncObservers,
boolean copyACL)
Copy a content.
|
Map<String,Object> |
deleteContents(List<String> contentsId)
Delete contents
|
Map<String,Object> |
deleteContents(List<String> contentsId,
boolean ignoreRights)
Delete contents
|
Map<String,Object> |
getAttachmentsRootNode(String id)
Returns the content's attachments root node
|
Map<String,Object> |
getContentDescription(Content content)
Get the content's properties for description
|
Map<String,Object> |
getContentDescription(String contentId,
String workspaceName)
Get the content's properties for description
|
List<Map<String,Object>> |
getContentMetadataSets(String contentId,
boolean edition,
boolean includeInternal)
Get the metadata sets of a content
|
Map<String,Object> |
getContentProperties(Content content)
Get the content properties
|
Map<String,Object> |
getContentProperties(String contentId,
String workspaceName)
Get the content properties
|
Map<String,Object> |
getContentsProperties(List<String> contentIds,
String workspaceName)
Get the contents properties
|
Set<String> |
getTags(List<String> contentIds)
Get the tags of contents
|
protected Set<String> |
getUserRights(Content content)
Get the user rights on content
|
boolean |
react(Content content,
UserIdentity userIdentity,
ReactionableObject.ReactionType reactionType)
Add a reaction on a
Content . |
Map<String,Object> |
react(String contentId,
String reactionName,
boolean remove)
Add or remove a reaction on a content
|
void |
service(ServiceManager smanager) |
Map<String,Object> |
tag(List<String> contentIds,
List<String> tagNames,
Map<String,Object> contextualParameters)
Tag a list of contents with the given tags
|
Map<String,Object> |
tag(List<String> contentIds,
List<String> tagNames,
String mode,
Map<String,Object> contextualParameters)
Tag a list of contents
|
boolean |
unreact(Content content,
UserIdentity userIdentity,
ReactionableObject.ReactionType reactionType)
Remove reaction if exists on a
Content . |
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
protected AmetysObjectResolver _resolver
protected ObservationManager _observationManager
protected CurrentUserProvider _currentUserProvider
protected TagProviderExtensionPoint _tagProvider
protected WorkflowProvider _workflowProvider
protected ContentWorkflowHelper _contentWorkflowHelper
protected LockContentManager _lockManager
protected ContentTypeExtensionPoint _contentTypeEP
protected ContentHelper _contentHelper
protected ContentTypesHelper _cTypesHelper
protected RightManager _rightManager
protected UserManager _usersManager
protected UserHelper _userHelper
protected HierarchicalReferenceTablesHelper _hierarchicalSimpleContentsHelper
protected ModifiableContentHelper _modifiableContentHelper
public ContentDAO()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
ServiceException
public Map<String,Object> deleteContents(List<String> contentsId)
contentsId
- The ids of contents to deletepublic Map<String,Object> deleteContents(List<String> contentsId, boolean ignoreRights)
contentsId
- The ids of contents to deleteignoreRights
- true to ignore user rightsprotected boolean _isContentReferenced(Content content)
content
- The content to removeprotected Map<String,Object> _getEventParametersForDeletion(Content content)
Event
content
- the removed contentpublic Map<String,Object> getContentsProperties(List<String> contentIds, String workspaceName)
contentIds
- The ids of contentsworkspaceName
- The workspace name. Can be null to get contents in current workspace.public Map<String,Object> getContentProperties(String contentId, String workspaceName)
contentId
- The id of contentworkspaceName
- The workspace name. Can be null to get content in current workspace.public Map<String,Object> getContentProperties(Content content)
content
- The contentpublic Map<String,Object> getContentDescription(String contentId, String workspaceName)
contentId
- The id of contentworkspaceName
- The workspace name. Can be null to get content in current workspace.public Map<String,Object> getContentDescription(Content content)
content
- The contentpublic List<Map<String,Object>> getContentMetadataSets(String contentId, boolean edition, boolean includeInternal)
contentId
- the content's idedition
- Set to true to get edition metadata set. False otherwise.includeInternal
- Set to true to include internal metadata sets.protected Set<String> getUserRights(Content content)
content
- The contentpublic Set<String> getTags(List<String> contentIds)
contentIds
- The content's idspublic Map<String,Object> tag(List<String> contentIds, List<String> tagNames, Map<String,Object> contextualParameters)
contentIds
- The ids of contents to tagtagNames
- The tagscontextualParameters
- The contextual parameterspublic Map<String,Object> tag(List<String> contentIds, List<String> tagNames, String mode, Map<String,Object> contextualParameters)
contentIds
- The ids of contents to tagtagNames
- The tagsmode
- The mode for updating tags: 'REPLACE' to replace tags, 'INSERT' to add tags or 'REMOVE' to remove tags.contextualParameters
- The contextual parametersprivate void _removeAllTagsInReplaceMode(TaggableAmetysObject mContent, ContentDAO.TagMode tagMode, Set<String> oldTags)
public boolean _isTagValid(String tagName, Map<String,Object> contextualParameters)
tagName
- The tag namecontextualParameters
- The contextual parameterspublic ModifiableContent copy(DefaultContent originalContent, ModifiableTraversableAmetysObject parent, String name, int initWorkflowActionId) throws AmetysRepositoryException
originalContent
- the original content.parent
- the object in which to create a content.name
- the content name.initWorkflowActionId
- The initial workflow action idAmetysRepositoryException
- If an error occuredpublic ModifiableContent copy(DefaultContent originalContent, ModifiableTraversableAmetysObject parent, String name, String lang, int initWorkflowActionId) throws AmetysRepositoryException
originalContent
- the original content.parent
- the object in which to create a content.name
- the content name.lang
- the content language. If null, the content language will be the same of the original contentinitWorkflowActionId
- The initial workflow action idAmetysRepositoryException
- If an error occuredpublic ModifiableContent copy(DefaultContent originalContent, ModifiableTraversableAmetysObject parent, String name, String lang, int initWorkflowActionId, boolean notifyObservers, boolean waitAsyncObservers, boolean copyACL) throws AmetysRepositoryException
originalContent
- the original content.parent
- the object in which to create a content.name
- the content name.lang
- the content language. If null, the content language will be the same of the original contentinitWorkflowActionId
- The initial workflow action idnotifyObservers
- Set to false to do not fire observer eventswaitAsyncObservers
- true to wait for asynchronous observers to completecopyACL
- true to copy ACL of source contentAmetysRepositoryException
- If an error occuredprotected void _copyACL(Content srcContent, Content targetContent)
srcContent
- The source contenttargetContent
- The target contentprotected void _notifyContentCopied(Content content, boolean waitAsyncObservers) throws com.opensymphony.workflow.WorkflowException
content
- The content addedwaitAsyncObservers
- true to wait for asynchonous observers to finishcom.opensymphony.workflow.WorkflowException
- If an error occurredpublic Map<String,Object> getAttachmentsRootNode(String id)
id
- the content's idpublic boolean canDelete(Content content)
content
- The contentpublic Map<String,Object> react(String contentId, String reactionName, boolean remove)
contentId
- The content idreactionName
- the reaction name (ex: LIKE)remove
- true to remove the reaction, false to add reactionpublic boolean react(Content content, UserIdentity userIdentity, ReactionableObject.ReactionType reactionType)
Content
.content
- the contentuserIdentity
- the issuer of reactionreactionType
- the reaction typepublic boolean unreact(Content content, UserIdentity userIdentity, ReactionableObject.ReactionType reactionType)
Content
.content
- the contentuserIdentity
- the issuer of reactionreactionType
- the reaction typeprivate boolean _addOrRemoveReaction(Content content, UserIdentity userIdentity, ReactionableObject.ReactionType reactionType, boolean remove)