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
dataToJSONForEdition
(ViewItemAccessor viewItemAccessor, DataContext context) Convert into a JSON object the data in the given view in edition mode 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
void
dataToSAXForEdition
(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor, DataContext context) Generates SAX events for the data in the given view in edition mode in the currentRepeater
default Collection<ModelItem>
getDifferences
(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues) Get the collection of model items where there are differences between the given values and the repeater's entriesgetDifferences
(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues, SynchronizationContext context) Get the collection of model items where there are differences between the given values and the repeater's entriesList<? 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 repeaterdefault boolean
hasDifferences
(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues) Check if there are differences between the given values and the repeater's entriesboolean
hasDifferences
(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues, SynchronizationContext context) Check if there are differences between the given values and the repeater's entriesMethods inherited from interface org.ametys.plugins.repository.data.holder.group.Repeater
copyTo, copyTo, dataToJSON, dataToJSON, dataToSAX, dataToSAX, getRepositoryData, getSize, hasEntry, hasToMoveEntries
-
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
-
dataToSAXForEdition
void dataToSAXForEdition(ContentHandler contentHandler, ViewItemAccessor viewItemAccessor, DataContext context) throws SAXException, BadItemTypeException Generates SAX events for the data in the given view in edition mode 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
-
dataToJSONForEdition
Map<String,Object> dataToJSONForEdition(ViewItemAccessor viewItemAccessor, DataContext context) throws BadItemTypeException Convert into a JSON object the data in the given view in edition mode 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
-
hasDifferences
default boolean hasDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues) throws UndefinedItemPathException, BadItemTypeException Check if there are differences between the given values and the repeater's entries- Parameters:
viewItemAccessor
- TheViewItemAccessor
for all items to checkrepeaterValues
- the values of the repeater to check- Returns:
true
if there are differences,false
otherwise- Throws:
UndefinedItemPathException
- if an entry's key refers to a data that is not defined by the modelBadItemTypeException
- if the type defined by the model of one of the entry's key doesn't match the corresponding value
-
hasDifferences
boolean hasDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues, SynchronizationContext context) throws UndefinedItemPathException, BadItemTypeException Check if there are differences between the given values and the repeater's entries- Parameters:
viewItemAccessor
- TheViewItemAccessor
for all items to checkrepeaterValues
- the values of the repeater to checkcontext
- the context of the synchronization- Returns:
true
if there are differences,false
otherwise- Throws:
UndefinedItemPathException
- if an entry's key refers to a data that is not defined by the modelBadItemTypeException
- if the type defined by the model of one of the entry's key doesn't match the corresponding value
-
getDifferences
default Collection<ModelItem> getDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues) throws UndefinedItemPathException, BadItemTypeException Get the collection of model items where there are differences between the given values and the repeater's entries- Parameters:
viewItemAccessor
- TheViewItemAccessor
for all items to checkrepeaterValues
- the values of the repeater to check- Returns:
- a collection of model items with differences
- Throws:
UndefinedItemPathException
- if an entry's key refers to a data that is not defined by the modelBadItemTypeException
- if the type defined by the model of one of the entry's key doesn't match the corresponding value
-
getDifferences
Collection<ModelItem> getDifferences(ViewItemAccessor viewItemAccessor, SynchronizableRepeater repeaterValues, SynchronizationContext context) throws UndefinedItemPathException, BadItemTypeException Get the collection of model items where there are differences between the given values and the repeater's entries- Parameters:
viewItemAccessor
- TheViewItemAccessor
for all items to checkrepeaterValues
- the values of the repeater to checkcontext
- the context of the synchronization- Returns:
- a collection of model items with differences
- Throws:
UndefinedItemPathException
- if a key in the given Map refers to a data that is not defined by the modelBadItemTypeException
- if the type defined by the model of one of the Map's key doesn't match the corresponding value
-
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
-