You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by le...@apache.org on 2010/04/06 19:00:05 UTC

svn commit: r931222 - in /ofbiz/trunk/framework/webtools/webapp/webtools: WEB-INF/actions/artifactinfo/ArtifactInfo.groovy artifactinfo/ArtifactInfo.ftl

Author: lektran
Date: Tue Apr  6 17:00:05 2010
New Revision: 931222

URL: http://svn.apache.org/viewvc?rev=931222&view=rev
Log:
Store the ArtifactInfo's Recently Viewed Artifacts list in the session as basic maps instead of ArtifactInfoBase objects that aren't serializable.

Modified:
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy
    ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy?rev=931222&r1=931221&r2=931222&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy Tue Apr  6 17:00:05 2010
@@ -49,15 +49,16 @@ if ("search".equals(parameters.findType)
 }
 
 if (artifactInfo) {
+    artifactInfoMap = [type : artifactInfo.getType(), uniqueId : artifactInfo.getUniqueId(), displayName : artifactInfo.getDisplayName()];
     // add to the recently viewed list
     recentArtifactInfoList = session.getAttribute("recentArtifactInfoList");
     if (!recentArtifactInfoList) {
         recentArtifactInfoList = FastList.newInstance();
         session.setAttribute("recentArtifactInfoList", recentArtifactInfoList);
     }
-    if (recentArtifactInfoList && recentArtifactInfoList.get(0).equals(artifactInfo)) {
+    if (recentArtifactInfoList && recentArtifactInfoList.get(0).equals(artifactInfoMap)) {
         // hmmm, I guess do nothing if it's already there
     } else {
-        recentArtifactInfoList.add(0, artifactInfo);
+        recentArtifactInfoList.add(0, artifactInfoMap);
     }
 }

Modified: ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl?rev=931222&r1=931221&r2=931222&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl Tue Apr  6 17:00:05 2010
@@ -23,7 +23,7 @@ under the License.
     <#assign highRef = sessionAttributes.recentArtifactInfoList.size() - 1/>
     <#if (highRef > 19)><#assign highRef = 19/></#if>
     <#list sessionAttributes.recentArtifactInfoList[0..highRef] as recentArtifactInfo>
-        <div>${recentArtifactInfo_index + 1} - ${recentArtifactInfo.getDisplayType()}: <@displayArtifactInfoLink artifactInfo=recentArtifactInfo/></div>
+        <div>${recentArtifactInfo_index + 1} - ${recentArtifactInfo.type}: <@displayArtifactInfoLink type=recentArtifactInfo.type uniqueId=recentArtifactInfo.uniqueId displayName=recentArtifactInfo.displayName/></div>
     </#list>
   </div>
 </#if>
@@ -70,7 +70,7 @@ under the License.
     <div>
         <h4>Multiple Artifacts Found:</h4>
         <#list artifactInfoSet as curArtifactInfo>
-            <div>${curArtifactInfo.getDisplayType()}: <@displayArtifactInfoLink artifactInfo=curArtifactInfo/></div>
+            <div>${curArtifactInfo.getDisplayType()}: <@displayArtifactInfo artifactInfo=curArtifactInfo/></div>
         </#list>
     </div>
     </#if>
@@ -371,11 +371,11 @@ under the License.
 
 <#-- ==================== MACROS ===================== -->
 <#macro displayEntityArtifactInfo entityArtifactInfo>
-    <div>&nbsp;-&nbsp;<@displayArtifactInfoLink artifactInfo=entityArtifactInfo/></div>
+    <div>&nbsp;-&nbsp;<@displayArtifactInfo artifactInfo=entityArtifactInfo/></div>
 </#macro>
 
 <#macro displayServiceArtifactInfo serviceArtifactInfo>
-    <div>&nbsp;-&nbsp;<@displayArtifactInfoLink artifactInfo=serviceArtifactInfo/></div>
+    <div>&nbsp;-&nbsp;<@displayArtifactInfo artifactInfo=serviceArtifactInfo/></div>
 </#macro>
 
 <#macro displayServiceEcaArtifactInfo serviceEcaArtifactInfo>
@@ -415,21 +415,25 @@ under the License.
 </#macro>
 
 <#macro displayFormWidgetArtifactInfo formWidgetArtifactInfo>
-    <div>&nbsp;-&nbsp;<@displayArtifactInfoLink artifactInfo=formWidgetArtifactInfo/></div>
+    <div>&nbsp;-&nbsp;<@displayArtifactInfo artifactInfo=formWidgetArtifactInfo/></div>
 </#macro>
 
 <#macro displayScreenWidgetArtifactInfo screenWidgetArtifactInfo>
-    <div>&nbsp;-&nbsp;<@displayArtifactInfoLink artifactInfo=screenWidgetArtifactInfo/></div>
+    <div>&nbsp;-&nbsp;<@displayArtifactInfo artifactInfo=screenWidgetArtifactInfo/></div>
 </#macro>
 
 <#macro displayControllerRequestArtifactInfo controllerRequestArtifactInfo>
-    <div>&nbsp;-&nbsp;<@displayArtifactInfoLink artifactInfo=controllerRequestArtifactInfo/></div>
+    <div>&nbsp;-&nbsp;<@displayArtifactInfo artifactInfo=controllerRequestArtifactInfo/></div>
 </#macro>
 
 <#macro displayControllerViewArtifactInfo controllerViewArtifactInfo>
-    <div>&nbsp;-&nbsp;<@displayArtifactInfoLink artifactInfo=controllerViewArtifactInfo/></div>
+    <div>&nbsp;-&nbsp;<@displayArtifactInfo artifactInfo=controllerViewArtifactInfo/></div>
 </#macro>
 
-<#macro displayArtifactInfoLink artifactInfo>
-<a href="<@o...@ofbizUrl>">${artifactInfo.getDisplayName()}</a>
+<#macro displayArtifactInfo artifactInfo>
+    <@displayArtifactInfoLink type=artifactInfo.getType() uniqueId=artifactInfo.getUniqueId() displayName=artifactInfo.getDisplayName()/>
+</#macro>
+
+<#macro displayArtifactInfoLink type uniqueId displayName>
+<a href="<@o...@ofbizUrl>">${displayName}</a>
 </#macro>



Re: svn commit: r931222 - in /ofbiz/trunk/framework/webtools/webapp/webtools: WEB-INF/actions/artifactinfo/ArtifactInfo.groovy artifactinfo/ArtifactInfo.ftl

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 6/04/2010, at 11:04 AM, Adam Heath wrote:

> lektran@apache.org wrote:
>> Author: lektran
>> Date: Tue Apr  6 17:00:05 2010
>> New Revision: 931222
>> 
>> URL: http://svn.apache.org/viewvc?rev=931222&view=rev
>> Log:
>> Store the ArtifactInfo's Recently Viewed Artifacts list in the session as basic maps instead of ArtifactInfoBase objects that aren't serializable.
>> 
>> Modified:
>>    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy
>>    ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl
>> 
>> Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy?rev=931222&r1=931221&r2=931222&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy (original)
>> +++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy Tue Apr  6 17:00:05 2010
>> @@ -49,15 +49,16 @@ if ("search".equals(parameters.findType)
>> }
>> 
>> if (artifactInfo) {
>> +    artifactInfoMap = [type : artifactInfo.getType(), uniqueId : artifactInfo.getUniqueId(), displayName : artifactInfo.getDisplayName()];
> 
> What is the ofbiz best practice for reading bean-type info?
> artifactInfo.type, or artifactInfo.getType()?

I thought about using it briefly but figured it may just confuse people who aren't familiar with groovy.  I don't think we really need a best practice for something so minor.


Re: svn commit: r931222 - in /ofbiz/trunk/framework/webtools/webapp/webtools: WEB-INF/actions/artifactinfo/ArtifactInfo.groovy artifactinfo/ArtifactInfo.ftl

Posted by Adam Heath <do...@brainfood.com>.
lektran@apache.org wrote:
> Author: lektran
> Date: Tue Apr  6 17:00:05 2010
> New Revision: 931222
> 
> URL: http://svn.apache.org/viewvc?rev=931222&view=rev
> Log:
> Store the ArtifactInfo's Recently Viewed Artifacts list in the session as basic maps instead of ArtifactInfoBase objects that aren't serializable.
> 
> Modified:
>     ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy
>     ofbiz/trunk/framework/webtools/webapp/webtools/artifactinfo/ArtifactInfo.ftl
> 
> Modified: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy?rev=931222&r1=931221&r2=931222&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy (original)
> +++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/artifactinfo/ArtifactInfo.groovy Tue Apr  6 17:00:05 2010
> @@ -49,15 +49,16 @@ if ("search".equals(parameters.findType)
>  }
>  
>  if (artifactInfo) {
> +    artifactInfoMap = [type : artifactInfo.getType(), uniqueId : artifactInfo.getUniqueId(), displayName : artifactInfo.getDisplayName()];

What is the ofbiz best practice for reading bean-type info?
artifactInfo.type, or artifactInfo.getType()?

Re: svn commit: r931222 - in /ofbiz/trunk/framework/webtools/webapp/webtools: WEB-INF/actions/artifactinfo/ArtifactInfo.groovy artifactinfo/ArtifactInfo.ftl

Posted by Scott Gray <sc...@hotwaxmedia.com>.
On 6/04/2010, at 11:05 AM, Adam Heath wrote:

> lektran@apache.org wrote:
>> -    if (recentArtifactInfoList && recentArtifactInfoList.get(0).equals(artifactInfo)) {
>> +    if (recentArtifactInfoList && recentArtifactInfoList.get(0).equals(artifactInfoMap)) {
> 
> Same here, recentArtifactInfoList[0] == artifactInfoMap.  Might be
> able to do foo?[0] ==, but I haven't tried that.

I'm not sure if that would work, the safe navigation operator is ?. not just ? which I think it might confuse with part of a ternary operation.
I know groovy has a ton of useful stuff but I just don't use it often enough to get comfortable with most of them.

Re: svn commit: r931222 - in /ofbiz/trunk/framework/webtools/webapp/webtools: WEB-INF/actions/artifactinfo/ArtifactInfo.groovy artifactinfo/ArtifactInfo.ftl

Posted by Adam Heath <do...@brainfood.com>.
lektran@apache.org wrote:
> -    if (recentArtifactInfoList && recentArtifactInfoList.get(0).equals(artifactInfo)) {
> +    if (recentArtifactInfoList && recentArtifactInfoList.get(0).equals(artifactInfoMap)) {

Same here, recentArtifactInfoList[0] == artifactInfoMap.  Might be
able to do foo?[0] ==, but I haven't tried that.