Class IndexableDataHolderHelper

java.lang.Object
org.ametys.cms.data.holder.impl.IndexableDataHolderHelper
All Implemented Interfaces:
Disposable, Component, Serviceable

public final class IndexableDataHolderHelper extends Object implements Component, Serviceable, Disposable
Helper for implementations of indexable data holder
  • Constructor Details

  • Method Details

    • service

      public void service(ServiceManager manager) throws ServiceException
      Specified by:
      service in interface Serviceable
      Throws:
      ServiceException
    • dispose

      public void dispose()
      Specified by:
      dispose in interface Disposable
    • indexData

      public static List<org.apache.solr.common.SolrInputDocument> indexData(IndexableDataHolder dataHolder, ViewItemAccessor viewItemAccessor, org.apache.solr.common.SolrInputDocument document, org.apache.solr.common.SolrInputDocument rootDocument, String solrFieldPrefix, CMSDataContext context) throws BadItemTypeException
      Indexes data of the given IndexableDataHolder
      Parameters:
      dataHolder - the IndexableDataHolder to index
      viewItemAccessor - the view item accessor to explore
      document - the solr document representing this IndexableDataHolder
      rootDocument - the solr document of the root object.
      solrFieldPrefix - the prefix of the solr field
      context - The context of the data to index
      Returns:
      additional solr documents that may have been created (ex: repeater entries)
      Throws:
      BadItemTypeException - if the saxed value's type does not matches the stored data
    • indexRepeaterData

      public static List<org.apache.solr.common.SolrInputDocument> indexRepeaterData(IndexableRepeater repeater, org.apache.solr.common.SolrInputDocument document, org.apache.solr.common.SolrInputDocument rootDocument, String solrFieldPrefix, CMSDataContext context) throws BadItemTypeException
      Indexes all data and properties of the given Repeater
      Parameters:
      repeater - the Repeater to index
      document - the solr document representing the Repeater
      rootDocument - the solr document of the root object.
      solrFieldPrefix - the prefix of the solr field
      context - The context of the data to index
      Returns:
      additional solr documents that may have been created (ex: repeater entries)
      Throws:
      BadItemTypeException - if the saxed value's type does not matches the stored data
    • getAmetysObjectFromContext

      Retrieves the IndexableAmetysObject from the given DataContext
      Parameters:
      context - the context containing the ametys object
      Returns:
      the ametys object, or null if there is no object id in the context
    • hasPropertyValue

      public static boolean hasPropertyValue(IndexableDataHolder dataHolder, Property property)
      Checks if the given property has a value on the root data holder of the given data holder
      Parameters:
      dataHolder - the data holder to check the property on
      property - the property to check
      Returns:
      true if the property has a value, false otherwise
    • getPropertyValue

      public static <T> T getPropertyValue(IndexableDataHolder dataHolder, Property property)
      Retrieves the value of the given property from the root data holder of the given data holder
      Type Parameters:
      T - the type of the property value
      Parameters:
      dataHolder - the data holder to get the property value from
      property - the property to get the value of
      Returns:
      the value of the property, or null if the property has no value
    • getSystemProperty

      Retrieves the SystemProperty corresponding to the given path, if it exists
      Parameters:
      dataHolder - the data holder to check the system property on
      path - the path of the system property, relative to the given data holder
      Returns:
      the SystemProperty corresponding to the given path, or an empty Optional if it does not exist
    • getPropertyAmetysObject

      Retrieves the ametys object containing the property at the given path
      Parameters:
      dataHolder - the data holder to check the property on
      dataPath - the path of the property
      Returns:
      the ametys object containing the property
      Throws:
      UndefinedItemPathException - if the given path does not represent a property