Package org.ametys.odf.workflow.task
Class AbstractOdfWorkflowTasksWithChangesComponent
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.cms.workflow.WorkflowTasksComponent
org.ametys.odf.workflow.task.AbstractOdfWorkflowTasksComponent
org.ametys.odf.workflow.task.AbstractOdfWorkflowTasksWithChangesComponent
- All Implemented Interfaces:
Component
,Configurable
,LogEnabled
,Serviceable
,ThreadSafe
- Direct Known Subclasses:
ProgramWorkflowTasksComponent
,SubProgramWorkflowTasksComponent
public abstract class AbstractOdfWorkflowTasksWithChangesComponent
extends AbstractOdfWorkflowTasksComponent
Override
AbstractOdfWorkflowTasksComponent
to add the change informations-
Nested Class Summary
Nested classes/interfaces inherited from class org.ametys.cms.workflow.WorkflowTasksComponent
WorkflowTasksComponent.LastModifiedDateComparator, WorkflowTasksComponent.Task, WorkflowTasksComponent.TaskStep
-
Field Summary
Modifier and TypeFieldDescriptionprotected CompareVersionHelper
The helper for comparing versionsprotected Map<String,
Collection<String>> The (defined in configuration) important attributes by taskprotected JSONUtils
The JSON utilMap of show changes indexed by task idMap of show important changes indexed by task idFields inherited from class org.ametys.odf.workflow.task.AbstractOdfWorkflowTasksComponent
_catalogsManager
Fields inherited from class org.ametys.cms.workflow.WorkflowTasksComponent
_allowUserQuery, _contentHelper, _contentTypesHelper, _cTypeEP, _languagesManager, _objectResolver, _rightManager, _tasks, _userManager, _workflowProvider, ROLE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
_configureAdditional
(WorkflowTasksComponent.Task task, Configuration taskConf) Configure additional configurationprotected void
_configureChanges
(Configuration taskConfiguration) Configures the changes to SAX_getAttributeChanges
(WorkflowTasksComponent.Task task, List<ContentComparatorChange> changes) Gets the attribute changes (as JSON) of the given content which changed since the last validationprotected <C extends Content & VersionAwareAmetysObject>
Optional<String>_getBaseVersion
(C versionable) Gets the base version of comparison.protected <C extends Content & VersionAwareAmetysObject>
List<ContentComparatorChange>_getChanges
(C content) Gets the changesprotected <C extends Content & VersionAwareAmetysObject>
String_getTargetVersion
(C versionable) Gets the source version of comparison.protected boolean
_isImportant
(WorkflowTasksComponent.Task task, ModelItem changedModelItem) Determines if a change is importantprotected void
_saxAdditionalData
(ContentHandler ch, Content content, WorkflowTasksComponent.Task task) SAX additional dataprotected void
_saxAttributeChanges
(ContentHandler ch, Content content, WorkflowTasksComponent.Task task, List<ContentComparatorChange> changes) SAX attributes of the given content which changed since the last validationvoid
service
(ServiceManager manager) boolean
Determines if changes have to be shown for the given taskboolean
Determines if important changes have to be shown for the given taskMethods inherited from class org.ametys.odf.workflow.task.AbstractOdfWorkflowTasksComponent
_getContentsAndExpressions, getContentTypeExpression
Methods inherited from class org.ametys.cms.workflow.WorkflowTasksComponent
_configureStep, _configureStepIds, _configureTasks, _getContents, _getCorrespondingWorkflows, _getTaskContents, _getTaskContents, _saxAdditionalAttributes, _saxAdditionalAttributes, _saxContent, _saxContentCurrentState, _saxTask, _testContent, allowUserQuery, configure, getContents, getTasks, toSAX, toSAX
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
_jsonUtils
The JSON util -
_compareVersionHelper
The helper for comparing versions -
_showChanges
Map of show changes indexed by task id -
_showImportantChanges
Map of show important changes indexed by task id -
_importantAttributes
The (defined in configuration) important attributes by task
-
-
Constructor Details
-
AbstractOdfWorkflowTasksWithChangesComponent
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Overrides:
service
in classAbstractOdfWorkflowTasksComponent
- Throws:
ServiceException
-
_configureAdditional
protected void _configureAdditional(WorkflowTasksComponent.Task task, Configuration taskConf) throws ConfigurationException Description copied from class:WorkflowTasksComponent
Configure additional configuration- Overrides:
_configureAdditional
in classWorkflowTasksComponent
- Parameters:
task
- task the current tasktaskConf
- the task configuration.- Throws:
ConfigurationException
- if a configuration error occurs.
-
showChanges
Determines if changes have to be shown for the given task- Parameters:
task
- the task- Returns:
true
if changes are configured to be SAXed
-
showImportantChanges
Determines if important changes have to be shown for the given task- Parameters:
task
- the task- Returns:
true
if changes are configured to be SAXed
-
_configureChanges
Configures the changes to SAX- Parameters:
taskConfiguration
- The task configuration- Throws:
ConfigurationException
- If the configuration is invalid.
-
_saxAdditionalData
protected void _saxAdditionalData(ContentHandler ch, Content content, WorkflowTasksComponent.Task task) throws SAXException Description copied from class:WorkflowTasksComponent
SAX additional data- Overrides:
_saxAdditionalData
in classAbstractOdfWorkflowTasksComponent
- Parameters:
ch
- the content handler.content
- the contenttask
- the task- Throws:
SAXException
- If an error occurred
-
_getChanges
protected <C extends Content & VersionAwareAmetysObject> List<ContentComparatorChange> _getChanges(C content) throws AmetysRepositoryException, IOException Gets the changes- Type Parameters:
C
- The type of theVersionAwareAmetysObject
Content
- Parameters:
content
- The content- Returns:
- The changes
- Throws:
AmetysRepositoryException
- repository exceptionIOException
- IO exception
-
_getTargetVersion
Gets the source version of comparison. By default, it is the current one.- Type Parameters:
C
- The type of theVersionAwareAmetysObject
Content
- Parameters:
versionable
- TheContent
- Returns:
- the source version
-
_getBaseVersion
protected <C extends Content & VersionAwareAmetysObject> Optional<String> _getBaseVersion(C versionable) Gets the base version of comparison. By default, it is the last validated one.- Type Parameters:
C
- The type of theVersionAwareAmetysObject
Content
- Parameters:
versionable
- TheContent
- Returns:
- the target version
-
_saxAttributeChanges
protected void _saxAttributeChanges(ContentHandler ch, Content content, WorkflowTasksComponent.Task task, List<ContentComparatorChange> changes) throws SAXException SAX attributes of the given content which changed since the last validation- Parameters:
ch
- The content handlercontent
- The contenttask
- the current taskchanges
- The changes- Throws:
SAXException
- If an error occurred
-
_getAttributeChanges
protected List<Map<String,Object>> _getAttributeChanges(WorkflowTasksComponent.Task task, List<ContentComparatorChange> changes) Gets the attribute changes (as JSON) of the given content which changed since the last validation- Parameters:
task
- the current taskchanges
- The changes- Returns:
- The changes as JSON
-
_isImportant
Determines if a change is important- Parameters:
task
- the current taskchangedModelItem
- The changedModelItem
- Returns:
true
if the change is important
-