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 @Override 092 public String getMetadataSetName() throws AmetysRepositoryException 093 { 094 return _zoneItem.getMetadataSetName(); 095 } 096 097 public String getViewName() throws AmetysRepositoryException 098 { 099 return _zoneItem.getViewName(); 100 } 101 102 @Override 103 public String getServiceId() throws AmetysRepositoryException 104 { 105 return _zoneItem.getServiceId(); 106 } 107 108 public ModelAwareDataHolder getServiceParameters() throws AmetysRepositoryException 109 { 110 return _zoneItem.getServiceParameters(); 111 } 112 113 @Override 114 public Zone getZone() 115 { 116 return _zoneItem.getZone(); 117 } 118 119}