Package org.ametys.odf.workflow.copy
Class CopyODFContentClientSideElement
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.core.ui.StaticFileImportsClientSideElement
-
- org.ametys.core.ui.StaticClientSideElement
-
- org.ametys.cms.clientsideelement.SmartContentClientSideElement
-
- org.ametys.odf.workflow.copy.CopyODFContentClientSideElement
-
- All Implemented Interfaces:
ClientSideElement
,LogEnabled
,PluginAware
,Configurable
,Serviceable
- Direct Known Subclasses:
CopyODFPilotageContentClientSideElement
public class CopyODFContentClientSideElement extends SmartContentClientSideElement
Client side element for ODF content copy
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CopyODFContentClientSideElement.DuplicationMode
Enumeration for the mode of duplication-
Nested classes/interfaces inherited from interface org.ametys.core.ui.ClientSideElement
ClientSideElement.Script, ClientSideElement.ScriptFile
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentWorkflowHelper
_contentWorkflowHelper
The content workflow helperprotected CopyContentClientInteraction
_copyClientSideInteraction
The client side element for copyprotected JSONUtils
_jsonUtils
JSON utilsprotected ObservationManager
_observationManager
The observation managerprotected ODFHelper
_odfHelper
The ODF helperprotected ShareableCourseHelper
_shareableCourseHelper
The shareable course helperprotected SolrIndexHelper
_solrIndexHelper
The Solr index helperstatic String
DUPLICATION_MODE_KEY
The key to get the duplication modestatic String
KEEP_CREATION_TITLE_KEY
The key to tell if we keep the creation titlestatic String
PARENT_KEY
The key to get the parent ProgramPart's id-
Fields inherited from class org.ametys.cms.clientsideelement.SmartContentClientSideElement
_contentHelper, _resolver, _smartHelper
-
Fields inherited from class org.ametys.core.ui.StaticFileImportsClientSideElement
_currentUserProvider, _dependencies, _featureName, _id, _pluginName, _rightManager, _rights, _rightsMode, _script
-
-
Constructor Summary
Constructors Constructor Description CopyODFContentClientSideElement()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Set<Course>
_getCourse(ProgramItem programItem)
Get all first courses in sub item of the program itemprotected void
_initializeShareableFields(String copiedContentId, String parentContentId, List<String> createdContentIds)
Initialize shareable fields for the copied contentMap<String,Object>
canCopyTo(String copiedContentId, String targetContentId, Map<String,Object> contextualParameters)
Determines if a ODF content can be copied and linked to a target contentprotected boolean
checkBeforeDuplication(String programItemId, String parentContentId, CopyODFContentClientSideElement.DuplicationMode duplicationMode, Map<String,Object> results)
Check that duplication can be performed without blocking errorsMap<String,Object>
createContentByCopy(String baseContentId, String newContentTitle, String viewNameToCopy, String fallbackViewNameToCopy, String viewMode, 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 attribute of type "content".void
service(ServiceManager sManager)
-
Methods inherited from class org.ametys.cms.clientsideelement.SmartContentClientSideElement
_getAllRightDescription, _getIncorrectWorkflowStepDescription, _getLockedDescription, _getNoModifiableDescription, _getNoRightDescription, _getWorkflowActionUnvailableDescription, _hasRight, _isAllRight, _isLocked, _isModifiable, _isWorkflowStepCorrect, _workflowAction, getContentDefaultParameters, getStatus
-
Methods inherited from class org.ametys.core.ui.StaticClientSideElement
_configureClass, _configureParameters, _configureScript, configureInitialParameters
-
Methods inherited from class org.ametys.core.ui.StaticFileImportsClientSideElement
_configureDependencies, _configureImports, _configureRights, _configureRightsMode, configure, getDependencies, getId, getPluginName, getRights, getScripts, getScripts, hasRight, setPluginInfo, toString
-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
DUPLICATION_MODE_KEY
public static final String DUPLICATION_MODE_KEY
The key to get the duplication mode- See Also:
- Constant Field Values
-
PARENT_KEY
public static final String PARENT_KEY
The key to get the parent ProgramPart's id- See Also:
- Constant Field Values
-
KEEP_CREATION_TITLE_KEY
public static final String KEEP_CREATION_TITLE_KEY
The key to tell if we keep the creation title- See Also:
- Constant Field Values
-
_contentWorkflowHelper
protected ContentWorkflowHelper _contentWorkflowHelper
The content workflow helper
-
_observationManager
protected ObservationManager _observationManager
The observation manager
-
_odfHelper
protected ODFHelper _odfHelper
The ODF helper
-
_copyClientSideInteraction
protected CopyContentClientInteraction _copyClientSideInteraction
The client side element for copy
-
_jsonUtils
protected JSONUtils _jsonUtils
JSON utils
-
_shareableCourseHelper
protected ShareableCourseHelper _shareableCourseHelper
The shareable course helper
-
_solrIndexHelper
protected SolrIndexHelper _solrIndexHelper
The Solr index helper
-
-
Constructor Detail
-
CopyODFContentClientSideElement
public CopyODFContentClientSideElement()
-
-
Method Detail
-
service
public void service(ServiceManager sManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classSmartContentClientSideElement
- Throws:
ServiceException
-
canCopyTo
public 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- Parameters:
copiedContentId
- The id of copied contenttargetContentId
- The id of target contentcontextualParameters
- the contextual parameters- Returns:
- the result with success to true if copy is available
-
createContentByCopy
public Map<String,Object> createContentByCopy(String baseContentId, String newContentTitle, String viewNameToCopy, String fallbackViewNameToCopy, String viewMode, int initActionId, int editActionId, String duplicationModeAsString, String parentContentId) throws Exception
Creates a content by copy of another one.
Also handle the possible inner duplication depending on the duplication mode for each attribute of type "content".- Parameters:
baseContentId
- The id of content to copynewContentTitle
- The title of content to createviewNameToCopy
- The view name to copy. Can be nullfallbackViewNameToCopy
- The fallback view name to use if 'viewNameToCopy' does not exist. Can be nullviewMode
- The view 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 null- Returns:
- the copy result
- Throws:
Exception
- if an error occurred during copy
-
_initializeShareableFields
protected void _initializeShareableFields(String copiedContentId, String parentContentId, List<String> createdContentIds)
Initialize shareable fields for the copied content- Parameters:
copiedContentId
- the copied content idparentContentId
- the parent content idcreatedContentIds
- the list of created content ids by copy
-
checkBeforeDuplication
protected boolean checkBeforeDuplication(String programItemId, String parentContentId, CopyODFContentClientSideElement.DuplicationMode duplicationMode, Map<String,Object> results)
Check that duplication can be performed without blocking errors- Parameters:
programItemId
- The program item id to copyparentContentId
- The parent content idduplicationMode
- The duplication moderesults
- the results map- Returns:
- true if the duplication can be performed
-
_getCourse
protected Set<Course> _getCourse(ProgramItem programItem)
Get all first courses in sub item of the program item- Parameters:
programItem
- the program item- Returns:
- a set of courses
-
-