public class CopyODFContentClientSideElement extends SmartContentClientSideElement
Modifier and Type | Class and Description |
---|---|
static class |
CopyODFContentClientSideElement.DuplicationMode
Enumeration for the mode of duplication
|
ClientSideElement.Script, ClientSideElement.ScriptFile
Modifier and Type | Field and Description |
---|---|
protected ContentWorkflowHelper |
_contentWorkflowHelper
The content workflow helper
|
protected CopyContentClientInteraction |
_copyClientSideInteraction
The client side element for copy
|
protected JSONUtils |
_jsonUtils
JSON utils
|
protected ObservationManager |
_observationManager
The observation manager
|
protected ODFHelper |
_odfHelper
The ODF helper
|
protected SolrIndexer |
_solrIndexer
The solr indexer
|
static String |
DUPLICATION_MODE_KEY
The key to get the duplication mode
|
static String |
KEEP_CREATION_TITLE_KEY
The key to tell if we keep the creation title
|
_contentHelper, _resolver, _smartHelper
_currentUserProvider, _dependencies, _featureName, _id, _pluginName, _rightManager, _rights, _rightsMode, _script
Constructor and Description |
---|
CopyODFContentClientSideElement() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
_addRelation(WorkflowAwareContent parentContent,
WorkflowAwareContent childContent,
String parentMetadataName,
String childMetadataName,
int actionId)
Add the relation parent-child relation on content.
|
protected void |
_applyChanges(WorkflowAwareContent content,
int actionId)
Apply changes to the content
|
protected void |
_commitAllChanges()
Commit all changes in solr
|
protected Set<Course> |
_getCourse(ProgramItem programItem)
Get all first courses in sub item of the program item
|
protected void |
_linkCopiedContentToParent(String copiedContentId,
String parentContentId)
Check if we can add the copied content to the parent content and set the relation
|
Map<String,Object> |
canCopyTo(String copiedContentId,
String targetContentId,
Map<String,Object> contextualParameters)
Determines if a ODF content can be copied and linked to a target content
|
protected boolean |
checkBeforeDuplication(String programItemId,
String parentContentId,
CopyODFContentClientSideElement.DuplicationMode duplicationMode,
Map<String,Object> results)
Check that duplication can be performed without blocking errors
|
Map<String,Object> |
createContentByCopy(String baseContentId,
String newContentTitle,
String metadataSetNameToCopy,
String metadataSetTypeToCopy,
int initActionId,
int editActionId,
String duplicationModeAsString,
String parentContentId)
Creates a content by copy of another one.
Also handle the possible inner duplication depending on the duplication mode for each metadata of type "content". |
void |
service(ServiceManager sManager) |
protected void |
setJCRReference(WorkflowAwareContent contentToEdit,
Content refContent,
String metadataName)
Add the jcr relation on content.
|
_getAllRightDescription, _getIncorrectWorkflowStepDescription, _getLockedDescription, _getNoModifiableDescription, _getNoRightDescription, _getWorkflowActionUnvailableDescription, _hasRight, _isAllRight, _isLocked, _isModifiable, _isWorkflowStepCorrect, _workflowAction, getContentDefaultParameters, getStatus
_configureClass, _configureParameters, _configureScript, configureInitialParameters
_configureDependencies, _configureImports, _configureRights, _configureRightsMode, configure, getDependencies, getId, getPluginName, getRights, getScripts, getScripts, hasRight, setPluginInfo, toString
getLogger, setLogger
public static final String DUPLICATION_MODE_KEY
public static final String KEEP_CREATION_TITLE_KEY
protected ContentWorkflowHelper _contentWorkflowHelper
protected ObservationManager _observationManager
protected SolrIndexer _solrIndexer
protected ODFHelper _odfHelper
protected CopyContentClientInteraction _copyClientSideInteraction
protected JSONUtils _jsonUtils
public CopyODFContentClientSideElement()
public void service(ServiceManager sManager) throws ServiceException
service
in interface Serviceable
service
in class SmartContentClientSideElement
ServiceException
public Map<String,Object> canCopyTo(String copiedContentId, String targetContentId, Map<String,Object> contextualParameters)
copiedContentId
- The id of copied contenttargetContentId
- The id of target contentcontextualParameters
- the contextual parameterspublic Map<String,Object> createContentByCopy(String baseContentId, String newContentTitle, String metadataSetNameToCopy, String metadataSetTypeToCopy, int initActionId, int editActionId, String duplicationModeAsString, String parentContentId) throws Exception
baseContentId
- The id of content to copynewContentTitle
- The title of content to createmetadataSetNameToCopy
- The metadata set name to copy. Can be nullmetadataSetTypeToCopy
- The metadata set type to copy. Can be nullinitActionId
- The init workflow action id for copyeditActionId
- The workflow action for editing contentduplicationModeAsString
- the duplication modeparentContentId
- the parent id under which the duplicated content will be created. Can be nullException
- if an error occurred during copyprotected boolean checkBeforeDuplication(String programItemId, String parentContentId, CopyODFContentClientSideElement.DuplicationMode duplicationMode, Map<String,Object> results)
programItemId
- The program item id to copyparentContentId
- The parent content idduplicationMode
- The duplication moderesults
- the results mapprotected Set<Course> _getCourse(ProgramItem programItem)
programItem
- the program itemprotected void _linkCopiedContentToParent(String copiedContentId, String parentContentId)
copiedContentId
- the copied content idparentContentId
- the parent content idprotected boolean _addRelation(WorkflowAwareContent parentContent, WorkflowAwareContent childContent, String parentMetadataName, String childMetadataName, int actionId)
parentContent
- The parent contentchildContent
- The child content to be added from parentContentparentMetadataName
- The name of the parent metadata holding the child relationshipchildMetadataName
- The name of the child metadata holding the parent relationshipactionId
- The id of workflow action to edit the relationprotected void setJCRReference(WorkflowAwareContent contentToEdit, Content refContent, String metadataName)
contentToEdit
- The content editrefContent
- The referenced content to be addedmetadataName
- The name of the metadata holding the relationshipprotected void _applyChanges(WorkflowAwareContent content, int actionId) throws com.opensymphony.workflow.WorkflowException
content
- the content changedactionId
- the workflow action idcom.opensymphony.workflow.WorkflowException
- if an error occurredprotected void _commitAllChanges()