Class ContentConsistencyManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.cms.content.consistency.ContentConsistencyManager
- All Implemented Interfaces:
LogEnabled,Initializable,Component,Contextualizable,Serviceable
- Direct Known Subclasses:
ContentConsistencyManager
public class ContentConsistencyManager
extends AbstractLogEnabled
implements Initializable, Contextualizable, Serviceable, Component
Manage all operation related to checking the consistency of a content
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRecord holding the results of a consistency checks on multiple contentsstatic classExpression which tests if contents have consistency informations. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConsistencyCheckerThe consistency checkerprotected AmetysObjectResolverThe ametys object resolver.static final StringThe avalon role -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription_checkContents(AmetysObjectIterable<Content> contents, SimpleProgressionTracker progressionTracker) Check all the content provided by the iterable for broken links.protected AmetysObjectIterable<Content>_getContents(Expression filterExpression) Get the contents with inconsistency information.checkAllContents(ContainerProgressionTracker progressionTracker) Check all contents to see if there references are consistent.voidcontextualize(Context context) voidprotected voidremoveOutdatedResult(ZonedDateTime date, Expression filterExpression, SimpleProgressionTracker progressionTracker) Remove results older than a given dateresultToJSON(ContentConsistencyResult result, List<Map<String, Object>> columns) Serialize a content consistency result as JSONvoidservice(ServiceManager manager) protected ContentConsistencyResultstoreResult(WorkflowAwareContent content, int successCount, int unknownCount, int unauthorizedCount, int notFoundCount, int serverErrorCount) Store the result of the consistency check done on the contentMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The avalon role -
_resolver
The ametys object resolver. -
_consistencyChecker
The consistency checker
-
-
Constructor Details
-
ContentConsistencyManager
public ContentConsistencyManager()
-
-
Method Details
-
contextualize
- Specified by:
contextualizein interfaceContextualizable- Throws:
ContextException
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
initialize
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
checkAllContents
public ContentConsistencyManager.ConsistenciesReport checkAllContents(ContainerProgressionTracker progressionTracker) Check all contents to see if there references are consistent. All result will also be stored in the consistency result database table for later access.- Parameters:
progressionTracker- the progression tracker for consistensy check- Returns:
- record describing the results of the checks
-
removeOutdatedResult
protected void removeOutdatedResult(ZonedDateTime date, Expression filterExpression, SimpleProgressionTracker progressionTracker) Remove results older than a given date- Parameters:
date- the thresholdfilterExpression- an expression to filter the content to consider, null to consider all contentsprogressionTracker- the progression tracker for the task
-
_checkContents
protected ContentConsistencyManager.ConsistenciesReport _checkContents(AmetysObjectIterable<Content> contents, SimpleProgressionTracker progressionTracker) Check all the content provided by the iterable for broken links. This method will actually provideCallableto anExecutorthat parallelize the checks.- Parameters:
contents- an iterable of contents to checkprogressionTracker- progression tracker for ckecking conistency in contents- Returns:
- record describing the results of the checks
-
storeResult
protected ContentConsistencyResult storeResult(WorkflowAwareContent content, int successCount, int unknownCount, int unauthorizedCount, int notFoundCount, int serverErrorCount) Store the result of the consistency check done on the content- Parameters:
content- the content checkedsuccessCount- the number of successunknownCount- the number of unknownunauthorizedCount- the number of unauthorizednotFoundCount- the number of not foundserverErrorCount- the number of server error- Returns:
- the result
-
_getContents
Get the contents with inconsistency information.- Parameters:
filterExpression- an expression to filter content to check, or null to check all contents- Returns:
- an iterator on contents.
-
resultToJSON
public Map<String,Object> resultToJSON(ContentConsistencyResult result, List<Map<String, Object>> columns) Serialize a content consistency result as JSON- Parameters:
result- the results to serializecolumns- the list of columns to use as "view"- Returns:
- a JSON representation of the result
-