Package org.opencms.xml.content
Class CmsXmlContentErrorHandler
- java.lang.Object
-
- org.opencms.xml.content.CmsXmlContentErrorHandler
-
public class CmsXmlContentErrorHandler extends java.lang.Object
Handler for issues found during XML content validation.- Since:
- 6.0.0
-
-
Constructor Summary
Constructors Constructor Description CmsXmlContentErrorHandler()
Create a new instance of the validation handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addError(I_CmsXmlContentValue value, java.lang.String message)
Adds an error message to the internal list of errors, also raised the "has errors" flag.void
addWarning(I_CmsXmlContentValue value, java.lang.String message)
Adds an warning message to the internal list of errors, also raised the "has warning" flag.java.util.Map<java.util.Locale,java.util.Map<java.lang.String,java.lang.String>>
getErrors()
Returns the map of validation errors.java.util.Map<java.lang.String,java.lang.String>
getErrors(java.util.Locale locale)
Returns the Map of errors for the selected locale.java.util.Map<java.util.Locale,java.util.Map<java.lang.String,java.lang.String>>
getWarnings()
Returns the map of validation warnings.java.util.Map<java.lang.String,java.lang.String>
getWarnings(java.util.Locale locale)
Returns the Map of warnings for the selected locale.boolean
hasErrors()
Returns true if the validated content had errors.boolean
hasErrors(java.util.Locale locale)
Returnstrue
if there is at last one error in the selected locale.boolean
hasWarnings()
Returns true if the validated content has warnings.boolean
hasWarnings(java.util.Locale locale)
Returnstrue
if there is at last one warning in the selected locale.
-
-
-
Constructor Detail
-
CmsXmlContentErrorHandler
public CmsXmlContentErrorHandler()
Create a new instance of the validation handler.
-
-
Method Detail
-
addError
public void addError(I_CmsXmlContentValue value, java.lang.String message)
Adds an error message to the internal list of errors, also raised the "has errors" flag.- Parameters:
value
- the value that contains the errormessage
- the error message to add
-
addWarning
public void addWarning(I_CmsXmlContentValue value, java.lang.String message)
Adds an warning message to the internal list of errors, also raised the "has warning" flag.- Parameters:
value
- the value that contians the warningmessage
- the warning message to add
-
getErrors
public java.util.Map<java.util.Locale,java.util.Map<java.lang.String,java.lang.String>> getErrors()
Returns the map of validation errors.The map contains further maps. The key of the "first" map is the
Locale
of the language where issues where found. The key of the "second" map is a mapping from the element node name obtained withI_CmsXmlContentValue.getPath()
to the error message which is a String.- Returns:
- the map of validation errors
-
getErrors
public java.util.Map<java.lang.String,java.lang.String> getErrors(java.util.Locale locale)
Returns the Map of errors for the selected locale.- Parameters:
locale
- the locale to get the errors for- Returns:
- the Map of errors for the selected locale
-
getWarnings
public java.util.Map<java.util.Locale,java.util.Map<java.lang.String,java.lang.String>> getWarnings()
Returns the map of validation warnings.The map contains further maps. The key of the "first" map is the
Locale
of the language where issues where found. The key of the "second" map is a mapping from the element node name obtained withI_CmsXmlContentValue.getPath()
to the error message which is a String.- Returns:
- the map of validation warnings
-
getWarnings
public java.util.Map<java.lang.String,java.lang.String> getWarnings(java.util.Locale locale)
Returns the Map of warnings for the selected locale.- Parameters:
locale
- the locale to get the warnings for- Returns:
- the Map of warnings for the selected locale
-
hasErrors
public boolean hasErrors()
Returns true if the validated content had errors.- Returns:
- true if the validated content had errors
-
hasErrors
public boolean hasErrors(java.util.Locale locale)
Returnstrue
if there is at last one error in the selected locale.- Parameters:
locale
- the locale to check- Returns:
true
if there is at last one error in the selected locale
-
hasWarnings
public boolean hasWarnings()
Returns true if the validated content has warnings.- Returns:
- true if the validated content had warnings
-
hasWarnings
public boolean hasWarnings(java.util.Locale locale)
Returnstrue
if there is at last one warning in the selected locale.- Parameters:
locale
- the locale to check- Returns:
true
if there is at last one warning in the selected locale
-
-