View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16   
17  package org.apache.jetspeed.modules.actions.controls;
18  
19  // Turbine stuff
20  import org.apache.turbine.modules.Action;
21  import org.apache.turbine.util.RunData;
22  
23  // Jetspeed stuff
24  import org.apache.jetspeed.services.rundata.JetspeedRunData;
25  
26  /***
27   * Change the internal state of a portlet from normal to closed
28   * 
29   * @author <a href="mailto:re_carrasco@bco011.sonda.cl">Roberto Carrasco</a>
30   * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a>
31   * @author <a href="mailto:paulsp@apache.org">Paul Spencer</a>
32   */
33  public class Close extends Action
34  {
35      /***
36       * @param rundata The RunData object for the current request
37       */    
38      public void doPerform( RunData rundata ) throws Exception
39      {
40  
41          // Only logged in users can minmize
42          if( rundata.getUser() == null)
43          {
44              return;
45          }
46  
47          // Get jsp_peid parmameter.  If it does not exist, then do nothing
48          String peid = rundata.getParameters().getString("js_peid");
49          if ( peid == null )
50          {
51              return;
52          }
53          
54          JetspeedRunData jdata = (JetspeedRunData)rundata;
55  
56          // Remove the Portlet using the PEID
57          jdata.getProfile().getDocument().removeEntryById(peid);
58      }
59  }