You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Adrian Crum <ad...@sandglass-software.com> on 2013/06/16 08:56:47 UTC

Re: svn commit: r1493353 - in /ofbiz/branches/release12.04: ./ framework/common/script/org/ofbiz/common/PortalPageServices.xml framework/widget/src/org/ofbiz/widget/PortalPageWorker.java

The "change from FastList to standard java List " exists only in the trunk.

-Adrian

On 6/15/2013 2:45 PM, jleroux@apache.org wrote:
> Author: jleroux
> Date: Sat Jun 15 13:45:26 2013
> New Revision: 1493353
>
> URL: http://svn.apache.org/r1493353
> Log:
> "Applied fix from trunk for revision: 1493352"
> ------------------------------------------------------------------------
> r1493352 | jleroux | 2013-06-15 15:40:42 +0200 (sam., 15 juin 2013) | 40 lines
>
> A patch from Olivier Heintz for "Portal page personalization is not working" https://issues.apache.org/jira/browse/OFBIZ-5189
>
> Two simples errors after last change from FastList to standard java List :
> 1) go to example component / Dasboard
> 1.1) click on edit for one page
> Screen is blocked
> reason :
> {code}
>                      for (GenericValue portalPage : portalPages) {
>                          cond = EntityCondition.makeCondition(UtilMisc.toList(
>                                  EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
>                                  EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, portalPage.getString("portalPageId"))),
>                                  EntityOperator.AND);
>                          List <GenericValue> privatePortalPages = delegator.findList("PortalPage", cond, null, null, null, false);
>                          if (UtilValidate.isNotEmpty(privatePortalPages)) {
>                              portalPages.remove(portalPage);
>                              portalPages.add(privatePortalPages.get(0));
>                          }
>                      }
> {code}
> code iterate on a list and modify it, I don't know how it could work before ;-)
> I propose to use an other list on iterate
>
> 2) on appbarclose.ftl for tomawak theme there is
> {code}
>      <#assign portalPage = delegator.findOne("PortalPage", findMap, true)>
> {code}
> when you click to "revert to original" in dasboard screen
> {code}
> Error on line 45, column 5 in component://tomahawk/includes/appbarClose.ftl delegator.findOne("PortalPage", findMap, true) is undefined. It cannot be assigned to portalPage The problematic instruction: ---------- ==> assignment: portalPage=delegator.findOne("PortalPage", findMap, true) [on line 45, column 5 in component://tomahawk/includes/appbarClose.ftl] -
> {code}
> 2.1) to see the error, modify ExampleMenus.xml and change menu-item name from "Dasboard" to "Dasboard1"
> 2.2) go to example / dashboard and edit one page
> 2.3) click to "revert to original"
> I propose to add ?if_exists
>
> One other bug in portal page personalization.
> When trying to delete portlet or column in portal page, there is an error because in delete service, cache is used to read data before remove.
>
> Correction proposed is to remove use-cache="true"
> ------------------------------------------------------------------------
> 
>
> Modified:
>      ofbiz/branches/release12.04/   (props changed)
>      ofbiz/branches/release12.04/framework/common/script/org/ofbiz/common/PortalPageServices.xml
>      ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java
>
> Propchange: ofbiz/branches/release12.04/
> ------------------------------------------------------------------------------
>    Merged /ofbiz/trunk:r1493352
>
> Modified: ofbiz/branches/release12.04/framework/common/script/org/ofbiz/common/PortalPageServices.xml
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/script/org/ofbiz/common/PortalPageServices.xml?rev=1493353&r1=1493352&r2=1493353&view=diff
> ==============================================================================
> --- ofbiz/branches/release12.04/framework/common/script/org/ofbiz/common/PortalPageServices.xml (original)
> +++ ofbiz/branches/release12.04/framework/common/script/org/ofbiz/common/PortalPageServices.xml Sat Jun 15 13:45:26 2013
> @@ -50,7 +50,7 @@ under the License.
>   
>       <simple-method method-name="deletePortalPageColumn" short-description="Delete a Column from a PortalPage">
>           <call-simple-method method-name="checkOwnerShip"/>
> -        <entity-one entity-name="PortalPageColumn" value-field="column" auto-field-map="true" use-cache="true"/>
> +        <entity-one entity-name="PortalPageColumn" value-field="column" auto-field-map="true"/>
>           <if-not-empty field="column">
>               <entity-and entity-name="PortalPagePortlet" list="portalPortletList">
>                   <field-map field-name="portalPageId" from-field="column.portalPageId"/>
> @@ -97,7 +97,7 @@ under the License.
>   
>       <simple-method method-name="deletePortalPagePortlet" short-description="Delete a PortalPortlet from a PortalPageColumn">
>           <call-simple-method method-name="checkOwnerShip"/>
> -        <entity-one entity-name="PortalPagePortlet" value-field="portlet" auto-field-map="true" use-cache="true"/>
> +        <entity-one entity-name="PortalPagePortlet" value-field="portlet" auto-field-map="true"/>
>           <if-not-empty field="portlet">
>               <make-value value-field="newEntity" entity-name="PortletAttribute"/>
>               <set field="newEntity.portalPageId" from-field="portlet.portalPageId"/>
>
> Modified: ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java
> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java?rev=1493353&r1=1493352&r2=1493353&view=diff
> ==============================================================================
> --- ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java (original)
> +++ ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java Sat Jun 15 13:45:26 2013
> @@ -19,6 +19,7 @@
>   package org.ofbiz.widget;
>   
>   import java.io.IOException;
> +import java.util.ArrayList;
>   import java.util.List;
>   import java.util.Map;
>   import org.ofbiz.base.util.Debug;
> @@ -66,6 +67,7 @@ public class PortalPageWorker {
>                                   EntityOperator.OR)),
>                           EntityOperator.AND);
>                   portalPages = delegator.findList("PortalPage", cond, null, null, null, false);
> +                List<GenericValue> userPortalPages = new ArrayList<GenericValue>();
>                   if (UtilValidate.isNotEmpty(context.get("userLogin"))) { // check if a user is logged in
>                       String userLoginId = ((GenericValue)context.get("userLogin")).getString("userLoginId");
>                       // replace with private pages
> @@ -76,8 +78,10 @@ public class PortalPageWorker {
>                                   EntityOperator.AND);
>                           List <GenericValue> privatePortalPages = delegator.findList("PortalPage", cond, null, null, null, false);
>                           if (UtilValidate.isNotEmpty(privatePortalPages)) {
> -                            portalPages.remove(portalPage);
> -                            portalPages.add(privatePortalPages.get(0));
> +                            //portalPages.remove(portalPage);
> +                            userPortalPages.add(privatePortalPages.get(0));
> +                        } else {
> +                            userPortalPages.add(portalPage);
>                           }
>                       }
>                       // add any other created private pages
> @@ -86,9 +90,9 @@ public class PortalPageWorker {
>                               EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, null),
>                               EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parentPortalPageId)),
>                               EntityOperator.AND);
> -                    portalPages.addAll(delegator.findList("PortalPage", cond, null, null, null, false));
> +                    userPortalPages.addAll(delegator.findList("PortalPage", cond, null, null, null, false));
>                   }
> -                portalPages = EntityUtil.orderBy(portalPages, UtilMisc.toList("sequenceNum"));
> +                portalPages = EntityUtil.orderBy(userPortalPages, UtilMisc.toList("sequenceNum"));
>               } catch (GenericEntityException e) {
>                   Debug.logError("Could not retrieve portalpages:" + e.getMessage(), module);
>               }
>
>


