Package org.ametys.cms.transformation
Class ConsistencyChecker
java.lang.Object
org.apache.avalon.framework.logger.AbstractLogEnabled
org.ametys.cms.transformation.ConsistencyChecker
- All Implemented Interfaces:
Component
,LogEnabled
,Serviceable
Consistency checker component.
Checks the state of the links extracted as outgoing references for a content.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
The state of the checkstatic final record
Represent the result of a consistency check -
Field Summary
Modifier and TypeFieldDescriptionprotected URIResolverExtensionPoint
The ametys uri resolverprotected HttpUrlUtils
The URL utilsprotected VersionsHandler
The version handlerstatic final String
Constants for the special external type for outgoing referencesstatic final String
Avalon role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ConsistencyChecker.CheckReport
_checkHTTPLink
(String linkValue, boolean shortTest) Test an http linkcheckConsistency
(String referenceType, String referenceValue, String contentId, String dataPath, boolean quickTest) Check the consistency of a referenceGet the label of a reference.void
service
(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
Avalon role -
CONSISTENCY_EXTERNAL_REFERENCE_TYPE
Constants for the special external type for outgoing references- See Also:
-
_uriResolverEP
The ametys uri resolver -
_versionsHandler
The version handler -
_urlUtils
The URL utils
-
-
Constructor Details
-
ConsistencyChecker
public ConsistencyChecker()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
checkConsistency
public ConsistencyChecker.CheckReport checkConsistency(String referenceType, String referenceValue, String contentId, String dataPath, boolean quickTest) Check the consistency of a reference- Parameters:
referenceType
- The type of the reference to test (can be 'attachment', 'explorer', 'metadata', '__external', etc...)referenceValue
- The value of the reference to testcontentId
- The id of the content containing the referencedataPath
- The path of the data containing the referencequickTest
- true to make a quick test, that means that long tests will return UNKNOWN immediately.- Returns:
- CHECK enum value
-
getLabel
public I18nizableText getLabel(String referenceType, String referenceValue, String contentId, String dataPath) Get the label of a reference.- Parameters:
referenceType
- The type of the reference to test (can be 'attachment', 'explorer', 'metadata', '__external', etc...)referenceValue
- The value of the reference to testcontentId
- The id of the content containing the referencedataPath
- The path of the data containing the reference- Returns:
- the element label.
-
_checkHTTPLink
Test an http link- Parameters:
linkValue
- The http url to testshortTest
- true to make a short test (with short timeout)- Returns:
- The state. UNKNOWN if test cannot be done fully
-