Class DefaultModifiableIndexableRepeater
java.lang.Object
org.ametys.plugins.repository.data.holder.group.impl.DefaultRepeater
org.ametys.plugins.repository.data.holder.group.impl.DefaultModifiableRepeater
org.ametys.cms.data.holder.group.impl.DefaultModifiableIndexableRepeater
- All Implemented Interfaces:
IndexableRepeater,ModifiableIndexableRepeater,ModifiableRepeater,Repeater
public class DefaultModifiableIndexableRepeater
extends DefaultModifiableRepeater
implements ModifiableIndexableRepeater
Class for modifiable indexable repeaters
-
Field Summary
Fields inherited from class org.ametys.plugins.repository.data.holder.group.impl.DefaultModifiableRepeater
_lockableAmetysObject, _modifiableParent, _modifiableRepositoryData, _modifiableRootFields inherited from class org.ametys.plugins.repository.data.holder.group.impl.DefaultRepeater
_definition, _parent, _repositoryData, _root -
Constructor Summary
ConstructorsConstructorDescriptionDefaultModifiableIndexableRepeater(ModifiableRepositoryData repositoryData, RepeaterDefinition definition, Optional<LockableAmetysObject> lockableAmetysObject, ModifiableIndexableDataHolder parent, ModifiableIndexableDataHolder root) Creates a default modifiable indexable repeater -
Method Summary
Modifier and TypeMethodDescriptionaddEntry()Creates a Repeater entry at the last position.addEntry(int position) Creates a Repeater entry at the given position.protected ModifiableIndexableRepeaterEntrycreateRepeaterEntryInstance(RepositoryData entryRepositoryData) Creates an instance ofRepeaterEntryto useList<? extends ModifiableIndexableRepeaterEntry> Retrieves the repeater entries, sorted by positiongetEntry(int position) Retrieves the repeater entry at the given position.Retrieves the parent of the currentRepeaterRetrieves the rootDataHolderof the current repeaterList<org.apache.solr.common.SolrInputDocument> indexData(org.apache.solr.common.SolrInputDocument document, org.apache.solr.common.SolrInputDocument rootDocument, String solrFieldPrefix, CMSDataContext context) Indexes all data and properties of thisRepeaterMethods inherited from class org.ametys.plugins.repository.data.holder.group.impl.DefaultModifiableRepeater
getRepositoryData, moveEntries, removeEntries, removeEntry, synchronizeValuesMethods inherited from class org.ametys.plugins.repository.data.holder.group.impl.DefaultRepeater
copyTo, dataToJSON, dataToJSON, dataToJSON, dataToJSON, dataToJSONForEdition, dataToSAX, dataToSAX, dataToSAX, dataToSAXForEdition, getDifferences, getDifferencesInAppendMode, getDifferencesInReplaceAllMode, getDifferencesInReplaceMode, getEntryAttributes, getModel, getSize, hasDifferences, hasDifferencesInAppendMode, hasDifferencesInReplaceAllMode, hasDifferencesInReplaceMode, hasEntry, hasToMoveEntriesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.ametys.cms.data.holder.group.IndexableRepeater
indexDataMethods inherited from interface org.ametys.plugins.repository.data.holder.group.ModifiableRepeater
getRepositoryData, moveEntries, removeEntries, removeEntry, synchronizeValues, synchronizeValuesMethods inherited from interface org.ametys.plugins.repository.data.holder.group.Repeater
copyTo, copyTo, dataToJSON, dataToJSON, dataToJSON, dataToJSON, dataToJSON, dataToJSON, dataToJSONForEdition, dataToSAX, dataToSAX, dataToSAX, dataToSAX, dataToSAX, dataToSAX, dataToSAXForEdition, getDifferences, getDifferences, getModel, getSize, hasDifferences, hasDifferences, hasEntry, hasToMoveEntries
-
Constructor Details
-
DefaultModifiableIndexableRepeater
public DefaultModifiableIndexableRepeater(ModifiableRepositoryData repositoryData, RepeaterDefinition definition, Optional<LockableAmetysObject> lockableAmetysObject, ModifiableIndexableDataHolder parent, ModifiableIndexableDataHolder root) Creates a default modifiable indexable repeater- Parameters:
repositoryData- the repository data of the repeaterdefinition- the definition of the repeaterlockableAmetysObject- the ametys object that can be locked on data modificationparent- the parent of the created repeaterroot- the rootModifiableIndexableDataHolder
-
-
Method Details
-
getEntries
Description copied from interface:RepeaterRetrieves the repeater entries, sorted by position- Specified by:
getEntriesin interfaceIndexableRepeater- Specified by:
getEntriesin interfaceModifiableIndexableRepeater- Specified by:
getEntriesin interfaceModifiableRepeater- Specified by:
getEntriesin interfaceRepeater- Overrides:
getEntriesin classDefaultModifiableRepeater- Returns:
- the repeater entries
-
getEntry
Description copied from interface:RepeaterRetrieves 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)- Specified by:
getEntryin interfaceIndexableRepeater- Specified by:
getEntryin interfaceModifiableIndexableRepeater- Specified by:
getEntryin interfaceModifiableRepeater- Specified by:
getEntryin interfaceRepeater- Overrides:
getEntryin classDefaultModifiableRepeater- Parameters:
position- the position of the entry to retrieve- Returns:
- the repeater entry,
nullif there is no entry at this position
-
addEntry
Description copied from interface:ModifiableRepeaterCreates a Repeater entry at the last position.- Specified by:
addEntryin interfaceModifiableIndexableRepeater- Specified by:
addEntryin interfaceModifiableRepeater- Overrides:
addEntryin classDefaultModifiableRepeater- Returns:
- the created entry
-
addEntry
Description copied from interface:ModifiableRepeaterCreates a Repeater entry at the given position. The position starts at index 1. The position can be an integer between 1 and the repeater size + 1 to insert an entry from the beginning Or the position can an integer between 0 and - the repeater size to insert an entry from the end (0 means at the end, -1 means before the last one and so on)- Specified by:
addEntryin interfaceModifiableIndexableRepeater- Specified by:
addEntryin interfaceModifiableRepeater- Overrides:
addEntryin classDefaultModifiableRepeater- Parameters:
position- The position of the new entry- Returns:
- the created entry
- Throws:
IllegalArgumentException- if the position is not between the negative and positive repeater size
-
createRepeaterEntryInstance
protected ModifiableIndexableRepeaterEntry createRepeaterEntryInstance(RepositoryData entryRepositoryData) Description copied from class:DefaultRepeaterCreates an instance ofRepeaterEntryto use- Overrides:
createRepeaterEntryInstancein classDefaultModifiableRepeater- Parameters:
entryRepositoryData- the repository data of the entry to create- Returns:
- the created instance of
RepeaterEntry
-
indexData
public List<org.apache.solr.common.SolrInputDocument> indexData(org.apache.solr.common.SolrInputDocument document, org.apache.solr.common.SolrInputDocument rootDocument, String solrFieldPrefix, CMSDataContext context) throws BadItemTypeException Description copied from interface:IndexableRepeaterIndexes all data and properties of thisRepeater- Specified by:
indexDatain interfaceIndexableRepeater- Parameters:
document- the solr document representing thisRepeaterrootDocument- 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
-
getParentDataHolder
Description copied from interface:RepeaterRetrieves the parent of the currentRepeater- Specified by:
getParentDataHolderin interfaceIndexableRepeater- Specified by:
getParentDataHolderin interfaceModifiableIndexableRepeater- Specified by:
getParentDataHolderin interfaceModifiableRepeater- Specified by:
getParentDataHolderin interfaceRepeater- Overrides:
getParentDataHolderin classDefaultModifiableRepeater- Returns:
- the parent of the current
Repeater
-
getRootDataHolder
Description copied from interface:RepeaterRetrieves the rootDataHolderof the current repeater- Specified by:
getRootDataHolderin interfaceIndexableRepeater- Specified by:
getRootDataHolderin interfaceModifiableIndexableRepeater- Specified by:
getRootDataHolderin interfaceModifiableRepeater- Specified by:
getRootDataHolderin interfaceRepeater- Overrides:
getRootDataHolderin classDefaultModifiableRepeater- Returns:
- the root
DataHolder
-