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
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentWorkflowHelper
_contentWorkflowHelper
The workflow helper for contentsprotected ODFHelper
_odfHelper
The ODF helperprotected AmetysObjectResolver
_resolver
The Ametys object resolverprotected WorkflowProvider
_workflowProvider
The workflow providerprotected static String
CONTENTS_IN_ERROR_KEY
Constant for storing the result map into the transient variables map.static String
ROLE
The component role.static int
VALIDATE_ACTION_ID
The action id of global validationprotected static String
VALIDATED_CONTENTS_KEY
Constant for storing the result map into the transient variables map.static int
VALIDATED_STEP_ID
The validate step id
-
Constructor Summary
Constructors Constructor Description ODFWorkflowHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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>
checkReferences(List<String> contentIds)
Check if the contents has referenced contents that are not already validated (children excluded)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.boolean
isInValidatedStep(WorkflowAwareContent content)
Determines if a content is already in validated stepvoid
service(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
-
VALIDATE_ACTION_ID
public static final int VALIDATE_ACTION_ID
The action id of global validation- 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:
service
in interfaceServiceable
- Throws:
ServiceException
-
checkReferences
public Map<String,Object> checkReferences(List<String> contentIds)
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
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
-
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
-
-