1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.jetspeed.modules.actions.controls;
18
19
20 import org.apache.turbine.modules.Action;
21 import org.apache.turbine.util.RunData;
22
23
24 import org.apache.jetspeed.portal.Portlet;
25 import org.apache.jetspeed.portal.PortletState;
26 import org.apache.jetspeed.services.logging.JetspeedLogFactoryService;
27 import org.apache.jetspeed.services.logging.JetspeedLogger;
28 import org.apache.jetspeed.services.PortletFactory;
29 import org.apache.jetspeed.services.rundata.JetspeedRunData;
30 import org.apache.jetspeed.om.profile.Entry;
31
32 /***
33 Change the internal state of a portlet from minimized to normal
34
35 @author <a href="mailto:re_carrasco@bco011.sonda.cl">Roberto Carrasco</a>
36 @author <a href="mailto:paulsp@apache">Paul Spencer</a>
37 */
38 public class Restore extends Action
39 {
40
41 /***
42 * Static initialization of the logger for this class
43 */
44 private static final JetspeedLogger logger = JetspeedLogFactoryService.getLogger(Restore.class.getName());
45
46 /***
47 * @param rundata The RunData object for the current request
48 */
49 public void doPerform( RunData rundata ) throws Exception
50 {
51
52 if( rundata.getUser() == null)
53 {
54 return;
55 }
56
57
58 String peid = rundata.getParameters().getString("js_peid");
59 if ( peid == null )
60 {
61 return;
62 }
63
64
65 JetspeedRunData jdata = (JetspeedRunData)rundata;
66 Entry entry = jdata.getProfile().getDocument().getEntryById(peid);
67 if ( entry == null )
68 {
69 logger.warn("Failed to get PEID (" + peid + ") entry for User ("
70 + rundata.getUser().getName() + ")");
71 return;
72 }
73 Portlet portlet = PortletFactory.getPortlet(entry);
74
75
76 if (( portlet != null )&&( portlet instanceof PortletState ))
77 {
78 ((PortletState)portlet).setMinimized( false, rundata );
79 }
80
81
82 while (jdata.getCustomized()!=null)
83 {
84 jdata.setCustomized(null);
85 }
86
87
88 jdata.getUser().removeTemp("js_peid");
89
90 jdata.setScreenTemplate("Home");
91 }
92
93 }