ggolden 2002/09/27 10:02:29
Modified: src/java/org/apache/jetspeed/services/rundata
DefaultJetspeedRunData.java JetspeedRunData.java
Log:
The customizers, including the Portlet customizer, now work on a clone of the
current Profile / PSMLDocument rather than on the current ones. This is to
assure that if, due to new account creation and caching, there are two different
Profiles that use the same PSMLDocument, only the one being edited will be
modified. Also, as someone is modifying a Profile, other users won't see the
results until the modification is saved. If the modification is cancled, nothing
changes.
Some support was added to the JetspeedRunData and the Customize.java for this.
The JetspeedPortletInstance was changed to be aware of the clone used in
customization, and to make a clone if needed before modifying the current psml.
Revision Changes Path
1.16 +61 -25
jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/DefaultJetspeedRunData.java
Index: DefaultJetspeedRunData.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/DefaultJetspeedRunData.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- DefaultJetspeedRunData.java 29 Jul 2002 02:25:27 -0000 1.15
+++ DefaultJetspeedRunData.java 27 Sep 2002 17:02:29 -0000 1.16
@@ -119,7 +119,10 @@
*/
public Portlet getCustomized()
{
- Stack stack = (Stack)getSession().getAttribute("customize");
+ // customization state info is in the page's session state
+ SessionState customizationState = getPageSessionState();
+ Stack stack = (Stack)customizationState.getAttribute("customize-stack");
+
Portlet p = null;
if ((stack!=null)&&(!stack.empty()))
@@ -134,9 +137,9 @@
* Andreas Kempf, Siemens ICM S CP PE, Munich
*/
if ((p != null) && (stack.size() > 1))
- getSession().setAttribute ("customizedPaneName", (String)p.getTitle());
+ customizationState.setAttribute ("customize-paneName",
(String)p.getTitle());
else
- getSession().setAttribute ("customizedPaneName", "*");
+ customizationState.setAttribute ("customize-paneName", "*");
return (Portlet)p;
}
@@ -148,19 +151,20 @@
*/
public void setCustomized(Portlet p)
{
- Stack stack = (Stack)getSession().getAttribute("customize");
+ // customization state info is in the page's session state
+ SessionState customizationState = getPageSessionState();
+ Stack stack = (Stack)customizationState.getAttribute("customize-stack");
if (stack == null)
{
stack = new Stack();
- getSession().setAttribute("customize",stack);
-
+ customizationState.setAttribute("customize-stack", stack);
}
if (p==null)
{
if (!stack.empty()) stack.pop();
- getSession().setAttribute ("customizedPaneName", "*");
+ customizationState.setAttribute ("customize-paneName", "*");
}
else
{
@@ -187,11 +191,57 @@
* Andreas Kempf, Siemens ICM S CP PE, Munich
*/
- getSession().setAttribute ("customizedPaneName", (String)p.getTitle());
+ customizationState.setAttribute ("customize-paneName",
(String)p.getTitle());
}
}
/**
+ * Get the psml profile being customized.
+ * @return the Profile being customized.
+ */
+ public Profile getCustomizedProfile()
+ {
+ // customization state info is in the page's session state
+ SessionState customizationState = getPageSessionState();
+
+ return (Profile) customizationState.getAttribute("customize-profile");
+
+ } // getCustomizedProfile
+
+ /**
+ * Set the psml profile being customized.
+ * @param profile The Profile being customized.
+ */
+ public void setCustomizedProfile(Profile profile)
+ {
+ // customization state info is in the page's session state
+ SessionState customizationState = getPageSessionState();
+
+ customizationState.setAttribute("customize-profile", profile);
+
+ } // setCustomizedProfile
+
+ /**
+ * Clean up from customization
+ */
+ public void cleanupFromCustomization()
+ {
+ // get the customization state for this page
+ SessionState customizationState = getPageSessionState();
+
+ customizationState.removeAttribute("customize-stack");
+ customizationState.removeAttribute("customize-paneName");
+ customizationState.removeAttribute("customize-profile");
+ //customizationState.removeAttribute("customize-type");
+ customizationState.removeAttribute("customize-columns");
+ customizationState.removeAttribute("customize-mode");
+ customizationState.removeAttribute("customize-parameters");
+
+ setMode("default");
+
+ } // cleanupFromCustomization
+
+ /**
* Returns the portlet id which should be maximized for this request
*
* @return the portlet id being maximized or null
@@ -271,7 +321,7 @@
*/
public void setProfile(Profile profile)
{
- this.getUser().setTemp("profile",profile);
+ this.profile = profile;
}
/**
@@ -281,21 +331,7 @@
*/
public Profile getProfile()
{
- try
- {
- Object object = this.getUser().getTemp("profile");
- if (object != null && object instanceof Profile)
- {
- return (Profile)this.getUser().getTemp("profile");
- }
- return null;
-
- } catch (Throwable t)
- {
- Log.error( "Captured Exception: " );
- Log.error( t );
- }
- return null;
+ return this.profile;
}
/** Clears the state of this object for recycling... */
1.8 +18 -1
jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/JetspeedRunData.java
Index: JetspeedRunData.java
===================================================================
RCS file:
/home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/services/rundata/JetspeedRunData.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- JetspeedRunData.java 28 Jun 2002 05:37:33 -0000 1.7
+++ JetspeedRunData.java 27 Sep 2002 17:02:29 -0000 1.8
@@ -128,6 +128,23 @@
public void setCustomized(Portlet p);
/**
+ * Get the psml profile being customized.
+ * @return the Profile being customized.
+ */
+ public Profile getCustomizedProfile();
+
+ /**
+ * Set the psml profile being customized.
+ * @param profile The Profile being customized.
+ */
+ public void setCustomizedProfile(Profile profile);
+
+ /**
+ * Clean up from customization
+ */
+ public void cleanupFromCustomization();
+
+ /**
* Returns the portlet id which should be maximized for this request
*
* @return the portlet id being maximized or null
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>