gatein SVN: r4675 - in epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide: en-US/images and 1 other directories.
by do-not-reply@jboss.org
Author: smumford
Date: 2010-10-15 02:18:01 -0400 (Fri, 15 Oct 2010)
New Revision: 4675
Added:
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/activateversionmessage.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/addlabelform.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/admintab.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/commentdisplay.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/commentview.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/emptysearch.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/labellist.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/manageversionsbutton.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/preferencesettingform.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/removelabelform.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versioninfo.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versionmenu.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versionminusicon.png
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versionplusicon.png
Removed:
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/commentdisplay.jpg
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/commentview.jpg
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/emptysearch.jpg
Modified:
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/modules/Usage/SitesExplorer.xml
epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/publican.cfg
Log:
JBEPP-518: Conversion
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/activateversionmessage.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/activateversionmessage.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/addlabelform.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/addlabelform.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/admintab.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/admintab.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/commentdisplay.jpg
===================================================================
(Binary files differ)
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/commentdisplay.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/commentdisplay.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/commentview.jpg
===================================================================
(Binary files differ)
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/commentview.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/commentview.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Deleted: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/emptysearch.jpg
===================================================================
(Binary files differ)
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/emptysearch.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/emptysearch.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/labellist.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/labellist.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/manageversionsbutton.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/manageversionsbutton.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/preferencesettingform.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/preferencesettingform.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/removelabelform.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/removelabelform.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versioninfo.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versioninfo.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versionmenu.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versionmenu.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versionminusicon.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versionminusicon.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versionplusicon.png
===================================================================
(Binary files differ)
Property changes on: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/images/versionplusicon.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/modules/Usage/SitesExplorer.xml
===================================================================
--- epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/modules/Usage/SitesExplorer.xml 2010-10-15 01:59:25 UTC (rev 4674)
+++ epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/en-US/modules/Usage/SitesExplorer.xml 2010-10-15 06:18:01 UTC (rev 4675)
@@ -1450,7 +1450,6 @@
</step>
</procedure>
-
</section>
@@ -1681,7 +1680,6 @@
</para>
</section>
-
</section>
@@ -6398,10 +6396,10 @@
</para>
<mediaobject>
<imageobject role="html">
- <imagedata align="center" fileref="images/commentdisplay.jpg" format="JPG" scale="" width="444" />
+ <imagedata align="center" fileref="images/commentdisplay.png" format="PNG" scale="100" />
</imageobject>
<imageobject role="fo">
- <imagedata align="center" contentwidth="150mm" fileref="images/commentdisplay.jpg" format="JPG" width="444" />
+ <imagedata align="center" contentwidth="150mm" fileref="images/commentdisplay.png" format="PNG" />
</imageobject>
</mediaobject>
@@ -6410,10 +6408,10 @@
</para>
<mediaobject>
<imageobject role="html">
- <imagedata align="center" fileref="images/commentview.jpg" format="JPG" scale="" />
+ <imagedata align="center" fileref="images/commentview.png" format="PNG" scale="100" />
</imageobject>
<imageobject role="fo">
- <imagedata align="center" contentwidth="150mm" fileref="images/commentview.jpg" format="JPG" />
+ <imagedata align="center" contentwidth="150mm" fileref="images/commentview.png" format="PNG" />
</imageobject>
</mediaobject>
@@ -6497,10 +6495,10 @@
</para>
<mediaobject>
<imageobject role="html">
- <imagedata fileref="images/emptysearch.jpg" format="JPG" align="center" scale="100" />
+ <imagedata fileref="images/emptysearch.png" format="PNG" align="center" scale="100" />
</imageobject>
<imageobject role="fo">
- <imagedata fileref="images/emptysearch.jpg" format="JPG" align="center" contentwidth="150mm" />
+ <imagedata fileref="images/emptysearch.png" format="PNG" align="center" contentwidth="150mm" />
</imageobject>
</mediaobject>
</step>
@@ -6571,7 +6569,7 @@
</listitem>
<listitem>
<para>
- <xref linkend="sect-Site_Publisher_User_Guide-Search_in_Sites_Explorer-Advanced_Search-Search_with_constraints"/>
+ <xref linkend="sect-Site_Publisher_User_Guide-Search_in_Sites_Explorer-Advanced_Search-Advanced_Search"/>
</para>
</listitem>
<listitem>
@@ -6581,7 +6579,7 @@
</listitem>
<listitem>
<para>
- <xref linkend="sect-Site_Publisher_User_Guide-Search_in_Sites_Explorer-Advanced_Search-Existing_Queries"/>
+ <xref linkend="sect-Site_Publisher_User_Guide-Search_in_Sites_Explorer-Advanced_Search-Saved_Query"/>
</para>
</listitem>
</itemizedlist>
@@ -6910,7 +6908,7 @@
</step>
<step>
<para>
- Enter the required property in the <emphasis role="bold">Property</emphasis> field or click the <emphasis role="bold">Add Property</emphasis> icon <inlinemediaobject><imageobject><imagedata fileref="images/furtherpropertyicon.png"/></imageobject></inlinemediaobject> (refer to <emphasis role="bold">Step B</emphasis> in <xref linkend="proc-Site_Publisher_User_Guide-Search_in_Sites_Explorer-Advanced_Search-Search_with_constraints-exact_vlaues"/> for more information).
+ Enter the required property in the <emphasis role="bold">Property</emphasis> field or click the <emphasis role="bold">Add Property</emphasis> icon <inlinemediaobject><imageobject><imagedata fileref="images/furtherpropertyicon.png"/></imageobject></inlinemediaobject> (refer to <emphasis role="bold">Step B</emphasis> in <xref linkend="proc-Site_Publisher_User_Guide-Search_in_Sites_Explorer-Advanced_Search-Search_with_constraints-exact_values"/> for more information).
</para>
</step>
<step>
@@ -7188,10 +7186,339 @@
<section id="sect-Site_Publisher_User_Guide-Manage_Site_Content_with_Sites_Explorer-Preference_Settings">
<title>Preference Settings</title>
<para>
-
+ This function is used to set up your browsing preferences.
</para>
-
+ <procedure>
+ <title></title>
+ <step>
+ <para>
+ Click on <inlinemediaobject><imageobject><imagedata fileref="images/preferencesettingicon.png"/></imageobject></inlinemediaobject> on the right side of the <emphasis role="bold">Sites Explorer</emphasis> portlet.
+ </para>
+ <para>
+ The <emphasis role="bold">Preference Setting</emphasis> window will appear:
+ </para>
+ <mediaobject>
+ <imageobject role="html">
+ <imagedata fileref="images/preferencesettingform.png" format="PNG" align="center" scale="" />
+ </imageobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/preferencesettingform.png" format="PNG" align="center" contentwidth="150mm" />
+ </imageobject>
+ </mediaobject>
+ <table>
+ <title></title>
+ <tgroup cols="2">
+ <thead>
+ <row>
+ <entry>
+ Setting
+ </entry>
+ <entry>
+ Details
+ </entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ Enable JCR like structure.
+ </entry>
+ <entry>
+ This option is to display nodes in a document in tree structure.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ Show sidebar
+ </entry>
+ <entry>
+ This option is to display a sidebar.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ Show non document nodes
+ </entry>
+ <entry>
+ This option is to display nodes that are non–documents.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ Show referenced documents
+ </entry>
+ <entry>
+ This option is to display referenced documents.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ Show hidden nodes
+ </entry>
+ <entry>
+ The option is to display hidden nodes.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ Show items by user in Time line View
+ </entry>
+ <entry>
+ This option is to display items by a user or not in Timeline view.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ Enable drag and drop
+ </entry>
+ <entry>
+ This option is to allows taking the “drag and drop” action or not.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ Query Type
+ </entry>
+ <entry>
+ This query type.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ Sort by
+ </entry>
+ <entry>
+ This condition is used to sort nodes in nodes list.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ Order
+ </entry>
+ <entry>
+ This type of the sorted order.
+ </entry>
+ </row>
+ <row>
+ <entry>
+ Nodes per page
+ </entry>
+ <entry>
+ This number of nodes that will be displayed per page.
+ </entry>
+ </row>
+ <row>
+ <entry>
+
+ </entry>
+ <entry>
+
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </step>
+ <step>
+ <para>
+ Configure the preferences as required and click <emphasis role="bold">Save</emphasis> to set them.
+ </para>
+ <para>
+ Or click <emphasis role="bold">Back</emphasis> to quit without submitting changes.
+ </para>
+ </step>
+ </procedure>
</section> <!-- Close Section: 3.3.6 Preference Setting -->
+ <section id="sect-Site_Publisher_User_Guide-Manage_Site_Content_with_Sites_Explorer-Admin">
+ <title>Admin</title>
+ <para>
+ <emphasis role="bold">Admin</emphasis> functions allow you to create versions , view properties, manage categories, actions, import and export nodes.
+ </para>
+ <section id="sect-Site_Publisher_User_Guide-Manage_Site_Content_with_Sites_Explorer-Admin-Manage_Nodes">
+ <title>Manage Nodes</title>
+ <section id="sect-Site_Publisher_User_Guide-Manage_Site_Content_with_Sites_Explorer-Admin-Manage_Nodes-Add_versions">
+ <title>Add versions for nodes</title>
+ <procedure>
+ <title></title>
+ <step>
+ <para>
+ Select a node to add a version to.
+ </para>
+ </step>
+ <step>
+ <para>
+ Select the <emphasis role="bold">Admin</emphasis> tab to show available administration actions:
+ </para>
+ <mediaobject>
+ <imageobject role="html">
+ <imagedata fileref="images/admintab.png" format="PNG" align="center" scale="" />
+ </imageobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/admintab.png" format="PNG" align="center" contentwidth="150mm" />
+ </imageobject>
+ </mediaobject>
+ </step>
+ <step>
+ <para>
+ Click <inlinemediaobject><imageobject><imagedata fileref="images/manageversionsbutton.png"/></imageobject></inlinemediaobject>.
+ </para>
+ <para>
+ The following message box will appear:
+ </para>
+ <mediaobject>
+ <imageobject role="html">
+ <imagedata fileref="images/activateversionmessage.png" format="PNG" align="center" scale="" />
+ </imageobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/activateversionmessage.png" format="PNG" align="center" contentwidth="150mm" />
+ </imageobject>
+ </mediaobject>
+ </step>
+ <step>
+ <para>
+ Click <emphasis role="bold">Activate</emphasis> to activate a version for the node.
+ </para>
+ </step>
+ <step>
+ <para>
+ Right click the selected node and select <emphasis role="bold">CheckIn</emphasis> from the menu:
+ </para>
+ <mediaobject>
+ <imageobject role="html">
+ <imagedata fileref="images/versionmenu.png" format="PNG" align="center" scale="" />
+ </imageobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/versionmenu.png" format="PNG" align="center" contentwidth="150mm" />
+ </imageobject>
+ </mediaobject>
+ </step>
+ <step>
+ <para>
+ Click <inlinemediaobject><imageobject><imagedata fileref="images/manageversionsbutton.png"/></imageobject></inlinemediaobject> again to open the <emphasis role="bold">Version Info</emphasis> window.
+ </para>
+ <mediaobject>
+ <imageobject role="html">
+ <imagedata fileref="images/versioninfo.png" format="PNG" align="center" scale="" />
+ </imageobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/versioninfo.png" format="PNG" align="center" contentwidth="150mm" />
+ </imageobject>
+ </mediaobject>
+ <para>
+ The node selected in step one has been added as the <emphasis>Base version</emphasis>.
+ </para>
+ </step>
+ <step>
+ <para>
+ Right click the node again and select <emphasis role="bold">Check out</emphasis> to obtain a version of this node.
+ </para>
+ </step>
+ </procedure>
+ <note>
+ <title></title>
+ <para>
+ No actions (copy/cut/rename) can be taken on a node in <emphasis role="bold">Check In</emphasis> status. You must check it out before you can perform any actions on it.
+ </para>
+ <para>
+ If you want to add more versions for a node, right click selected node above and select <emphasis role="bold">Check In</emphasis> and then <emphasis role="bold">Check Out</emphasis>
+ </para>
+ </note>
+ </section> <!-- Close Section: 3.3.7.1.1 Add versions -->
+ <section id="sect-Site_Publisher_User_Guide-Manage_Site_Content_with_Sites_Explorer-Admin-Manage_Nodes-Adding_Removing_labels">
+ <title>Adding and Removing labels for Versions</title>
+ <procedure>
+ <title>Adding a label</title>
+ <step>
+ <para>
+ Select a versioned node.
+ </para>
+ </step>
+ <step>
+ <para>
+ Click <inlinemediaobject><imageobject><imagedata fileref="images/manageversionsbutton.png"/></imageobject></inlinemediaobject>.
+ </para>
+ </step>
+ <step>
+ <para>
+ Click the <inlinemediaobject><imageobject><imagedata fileref="images/versionplusicon.png"/></imageobject></inlinemediaobject> on the <emphasis role="bold">Version Info</emphasis> window to show the <emphasis role="bold">Add label</emphasis> field under the version list.
+ </para>
+ <mediaobject>
+ <imageobject role="html">
+ <imagedata fileref="images/addlabelform.png" format="PNG" align="center" scale="" />
+ </imageobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/addlabelform.png" format="PNG" align="center" contentwidth="150mm" />
+ </imageobject>
+ </mediaobject>
+ </step>
+ <step>
+ <para>
+ Enter a value into the <emphasis role="bold">Label</emphasis> field.
+ </para>
+ <para>
+ The label must be unique and can not use special characters such as @, #, $.
+ </para>
+ </step>
+ <step>
+ <para>
+ Click <emphasis role="bold">Save</emphasis> to submit the new label.
+ </para>
+ </step>
+ </procedure>
+ <procedure>
+ <title>Removing a label</title>
+ <step>
+ <para>
+ Select a versioned node that has at least one label.
+ </para>
+ </step>
+ <step>
+ <para>
+ Click <inlinemediaobject><imageobject><imagedata fileref="images/manageversionsbutton.png"/></imageobject></inlinemediaobject>.
+ </para>
+ </step>
+ <step>
+ <para>
+ Click the <inlinemediaobject><imageobject><imagedata fileref="images/versionminusicon.png"/></imageobject></inlinemediaobject> on the <emphasis role="bold">Version Info</emphasis> window to show the <emphasis role="bold">Remove label</emphasis> field under the version list.
+ </para>
+ <mediaobject>
+ <imageobject role="html">
+ <imagedata fileref="images/removelabelform.png" format="PNG" align="center" scale="" />
+ </imageobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/removelabelform.png" format="PNG" align="center" contentwidth="150mm" />
+ </imageobject>
+ </mediaobject>
+ </step>
+ <step>
+ <para>
+ Select the label you want to remove from the drop down menu:
+ </para>
+ <mediaobject>
+ <imageobject role="html">
+ <imagedata fileref="images/labellist.png" format="PNG" align="center" scale="" />
+ </imageobject>
+ <imageobject role="fo">
+ <imagedata fileref="images/labellist.png" format="PNG" align="center" contentwidth="150mm" />
+ </imageobject>
+ </mediaobject>
+ </step>
+ <step>
+ <para>
+ Click the <emphasis role="bold">Remove</emphasis> button to remove the selected label.
+ </para>
+ </step>
+ </procedure>
+ </section> <!-- Close Section: 3.3.7.1.2 Adding Removing labels -->
+ <section id="sect-Site_Publisher_User_Guide-Manage_Site_Content_with_Sites_Explorer-Admin-Manage_Nodes-View_versions">
+ <title>View versions</title>
+ <para>
+
+ </para>
+
+ </section> <!-- Close Section: 3.3.7.7.1.3 View Versions -->
+ </section> <!-- Close Section: 3.3.7.1 Manage Nodes -->
+ </section> <!-- Close Section: 3.3.7 Admin -->
</section> <!-- Close Section: 3.3 Manage Site Content with Sites Explorer -->
Modified: epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/publican.cfg
===================================================================
--- epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/publican.cfg 2010-10-15 01:59:25 UTC (rev 4674)
+++ epp/docs/branches/EPP_5_1_Branch/Site_Publisher_User_Guide/publican.cfg 2010-10-15 06:18:01 UTC (rev 4675)
@@ -3,6 +3,6 @@
xml_lang: en-US
type: Book
-brand: JBoss
+brand: JBoss-ECS
debug:1
toc_section_depth:10
14 years
gatein SVN: r4674 - in portal/trunk: webui/portal/src/main/java/org/exoplatform/portal/webui/application and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-10-14 21:59:25 -0400 (Thu, 14 Oct 2010)
New Revision: 4674
Modified:
portal/trunk/pom.xml
portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
Log:
- Updated to use PC 2.2.0-BETA06-SNAPSHOT and adapted to CacheLevel changes.
- GTNWSRP-97: retrieve WSRP-specific parameters from servlet request and set them as attributes of the invocation so that they can be used by the WSRP component. This is needed when the consumer uses templates.
Modified: portal/trunk/pom.xml
===================================================================
--- portal/trunk/pom.xml 2010-10-15 01:53:39 UTC (rev 4673)
+++ portal/trunk/pom.xml 2010-10-15 01:59:25 UTC (rev 4674)
@@ -46,7 +46,7 @@
<nl.captcha.simplecaptcha.version>1.1.1-GA-Patch01</nl.captcha.simplecaptcha.version>
<org.gatein.common.version>2.0.3-GA</org.gatein.common.version>
<org.gatein.wci.version>2.0.2-GA</org.gatein.wci.version>
- <org.gatein.pc.version>2.2.0-Beta05</org.gatein.pc.version>
+ <org.gatein.pc.version>2.2.0-Beta06-SNAPSHOT</org.gatein.pc.version>
<org.picketlink.idm>1.1.6.GA</org.picketlink.idm>
<org.gatein.wsrp.version>2.0.0-Beta02-SNAPSHOT</org.gatein.wsrp.version>
<org.gatein.mop.version>1.0.3-GA</org.gatein.mop.version>
Modified: portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java
===================================================================
--- portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2010-10-15 01:53:39 UTC (rev 4673)
+++ portal/trunk/webui/portal/src/main/java/org/exoplatform/portal/webui/application/UIPortlet.java 2010-10-15 01:59:25 UTC (rev 4674)
@@ -79,6 +79,11 @@
import org.gatein.pc.portlet.impl.spi.AbstractServerContext;
import org.gatein.pc.portlet.impl.spi.AbstractWindowContext;
+import javax.portlet.PortletMode;
+import javax.portlet.WindowState;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.namespace.QName;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
@@ -89,16 +94,10 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
-import java.util.Map.Entry;
-import javax.portlet.PortletMode;
-import javax.portlet.WindowState;
-import javax.servlet.http.Cookie;
-import javax.servlet.http.HttpServletRequest;
-import javax.xml.namespace.QName;
-
/** May 19, 2006 */
@ComponentConfig(lifecycle = UIPortletLifecycle.class, template = "system:/groovy/portal/webui/application/UIPortlet.gtmpl", events = {
@EventConfig(listeners = RenderActionListener.class),
@@ -115,6 +114,10 @@
protected static final Log log = ExoLogger.getLogger("portal:UIPortlet");
static final public String DEFAULT_THEME = "Default:DefaultTheme::Vista:VistaTheme::Mac:MacTheme";
+ private static final String WSRP_URL = "wsrp-url";
+ private static final String WSRP_PREFER_OPERATION = "wsrp-preferOperation";
+ private static final String WSRP_REQUIRES_REWRITE = "wsrp-requiresRewrite";
+ private static final String WSRP_NAVIGATIONAL_VALUES = "wsrp-navigationalValues";
/** . */
private String storageId;
@@ -162,9 +165,9 @@
private StateString navigationalState;
- /** A field storing localized value of javax.portlet.title **/
+ /** A field storing localized value of javax.portlet.title * */
private String configuredTitle;
-
+
public UIPortlet()
{
// That value will be overriden when it is mapped onto a data storage
@@ -661,7 +664,7 @@
Map<String, String[]> publicParams = uiPortal.getPublicParameters();
Set<String> allPublicParamsNames = publicParams.keySet();
List<String> supportedPublicParamNames = getPublicRenderParamNames();
-
+
for (String oneOfAllParams : allPublicParamsNames)
{
if (supportedPublicParamNames.contains(oneOfAllParams))
@@ -669,14 +672,14 @@
publicParamsMap.put(oneOfAllParams, publicParams.get(oneOfAllParams));
}
}
-
+
// Handle exposed portal contextual properties
ContextualPropertyManager propertyManager = this.getApplicationComponent(ContextualPropertyManager.class);
Map<QName, String[]> exposedPortalState = propertyManager.getProperties(this);
- for(QName prpQName : exposedPortalState.keySet())
+ for (QName prpQName : exposedPortalState.keySet())
{
String prpId = supportsPublicParam(prpQName);
- if(prpId != null)
+ if (prpId != null)
{
publicParamsMap.put(prpId, exposedPortalState.get(prpQName));
}
@@ -711,7 +714,6 @@
if (type.equals(ActionInvocation.class))
{
ActionInvocation actionInvocation = new ActionInvocation(pic);
- actionInvocation.setForm(allParams);
actionInvocation.setRequestContext(new AbstractRequestContext(servletRequest));
String interactionState =
@@ -719,8 +721,12 @@
if (interactionState != null)
{
actionInvocation.setInteractionState(StateString.create(interactionState));
+ // remove the interaction state from remaining params
+ allParams.remove(ExoPortletInvocationContext.INTERACTION_STATE_PARAM_NAME);
}
+ actionInvocation.setForm(allParams);
+
invocation = type.cast(actionInvocation);
}
else if (type.equals(ResourceInvocation.class))
@@ -729,23 +735,49 @@
resourceInvocation.setRequestContext(new AbstractRequestContext(servletRequest));
String resourceId = servletRequest.getParameter(Constants.RESOURCE_ID_PARAMETER);
- if (resourceId != null)
+ if (!ParameterValidation.isNullOrEmpty(resourceId))
{
resourceInvocation.setResourceId(resourceId);
}
String cachability = servletRequest.getParameter(Constants.CACHELEVEL_PARAMETER);
- if (cachability != null)
+ if (!ParameterValidation.isNullOrEmpty(cachability))
{
- resourceInvocation.setCacheLevel(CacheLevel.valueOf(cachability));
+ // we need to convert the given value to upper case as it might come from WSRP in lower case
+ resourceInvocation.setCacheLevel(CacheLevel.create(cachability.toUpperCase(Locale.ENGLISH)));
}
String resourceState = servletRequest.getParameter(ExoPortletInvocationContext.RESOURCE_STATE_PARAM_NAME);
- if (resourceState != null)
+ if (!ParameterValidation.isNullOrEmpty(resourceState))
{
resourceInvocation.setResourceState(StateString.create(resourceState));
}
+ // remove the resource state from remaining params
+ allParams.remove(ExoPortletInvocationContext.RESOURCE_STATE_PARAM_NAME);
+ // deal with WSRP-specific parameters: add them to the invocation attributes if they exist and remove them from form params
+ String url = servletRequest.getParameter(WSRP_URL);
+ if (!ParameterValidation.isNullOrEmpty(url))
+ {
+ resourceInvocation.setAttribute(WSRP_URL, url);
+ }
+ allParams.remove(WSRP_URL);
+
+ String preferOperation = servletRequest.getParameter(WSRP_PREFER_OPERATION);
+ if (!ParameterValidation.isNullOrEmpty(preferOperation))
+ {
+ resourceInvocation.setAttribute(WSRP_PREFER_OPERATION, preferOperation);
+ }
+ allParams.remove(WSRP_PREFER_OPERATION);
+
+ String requiresRewrite = servletRequest.getParameter(WSRP_REQUIRES_REWRITE);
+ if (!ParameterValidation.isNullOrEmpty(requiresRewrite))
+ {
+ resourceInvocation.setAttribute(WSRP_REQUIRES_REWRITE, requiresRewrite);
+ }
+ allParams.remove(WSRP_REQUIRES_REWRITE);
+ // End WSRP-specific parameters handling
+
resourceInvocation.setForm(allParams);
invocation = type.cast(resourceInvocation);
@@ -766,9 +798,19 @@
// Navigational state
invocation.setNavigationalState(navigationalState);
- // Public navigational state
+ // Public navigational state
invocation.setPublicNavigationalState(this.getPublicParameters());
+ // WSRP-specific public navigational state handling needed when we have a URL coming from template
+ String navigationalValues = servletRequest.getParameter(WSRP_NAVIGATIONAL_VALUES);
+ if(!ParameterValidation.isNullOrEmpty(navigationalValues))
+ {
+ // add to the invocation attributes so that it can be retrieved and used by the WSRP component
+ invocation.setAttribute(WSRP_NAVIGATIONAL_VALUES, navigationalValues);
+ }
+ allParams.remove(WSRP_NAVIGATIONAL_VALUES);
+ // End WSRP-specific public navigational state handling
+
// Mode
invocation.setMode(Mode.create(getCurrentPortletMode().toString()));
@@ -777,7 +819,7 @@
StatefulPortletContext<C> preferencesPortletContext = getPortletContext();
if (preferencesPortletContext == null)
- {
+ {
return null;
}
@@ -866,22 +908,24 @@
ModelAdapter<S, C> adapter = ModelAdapter.getAdapter(state.getApplicationType());
PortletContext producerOfferedPortletContext = adapter.getProducerOfferedPortletContext(applicationId);
org.gatein.pc.api.Portlet producedOfferedPortlet;
-
+
try
{
- producedOfferedPortlet = portletInvoker.getPortlet(producerOfferedPortletContext);
+ producedOfferedPortlet = portletInvoker.getPortlet(producerOfferedPortletContext);
}
catch (NoSuchPortletException nspe)
{
- producedOfferedPortlet = null;
- nspe.printStackTrace();
+ producedOfferedPortlet = null;
+ nspe.printStackTrace();
}
-
+
this.adapter = adapter;
this.producerOfferedPortletContext = producerOfferedPortletContext;
this.producedOfferedPortlet = producedOfferedPortlet;
this.applicationId = applicationId;
- } catch(NoSuchDataException de){
+ }
+ catch (NoSuchDataException de)
+ {
log.error(de.getMessage());
throw de;
}
@@ -973,37 +1017,38 @@
{
this.navigationalState = navigationalState;
}
-
+
protected void setConfiguredTitle(String _configuredTitle)
{
- this.configuredTitle = _configuredTitle;
+ this.configuredTitle = _configuredTitle;
}
-
+
/**
* Returns the title showed on the InfoBar. The title is computed in following manner.
- *
- * 1. First, the method getTitle(), inherited from UIPortalComponent is called. The getTitle() returns
- * what users set in the PortletSetting tab, the current method returns call result if it is not null.
- *
+ * <p/>
+ * 1. First, the method getTitle(), inherited from UIPortalComponent is called. The getTitle() returns what users set
+ * in the PortletSetting tab, the current method returns call result if it is not null.
+ * <p/>
* 2. configuredTitle, which is the localized value of javax.portlet.title is returned if it is not null.
- *
- * 3. If the method does not terminate at neither (1) nor (2), the configured display name is returned.
+ * <p/>
+ * 3. If the method does not terminate at neither (1) nor (2), the configured display name is returned.
+ *
* @return
*/
public String getDisplayTitle()
{
- String displayedTitle = getTitle();
- if(displayedTitle != null && displayedTitle.trim().length() > 0)
- {
- return displayedTitle;
- }
-
- if(configuredTitle != null)
- {
- return configuredTitle;
- }
-
- return getDisplayName();
-
+ String displayedTitle = getTitle();
+ if (displayedTitle != null && displayedTitle.trim().length() > 0)
+ {
+ return displayedTitle;
+ }
+
+ if (configuredTitle != null)
+ {
+ return configuredTitle;
+ }
+
+ return getDisplayName();
+
}
}
\ No newline at end of file
14 years
gatein SVN: r4673 - in components/wsrp/trunk: common/src/main/java/org/gatein/wsrp and 2 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-10-14 21:53:39 -0400 (Thu, 14 Oct 2010)
New Revision: 4673
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java
components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java
components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java
components/wsrp/trunk/pom.xml
Log:
- GTNWSRP-97, GTNWSRP-99:
+ Significantly improved URL templates by providing values where none were previously provided, including parameters that cannot be handled by PortletInvocationContext.renderURL method.
+ Parameters that cannot be handled regularly are passed around using the Invocation attribute mechanism. Note that this will require support from the portal side.
- Should now properly handle public navigational state provided via URL templates as well, though this hasn't been tested yet.
- Adapted to changes in PC CacheLevel.
- Moved public NS encoding and decoding methods from WSRPRenderURL to WSRPUtils.
- Use PC 2.2.0-BETA06-SNAPSHOT.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java 2010-10-14 21:44:04 UTC (rev 4672)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPRenderURL.java 2010-10-15 01:53:39 UTC (rev 4673)
@@ -23,17 +23,13 @@
package org.gatein.wsrp;
-import org.gatein.common.net.URLTools;
-import org.gatein.common.util.ParameterValidation;
import org.gatein.pc.api.Mode;
import org.gatein.pc.api.RenderURL;
import org.gatein.pc.api.StateString;
import org.gatein.pc.api.WindowState;
import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
-import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
@@ -63,7 +59,7 @@
String paramValue = getRawParameterValueFor(params, WSRP2RewritingConstants.NAVIGATIONAL_VALUES);
if (paramValue != null)
{
- publicNSChanges = decodePublicNS(paramValue);
+ publicNSChanges = WSRPUtils.decodePublicNS(paramValue);
params.remove(WSRP2RewritingConstants.NAVIGATIONAL_VALUES);
}
}
@@ -82,108 +78,7 @@
{
if (publicNSChanges != null)
{
- createURLParameter(sb, WSRP2RewritingConstants.NAVIGATIONAL_VALUES, encodePublicNS(publicNSChanges));
+ createURLParameter(sb, WSRP2RewritingConstants.NAVIGATIONAL_VALUES, WSRPUtils.encodePublicNS(publicNSChanges));
}
}
-
- /**
- * Encodes the public NS according to the rules found at <a href='http://docs.oasis-open.org/wsrp/v2/wsrp-2.0-spec-os-01.html#_wsrp-navigat...'>
- * http://docs.oasis-open.org/wsrp/v2/wsrp-2.0-spec-os-01.html#_wsrp-navigat...</a>
- *
- * @param publicNSChanges
- * @return
- */
- protected static String encodePublicNS(Map<String, String[]> publicNSChanges)
- {
- if (ParameterValidation.existsAndIsNotEmpty(publicNSChanges))
- {
- StringBuilder sb = new StringBuilder(128);
-
- Set<Map.Entry<String, String[]>> entries = publicNSChanges.entrySet();
- int entryNb = entries.size();
- int currentEntry = 0;
- for (Map.Entry<String, String[]> entry : entries)
- {
- String name = entry.getKey();
- String[] values = entry.getValue();
-
- if (ParameterValidation.existsAndIsNotEmpty(values))
- {
- int valueNb = values.length;
- int currentValueIndex = 0;
- for (String value : values)
- {
- sb.append(name).append("=").append(value);
- if (currentValueIndex++ != valueNb - 1)
- {
- sb.append("&");
- }
- }
- }
- else
- {
- sb.append(name);
- }
-
- if (currentEntry++ != entryNb - 1)
- {
- sb.append("&");
- }
- }
-
- return URLTools.encodeXWWWFormURL(sb.toString());
- }
- else
- {
- return null;
- }
- }
-
- protected static Map<String, String[]> decodePublicNS(String paramValue)
- {
- if (!ParameterValidation.isNullOrEmpty(paramValue))
- {
- String encodedURL = URLTools.decodeXWWWFormURL(paramValue);
- Map<String, String[]> publicNS = new HashMap<String, String[]>(7);
-
- boolean finished = false;
- while (encodedURL.length() > 0 && !finished)
- {
- int endParamIndex = encodedURL.indexOf(AMPERSAND);
- String param;
- if (endParamIndex < 0)
- {
- // no param left: try the remainder of the String
- param = encodedURL;
- finished = true;
- }
- else
- {
- param = encodedURL.substring(0, endParamIndex);
- }
-
- int equalsIndex = param.indexOf(EQUALS);
- if (equalsIndex < 0)
- {
- publicNS.put(param, null);
- }
- else
- {
- // extract param name
- String name = param.substring(0, equalsIndex);
- // extract param value
- String value = param.substring(equalsIndex + EQUALS.length(), param.length());
-
- WSRPUtils.addMultiValuedValueTo(publicNS, name, value);
- }
- encodedURL = encodedURL.substring(endParamIndex + AMPERSAND.length());
- }
-
- return publicNS;
- }
- else
- {
- return null;
- }
- }
}
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-10-14 21:44:04 UTC (rev 4672)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPTypeFactory.java 2010-10-15 01:53:39 UTC (rev 4673)
@@ -40,6 +40,7 @@
import org.gatein.pc.api.spi.PortletInvocationContext;
import org.gatein.wsrp.payload.PayloadUtils;
import org.gatein.wsrp.spec.v2.ErrorCodes;
+import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
import org.oasis.wsrp.v2.BlockingInteractionResponse;
import org.oasis.wsrp.v2.CacheControl;
import org.oasis.wsrp.v2.ClientData;
@@ -134,6 +135,7 @@
import java.io.Serializable;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -150,7 +152,16 @@
*/
public class WSRPTypeFactory
{
- private static final String REQUIRE_REWRITE_URL_PARAM = "&" + WSRPRewritingConstants.RESOURCE_REQUIRES_REWRITE + "=" + WSRPRewritingConstants.WSRP_REQUIRES_REWRITE;
+ private static final String AMP = "&";
+ private static final String EQ = "=";
+ private static final String ADDITIONAL_RESOURCE_URL_PARAMS = AMP + RESOURCE_REQUIRES_REWRITE + EQ
+ + WSRP_REQUIRES_REWRITE + AMP + WSRPRewritingConstants.RESOURCE_URL + EQ + REWRITE_PARAMETER_OPEN
+ + WSRPRewritingConstants.RESOURCE_URL + REWRITE_PARAMETER_CLOSE + AMP
+ + WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION + EQ + REWRITE_PARAMETER_OPEN
+ + WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION + REWRITE_PARAMETER_CLOSE;
+ private static final OpaqueStateString WSRP_NAVIGATIONAL_STATE_TOKEN = new OpaqueStateString(REWRITE_PARAMETER_OPEN + NAVIGATIONAL_STATE + REWRITE_PARAMETER_CLOSE);
+ private static final WindowState WSRP_WINDOW_STATE_TOKEN = WindowState.create(REWRITE_PARAMETER_OPEN + WINDOW_STATE + REWRITE_PARAMETER_CLOSE, true);
+ private static final Mode WSRP_MODE_TOKEN = Mode.create(REWRITE_PARAMETER_OPEN + MODE + REWRITE_PARAMETER_CLOSE, true);
private WSRPTypeFactory()
{
@@ -738,11 +749,12 @@
return property;
}
+ private static final OpaqueStateString WSRP_INTERACTION_STATE_TOKEN = new OpaqueStateString(REWRITE_PARAMETER_OPEN + INTERACTION_STATE + REWRITE_PARAMETER_CLOSE);
private static final ActionURL ACTION_URL = new ActionURL()
{
public StateString getInteractionState()
{
- return new OpaqueStateString(REWRITE_PARAMETER_OPEN + INTERACTION_STATE + REWRITE_PARAMETER_CLOSE);
+ return WSRP_INTERACTION_STATE_TOKEN;
}
public StateString getNavigationalState()
@@ -766,6 +778,14 @@
}
};
+ private static final HashMap<String, String[]> WSRP_PNS_MAP_TOKEN = new HashMap<String, String[]>();
+
+ static
+ {
+ WSRP_PNS_MAP_TOKEN.put(WSRP2RewritingConstants.NAVIGATIONAL_VALUES,
+ new String[]{REWRITE_PARAMETER_OPEN + WSRP2RewritingConstants.NAVIGATIONAL_VALUES + REWRITE_PARAMETER_CLOSE});
+ }
+
private static final RenderURL RENDER_URL = new RenderURL()
{
public StateString getNavigationalState()
@@ -775,8 +795,7 @@
public Map<String, String[]> getPublicNavigationalStateChanges()
{
- // todo: implement properly
- return null;
+ return WSRP_PNS_MAP_TOKEN;
}
public Mode getMode()
@@ -795,23 +814,22 @@
}
};
- private static ResourceURL RESOURCE_URL = new WSRPResourceURL()
+ private static final OpaqueStateString WSRP_RESOURCE_STATE_TOKEN = new OpaqueStateString(REWRITE_PARAMETER_OPEN + WSRP2RewritingConstants.RESOURCE_STATE + REWRITE_PARAMETER_CLOSE);
+ private static ResourceURL RESOURCE_URL = new ResourceURL()
{
public String getResourceId()
{
- return REWRITE_PARAMETER_OPEN + WSRPRewritingConstants.RESOURCE_URL + REWRITE_PARAMETER_CLOSE;
+ return REWRITE_PARAMETER_OPEN + WSRP2RewritingConstants.RESOURCE_ID + REWRITE_PARAMETER_CLOSE;
}
public StateString getResourceState()
{
- // todo: fix-me
- return null;
+ return WSRP_RESOURCE_STATE_TOKEN;
}
public CacheLevel getCacheability()
{
- // todo: fix-me
- return null;
+ return CacheLevel.create(REWRITE_PARAMETER_OPEN + WSRP2RewritingConstants.RESOURCE_CACHEABILITY + REWRITE_PARAMETER_CLOSE);
}
public Mode getMode()
@@ -828,21 +846,26 @@
{
return getTemplateNS();
}
+
+ public Map<String, String> getProperties()
+ {
+ return Collections.emptyMap();
+ }
};
private static StateString getTemplateNS()
{
- return new OpaqueStateString(REWRITE_PARAMETER_OPEN + NAVIGATIONAL_STATE + REWRITE_PARAMETER_CLOSE);
+ return WSRP_NAVIGATIONAL_STATE_TOKEN;
}
private static WindowState getTemplateWindowState()
{
- return WindowState.create(REWRITE_PARAMETER_OPEN + WINDOW_STATE + REWRITE_PARAMETER_CLOSE, true);
+ return WSRP_WINDOW_STATE_TOKEN;
}
private static Mode getTemplateMode()
{
- return Mode.create(REWRITE_PARAMETER_OPEN + MODE + REWRITE_PARAMETER_CLOSE, true);
+ return WSRP_MODE_TOKEN;
}
@@ -862,8 +885,6 @@
templates.setRenderTemplate(createTemplate(context, RENDER_URL, Boolean.FALSE));
templates.setSecureBlockingActionTemplate(createTemplate(context, ACTION_URL, Boolean.TRUE));
templates.setSecureRenderTemplate(createTemplate(context, RENDER_URL, Boolean.TRUE));
-
- //fix-me: deal with resources properly, create fake ones for now
templates.setResourceTemplate(createTemplate(context, RESOURCE_URL, false));
templates.setSecureResourceTemplate(createTemplate(context, RESOURCE_URL, true));
@@ -894,7 +915,7 @@
// fix for GTNWSRP-22
if (RESOURCE_URL == url)
{
- template += REQUIRE_REWRITE_URL_PARAM;
+ template += ADDITIONAL_RESOURCE_URL_PARAMS;
}
return template;
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java 2010-10-14 21:44:04 UTC (rev 4672)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPUtils.java 2010-10-15 01:53:39 UTC (rev 4673)
@@ -300,7 +300,7 @@
{
return CacheLevel.PAGE;
}
- return CacheLevel.valueOf(resourceCacheability.toUpperCase(Locale.ENGLISH));
+ return CacheLevel.create(resourceCacheability.toUpperCase(Locale.ENGLISH));
}
@@ -569,6 +569,107 @@
}
/**
+ * Encodes the public NS according to the rules found at <a href='http://docs.oasis-open.org/wsrp/v2/wsrp-2.0-spec-os-01.html#_wsrp-navigat...'>
+ * http://docs.oasis-open.org/wsrp/v2/wsrp-2.0-spec-os-01.html#_wsrp-navigat...</a>
+ *
+ * @param publicNSChanges
+ * @return
+ */
+ public static String encodePublicNS(Map<String, String[]> publicNSChanges)
+ {
+ if (ParameterValidation.existsAndIsNotEmpty(publicNSChanges))
+ {
+ StringBuilder sb = new StringBuilder(128);
+
+ Set<Map.Entry<String, String[]>> entries = publicNSChanges.entrySet();
+ int entryNb = entries.size();
+ int currentEntry = 0;
+ for (Map.Entry<String, String[]> entry : entries)
+ {
+ String name = entry.getKey();
+ String[] values = entry.getValue();
+
+ if (ParameterValidation.existsAndIsNotEmpty(values))
+ {
+ int valueNb = values.length;
+ int currentValueIndex = 0;
+ for (String value : values)
+ {
+ sb.append(name).append("=").append(value);
+ if (currentValueIndex++ != valueNb - 1)
+ {
+ sb.append("&");
+ }
+ }
+ }
+ else
+ {
+ sb.append(name);
+ }
+
+ if (currentEntry++ != entryNb - 1)
+ {
+ sb.append("&");
+ }
+ }
+
+ return URLTools.encodeXWWWFormURL(sb.toString());
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public static Map<String, String[]> decodePublicNS(String paramValue)
+ {
+ if (!ParameterValidation.isNullOrEmpty(paramValue))
+ {
+ String encodedURL = URLTools.decodeXWWWFormURL(paramValue);
+ Map<String, String[]> publicNS = new HashMap<String, String[]>(7);
+
+ boolean finished = false;
+ while (encodedURL.length() > 0 && !finished)
+ {
+ int endParamIndex = encodedURL.indexOf(WSRPPortletURL.AMPERSAND);
+ String param;
+ if (endParamIndex < 0)
+ {
+ // no param left: try the remainder of the String
+ param = encodedURL;
+ finished = true;
+ }
+ else
+ {
+ param = encodedURL.substring(0, endParamIndex);
+ }
+
+ int equalsIndex = param.indexOf(WSRPPortletURL.EQUALS);
+ if (equalsIndex < 0)
+ {
+ publicNS.put(param, null);
+ }
+ else
+ {
+ // extract param name
+ String name = param.substring(0, equalsIndex);
+ // extract param value
+ String value = param.substring(equalsIndex + WSRPPortletURL.EQUALS.length(), param.length());
+
+ addMultiValuedValueTo(publicNS, name, value);
+ }
+ encodedURL = encodedURL.substring(endParamIndex + WSRPPortletURL.AMPERSAND.length());
+ }
+
+ return publicNS;
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
* @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
* @version $Revision$
*/
Modified: components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java
===================================================================
--- components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java 2010-10-14 21:44:04 UTC (rev 4672)
+++ components/wsrp/trunk/common/src/test/java/org/gatein/wsrp/WSRPRenderURLTestCase.java 2010-10-15 01:53:39 UTC (rev 4673)
@@ -56,13 +56,13 @@
publicNS.put("p1", new String[]{"value1", "value2"});
publicNS.put("p2", null);
- String actual = WSRPRenderURL.encodePublicNS(publicNS);
+ String actual = WSRPUtils.encodePublicNS(publicNS);
assertEquals("p1%3Dvalue1%26p1%3Dvalue2%26p2", actual);
}
public void testPublicNavigationalStateDecoding()
{
- Map<String, String[]> publicNS = WSRPRenderURL.decodePublicNS("p1%3Dvalue1%26p1%3Dvalue2%26p2");
+ Map<String, String[]> publicNS = WSRPUtils.decodePublicNS("p1%3Dvalue1%26p1%3Dvalue2%26p2");
assertEquals(2, publicNS.size());
assertTrue(publicNS.containsKey("p2"));
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java 2010-10-14 21:44:04 UTC (rev 4672)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationDispatcher.java 2010-10-15 01:53:39 UTC (rev 4673)
@@ -28,6 +28,7 @@
import org.gatein.common.net.media.MediaType;
import org.gatein.common.net.media.TypeDef;
import org.gatein.common.util.MultiValuedPropertyMap;
+import org.gatein.common.util.ParameterValidation;
import org.gatein.common.util.Tools;
import org.gatein.pc.api.PortletInvokerException;
import org.gatein.pc.api.invocation.ActionInvocation;
@@ -88,13 +89,27 @@
}
else if (invocation instanceof ResourceInvocation)
{
- String resourceInvocationId = ((ResourceInvocation)invocation).getResourceId();
+ ResourceInvocation resourceInvocation = (ResourceInvocation)invocation;
+ String resourceInvocationId = resourceInvocation.getResourceId();
+ String resourceId;
+ String resourceURL;
+ String preferOperationAsString;
- Map<String, String> resourceMap = WSRPResourceURL.decodeResource(resourceInvocationId);
+ if (!ParameterValidation.isNullOrEmpty(resourceInvocationId))
+ {
+ Map<String, String> resourceMap = WSRPResourceURL.decodeResource(resourceInvocationId);
+ resourceId = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
+ resourceURL = resourceMap.get(WSRPRewritingConstants.RESOURCE_URL);
+ preferOperationAsString = resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION);
+ }
+ else
+ {
+ // GateIn-specific: WSRP-specific URL parameters might also be put as attributes by UIPortlet when the invocation is created
+ resourceId = (String)resourceInvocation.getAttribute(WSRP2RewritingConstants.RESOURCE_ID);
+ resourceURL = (String)resourceInvocation.getAttribute(WSRPRewritingConstants.RESOURCE_URL);
+ preferOperationAsString = (String)resourceInvocation.getAttribute(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION);
+ }
- String resourceId = resourceMap.get(WSRP2RewritingConstants.RESOURCE_ID);
- String resourceURL = resourceMap.get(WSRPRewritingConstants.RESOURCE_URL);
- String preferOperationAsString = resourceMap.get(WSRP2RewritingConstants.RESOURCE_PREFER_OPERATION);
boolean preferOperation = (preferOperationAsString != null && Boolean.parseBoolean(preferOperationAsString));
if (consumer.isUsingWSRP2() && (preferOperation || resourceURL == null || (resourceId != null && resourceId.length() > 0)))
Modified: components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java
===================================================================
--- components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java 2010-10-14 21:44:04 UTC (rev 4672)
+++ components/wsrp/trunk/consumer/src/main/java/org/gatein/wsrp/consumer/handlers/InvocationHandler.java 2010-10-15 01:53:39 UTC (rev 4673)
@@ -38,6 +38,7 @@
import org.gatein.wsrp.WSRPTypeFactory;
import org.gatein.wsrp.WSRPUtils;
import org.gatein.wsrp.consumer.WSRPConsumerImpl;
+import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
import org.oasis.wsrp.v2.InvalidCookie;
import org.oasis.wsrp.v2.InvalidRegistration;
import org.oasis.wsrp.v2.InvalidSession;
@@ -390,6 +391,14 @@
// navigational state
StateString navigationalState = invocation.getNavigationalState();
Map<String, String[]> publicNavigationalState = invocation.getPublicNavigationalState();
+
+ // it is possible to get additonal public navigational state from the invocation attributes if the producer used templates:
+ String publicNS = (String)invocation.getAttribute(WSRP2RewritingConstants.NAVIGATIONAL_VALUES);
+ if (!ParameterValidation.isNullOrEmpty(publicNS))
+ {
+ publicNavigationalState.putAll(WSRPUtils.decodePublicNS(publicNS));
+ }
+
NavigationalContext navigationalContext = WSRPTypeFactory.createNavigationalContextOrNull(navigationalState, publicNavigationalState);
getMarkupParams().setNavigationalContext(navigationalContext);
Modified: components/wsrp/trunk/pom.xml
===================================================================
--- components/wsrp/trunk/pom.xml 2010-10-14 21:44:04 UTC (rev 4672)
+++ components/wsrp/trunk/pom.xml 2010-10-15 01:53:39 UTC (rev 4673)
@@ -21,7 +21,8 @@
~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -46,7 +47,7 @@
</scm>
<properties>
- <version.gatein.pc>2.2.0-Beta05</version.gatein.pc>
+ <version.gatein.pc>2.2.0-Beta06-SNAPSHOT</version.gatein.pc>
<version.gatein.common>2.0.3-GA</version.gatein.common>
<version.gatein.wci>2.0.2-GA</version.gatein.wci>
14 years
gatein SVN: r4672 - in portal/trunk/component/scripting/src: test/java/org/exoplatform/groovyscript and 1 other directory.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-10-14 17:44:04 -0400 (Thu, 14 Oct 2010)
New Revision: 4672
Modified:
portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/TemplateParser.java
portal/trunk/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java
Log:
GTNPORTAL-1563: Backslash not properly handled in gtmpl
Modified: portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/TemplateParser.java
===================================================================
--- portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/TemplateParser.java 2010-10-14 19:54:25 UTC (rev 4671)
+++ portal/trunk/component/scripting/src/main/java/org/exoplatform/groovyscript/TemplateParser.java 2010-10-14 21:44:04 UTC (rev 4672)
@@ -55,7 +55,9 @@
GSTRING_CURLY_EXPR,
- GSTRING_EXPR
+ GSTRING_EXPR,
+
+ BACKSLASH
}
public List<TemplateSection> parse(String s)
@@ -127,6 +129,10 @@
{
status = Status.START_ANGLE;
}
+ else if (c == '\\')
+ {
+ status = Status.BACKSLASH;
+ }
else if (c == '$')
{
status = Status.MAYBE_GSTRING_EXPR;
@@ -286,6 +292,11 @@
accumulator.append(c);
}
break;
+ case BACKSLASH:
+ accumulator.append('\\');
+ accumulator.append(c);
+ status = Status.TEXT;
+ break;
default:
throw new AssertionError();
}
Modified: portal/trunk/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java
===================================================================
--- portal/trunk/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java 2010-10-14 19:54:25 UTC (rev 4671)
+++ portal/trunk/component/scripting/src/test/java/org/exoplatform/groovyscript/TestTemplateRendering.java 2010-10-14 21:44:04 UTC (rev 4672)
@@ -173,7 +173,7 @@
assertEquals("bar", s);
}
- public void testGString2() throws Exception
+ public void testQuoteAfterGString() throws Exception
{
GroovyTemplate template = new GroovyTemplate("$foo\"");
Map<String, String> context = new HashMap<String, String>();
@@ -182,6 +182,51 @@
assertEquals("bar\"", s);
}
+ public void testDollarInExpression() throws Exception
+ {
+ GroovyTemplate template = new GroovyTemplate("<%= \"$foo\" %>");
+ Map<String, String> context = new HashMap<String, String>();
+ context.put("foo", "bar");
+ String s = template.render(context);
+ assertEquals("bar", s);
+ }
+
+ public void testEscapeDollarInExpression() throws Exception
+ {
+ GroovyTemplate template = new GroovyTemplate("<%= \"\\$foo\" %>");
+ Map<String, String> context = new HashMap<String, String>();
+ context.put("foo", "bar");
+ String s = template.render(context);
+ assertEquals("$foo", s);
+ }
+
+ public void testEscapeDollarInText() throws Exception
+ {
+ GroovyTemplate template = new GroovyTemplate("\\$foo");
+ Map<String, String> context = new HashMap<String, String>();
+ context.put("foo", "bar");
+ String s = template.render(context);
+ assertEquals("$foo", s);
+ }
+
+ public void testDollarInScriplet() throws Exception
+ {
+ GroovyTemplate template = new GroovyTemplate("<% out.print(\"$foo\") %>");
+ Map<String, String> context = new HashMap<String, String>();
+ context.put("foo", "bar");
+ String s = template.render(context);
+ assertEquals("bar", s);
+ }
+
+ public void testEscapeDollarInScriplet() throws Exception
+ {
+ GroovyTemplate template = new GroovyTemplate("<% out.print(\"\\$foo\") %>");
+ Map<String, String> context = new HashMap<String, String>();
+ context.put("foo", "bar");
+ String s = template.render(context);
+ assertEquals("$foo", s);
+ }
+
public void testQuote() throws Exception
{
GroovyTemplate template = new GroovyTemplate("\"");
14 years
gatein SVN: r4671 - in components/pc/trunk: portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-10-14 15:54:25 -0400 (Thu, 14 Oct 2010)
New Revision: 4671
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/Mode.java
components/pc/trunk/api/src/main/java/org/gatein/pc/api/WindowState.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/StateAwareResponseImpl.java
Log:
- Made constructors private so that clients use the factory methods instead.
- Improved code a little.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/Mode.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/Mode.java 2010-10-14 19:51:38 UTC (rev 4670)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/Mode.java 2010-10-14 19:54:25 UTC (rev 4671)
@@ -53,7 +53,7 @@
/** . */
private String name;
- public Mode(String name)
+ private Mode(String name)
{
this(name, false);
}
@@ -99,22 +99,12 @@
private Object readResolve()
{
- if (VIEW.name.equals(name))
+ Mode standardMode = isStandardMode(name);
+
+ if (standardMode != null)
{
- return VIEW;
+ return standardMode;
}
- else if (EDIT.name.equals(name))
- {
- return EDIT;
- }
- else if (HELP.name.equals(name))
- {
- return HELP;
- }
- else if (EDIT_DEFAULTS.name.equals(name))
- {
- return EDIT_DEFAULTS;
- }
else
{
return this;
@@ -134,6 +124,19 @@
*/
public static Mode create(String name, boolean preserveCase)
{
+ Mode standardMode = isStandardMode(name);
+ if (standardMode != null)
+ {
+ return standardMode;
+ }
+ else
+ {
+ return new Mode(name, preserveCase);
+ }
+ }
+
+ private static Mode isStandardMode(String name)
+ {
if (Mode.VIEW.name.equals(name))
{
return Mode.VIEW;
@@ -156,7 +159,7 @@
}
else
{
- return new Mode(name, preserveCase);
+ return null;
}
}
}
\ No newline at end of file
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/WindowState.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/WindowState.java 2010-10-14 19:51:38 UTC (rev 4670)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/WindowState.java 2010-10-14 19:54:25 UTC (rev 4671)
@@ -47,7 +47,7 @@
/** . */
private String name;
- public WindowState(String name)
+ private WindowState(String name)
{
this(name, false);
}
@@ -93,6 +93,19 @@
private Object readResolve()
{
+ WindowState standardWindowState = isStandardWindowState(name);
+ if (standardWindowState != null)
+ {
+ return standardWindowState;
+ }
+ else
+ {
+ return this;
+ }
+ }
+
+ private static WindowState isStandardWindowState(String name)
+ {
if (NORMAL.name.equals(name))
{
return NORMAL;
@@ -107,7 +120,7 @@
}
else
{
- return this;
+ return null;
}
}
@@ -124,18 +137,11 @@
*/
public static WindowState create(String name, boolean preserveCase)
{
- if (WindowState.NORMAL.name.equals(name))
+ WindowState standardWindowState = isStandardWindowState(name);
+ if (standardWindowState != null)
{
- return WindowState.NORMAL;
+ return standardWindowState;
}
- else if (WindowState.MINIMIZED.name.equals(name))
- {
- return WindowState.MINIMIZED;
- }
- else if (WindowState.MAXIMIZED.name.equals(name))
- {
- return WindowState.MAXIMIZED;
- }
else
{
return new WindowState(name, preserveCase);
Modified: components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/StateAwareResponseImpl.java
===================================================================
--- components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2010-10-14 19:51:38 UTC (rev 4670)
+++ components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/StateAwareResponseImpl.java 2010-10-14 19:54:25 UTC (rev 4671)
@@ -22,20 +22,20 @@
******************************************************************************/
package org.gatein.pc.portlet.impl.jsr168.api;
+import org.gatein.common.NotYetImplemented;
import org.gatein.common.logging.Logger;
-import org.gatein.common.NotYetImplemented;
import org.gatein.common.logging.LoggerFactory;
import org.gatein.common.util.Tools;
import org.gatein.pc.api.ParametersStateString;
+import org.gatein.pc.api.invocation.PortletInvocation;
+import org.gatein.pc.api.invocation.response.HTTPRedirectionResponse;
+import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
+import org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse;
import org.gatein.pc.portlet.impl.info.ContainerEventInfo;
import org.gatein.pc.portlet.impl.info.ContainerPortletApplicationInfo;
import org.gatein.pc.portlet.impl.info.ContainerTypeInfo;
import org.gatein.pc.portlet.impl.jsr168.PortletApplicationImpl;
import org.gatein.pc.portlet.impl.jsr168.PortletParameterMap;
-import org.gatein.pc.api.invocation.PortletInvocation;
-import org.gatein.pc.api.invocation.response.HTTPRedirectionResponse;
-import org.gatein.pc.api.invocation.response.PortletInvocationResponse;
-import org.gatein.pc.api.invocation.response.UpdateNavigationalStateResponse;
import javax.portlet.PortletMode;
import javax.portlet.PortletModeException;
@@ -362,10 +362,10 @@
protected PortletParameterMap navigationalState = new PortletParameterMap(preq.navigationInfo);
/** The new window state requested. */
- protected org.gatein.pc.api.WindowState windowState = new org.gatein.pc.api.WindowState(preq.getWindowState().toString());
+ protected org.gatein.pc.api.WindowState windowState = org.gatein.pc.api.WindowState.create(preq.getWindowState().toString());
/** The new mode requested. */
- protected org.gatein.pc.api.Mode mode = new org.gatein.pc.api.Mode(preq.getPortletMode().toString());
+ protected org.gatein.pc.api.Mode mode = org.gatein.pc.api.Mode.create(preq.getPortletMode().toString());
protected PortletInvocationResponse getResponse()
{
14 years
gatein SVN: r4670 - in components/pc/trunk: api/src/test/java/org/gatein/pc/api and 3 other directories.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-10-14 15:51:38 -0400 (Thu, 14 Oct 2010)
New Revision: 4670
Added:
components/pc/trunk/api/src/test/java/org/gatein/pc/api/cache/
components/pc/trunk/api/src/test/java/org/gatein/pc/api/cache/CacheLevelTestCase.java
Modified:
components/pc/trunk/api/src/main/java/org/gatein/pc/api/cache/CacheLevel.java
components/pc/trunk/controller/src/main/java/org/gatein/pc/controller/impl/ControllerRequestFactory.java
components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceURLImpl.java
Log:
- GTNPC-35: Changed CacheLevel into a class instead of an enumeration so more values than standard ones can be used.
Modified: components/pc/trunk/api/src/main/java/org/gatein/pc/api/cache/CacheLevel.java
===================================================================
--- components/pc/trunk/api/src/main/java/org/gatein/pc/api/cache/CacheLevel.java 2010-10-14 12:39:34 UTC (rev 4669)
+++ components/pc/trunk/api/src/main/java/org/gatein/pc/api/cache/CacheLevel.java 2010-10-14 19:51:38 UTC (rev 4670)
@@ -22,13 +22,101 @@
******************************************************************************/
package org.gatein.pc.api.cache;
+import org.gatein.common.util.ParameterValidation;
+
+import java.io.Serializable;
+
/**
* @author <a href="mailto:julien@jboss.org">Julien Viet</a>
* @version $Revision: 630 $
*/
-public enum CacheLevel
+public final class CacheLevel implements Serializable
{
+ public static final CacheLevel FULL = new CacheLevel("FULL");
+ public static final CacheLevel PORTLET = new CacheLevel("PORTLET");
+ public static final CacheLevel PAGE = new CacheLevel("PAGE");
- FULL, PORTLET, PAGE
+ private static final long serialVersionUID = -7020875805659724988L;
+ private final String name;
+
+ private CacheLevel(String name)
+ {
+ ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(name, "CacheLevel name", null);
+ this.name = name;
+ }
+
+ public final String name()
+ {
+ return name;
+ }
+
+ private Object readResolve()
+ {
+ CacheLevel standardCacheLevel = isStandardCacheLevel(name);
+ if (standardCacheLevel != null)
+ {
+ return standardCacheLevel;
+ }
+ else
+ {
+ return this;
+ }
+ }
+
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ CacheLevel that = (CacheLevel)o;
+
+ return !(name == null ? that.name != null : !name.equals(that.name));
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return name != null ? name.hashCode() : 0;
+ }
+
+ public static CacheLevel create(String name)
+ {
+ CacheLevel standardCacheLevel = isStandardCacheLevel(name);
+ if (standardCacheLevel != null)
+ {
+ return standardCacheLevel;
+ }
+ else
+ {
+ return new CacheLevel(name);
+ }
+ }
+
+ private static CacheLevel isStandardCacheLevel(String name)
+ {
+ if (FULL.name.equals(name))
+ {
+ return FULL;
+ }
+ else if (PORTLET.name.equals(name))
+ {
+ return PORTLET;
+ }
+ else if (PAGE.name.equals(name))
+ {
+ return PAGE;
+ }
+ else
+ {
+ return null;
+ }
+ }
}
Added: components/pc/trunk/api/src/test/java/org/gatein/pc/api/cache/CacheLevelTestCase.java
===================================================================
--- components/pc/trunk/api/src/test/java/org/gatein/pc/api/cache/CacheLevelTestCase.java (rev 0)
+++ components/pc/trunk/api/src/test/java/org/gatein/pc/api/cache/CacheLevelTestCase.java 2010-10-14 19:51:38 UTC (rev 4670)
@@ -0,0 +1,102 @@
+/*
+* JBoss, a division of Red Hat
+* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* This is free software; you can redistribute it and/or modify it
+* under the terms of the GNU Lesser General Public License as
+* published by the Free Software Foundation; either version 2.1 of
+* the License, or (at your option) any later version.
+*
+* This software is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this software; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+*/
+
+package org.gatein.pc.api.cache;
+
+import junit.framework.TestCase;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+
+/**
+ * @author <a href="mailto:chris.laprun@jboss.com">Chris Laprun</a>
+ * @version $Revision$
+ */
+public class CacheLevelTestCase extends TestCase
+{
+ public void testCacheLevelFactory()
+ {
+ CacheLevel cacheLevel = CacheLevel.create("FULL");
+ assertTrue(CacheLevel.FULL == cacheLevel);
+ assertEquals(CacheLevel.FULL, cacheLevel);
+ assertEquals(CacheLevel.FULL.name(), cacheLevel.name());
+
+ cacheLevel = CacheLevel.create("PORTLET");
+ assertTrue(CacheLevel.PORTLET == cacheLevel);
+ assertEquals(CacheLevel.PORTLET, cacheLevel);
+ assertEquals(CacheLevel.PORTLET.name(), cacheLevel.name());
+
+ cacheLevel = CacheLevel.create("PAGE");
+ assertTrue(CacheLevel.PAGE == cacheLevel);
+ assertEquals(CacheLevel.PAGE, cacheLevel);
+ assertEquals(CacheLevel.PAGE.name(), cacheLevel.name());
+
+ try
+ {
+ CacheLevel.create(null);
+ fail("Shouldn't allow creating a CacheLevel with null name!");
+ }
+ catch (Exception e)
+ {
+ // expected
+ }
+
+ cacheLevel = CacheLevel.create("foo");
+ assertNotNull(cacheLevel);
+ assertEquals("foo", cacheLevel.name());
+ assertEquals(cacheLevel, CacheLevel.create("foo"));
+ }
+
+ public void testSerialization() throws IOException, ClassNotFoundException
+ {
+ Object read = serializeCacheLevel(CacheLevel.FULL);
+
+ assertTrue(CacheLevel.FULL == read);
+
+ CacheLevel foo = CacheLevel.create("foo");
+ read = serializeCacheLevel(foo);
+
+ assertEquals(foo, read);
+ }
+
+ private Object serializeCacheLevel(final CacheLevel cacheLevel)
+ throws IOException, ClassNotFoundException
+ {
+ File tempFile = File.createTempFile("foo", "tmp");
+ tempFile.deleteOnExit();
+
+ FileOutputStream fos = new FileOutputStream(tempFile);
+ ObjectOutputStream oos = new ObjectOutputStream(fos);
+ oos.writeObject(cacheLevel);
+ oos.close();
+
+ FileInputStream fis = new FileInputStream(tempFile);
+ ObjectInputStream ois = new ObjectInputStream(fis);
+ Object read = ois.readObject();
+ ois.close();
+ return read;
+ }
+}
Modified: components/pc/trunk/controller/src/main/java/org/gatein/pc/controller/impl/ControllerRequestFactory.java
===================================================================
--- components/pc/trunk/controller/src/main/java/org/gatein/pc/controller/impl/ControllerRequestFactory.java 2010-10-14 12:39:34 UTC (rev 4669)
+++ components/pc/trunk/controller/src/main/java/org/gatein/pc/controller/impl/ControllerRequestFactory.java 2010-10-14 19:51:38 UTC (rev 4670)
@@ -149,24 +149,26 @@
String resourceId = queryParameters.get(ControllerRequestParameterNames.RESOURCE_ID);
//
- CacheLevel resourceCacheLevel = CacheLevel.valueOf(queryParameters.get(ControllerRequestParameterNames.RESOURCE_CACHEABILITY));
+ CacheLevel resourceCacheLevel = CacheLevel.create(queryParameters.get(ControllerRequestParameterNames.RESOURCE_CACHEABILITY));
//
PortletResourceRequest.Scope scope;
- switch (resourceCacheLevel)
+ if (CacheLevel.FULL.equals(resourceCacheLevel))
{
- case FULL:
- scope = new PortletResourceRequest.FullScope();
- break;
- case PORTLET:
- scope = new PortletResourceRequest.PortletScope(windowNavigationalState);
- break;
- case PAGE:
- scope = new PortletResourceRequest.PageScope(windowNavigationalState, pageNavigationalState);
- break;
- default:
- throw new AssertionError();
+ scope = new PortletResourceRequest.FullScope();
}
+ else if (CacheLevel.PORTLET.equals(resourceCacheLevel))
+ {
+ scope = new PortletResourceRequest.PortletScope(windowNavigationalState);
+ }
+ else if (CacheLevel.PAGE.equals(resourceCacheLevel))
+ {
+ scope = new PortletResourceRequest.PageScope(windowNavigationalState, pageNavigationalState);
+ }
+ else
+ {
+ throw new AssertionError();
+ }
//
return new PortletResourceRequest(
Modified: components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceURLImpl.java
===================================================================
--- components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceURLImpl.java 2010-10-14 12:39:34 UTC (rev 4669)
+++ components/pc/trunk/portlet/src/main/java/org/gatein/pc/portlet/impl/jsr168/api/ResourceURLImpl.java 2010-10-14 19:51:38 UTC (rev 4670)
@@ -124,21 +124,16 @@
}
else
{
- switch (url.parentCacheLevel)
+ if (CacheLevel.FULL == url.parentCacheLevel && cacheLevel != CacheLevel.FULL)
{
- case FULL:
- if (cacheLevel != CacheLevel.FULL)
- {
- throw new IllegalStateException();
- }
- break;
- case PORTLET:
- if (cacheLevel == CacheLevel.PAGE)
- {
- throw new IllegalStateException();
- }
- break;
+ throw new IllegalStateException();
}
+
+ if (CacheLevel.PORTLET == url.parentCacheLevel && cacheLevel == CacheLevel.PAGE)
+ {
+ throw new IllegalStateException();
+ }
+
url.cacheLevel = cacheLevel;
}
}
14 years
gatein SVN: r4669 - in components/common/trunk/common/src: test/java/org/gatein/common and 1 other directory.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-10-14 08:39:34 -0400 (Thu, 14 Oct 2010)
New Revision: 4669
Modified:
components/common/trunk/common/src/main/java/org/gatein/common/text/TextTools.java
components/common/trunk/common/src/test/java/org/gatein/common/StringTestCase.java
Log:
- GTNCOMMON-13:
+ Added possibility of knowing whether the match was from a prefix only match.
+ Match is the remainder of the string if the match was from prefix only instead of simply the prefix.
+ Fixed an issue where the parser would miss matches if prefix and suffix are too close one to another.
Modified: components/common/trunk/common/src/main/java/org/gatein/common/text/TextTools.java
===================================================================
--- components/common/trunk/common/src/main/java/org/gatein/common/text/TextTools.java 2010-10-14 09:48:30 UTC (rev 4668)
+++ components/common/trunk/common/src/main/java/org/gatein/common/text/TextTools.java 2010-10-14 12:39:34 UTC (rev 4669)
@@ -136,7 +136,7 @@
* specify whether the substitution will happen only if the delimited String is non-empty by setting
* <code>replaceIfBoundedStringEmpty</code> to <code>false</code>. It is also possible to keep the boundaries (prefix
* and suffix) after the substitution by setting <code>keepBoundaries</code> to <code>true</code>. <br/> Note that it
- * is possible to specify that the suffix is optional, in which case, the prefix will be passed on to the specified
+ * is possible to specify that the suffix is optional, will be passed as a match on to the specified
* StringReplacementGenerator and be replaced. <br/> See org.gatein.common.StringTestCase.testReplaceBoundedString()
* for usage details.
*
@@ -168,6 +168,7 @@
int prefixIndex = tmp.indexOf(prefix);
final int prefixLength = prefix.length();
boolean suffixAbsent = suffix == null;
+ int suffixLength = suffixAbsent ? 0 : suffix.length();
// nothing to do if didn't ask for an optional suffix and we have one and it's not present in our string
if (!suffixIsOptional && suffix != null && tmp.indexOf(suffix) == -1)
@@ -181,17 +182,19 @@
int suffixIndex;
if (suffixAbsent)
{
+ String match = tmp.substring(prefixIndex + prefixLength);
+
// replace prefix with replacement
if (keepBoundaries)
{
// just insert replacement for prefix
- tmp.insert(prefixIndex + prefixLength, generator.getReplacementFor(prefix, prefix, suffix));
+ tmp.insert(prefixIndex + prefixLength, generator.getReplacementFor(match, prefix, suffix, true));
}
else
{
// delete prefix then insert remplacement instead
tmp.delete(prefixIndex, prefixIndex + prefixLength);
- tmp.insert(prefixIndex, generator.getReplacementFor(prefix, prefix, suffix));
+ tmp.insert(prefixIndex, generator.getReplacementFor(match, prefix, suffix, true));
}
// new lookup starting position
@@ -215,12 +218,20 @@
// if suffix is optional, look for potential next prefix instance that we'd need to replace
int nextPrefixIndex = tmp.indexOf(prefix, prefixIndex + prefixLength);
+ // check that we're not matching the suffix, which can happen if they are close one to another as is the case with WSRP
+ if (nextPrefixIndex >= suffixIndex && nextPrefixIndex <= (suffixIndex + suffixLength))
+ {
+ // if that's the case, look for the next one instead
+ nextPrefixIndex = tmp.indexOf(prefix, suffixIndex + suffixLength);
+ }
+
if (nextPrefixIndex != -1 && nextPrefixIndex <= suffixIndex)
{
// we've found an in-between prefix, use it as the suffix for the current match
// delete prefix then insert remplacement instead
+ String match = tmp.substring(prefixIndex + prefixLength, nextPrefixIndex);
tmp.delete(prefixIndex, prefixIndex + prefixLength);
- String replacement = generator.getReplacementFor(prefix, prefix, suffix);
+ String replacement = generator.getReplacementFor(match, prefix, suffix, true);
tmp.insert(prefixIndex, replacement);
prefixIndex = nextPrefixIndex - prefixLength + replacement.length();
@@ -232,9 +243,15 @@
if (replaceIfBoundedStringEmpty || suffixIndex != prefixIndex + prefixLength)
{
String match = tmp.substring(prefixIndex + prefixLength, suffixIndex);
+ String replacement = generator.getReplacementFor(match, prefix, suffix, false);
+ int changeInLength = replacement.length() - match.length();
+
+ // compute the next lookup index from which we will look for the next prefix
+ int nextLookupIndex = prefixIndex + changeInLength;
+
if (keepBoundaries)
{
- if (suffix != null)
+ if (!suffixAbsent)
{
// delete only match
tmp.delete(prefixIndex + prefixLength, suffixIndex);
@@ -243,13 +260,12 @@
{
// delete nothing
}
- tmp.insert(prefixIndex + prefixLength, generator.getReplacementFor(match, prefix, suffix));
+ tmp.insert(prefixIndex + prefixLength, replacement);
+ nextLookupIndex += prefixLength + suffixLength;
}
else
{
- int suffixLength = suffix != null ? suffix.length() : 0;
-
- if (suffix != null)
+ if (!suffixAbsent)
{
// if we have a suffix, delete everything between start of prefix and end of suffix
tmp.delete(prefixIndex, suffixIndex + suffixLength);
@@ -259,12 +275,14 @@
// only delete prefix
tmp.delete(prefixIndex, prefixIndex + prefixLength);
}
- tmp.insert(prefixIndex, generator.getReplacementFor(match, prefix, suffix));
+ tmp.insert(prefixIndex, replacement);
}
+
+ prefixIndex = nextLookupIndex;
}
}
- prefixIndex = tmp.indexOf(prefix, prefixIndex + prefixLength);
+ prefixIndex = tmp.indexOf(prefix, prefixIndex + 1); // +1 to avoid infinite loop on border cases
}
}
@@ -274,7 +292,7 @@
public static interface StringReplacementGenerator
{
- String getReplacementFor(String match, String prefix, String suffix);
+ String getReplacementFor(String match, String prefix, String suffix, boolean matchedPrefixOnly);
}
public static class ConstantStringReplacementGenerator implements StringReplacementGenerator
@@ -286,7 +304,7 @@
this.replacement = replacement;
}
- public String getReplacementFor(String match, String prefix, String suffix)
+ public String getReplacementFor(String match, String prefix, String suffix, boolean matchedPrefixOnly)
{
return replacement;
}
Modified: components/common/trunk/common/src/test/java/org/gatein/common/StringTestCase.java
===================================================================
--- components/common/trunk/common/src/test/java/org/gatein/common/StringTestCase.java 2010-10-14 09:48:30 UTC (rev 4668)
+++ components/common/trunk/common/src/test/java/org/gatein/common/StringTestCase.java 2010-10-14 12:39:34 UTC (rev 4669)
@@ -1,25 +1,25 @@
-/******************************************************************************
- * JBoss, a division of Red Hat *
- * Copyright 2009, Red Hat Middleware, LLC, and individual *
- * contributors as indicated by the @authors tag. See the *
- * copyright.txt in the distribution for a full listing of *
- * individual contributors. *
- * *
- * This is free software; you can redistribute it and/or modify it *
- * under the terms of the GNU Lesser General Public License as *
- * published by the Free Software Foundation; either version 2.1 of *
- * the License, or (at your option) any later version. *
- * *
- * This software is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this software; if not, write to the Free *
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org. *
- ******************************************************************************/
+/*
+ * JBoss, a division of Red Hat
+ * Copyright 2010, Red Hat Middleware, LLC, and individual
+ * contributors as indicated by the @authors tag. See the
+ * copyright.txt in the distribution for a full listing of
+ * individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.gatein.common;
import junit.framework.TestCase;
@@ -56,13 +56,13 @@
assertEquals("", TextTools.replaceAllInstancesOfBoundedString("", PREFIX, "", REPLACEMENT));
assertEquals("", TextTools.replaceAllInstancesOfBoundedString("", "", "", REPLACEMENT));
- DEF_GEN.setExpectedMatch("");
+ DEF_GEN.setExpectedMatch(new Pair("", false));
assertEquals(REPLACEMENT, TextTools.replaceAllInstancesOfBoundedString("PREFIXSUF", PREFIX, SUFFIX, DEF_GEN));
- DEF_GEN.setExpectedMatch("bbbbb");
+ DEF_GEN.setExpectedMatch(new Pair("bbbbb", false));
assertEquals("aaaaREPLACEMENTccccc", TextTools.replaceAllInstancesOfBoundedString("aaaaPREFIXbbbbbSUFccccc", PREFIX, SUFFIX, DEF_GEN));
- DEF_GEN.setExpectedMatch(null);
+ DEF_GEN.setExpectedMatch((Pair)null);
assertEquals("aaaPREFIXbbbbSUFF", TextTools.replaceAllInstancesOfBoundedString("aaaPREFIXbbbbSUFF", PREFIX, "SUFFI", DEF_GEN));
assertEquals("aRcccReeeR", TextTools.replaceAllInstancesOfBoundedString("aPbbScccPdSeeePS", "P", "S", "R"));
}
@@ -73,22 +73,75 @@
replaceBoundedString(true);
}
+ public void testReplaceStringsWithNullSuffix()
+ {
+ replaceStringsWithOptionalSuffix(false, null);
+ replaceStringsWithOptionalSuffix(true, null);
+ }
+
+ public void testReplaceStringsWithOptionalSuffix()
+ {
+ replaceStringsWithOptionalSuffix(true, SUFFIX);
+ buildTest(REPLACEMENT + "blah" + REPLACEMENT + "foo", PREFIX + "blah" + PREFIX + "replaced" + SUFFIX + "foo", REPLACEMENT, PREFIX, SUFFIX, false, false, true, new Pair("blah", true), new Pair("replaced", false));
+ buildTest(REPLACEMENT + "blah" + PREFIX + REPLACEMENT + SUFFIX + "foo", PREFIX + "blah" + PREFIX + "replaced" + SUFFIX + "foo", REPLACEMENT, PREFIX, SUFFIX, false, true, true, new Pair("blah", true), new Pair("replaced", false));
+ }
+
+ /*public void testReplaceWSRPTokens()
+ {
+ String original = "<form method='post' action='wsrp_rewrite?wsrp-urlType=blockingAction&wsrp" +
+ "-interactionState=JBPNS_/wsrp_rewrite' id='wsrp_rewrite_portfolioManager'><table><tr><td>Stock symbol</t" +
+ "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>";
+
+ String expected = "<form method='post' action='foo' id='namespaceportfolioManager'><table><tr><td>Stock symbol</t" +
+ "d><td><input name='symbol'/></td></tr><tr><td><input type='submit' value='Submit'></td></tr></table></form>";
+
+ String replaced = TextTools.replaceBoundedString(original, "wsrp_rewrite", "/wsrp_rewrite", new TextTools.StringReplacementGenerator()
+ {
+ public String getReplacementFor(String match, String prefix, String suffix, boolean matchedPrefixOnly)
+ {
+ if(matchedPrefixOnly)
+ {
+ return "namespace" + match.substring(1);
+ }
+ else
+ {
+ return "foo";
+ }
+ }
+ }, true, false, true);
+
+ assertEquals(expected, replaced);
+ }*/
+
private void replaceBoundedString(boolean suffixIsOptional)
{
buildTestWithDefaults(PREFIX + SUFFIX, PREFIX + SUFFIX, false, true, suffixIsOptional, "");
buildTestWithDefaults(PREFIX + SUFFIX, PREFIX + SUFFIX, false, false, suffixIsOptional, "");
buildTestWithDefaults(REPLACEMENT, PREFIX + SUFFIX, true, false, suffixIsOptional, "");
buildTestWithDefaults(PREFIX + REPLACEMENT + SUFFIX, PREFIX + SUFFIX, true, true, suffixIsOptional, "");
- buildTest(PREFIX + SUFFIX, PREFIX + SUFFIX, "", PREFIX, SUFFIX, false, false, suffixIsOptional, "");
- buildTest("PSaPScccReeePS", "PSaPScccPdSeeePS", "R", "P", "S", false, false, suffixIsOptional, "d");
+ buildTest(PREFIX + SUFFIX, PREFIX + SUFFIX, "", PREFIX, SUFFIX, false, false, suffixIsOptional, new Pair("", false));
+ buildTest("PSaPScccReeePS", "PSaPScccPdSeeePS", "R", "P", "S", false, false, suffixIsOptional, new Pair("d", false));
}
+ private void replaceStringsWithOptionalSuffix(boolean suffixIsOptional, String suffix)
+ {
+ buildTest(REPLACEMENT + "blah", PREFIX + "blah", REPLACEMENT, PREFIX, suffix, false, false, suffixIsOptional, new Pair("blah", true));
+ buildTest(PREFIX + REPLACEMENT + "blah", PREFIX + "blah", REPLACEMENT, PREFIX, suffix, false, true, suffixIsOptional, new Pair("blah", true));
+ buildTest(REPLACEMENT + "blah", PREFIX + "blah", REPLACEMENT, PREFIX, suffix, true, false, suffixIsOptional, new Pair("blah", true));
+ buildTest(REPLACEMENT, PREFIX, REPLACEMENT, PREFIX, suffix, true, false, suffixIsOptional, new Pair("", true));
+ }
+
private void buildTestWithDefaults(String expected, String initial, boolean replaceIfBoundedStringEmpty, boolean keepBoundaries, boolean suffixIsOptional, String... expectedMatches)
{
- buildTest(expected, initial, null, PREFIX, SUFFIX, replaceIfBoundedStringEmpty, keepBoundaries, suffixIsOptional, expectedMatches);
+ Pair[] pairs = new Pair[expectedMatches.length];
+ for (int i = 0; i < expectedMatches.length; i++)
+ {
+ pairs[i] = new Pair(expectedMatches[i], false);
+ }
+ buildTest(expected, initial, null, PREFIX, SUFFIX, replaceIfBoundedStringEmpty, keepBoundaries, suffixIsOptional, pairs);
}
- private void buildTest(String expected, String initial, String replacement, String prefix, String suffix, boolean replaceIfBoundedStringEmpty, boolean keepBoundaries, boolean suffixIsOptional, String... expectedMatches)
+ private void buildTest(String expected, String initial, String replacement, String prefix, String suffix, boolean replaceIfBoundedStringEmpty, boolean keepBoundaries, boolean suffixIsOptional, Pair... expectedMatches)
{
if (replacement == null)
{
@@ -100,31 +153,10 @@
assertEquals(expected, TextTools.replaceBoundedString(initial, prefix, suffix, gen, replaceIfBoundedStringEmpty, keepBoundaries, suffixIsOptional));
}
- public void testReplaceStringsWithNullSuffix()
- {
- replaceStringsWithOptionalSuffix(false, null);
- replaceStringsWithOptionalSuffix(true, null);
- }
-
- private void replaceStringsWithOptionalSuffix(boolean suffixIsOptional, String suffix)
- {
- buildTest(REPLACEMENT + "blah", PREFIX + "blah", REPLACEMENT, PREFIX, suffix, false, false, suffixIsOptional, PREFIX);
- buildTest(PREFIX + REPLACEMENT + "blah", PREFIX + "blah", REPLACEMENT, PREFIX, suffix, false, true, suffixIsOptional, PREFIX);
- buildTest(REPLACEMENT + "blah", PREFIX + "blah", REPLACEMENT, PREFIX, suffix, true, false, suffixIsOptional, PREFIX);
- buildTest(REPLACEMENT, PREFIX, REPLACEMENT, PREFIX, suffix, true, false, suffixIsOptional, PREFIX);
- }
-
- public void testReplaceStringsWithOptionalSuffix()
- {
- replaceStringsWithOptionalSuffix(true, SUFFIX);
- buildTest(REPLACEMENT + "blah" + REPLACEMENT + "foo", PREFIX + "blah" + PREFIX + "replaced" + SUFFIX + "foo", REPLACEMENT, PREFIX, SUFFIX, false, false, true, PREFIX, "replaced");
- buildTest(REPLACEMENT + "blah" + PREFIX + REPLACEMENT + SUFFIX + "foo", PREFIX + "blah" + PREFIX + "replaced" + SUFFIX + "foo", REPLACEMENT, PREFIX, SUFFIX, false, true, true, PREFIX, "replaced");
- }
-
static class TestStringReplacementGenerator implements TextTools.StringReplacementGenerator
{
private String replacement;
- private String[] expectedMatch;
+ private Pair[] expectedMatch;
private int invocationCount;
TestStringReplacementGenerator(String replacement)
@@ -132,20 +164,34 @@
this.replacement = replacement;
}
- public void setExpectedMatch(String... expectedMatch)
+ public void setExpectedMatch(Pair... expectedMatch)
{
this.expectedMatch = expectedMatch;
this.invocationCount = 0;
}
- public String getReplacementFor(String match, String prefix, String suffix)
+ public String getReplacementFor(String match, String prefix, String suffix, boolean matchedPrefixOnly)
{
if (expectedMatch == null)
{
fail("getReplacementFor shouldn't have been called");
}
- assertEquals("'" + expectedMatch[invocationCount++] + "'", "'" + match + "'");
+ Pair pair = expectedMatch[invocationCount++];
+ assertEquals("'" + pair.match + "'", "'" + match + "'");
+ assertEquals(matchedPrefixOnly, pair.matchedPrefix);
return replacement;
}
}
+
+ static class Pair
+ {
+ String match;
+ boolean matchedPrefix;
+
+ public Pair(String match, boolean matchedPrefix)
+ {
+ this.match = match;
+ this.matchedPrefix = matchedPrefix;
+ }
+ }
}
14 years
gatein SVN: r4668 - portal/branches/branch-GTNPORTAL-1537/webui/portal/src/main/java/org/exoplatform/portal/webui/page.
by do-not-reply@jboss.org
Author: ndkhoiits
Date: 2010-10-14 05:48:30 -0400 (Thu, 14 Oct 2010)
New Revision: 4668
Modified:
portal/branches/branch-GTNPORTAL-1537/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java
Log:
GTNPORTAL-1561 Don't get the information from PUBLICATION_DATE after edit a SYSTEM node
Modified: portal/branches/branch-GTNPORTAL-1537/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java
===================================================================
--- portal/branches/branch-GTNPORTAL-1537/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java 2010-10-14 09:40:28 UTC (rev 4667)
+++ portal/branches/branch-GTNPORTAL-1537/webui/portal/src/main/java/org/exoplatform/portal/webui/page/UIPageNodeForm.java 2010-10-14 09:48:30 UTC (rev 4668)
@@ -186,13 +186,16 @@
public void invokeSetBindingBean(Object bean) throws Exception
{
super.invokeSetBindingBean(bean);
- PageNode node = (PageNode)bean;
- Calendar cal = getUIFormDateTimeInput(START_PUBLICATION_DATE).getCalendar();
- Date date = (cal != null) ? cal.getTime() : null;
- node.setStartPublicationDate(date);
- cal = getUIFormDateTimeInput(END_PUBLICATION_DATE).getCalendar();
- date = (cal != null) ? cal.getTime() : null;
- node.setEndPublicationDate(date);
+ PageNode node = (PageNode) bean;
+ if (node.getVisibility() != Visibility.SYSTEM)
+ {
+ Calendar cal = getUIFormDateTimeInput(START_PUBLICATION_DATE).getCalendar();
+ Date date = (cal != null) ? cal.getTime() : null;
+ node.setStartPublicationDate(date);
+ cal = getUIFormDateTimeInput(END_PUBLICATION_DATE).getCalendar();
+ date = (cal != null) ? cal.getTime() : null;
+ node.setEndPublicationDate(date);
+ }
}
public void setShowCheckPublicationDate(boolean show)
@@ -269,7 +272,11 @@
WebuiRequestContext ctx = event.getRequestContext();
UIPageNodeForm uiPageNodeForm = event.getSource();
UIApplication uiPortalApp = ctx.getUIApplication();
- if (uiPageNodeForm.getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked())
+ PageNode pageNode = uiPageNodeForm.getPageNode();
+ if (pageNode == null)
+ pageNode = new PageNode();
+
+ if (pageNode.getVisibility() != Visibility.SYSTEM && uiPageNodeForm.getUIFormCheckBoxInput(SHOW_PUBLICATION_DATE).isChecked())
{
Calendar currentCalendar = Calendar.getInstance();
currentCalendar.set(currentCalendar.get(Calendar.YEAR), currentCalendar.get(Calendar.MONTH), currentCalendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
@@ -305,10 +312,7 @@
}
}
-
- PageNode pageNode = uiPageNodeForm.getPageNode();
- if (pageNode == null)
- pageNode = new PageNode();
+
uiPageNodeForm.invokeSetBindingBean(pageNode);
UIPageSelector2 pageSelector = uiPageNodeForm.getChild(UIPageSelector2.class);
if (pageSelector.getPage() == null)
14 years
gatein SVN: r4667 - components/wsrp/trunk/common/src/main/java/org/gatein/wsrp.
by do-not-reply@jboss.org
Author: chris.laprun(a)jboss.com
Date: 2010-10-14 05:40:28 -0400 (Thu, 14 Oct 2010)
New Revision: 4667
Modified:
components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
Log:
- Removed unused logger. It was shadowing the one in WSRPPortletURL anyway.
Modified: components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java
===================================================================
--- components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java 2010-10-14 08:43:02 UTC (rev 4666)
+++ components/wsrp/trunk/common/src/main/java/org/gatein/wsrp/WSRPResourceURL.java 2010-10-14 09:40:28 UTC (rev 4667)
@@ -31,7 +31,6 @@
import org.gatein.pc.api.WindowState;
import org.gatein.pc.api.cache.CacheLevel;
import org.gatein.wsrp.spec.v2.WSRP2RewritingConstants;
-import org.jboss.logging.Logger;
import java.net.MalformedURLException;
import java.net.URL;
@@ -45,7 +44,6 @@
*/
public class WSRPResourceURL extends WSRPPortletURL implements ResourceURL
{
- private final static Logger log = Logger.getLogger(WSRPResourceURL.class);
public final static String DEFAULT_RESOURCE_ID = "_gtn_resid_";
private String resourceId;
14 years
gatein SVN: r4666 - portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/portal.
by do-not-reply@jboss.org
Author: phuong_vu
Date: 2010-10-14 04:43:02 -0400 (Thu, 14 Oct 2010)
New Revision: 4666
Modified:
portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js
Log:
GTNPORTAL-1546 the menu toolbars overlap each other in IE8
Modified: portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js
===================================================================
--- portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js 2010-10-14 07:25:24 UTC (rev 4665)
+++ portal/branches/branch-GTNPORTAL-1537/web/eXoResources/src/main/webapp/javascript/eXo/portal/UIPortalNavigation.js 2010-10-14 08:43:02 UTC (rev 4666)
@@ -223,8 +223,8 @@
eXo.portal.UIPortalNavigation.superClass.setPosition(menuItemContainer, x, y, eXo.core.I18n.isRT());
eXo.portal.UIPortalNavigation.superClass.show(menuItemContainer);
- menuItemContainer.style.width = menuItemContainer.offsetWidth - parseInt(DOMUtil.getStyle(menuItemContainer, "borderLeftWidth"))
- - parseInt(DOMUtil.getStyle(menuItemContainer, "borderRightWidth")) + "px";
+ menuItemContainer.style.width = menuItemContainer.offsetWidth - parseInt(DOMUtil.getStyle(menuItemContainer, "borderLeftWidth",true))
+ - parseInt(DOMUtil.getStyle(menuItemContainer, "borderRightWidth",true)) + "px";
var posXinBrowser = eXo.core.Browser.findPosX(menuItemContainer);
if(eXo.core.I18n.isLT()) {
if(posXinBrowser + menuItemContainer.offsetWidth >= eXo.core.Browser.getBrowserWidth()) {
14 years