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.metadata.CompositeMetadata;
022import org.ametys.web.repository.page.Zone;
023import org.ametys.web.repository.page.ZoneItem;
024
025/**
026 * Wrapper to present a modifiable zoneItem into a unmodifiable one.
027 */
028public class StaticZoneItem implements ZoneItem
029{
030    
031    /** The wrapped zone. */
032    protected ZoneItem _zoneItem;
033    
034    /**
035     * Construct a static zone, wrapping a given zone.
036     * @param zoneItem the zone to wrap.
037     */
038    public StaticZoneItem(ZoneItem zoneItem)
039    {
040        _zoneItem = zoneItem;
041    }
042    
043    @Override
044    public CompositeMetadata getMetadataHolder()
045    {
046        return _zoneItem.getMetadataHolder();
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    @Override
092    public String getMetadataSetName() throws AmetysRepositoryException
093    {
094        return _zoneItem.getMetadataSetName();
095    }
096    
097    @Override
098    public String getServiceId() throws AmetysRepositoryException
099    {
100        return _zoneItem.getServiceId();
101    }
102
103    @Override
104    public CompositeMetadata getServiceParameters() throws AmetysRepositoryException
105    {
106        return _zoneItem.getServiceParameters();
107    }
108
109    @Override
110    public Zone getZone()
111    {
112        return _zoneItem.getZone();
113    }
114
115}