Package org.ametys.cms.data.holder.impl
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondataToJSON(ModelAwareDataHolder dataHolder, ViewItemAccessor viewItemAccessor, DataContext context, boolean isEdition) Convert the data in the given view of the givenDataHolderdataToMap(ModelAwareDataHolder dataHolder, ViewItemAccessor viewItemAccessor, DataContext context) Returns all data of the given DataHolder as a typed-values Map.static voiddataToSAX(ModelAwareDataHolder dataHolder, ContentHandler contentHandler, ViewItemAccessor viewItemAccessor, DataContext context, boolean isEdition) Generates SAX events for the data in the given view in the givenDataHoldervoiddispose()getAmetysObjectFromContext(DataContext context) Retrieves theModelAwareDataAwareAmetysObjectfrom the givenDataContextstatic SystemPropertyExtensionPointRetrieves theSystemPropertyExtensionPointfor content system propertiesstatic 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, IndexableDataContext context) Indexes data of the givenIndexableDataHoldervoidservice(ServiceManager manager)
-
Constructor Details
-
IndexableDataHolderHelper
public IndexableDataHolderHelper()
-
-
Method Details
-
service
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
dispose
- Specified by:
disposein interfaceDisposable
-
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, IndexableDataContext context) throws BadItemTypeException Indexes data of the givenIndexableDataHolder- Parameters:
dataHolder- theIndexableDataHolderto indexviewItemAccessor- the view item accessor to exploredocument- the solr document representing thisIndexableDataHolderrootDocument- the solr document of the root object.solrFieldPrefix- the prefix of the solr fieldcontext- 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
-
dataToSAX
public static void dataToSAX(ModelAwareDataHolder dataHolder, ContentHandler contentHandler, ViewItemAccessor viewItemAccessor, DataContext context, boolean isEdition) throws SAXException, BadItemTypeException, UndefinedItemPathException Generates SAX events for the data in the given view in the givenDataHolder- Parameters:
dataHolder- theModelAwareDataHolderto SAXcontentHandler- theContentHandlerthat will receive the SAX eventsviewItemAccessor- theViewItemAccessorreferencing the items for which generate SAX eventscontext- The context of the data to SAXisEdition-trueif SAX events are generated in edition mode,falseotherwise- Throws:
SAXException- if an error occurs during the SAX events generationBadItemTypeException- if the saxed value's type does not matches the stored dataUndefinedItemPathException- if an item in the view is not part of the model
-
dataToJSON
public static Map<String,Object> dataToJSON(ModelAwareDataHolder dataHolder, ViewItemAccessor viewItemAccessor, DataContext context, boolean isEdition) throws BadItemTypeException, UndefinedItemPathException Convert the data in the given view of the givenDataHolder- Parameters:
dataHolder- theModelAwareDataHoldercontaining the data to convertviewItemAccessor- theViewItemAccessorreferencing the items to convertcontext- The context of the data to convertisEdition-trueto convert in edition mode,falseotherwise- Returns:
- The data of the given view as JSON
- Throws:
BadItemTypeException- if the value's type does not matches the stored dataUndefinedItemPathException- if an item in the view is not part of the model
-
dataToMap
public static Map<String,Object> dataToMap(ModelAwareDataHolder dataHolder, ViewItemAccessor viewItemAccessor, DataContext context) Returns all data of the given DataHolder as a typed-values Map.- Parameters:
dataHolder- the DataHolder to exportviewItemAccessor- theViewItemAccessorreferencing the items to include in the resulting Mapcontext- The context of the data- Returns:
- a Map containing all data.
-
getAmetysObjectFromContext
Retrieves theModelAwareDataAwareAmetysObjectfrom the givenDataContext- Parameters:
context- the context containing the ametys object- Returns:
- the ametys object, or
nullif there is no object id in the context
-
getContentSystemPropertyExtensionPoint
Retrieves theSystemPropertyExtensionPointfor content system properties- Returns:
- the
SystemPropertyExtensionPointfor content system properties
-