Class MetaDataProcessorResolver

java.lang.Object
org.craftercms.core.processors.impl.resolvers.MetaDataProcessorResolver
All Implemented Interfaces:
ItemProcessorResolver

public class MetaDataProcessorResolver extends Object implements ItemProcessorResolver
ItemProcessorResolver that searches the item's descriptor for a processor element that defines the name of the processor
Author:
Alfonso Vásquez
  • Field Details

    • processorElementXPathQuery

      protected String processorElementXPathQuery
      The XPath query for the processor element that defines the processor to use.
    • elementValueToProcessorMappings

      protected Map<String,ItemProcessor> elementValueToProcessorMappings
      Mappings of processor element values to processor names.
  • Constructor Details

    • MetaDataProcessorResolver

      public MetaDataProcessorResolver()
  • Method Details

    • setProcessorElementXPathQuery

      public void setProcessorElementXPathQuery(String processorElementXPathQuery)
      Sets the XPath query for the processor element that defines the processor to use.
    • setElementValueToProcessorMappings

      public void setElementValueToProcessorMappings(Map<String,ItemProcessor> elementValueToProcessorMappings)
      Sets the mappings of processor element values to processor names.
    • getProcessor

      public ItemProcessor getProcessor(Item item) throws XmlException
      Looks for the processor element (by querying it with the processorElementXPathQuery) in the item's descriptor. If the element is found, the element value is mapped to a processor and that processor is returned.
      Specified by:
      getProcessor in interface ItemProcessorResolver
      Throws:
      XmlException - if the element value doesn't refer to an existing processor