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
public class ODFWorkflowHelper extends AbstractLogEnabled implements Component, Serviceable
Helper for ODF contents on their workflow
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classODFWorkflowHelper.ContentTypeComparator
-
Field Summary
Fields Modifier and Type Field Description protected ContentWorkflowHelper_contentWorkflowHelperThe workflow helper for contentsprotected ODFHelper_odfHelperThe ODF helperprotected AmetysObjectResolver_resolverThe Ametys object resolverprotected WorkflowProvider_workflowProviderThe workflow providerprotected static StringCONTENTS_IN_ERROR_KEYConstant for storing the result map into the transient variables map.static StringROLEThe component role.protected static StringVALIDATED_CONTENTS_KEYConstant for storing the result map into the transient variables map.static intVALIDATED_STEP_IDThe validate step id
-
Constructor Summary
Constructors Constructor Description ODFWorkflowHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_checkReferencedContents(Collection<String> refContentIds, Set<Content> invalidatedContent)private void_checkValidateStep(WorkflowAwareContent content, Set<Content> invalidatedContents)protected Map<String,Object>_content2Json(Content content)Get the JSON representation of the contentprotected boolean_doValidateWorkflowAction(WorkflowAwareContent content, int actionId)Validate a contentprotected 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 contentsMap<String,Object>canValidContent(List<String> contentIds)Check if the contents can be validated.Map<String,Object>getGlobalValidationStatus(String contentId)Get the global validation status of a contentSet<Content>getInvalidatedContents(WorkflowAwareContent content)Get the invalidated contents referenced by a ODF contentMap<String,Object>globalValidate(List<String> contentIds)Global validation on a contents.booleanisInValidatedStep(WorkflowAwareContent content)Determines if a content is already in validated stepvoidservice(ServiceManager manager)-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
VALIDATED_STEP_ID
public static final int VALIDATED_STEP_ID
The validate step id- See Also:
- Constant Field Values
-
CONTENTS_IN_ERROR_KEY
protected static final String CONTENTS_IN_ERROR_KEY
Constant for storing the result map into the transient variables map.- See Also:
- Constant Field Values
-
VALIDATED_CONTENTS_KEY
protected static final String VALIDATED_CONTENTS_KEY
Constant for storing the result map into the transient variables map.- See Also:
- Constant Field Values
-
_resolver
protected AmetysObjectResolver _resolver
The Ametys object resolver
-
_workflowProvider
protected WorkflowProvider _workflowProvider
The workflow provider
-
_odfHelper
protected ODFHelper _odfHelper
The ODF helper
-
_contentWorkflowHelper
protected ContentWorkflowHelper _contentWorkflowHelper
The workflow helper for contents
-
-
Constructor Detail
-
ODFWorkflowHelper
public ODFWorkflowHelper()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
canValidContent
public Map<String,Object> canValidContent(List<String> contentIds)
Check if the contents can be validated. A content can be validated only if all its referenced contents are already validated.- Parameters:
contentIds- The id of contents to check- Returns:
- A map with success key to true if all contents can be validated. A map with the invalidated contents otherwise.
-
getGlobalValidationStatus
public Map<String,Object> getGlobalValidationStatus(String contentId)
Get the global validation status of a content- Parameters:
contentId- the id of content- Returns:
- the result
-
getInvalidatedContents
public Set<Content> getInvalidatedContents(WorkflowAwareContent content)
Get the invalidated contents referenced by a ODF content- Parameters:
content- the initial ODF content- Returns:
- the set of referenced invalidated contents
-
isInValidatedStep
public boolean isInValidatedStep(WorkflowAwareContent content)
Determines if a content is already in validated step- Parameters:
content- The content to test- Returns:
- true if the content is already validated
-
_checkValidateStep
private void _checkValidateStep(WorkflowAwareContent content, Set<Content> invalidatedContents)
-
_checkReferencedContents
private void _checkReferencedContents(Collection<String> refContentIds, Set<Content> invalidatedContent)
-
globalValidate
public Map<String,Object> globalValidate(List<String> contentIds)
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
protected Map<String,Object> _content2Json(Content content)
Get the JSON representation of the content- Parameters:
content- the content- Returns:
- the content properties
-
_validateRecursively
protected void _validateRecursively(WorkflowAwareContent content, Map<String,Object> result)
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 boolean _doValidateWorkflowAction(WorkflowAwareContent content, int actionId)
Validate a content- Parameters:
content- The content to validateactionId- The id of validate action- Returns:
- true if the validation success
-
-