Class AbstractProcessTemplateCheck

    • Field Detail

      • logger

        protected final Logger logger
        My logger.
    • Constructor Detail

      • AbstractProcessTemplateCheck

        protected AbstractProcessTemplateCheck​(String id)
        Default constructor.
        Parameters:
        id -
    • Method Detail

      • performCheck

        public final boolean performCheck​(Template template,
                                          NodeRelations relations,
                                          CheckReport checkReport)
        Description copied from interface: ProcessTemplateCheck
        Performs the check on the given template.

        Any problems which will be found during the check, will be reported to the checkReport, if the parameter is not null.

        Specified by:
        performCheck in interface ProcessTemplateCheck
        Parameters:
        template - The template to be checked.
        relations - The node relation cache to use.
        checkReport - The check report for found problems (may be null). If this is a LocalisedCheckReport, the check should respect and provide all preferred locale or corresponding fallbacks.
        Returns:
        True, if the check was OK.
      • performCheckSpi

        protected abstract void performCheckSpi​(Template template,
                                                NodeRelations relations,
                                                CheckReport checkReport)
        This is the method that must be implemented in subclasses and its purpose is to perform all required checks. The other methods of this class can help you with that.
        Parameters:
        template -
        relations -
        checkReport -
      • addReportEntry

        protected final void addReportEntry​(CheckReport.ResultType resultType,
                                            Object[] affectedElements,
                                            String msgKey,
                                            LocalisedString... args)
        Adds a localised entry to our check report (if it isn't null) and updates result. Note, that the objects passed as affectedElements must be supported, cf. implementation of getURIsForElement(URI, Object[]). The message for the report entry will be retrieved from GlobalMessages using the designated message key.
        The localisation for the root locale will be used for logging.
        Parameters:
        resultType - The type of the report entry.
        affectedElements - The affected elements that caused the report entry.
        msgKey - The message key with which to retrieve the localisation from the resource bundles.
        args - Optional arguments passed to the corresponding localised message using String.format(Locale, String, Object...).