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.IndexableDataHolder; 021import org.ametys.plugins.repository.data.holder.group.ModelAwareComposite; 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 indexable composites 028 */ 029public interface IndexableComposite extends ModelAwareComposite, IndexableDataHolder 030{ 031 @Override 032 public default IndexableComposite getComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException 033 { 034 return getDefaultDataHolder().getComposite(compositePath); 035 } 036 037 @Override 038 public default IndexableComposite getLocalComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException 039 { 040 return getDefaultDataHolder().getLocalComposite(compositePath); 041 } 042 043 @Override 044 public default IndexableComposite getExternalComposite(String compositePath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException 045 { 046 return getDefaultDataHolder().getExternalComposite(compositePath); 047 } 048 049 @Override 050 public default IndexableRepeater getRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException 051 { 052 return getDefaultDataHolder().getRepeater(repeaterPath); 053 } 054 055 @Override 056 public default IndexableRepeater getLocalRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException 057 { 058 return getDefaultDataHolder().getLocalRepeater(repeaterPath); 059 } 060 061 @Override 062 public default IndexableRepeater getExternalRepeater(String repeaterPath) throws IllegalArgumentException, UndefinedItemPathException, BadItemTypeException, BadDataPathCardinalityException 063 { 064 return getDefaultDataHolder().getExternalRepeater(repeaterPath); 065 } 066 067 @Override 068 public IndexableDataHolder getDefaultDataHolder(); 069 070 @Override 071 public default Optional<? extends IndexableDataHolder> getParentDataHolder() 072 { 073 return getDefaultDataHolder().getParentDataHolder(); 074 } 075 076 @Override 077 public default IndexableDataHolder getRootDataHolder() 078 { 079 return getDefaultDataHolder().getRootDataHolder(); 080 } 081}