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 classCopyODFContentClientSideElement.DuplicationModeEnumeration 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_contentWorkflowHelperThe content workflow helperprotected CopyContentClientInteraction_copyClientSideInteractionThe client side element for copyprotected JSONUtils_jsonUtilsJSON utilsprotected ObservationManager_observationManagerThe observation managerprotected ODFHelper_odfHelperThe ODF helperprotected ShareableCourseHelper_shareableCourseHelperThe shareable course helperprotected SolrIndexer_solrIndexerThe solr indexerstatic StringDUPLICATION_MODE_KEYThe key to get the duplication modestatic StringKEEP_CREATION_TITLE_KEYThe key to tell if we keep the creation titlestatic StringPARENT_KEYThe 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 void_commitAllChanges()Commit all changes in solrprotected 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 booleancheckBeforeDuplication(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 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".voidservice(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
-
_solrIndexer
protected SolrIndexer _solrIndexer
The solr indexer
-
_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
-
-
Constructor Detail
-
CopyODFContentClientSideElement
public CopyODFContentClientSideElement()
-
-
Method Detail
-
service
public void service(ServiceManager sManager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Overrides:
servicein 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 metadataSetTypeToCopy, 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 metadata 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 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 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
-
_commitAllChanges
protected void _commitAllChanges()
Commit all changes in solr
-
-