001/*
002 *  Copyright 2011 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.plugins.blog.repository;
017
018import org.ametys.cms.repository.Content;
019import org.ametys.plugins.repository.AmetysObject;
020import org.ametys.plugins.repository.AmetysRepositoryException;
021import org.ametys.plugins.repository.data.holder.ModelAwareDataHolder;
022import org.ametys.plugins.repository.data.holder.ModelLessDataHolder;
023import org.ametys.web.repository.page.Zone;
024import org.ametys.web.repository.page.ZoneItem;
025
026/**
027 * Wrapper to present a modifiable zoneItem into a unmodifiable one.
028 */
029public class StaticZoneItem implements ZoneItem
030{
031    
032    /** The wrapped zone. */
033    protected ZoneItem _zoneItem;
034    
035    /**
036     * Construct a static zone, wrapping a given zone.
037     * @param zoneItem the zone to wrap.
038     */
039    public StaticZoneItem(ZoneItem zoneItem)
040    {
041        _zoneItem = zoneItem;
042    }
043    
044    public ModelLessDataHolder getDataHolder()
045    {
046        return _zoneItem.getDataHolder();
047    }
048
049    @Override
050    public String getName() throws AmetysRepositoryException
051    {
052        return _zoneItem.getName();
053    }
054
055    @Override
056    public String getPath() throws AmetysRepositoryException
057    {
058        return _zoneItem.getPath();
059    }
060
061    @Override
062    public String getId() throws AmetysRepositoryException
063    {
064        return _zoneItem.getId();
065    }
066
067    @Override
068    public <A extends AmetysObject> A getParent() throws AmetysRepositoryException
069    {
070        return _zoneItem.getParent();
071    }
072
073    @Override
074    public String getParentPath() throws AmetysRepositoryException
075    {
076        return _zoneItem.getParentPath();
077    }
078    
079    @Override
080    public ZoneType getType() throws AmetysRepositoryException
081    {
082        return _zoneItem.getType();
083    }
084    
085    @Override
086    public <C extends Content> C getContent() throws AmetysRepositoryException
087    {
088        return _zoneItem.getContent();
089    }
090    
091    public String getViewName() throws AmetysRepositoryException
092    {
093        return _zoneItem.getViewName();
094    }
095    
096    @Override
097    public String getServiceId() throws AmetysRepositoryException
098    {
099        return _zoneItem.getServiceId();
100    }
101
102    public ModelAwareDataHolder getServiceParameters() throws AmetysRepositoryException
103    {
104        return _zoneItem.getServiceParameters();
105    }
106
107    @Override
108    public Zone getZone()
109    {
110        return _zoneItem.getZone();
111    }
112
113    public ModelAwareDataHolder getZoneItemParametersHolder() throws AmetysRepositoryException
114    {
115        return _zoneItem.getZoneItemParametersHolder();
116    }
117
118    public ModelAwareDataHolder getContentViewParametersHolder(String contentViewName) throws AmetysRepositoryException
119    {
120        return _zoneItem.getContentViewParametersHolder(contentViewName);
121    }
122
123    public ModelAwareDataHolder getServiceViewParametersHolder(String serviceViewName) throws AmetysRepositoryException
124    {
125        return _zoneItem.getServiceViewParametersHolder(serviceViewName);
126    }
127}