Class ItemProcessorPipeline

java.lang.Object
org.craftercms.core.processors.impl.ItemProcessorPipeline
All Implemented Interfaces:
ItemProcessor

public class ItemProcessorPipeline extends Object implements ItemProcessor
Pipeline of ItemProcessors. The output of each processor's ItemProcessor.process(org.craftercms.core.service.Context, org.craftercms.core.service.CachingOptions, Item) call is passed as input to the next processor.
Author:
Sumer Jabri, Alfonso Vásquez
  • Field Details

    • processors

      protected List<ItemProcessor> processors
      List of processors which conforms the pipeline
  • Constructor Details

    • ItemProcessorPipeline

      public ItemProcessorPipeline()
      Default no-args constructor.
    • ItemProcessorPipeline

      @ConstructorProperties("processors") public ItemProcessorPipeline(List<ItemProcessor> processors)
      Constructor that receives the list of processors which conform the pipeline.
    • ItemProcessorPipeline

      @ConstructorProperties("processors") public ItemProcessorPipeline(ItemProcessor... processors)
      Constructor that receives the list of processors (as an array) which conform the pipeline.
  • Method Details

    • setProcessors

      public void setProcessors(List<ItemProcessor> processors)
      Sets the list of processors.
    • addProcessor

      public void addProcessor(ItemProcessor processor)
      Adds a processor to the pipeline of processors.
    • addProcessors

      public void addProcessors(Collection<ItemProcessor> processors)
      Adds several processors to the pipeline of processors.
    • removeProcessor

      public boolean removeProcessor(ItemProcessor processor)
      Removes a processor from the pipeline of processors.
      Returns:
      true if the processor was removed
    • process

      public Item process(Context context, CachingOptions cachingOptions, Item item) throws ItemProcessingException
      Processes the given Item, by calling a pipeline of processors. The output of each processor's ItemProcessor.process(org.craftercms.core.service.Context, org.craftercms.core.service.CachingOptions, Item) call is passed as input to the next processor.
      Specified by:
      process in interface ItemProcessor
      Parameters:
      context - the current context
      cachingOptions - caching options in case you need access to items
      item - the item to process
      Returns:
      the result of the final processor in the pipeline.
      Throws:
      ItemProcessingException - if one of the processors in the pipeline couldn't process the item
    • equals

      public boolean equals(Object o)
      Returns true if the specified ItemProcessorPipeline's and this instance's list of processors are equal.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Returns the hash code for this instance, which is basically the hash code of the list of processors. As with any other ItemProcessor, this method is defined because any processor which is passed in the method call of a ContentStoreService can be used as part of a key for caching.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object