001/*
002 *  Copyright 2022 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.cms.data.holder.group;
017
018import java.util.Optional;
019
020import org.ametys.cms.data.holder.ModifiableIndexableDataHolder;
021import org.ametys.plugins.repository.data.holder.group.ModifiableModelAwareComposite;
022import org.ametys.runtime.model.exception.BadDataPathCardinalityException;
023import org.ametys.runtime.model.exception.BadItemTypeException;
024import org.ametys.runtime.model.exception.UndefinedItemPathException;
025
026/**
027 * Interface for modifiable indexable composites
028 */
029public interface ModifiableIndexableComposite extends IndexableComposite, ModifiableModelAwareComposite, ModifiableIndexableDataHolder
030{
031    @Override
032    public default ModifiableIndexableComposite getComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
033    {
034        return getDefaultDataHolder().getComposite(compositePath);
035    }
036
037    @Override
038    public default ModifiableIndexableComposite getLocalComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
039    {
040        return getDefaultDataHolder().getLocalComposite(compositePath);
041    }
042
043    @Override
044    public default ModifiableIndexableComposite getExternalComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
045    {
046        return getDefaultDataHolder().getExternalComposite(compositePath);
047    }
048
049    @Override
050    public default ModifiableIndexableRepeater getRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
051    {
052        return getDefaultDataHolder().getRepeater(repeaterPath);
053    }
054
055    @Override
056    public default ModifiableIndexableRepeater getLocalRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
057    {
058        return getDefaultDataHolder().getLocalRepeater(repeaterPath);
059    }
060
061    @Override
062    public default ModifiableIndexableRepeater getExternalRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
063    {
064        return getDefaultDataHolder().getExternalRepeater(repeaterPath);
065    }
066    
067    @Override
068    public default ModifiableIndexableComposite getComposite(String compositePath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
069    {
070        return getDefaultDataHolder().getComposite(compositePath, createNew);
071    }
072    
073    @Override
074    public default ModifiableIndexableComposite getLocalComposite(String compositePath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
075    {
076        return getDefaultDataHolder().getComposite(compositePath, createNew);
077    }
078    
079    @Override
080    public default ModifiableIndexableComposite getExternalComposite(String compositePath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
081    {
082        return getDefaultDataHolder().getComposite(compositePath, createNew);
083    }
084    
085    @Override
086    public default ModifiableIndexableRepeater getRepeater(String repeaterPath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
087    {
088        return getDefaultDataHolder().getRepeater(repeaterPath, createNew);
089    }
090    
091    @Override
092    public default ModifiableIndexableRepeater getLocalRepeater(String repeaterPath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
093    {
094        return getDefaultDataHolder().getRepeater(repeaterPath, createNew);
095    }
096    
097    @Override
098    public default ModifiableIndexableRepeater getExternalRepeater(String repeaterPath, boolean createNew) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException
099    {
100        return getDefaultDataHolder().getRepeater(repeaterPath, createNew);
101    }
102    
103    @Override
104    public ModifiableIndexableDataHolder getDefaultDataHolder();
105    
106    @Override
107    public default Optional<? extends ModifiableIndexableDataHolder> getParentDataHolder()
108    {
109        return getDefaultDataHolder().getParentDataHolder();
110    }
111    
112    @Override
113    public default ModifiableIndexableDataHolder getRootDataHolder()
114    {
115        return getDefaultDataHolder().getRootDataHolder();
116    }
117}