Package org.ametys.odf.workflow
Class ODFWorkflowHelper
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.odf.workflow.ODFWorkflowHelper
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
Helper for ODF contents on their workflow
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentWorkflowHelper
The workflow helper for contentsprotected ODFHelper
The ODF helperprotected AmetysObjectResolver
The Ametys object resolverprotected WorkflowProvider
The workflow providerprotected static final String
Constant for storing the result map into the transient variables map.protected static final String
Constant for storing the content with right error into the transient variables map.static final String
The component role.static final int
The action id of global unpublishmentprotected static final String
Constant for storing the unpublish result map into the transient variables map.static final int
The action id of global validationprotected static final String
Constant for storing the result map into the transient variables map.static final int
The validate step id -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_content2Json
(Content content) Get the JSON representation of the contentprotected org.ametys.odf.workflow.ODFWorkflowHelper.WorkflowActionStatus
_doUnpublishWorkflowAction
(WorkflowAwareContent content, int actionId) Unpublish a contentprotected org.ametys.odf.workflow.ODFWorkflowHelper.WorkflowActionStatus
_doValidateWorkflowAction
(WorkflowAwareContent content, int actionId) Validate a contentprotected void
_unpublishRecursively
(ProgramItem programItem, Map<String, Object> result) Unpublish the referenced contents recursivelyprotected void
_validateRecursively
(WorkflowAwareContent content, Map<String, Object> result) Validate the referenced contents recursivelyprotected void
_validateReferencedContents
(Collection<String> refContentIds, Map<String, Object> result) Validate the list of referenced contentscheckReferences
(List<String> contentIds) Check if the contents has referenced contents that are not already validated (children excluded)getGlobalValidationStatus
(String contentId) Get the global validation status of a contentGet the invalidated contents referenced by a ODF contentglobalValidate
(List<String> contentIds) Global validation on a contents.boolean
isInValidatedStep
(WorkflowAwareContent content) Determines if a content is already in validated stepboolean
isParentPublishable
(ProgramItem content) true
if the parent is publishablevoid
service
(ServiceManager manager) setPublishableState
(List<String> contentIds, boolean isPublishable) Set the publishable state of contentsMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The component role. -
VALIDATED_STEP_ID
The validate step id- See Also:
-
VALIDATE_ACTION_ID
The action id of global validation- See Also:
-
UNPUBLISH_ACTION_ID
The action id of global unpublishment- See Also:
-
CONTENTS_IN_ERROR_KEY
Constant for storing the result map into the transient variables map.- See Also:
-
CONTENTS_WITH_RIGHT_ERROR_KEY
Constant for storing the content with right error into the transient variables map.- See Also:
-
VALIDATED_CONTENTS_KEY
Constant for storing the result map into the transient variables map.- See Also:
-
UNPUBLISHED_CONTENTS_KEY
Constant for storing the unpublish result map into the transient variables map.- See Also:
-
_resolver
The Ametys object resolver -
_workflowProvider
The workflow provider -
_odfHelper
The ODF helper -
_contentWorkflowHelper
The workflow helper for contents
-
-
Constructor Details
-
ODFWorkflowHelper
public ODFWorkflowHelper()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
checkReferences
Check if the contents has referenced contents that are not already validated (children excluded)- Parameters:
contentIds
- The id of contents to check- Returns:
- A map with success key to true if referenced contents are validated. A map with the invalidated contents otherwise.
-
getGlobalValidationStatus
Get the global validation status of a content- Parameters:
contentId
- the id of content- Returns:
- the result
-
getInvalidatedContents
Get the invalidated contents referenced by a ODF content- Parameters:
content
- the initial ODF content- Returns:
- the set of referenced invalidated contents
-
isInValidatedStep
Determines if a content is already in validated step- Parameters:
content
- The content to test- Returns:
- true if the content is already validated
-
globalValidate
Global validation on a contents. Validate the contents with their whole structure and the others referenced contacts and orgunits.- Parameters:
contentIds
- the id of contents to validation recursively- Returns:
- the result for each initial contents
-
_content2Json
Get the JSON representation of the content- Parameters:
content
- the content- Returns:
- the content properties
-
_validateRecursively
Validate the referenced contents recursively- Parameters:
content
- The validated contentresult
- the result object to fill during process
-
_validateReferencedContents
protected void _validateReferencedContents(Collection<String> refContentIds, Map<String, Object> result) Validate the list of referenced contents- Parameters:
refContentIds
- The id of contents to validateresult
- the result object to fill during process
-
_doValidateWorkflowAction
protected org.ametys.odf.workflow.ODFWorkflowHelper.WorkflowActionStatus _doValidateWorkflowAction(WorkflowAwareContent content, int actionId) Validate a content- Parameters:
content
- The content to validateactionId
- The id of validate action- Returns:
- the validate workflow status
-
setPublishableState
Set the publishable state of contents- Parameters:
contentIds
- The id of contentsisPublishable
-true
to set content as publishable,false
otherwise- Returns:
- The result map
-
_unpublishRecursively
Unpublish the referenced contents recursively- Parameters:
programItem
- The content to unpublishresult
- the result object to fill during process
-
_doUnpublishWorkflowAction
protected org.ametys.odf.workflow.ODFWorkflowHelper.WorkflowActionStatus _doUnpublishWorkflowAction(WorkflowAwareContent content, int actionId) Unpublish a content- Parameters:
content
- The content to unpublishactionId
- The id of unpublish action- Returns:
- the workflow action status
-
isParentPublishable
true
if the parent is publishable- Parameters:
content
- the content- Returns:
true
if the parent is publishable
-