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
Client side element for ODF content copy
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Enumeration for the mode of duplicationNested classes/interfaces inherited from interface org.ametys.core.ui.ClientSideElement
ClientSideElement.Script, ClientSideElement.ScriptFile
-
Field Summary
Modifier and TypeFieldDescriptionprotected CopyContentClientInteraction
The client side element for copyprotected CopyODFContentUpdaterExtensionPoint
The copy ODF content updater extension pointprotected JSONUtils
JSON utilsprotected ODFHelper
The ODF helperprotected SolrIndexHelper
The Solr index helperstatic final String
The key to get the duplication modestatic final String
The key to tell if we keep the creation titlestatic final String
The key to get the parent ProgramPart's idFields 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
-
Method Summary
Modifier and TypeMethodDescription_getCourse
(ProgramItem programItem) Get all first courses in sub item of the program itemDetermines if a ODF content can be copied and linked to a target contentprotected boolean
canCopyTo
(Content copiedContent, Content targetContent, List<I18nizableText> errors, Map<String, Object> contextualParameters) Determines if a ODF content can be copied and linked to a target contentprotected boolean
checkBeforeDuplication
(String contentId, String parentContentId, CopyODFContentClientSideElement.DuplicationMode duplicationMode, Map<String, Object> results) Check that duplication can be performed without blocking errorscreateContentByCopy
(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 Details
-
DUPLICATION_MODE_KEY
The key to get the duplication mode- See Also:
-
PARENT_KEY
The key to get the parent ProgramPart's id- See Also:
-
KEEP_CREATION_TITLE_KEY
The key to tell if we keep the creation title- See Also:
-
_odfHelper
The ODF helper -
_copyClientSideInteraction
The client side element for copy -
_jsonUtils
JSON utils -
_solrIndexHelper
The Solr index helper -
_copyODFContentUpdaterEP
The copy ODF content updater extension point
-
-
Constructor Details
-
CopyODFContentClientSideElement
public CopyODFContentClientSideElement()
-
-
Method Details
-
service
- 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
-
canCopyTo
protected boolean canCopyTo(Content copiedContent, Content targetContent, List<I18nizableText> errors, Map<String, Object> contextualParameters) Determines if a ODF content can be copied and linked to a target content- Parameters:
copiedContent
- The copied contenttargetContent
- The target contenterrors
- The list of error messagescontextualParameters
- the contextual parameters- Returns:
- true if the relation is valid, false otherwise
-
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
-
checkBeforeDuplication
protected boolean checkBeforeDuplication(String contentId, String parentContentId, CopyODFContentClientSideElement.DuplicationMode duplicationMode, Map<String, Object> results) Check that duplication can be performed without blocking errors- Parameters:
contentId
- The content id to copyparentContentId
- The parent content idduplicationMode
- The duplication moderesults
- the results map- Returns:
- true if the duplication can be performed
-
_getCourse
Get all first courses in sub item of the program item- Parameters:
programItem
- the program item- Returns:
- a set of courses
-