Interface ModelAwareRepeater
- All Superinterfaces:
Repeater
- All Known Subinterfaces:
IndexableRepeater
,ModifiableIndexableRepeater
,ModifiableModelAwareRepeater
- All Known Implementing Classes:
DefaultModelAwareRepeater
,DefaultModifiableModelAwareRepeater
Class for model aware repeaters
Here is the format of generated SAX events for data in a repeater:
<entry name="<entry position>">
<sax events for data1 in the current entry>
<sax events for data2 in the current entry>
...
<\entry>
...
Here is the format of JSON object for data in a repeater:
{
"entryCount" : <size>,
"entries" : [
{
"position" : <entry position>,
"values" : {
"<data1>" : <value of data1 in current entry>
"<data2>" : <value of data2 in current entry>
...
}
},
...
]
}
-
Method Summary
Modifier and TypeMethodDescriptionConvert into a JSON object the data in the model of the currentRepeater
dataToJSON
(DataContext context) Convert into a JSON object the data in the model of the currentRepeater
dataToJSON
(ViewItemAccessor viewItemAccessor) Convert into a JSON object the data in the given view of the currentRepeater
dataToJSON
(ViewItemAccessor viewItemAccessor, DataContext context) Convert into a JSON object the data in the given view of the currentRepeater
default void
dataToSAX
(ContentHandler contentHandler) Generates SAX events for the data in the model of the currentDataHolder
void
dataToSAX
(ContentHandler contentHandler, DataContext context) Generates SAX events for the data in the model of the currentDataHolder
default void
dataToSAX
(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor) Generates SAX events for the data in the given view in the currentRepeater
void
dataToSAX
(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor, DataContext context) Generates SAX events for the data in the given view in the currentRepeater
List<? extends ModelAwareRepeaterEntry>
Retrieves the repeater entries, sorted by positiongetEntry
(int position) Retrieves the repeater entry at the given position.getModel()
Retrieves the repeater's modelRetrieves the parent of the currentRepeater
Retrieves the rootDataHolder
of the current repeaterMethods inherited from interface org.ametys.plugins.repository.data.holder.group.Repeater
copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX, getRepositoryData, getSize, hasEntry
-
Method Details
-
getEntries
List<? extends ModelAwareRepeaterEntry> getEntries()Description copied from interface:Repeater
Retrieves the repeater entries, sorted by position- Specified by:
getEntries
in interfaceRepeater
- Returns:
- the repeater entries
-
getEntry
Description copied from interface:Repeater
Retrieves the repeater entry at the given position. The position starts at index 1. The position can be an integer between 1 and the repeater size to get an entry from the beginning Or the position can an integer between 0 and - the repeater size to get an entry from the end (0 means at the end, -1 means before the last one and so on) -
dataToSAX
Generates SAX events for the data in the model of the currentDataHolder
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX events- Throws:
SAXException
- if an error occurs during the SAX events generationBadItemTypeException
- if the saxed value's type does not matches the stored data
-
dataToSAX
void dataToSAX(ContentHandler contentHandler, DataContext context) throws SAXException, BadItemTypeException Generates SAX events for the data in the model of the currentDataHolder
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventscontext
- The context of the data to SAX- Throws:
SAXException
- if an error occurs during the SAX events generationBadItemTypeException
- if the saxed value's type does not matches the stored data
-
dataToSAX
default void dataToSAX(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor) throws SAXException, BadItemTypeException Generates SAX events for the data in the given view in the currentRepeater
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventsviewItemAccessor
- theViewItemAccessor
referencing the items for which generate SAX events- Throws:
SAXException
- if an error occurs during the SAX events generationBadItemTypeException
- if the saxed value's type does not matches the stored data
-
dataToSAX
void dataToSAX(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor, DataContext context) throws SAXException, BadItemTypeException Generates SAX events for the data in the given view in the currentRepeater
- Parameters:
contentHandler
- theContentHandler
that will receive the SAX eventsviewItemAccessor
- theViewItemAccessor
referencing the items for which generate SAX eventscontext
- The context of the data to SAX- Throws:
SAXException
- if an error occurs during the SAX events generationBadItemTypeException
- if the saxed value's type does not matches the stored data
-
dataToJSON
Convert into a JSON object the data in the model of the currentRepeater
- Returns:
- The data of the current
DataHolder
as JSON - Throws:
BadItemTypeException
- if the value's type does not matches the stored data
-
dataToJSON
Convert into a JSON object the data in the model of the currentRepeater
- Parameters:
context
- The context of the data to convert- Returns:
- The data of the current
DataHolder
as JSON - Throws:
BadItemTypeException
- if the value's type does not matches the stored data
-
dataToJSON
default Map<String,Object> dataToJSON(ViewItemAccessor viewItemAccessor) throws BadItemTypeException Convert into a JSON object the data in the given view of the currentRepeater
- Parameters:
viewItemAccessor
- theViewItemAccessor
referencing the items to convert- Returns:
- The data of the given view as JSON
- Throws:
BadItemTypeException
- if the value's type does not matches the stored data
-
dataToJSON
Map<String,Object> dataToJSON(ViewItemAccessor viewItemAccessor, DataContext context) throws BadItemTypeException Convert into a JSON object the data in the given view of the currentRepeater
- Parameters:
viewItemAccessor
- theViewItemAccessor
referencing the items to convertcontext
- The context of the data to convert- Returns:
- The data of the given view as JSON
- Throws:
BadItemTypeException
- if the value's type does not matches the stored data
-
getParentDataHolder
Description copied from interface:Repeater
Retrieves the parent of the currentRepeater
- Specified by:
getParentDataHolder
in interfaceRepeater
- Returns:
- the parent of the current
Repeater
-
getRootDataHolder
Description copied from interface:Repeater
Retrieves the rootDataHolder
of the current repeater- Specified by:
getRootDataHolder
in interfaceRepeater
- Returns:
- the root
DataHolder
-
getModel
Retrieves the repeater's model- Returns:
- the repeater's model
-