1 16 17 package org.apache.jetspeed.portal.security.portlets; 18 19 import org.apache.jetspeed.portal.Portlet; 21 import org.apache.jetspeed.portal.PortletState; 22 23 import org.apache.jetspeed.services.JetspeedSecurity; 24 25 import org.apache.turbine.util.RunData; 27 29 30 31 40 public class StatefulPortletWrapper extends PortletWrapper implements PortletState 41 { 42 43 46 private PortletState wrappedState = null; 47 48 public StatefulPortletWrapper( Portlet inner ) 49 { 50 super( inner ); 51 if( inner instanceof PortletState ) 52 { 53 wrappedState = (PortletState) inner; 54 } 55 else 56 { 57 } 59 } 60 61 63 69 public final boolean allowClose( RunData rundata ) 70 { 71 return checkPermission(rundata, 72 JetspeedSecurity.PERMISSION_CLOSE ); 73 } 74 75 78 public final boolean isClosed(RunData rundata) 79 { 80 return wrappedState.isClosed( rundata ); 81 } 82 83 89 public final void setClosed(boolean close, RunData rundata) 90 { 91 if( allowClose( rundata ) ) 92 { 93 wrappedState.setClosed( close, rundata ); 94 } 95 } 96 97 103 public final boolean allowInfo( RunData rundata ) 104 { 105 return checkPermission(rundata, 106 JetspeedSecurity.PERMISSION_INFO ); 107 } 108 109 115 public final boolean allowCustomize( RunData rundata ) 116 { 117 return checkPermission(rundata, 118 JetspeedSecurity.PERMISSION_CUSTOMIZE ); 119 } 120 121 127 public boolean allowMaximize( RunData rundata ) 128 { 129 return checkPermission(rundata, 130 JetspeedSecurity.PERMISSION_MAXIMIZE ); 131 } 132 133 139 public boolean allowMinimize( RunData rundata ) 140 { 141 return checkPermission(rundata, 142 JetspeedSecurity.PERMISSION_MINIMIZE ); 143 } 144 145 148 public boolean isMinimized(RunData rundata) 149 { 150 return wrappedState.isMinimized( rundata ); 151 } 152 153 159 public void setMinimized( boolean minimize, RunData rundata ) 160 { 161 if( allowMinimize( rundata ) ) 162 { 163 wrappedState.setMinimized(minimize, rundata ); 164 } 165 } 166 167 173 public boolean allowPrintFriendly( RunData rundata ) 174 { 175 return checkPermission(rundata, 176 JetspeedSecurity.PERMISSION_PRINT_FRIENDLY ); 177 } 178 179 } 180 | Popular Tags |