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