Re: svn commit: r1493353 - in /ofbiz/branches/release12.04: ./ framework/common/script/org/ofbiz/common/PortalPageServices.xml framework/widget/src/org/ofbiz/widget/PortalPageWorker.java

Posted by Jacques Le Roux <ja...@les7arts.com>.
Anyway it was about removing elements in a foreach loop without an iterator, so Olivier's fix is always good. As he said "I don't know how it worked before"

Jacques

From: "Adrian Crum" <ad...@sandglass-software.com>
> The "change from FastList to standard java List " exists only in the trunk.
> 
> -Adrian
> 
> On 6/15/2013 2:45 PM, jleroux@apache.org wrote:
>> Author: jleroux
>> Date: Sat Jun 15 13:45:26 2013
>> New Revision: 1493353
>>
>> URL: http://svn.apache.org/r1493353
>> Log:
>> "Applied fix from trunk for revision: 1493352"
>> ------------------------------------------------------------------------
>> r1493352 | jleroux | 2013-06-15 15:40:42 +0200 (sam., 15 juin 2013) | 40 lines
>>
>> A patch from Olivier Heintz for "Portal page personalization is not working" https://issues.apache.org/jira/browse/OFBIZ-5189
>>
>> Two simples errors after last change from FastList to standard java List :
>> 1) go to example component / Dasboard
>> 1.1) click on edit for one page
>> Screen is blocked
>> reason :
>> {code}
>>                      for (GenericValue portalPage : portalPages) {
>>                          cond = EntityCondition.makeCondition(UtilMisc.toList(
>>                                  EntityCondition.makeCondition("ownerUserLoginId", EntityOperator.EQUALS, userLoginId),
>>                                  EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, portalPage.getString("portalPageId"))),
>>                                  EntityOperator.AND);
>>                          List <GenericValue> privatePortalPages = delegator.findList("PortalPage", cond, null, null, null, false);
>>                          if (UtilValidate.isNotEmpty(privatePortalPages)) {
>>                              portalPages.remove(portalPage);
>>                              portalPages.add(privatePortalPages.get(0));
>>                          }
>>                      }
>> {code}
>> code iterate on a list and modify it, I don't know how it could work before ;-)
>> I propose to use an other list on iterate
>>
>> 2) on appbarclose.ftl for tomawak theme there is
>> {code}
>>      <#assign portalPage = delegator.findOne("PortalPage", findMap, true)>
>> {code}
>> when you click to "revert to original" in dasboard screen
>> {code}
>> Error on line 45, column 5 in component://tomahawk/includes/appbarClose.ftl delegator.findOne("PortalPage", findMap, true) is undefined. It cannot be assigned to portalPage The problematic instruction: ---------- ==> assignment: portalPage=delegator.findOne("PortalPage", findMap, true) [on line 45, column 5 in component://tomahawk/includes/appbarClose.ftl] -
>> {code}
>> 2.1) to see the error, modify ExampleMenus.xml and change menu-item name from "Dasboard" to "Dasboard1"
>> 2.2) go to example / dashboard and edit one page
>> 2.3) click to "revert to original"
>> I propose to add ?if_exists
>>
>> One other bug in portal page personalization.
>> When trying to delete portlet or column in portal page, there is an error because in delete service, cache is used to read data before remove.
>>
>> Correction proposed is to remove use-cache="true"
>> ------------------------------------------------------------------------
>> 
>>
>> Modified:
>>      ofbiz/branches/release12.04/   (props changed)
>>      ofbiz/branches/release12.04/framework/common/script/org/ofbiz/common/PortalPageServices.xml
>>      ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java
>>
>> Propchange: ofbiz/branches/release12.04/
>> ------------------------------------------------------------------------------
>>    Merged /ofbiz/trunk:r1493352
>>
>> Modified: ofbiz/branches/release12.04/framework/common/script/org/ofbiz/common/PortalPageServices.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/common/script/org/ofbiz/common/PortalPageServices.xml?rev=1493353&r1=1493352&r2=1493353&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/common/script/org/ofbiz/common/PortalPageServices.xml (original)
>> +++ ofbiz/branches/release12.04/framework/common/script/org/ofbiz/common/PortalPageServices.xml Sat Jun 15 13:45:26 2013
>> @@ -50,7 +50,7 @@ under the License.
>>   
>>       <simple-method method-name="deletePortalPageColumn" short-description="Delete a Column from a PortalPage">
>>           <call-simple-method method-name="checkOwnerShip"/>
>> -        <entity-one entity-name="PortalPageColumn" value-field="column" auto-field-map="true" use-cache="true"/>
>> +        <entity-one entity-name="PortalPageColumn" value-field="column" auto-field-map="true"/>
>>           <if-not-empty field="column">
>>               <entity-and entity-name="PortalPagePortlet" list="portalPortletList">
>>                   <field-map field-name="portalPageId" from-field="column.portalPageId"/>
>> @@ -97,7 +97,7 @@ under the License.
>>   
>>       <simple-method method-name="deletePortalPagePortlet" short-description="Delete a PortalPortlet from a PortalPageColumn">
>>           <call-simple-method method-name="checkOwnerShip"/>
>> -        <entity-one entity-name="PortalPagePortlet" value-field="portlet" auto-field-map="true" use-cache="true"/>
>> +        <entity-one entity-name="PortalPagePortlet" value-field="portlet" auto-field-map="true"/>
>>           <if-not-empty field="portlet">
>>               <make-value value-field="newEntity" entity-name="PortletAttribute"/>
>>               <set field="newEntity.portalPageId" from-field="portlet.portalPageId"/>
>>
>> Modified: ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java
>> URL: http://svn.apache.org/viewvc/ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java?rev=1493353&r1=1493352&r2=1493353&view=diff
>> ==============================================================================
>> --- ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java (original)
>> +++ ofbiz/branches/release12.04/framework/widget/src/org/ofbiz/widget/PortalPageWorker.java Sat Jun 15 13:45:26 2013
>> @@ -19,6 +19,7 @@
>>   package org.ofbiz.widget;
>>   
>>   import java.io.IOException;
>> +import java.util.ArrayList;
>>   import java.util.List;
>>   import java.util.Map;
>>   import org.ofbiz.base.util.Debug;
>> @@ -66,6 +67,7 @@ public class PortalPageWorker {
>>                                   EntityOperator.OR)),
>>                           EntityOperator.AND);
>>                   portalPages = delegator.findList("PortalPage", cond, null, null, null, false);
>> +                List<GenericValue> userPortalPages = new ArrayList<GenericValue>();
>>                   if (UtilValidate.isNotEmpty(context.get("userLogin"))) { // check if a user is logged in
>>                       String userLoginId = ((GenericValue)context.get("userLogin")).getString("userLoginId");
>>                       // replace with private pages
>> @@ -76,8 +78,10 @@ public class PortalPageWorker {
>>                                   EntityOperator.AND);
>>                           List <GenericValue> privatePortalPages = delegator.findList("PortalPage", cond, null, null, null, false);
>>                           if (UtilValidate.isNotEmpty(privatePortalPages)) {
>> -                            portalPages.remove(portalPage);
>> -                            portalPages.add(privatePortalPages.get(0));
>> +                            //portalPages.remove(portalPage);
>> +                            userPortalPages.add(privatePortalPages.get(0));
>> +                        } else {
>> +                            userPortalPages.add(portalPage);
>>                           }
>>                       }
>>                       // add any other created private pages
>> @@ -86,9 +90,9 @@ public class PortalPageWorker {
>>                               EntityCondition.makeCondition("originalPortalPageId", EntityOperator.EQUALS, null),
>>                               EntityCondition.makeCondition("parentPortalPageId", EntityOperator.EQUALS, parentPortalPageId)),
>>                               EntityOperator.AND);
>> -                    portalPages.addAll(delegator.findList("PortalPage", cond, null, null, null, false));
>> +                    userPortalPages.addAll(delegator.findList("PortalPage", cond, null, null, null, false));
>>                   }
>> -                portalPages = EntityUtil.orderBy(portalPages, UtilMisc.toList("sequenceNum"));
>> +                portalPages = EntityUtil.orderBy(userPortalPages, UtilMisc.toList("sequenceNum"));
>>               } catch (GenericEntityException e) {
>>                   Debug.logError("Could not retrieve portalpages:" + e.getMessage(), module);
>>               }
>>
>>
>