You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2008/07/27 05:36:23 UTC

svn commit: r680062 - in /ofbiz/trunk/framework/webtools: webapp/webtools/WEB-INF/actions/datafile/viewdatafile.bsh webapp/webtools/WEB-INF/actions/datafile/viewdatafile.groovy widget/MiscScreens.xml

Author: jleroux
Date: Sat Jul 26 20:36:22 2008
New Revision: 680062

URL: http://svn.apache.org/viewvc?rev=680062&view=rev
Log:
Better handling of bsh->groovy migration

Added:
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.groovy   (contents, props changed)
      - copied, changed from r680061, ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.bsh
Removed:
    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.bsh
Modified:
    ofbiz/trunk/framework/webtools/widget/MiscScreens.xml

Copied: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.groovy (from r680061, ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.bsh)
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.groovy?p2=ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.groovy&p1=ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.bsh&r1=680061&r2=680062&rev=680062&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.bsh (original)
+++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.groovy Sat Jul 26 20:36:22 2008
@@ -24,19 +24,18 @@
 import org.ofbiz.datafile.*;
 
 uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
-List messages = new LinkedList();
+messages = [];
 
-String dataFileSave = request.getParameter("DATAFILE_SAVE");
+dataFileSave = request.getParameter("DATAFILE_SAVE");
 
-String entityXmlFileSave = request.getParameter("ENTITYXML_FILE_SAVE");
+entityXmlFileSave = request.getParameter("ENTITYXML_FILE_SAVE");
 
-String dataFileLoc = request.getParameter("DATAFILE_LOCATION");
-String definitionLoc = request.getParameter("DEFINITION_LOCATION");
-String definitionName = request.getParameter("DEFINITION_NAME");
-boolean dataFileIsUrl = request.getParameter("DATAFILE_IS_URL")!=null?true:false;
-boolean definitionIsUrl = request.getParameter("DEFINITION_IS_URL")!=null?true:false;
+dataFileLoc = request.getParameter("DATAFILE_LOCATION");
+definitionLoc = request.getParameter("DEFINITION_LOCATION");
+definitionName = request.getParameter("DEFINITION_NAME");
+dataFileIsUrl = null != request.getParameter("DATAFILE_IS_URL");
+definitionIsUrl = null != request.getParameter("DEFINITION_IS_URL");
 
-URL dataFileUrl = null;
 try {
     dataFileUrl = dataFileIsUrl?new URL(dataFileLoc):UtilURL.fromFilename(dataFileLoc);
 }
@@ -44,7 +43,6 @@
     messages.add(e.getMessage());
 }
 
-URL definitionUrl = null;
 try {
     definitionUrl = definitionIsUrl?new URL(definitionLoc):UtilURL.fromFilename(definitionLoc);
 }
@@ -52,17 +50,17 @@
     messages.add(e.getMessage());
 }
 
-Iterator definitionNames = null;
-if (definitionUrl != null) {
+definitionNames = null;
+if (definitionUrl) {
     ModelDataFileReader reader = ModelDataFileReader.getModelDataFileReader(definitionUrl);
-    if (reader != null) {
+    if (reader) {
         definitionNames = ((Collection)reader.getDataFileNames()).iterator();
+        context.put("definitionNames", definitionNames);
     }
 }
-context.put("definitionNames", definitionNames);
 
-DataFile dataFile = null;
-if (dataFileUrl != null && definitionUrl != null && definitionName != null && definitionName.length() > 0) {
+dataFile = null;
+if (dataFileUrl && definitionUrl && definitionNames) {
     try {
         dataFile = DataFile.readFile(dataFileUrl, definitionUrl, definitionName);
         context.put("dataFile", dataFile);
@@ -72,13 +70,12 @@
     }
 }
 
-ModelDataFile modelDataFile = null;
-if (dataFile != null) {
+if (dataFile) {
     modelDataFile = dataFile.getModelDataFile();
     context.put("modelDataFile", modelDataFile);
 }
 
-if (dataFile != null && dataFileSave != null && dataFileSave.length() > 0) {
+if (dataFile && dataFileSave) {
     try {
         dataFile.writeDataFile(dataFileSave);
         messages.add(uiLabelMap.get("WebtoolsDataFileSavedTo") + dataFileSave);
@@ -88,7 +85,7 @@
     }
 }
 
-if (dataFile != null && entityXmlFileSave != null && entityXmlFileSave.length() > 0) {
+if (dataFile && entityXmlFileSave) {
     try {
         //dataFile.writeDataFile(entityXmlFileSave);
         DataFile2EntityXml.writeToEntityXml(entityXmlFileSave, dataFile);
@@ -98,5 +95,4 @@
         messages.add(e.getMessage());
     }
 }
-
-context.put("messages", messages);
+context.messages = messages;

Propchange: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.groovy
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: ofbiz/trunk/framework/webtools/widget/MiscScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/MiscScreens.xml?rev=680062&r1=680061&r2=680062&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/widget/MiscScreens.xml (original)
+++ ofbiz/trunk/framework/webtools/widget/MiscScreens.xml Sat Jul 26 20:36:22 2008
@@ -1,24 +1,24 @@
 <!--
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied.  See the License for the
-specific language governing permissions and limitations
-under the License.
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+    http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
 -->
 
 <screens xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-        xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
+    xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/widget-screen.xsd">
     
     <screen name="ViewComponents">
         <section>
@@ -35,7 +35,7 @@
             </widgets>
         </section>
     </screen>
-
+    
     <screen name="EditCustomTimePeriod">
         <section>
             <actions>
@@ -52,13 +52,13 @@
             </widgets>
         </section>
     </screen>
-
+    
     <screen name="viewdatafile">
         <section>
             <actions>
                 <set field="headerItem" value="main"/>
                 <set field="titleProperty" value="WebtoolsDataFileMainTitle"/>
-                <script location="component://webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.bsh"/>
+                <script location="component://webtools/webapp/webtools/WEB-INF/actions/datafile/Viewdatafile.groovy"/>
             </actions>
             <widgets>
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
@@ -69,7 +69,7 @@
             </widgets>
         </section>
     </screen>
-
+    
     <screen name="readxpdl">
         <section>
             <actions>
@@ -81,29 +81,29 @@
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
                         <container style="screenlet">
-                             <container style="screenlet-title-bar">
-                                 <container style="h3">
-                                     <label text="${uiLabelMap.WebtoolsReadXPDLFile}"/>
-                                 </container>
-                             </container>
-                             <container style="screenlet-body">
-                                 <section>
-                                     <widgets>
-                                         <platform-specific>
-                                             <html>
-                                                 <html-template location="component://webtools/webapp/webtools/workflow/readxpdl.ftl"/>
-                                             </html>
-                                         </platform-specific>
-                                     </widgets>
-                                 </section>
-                             </container>
+                            <container style="screenlet-title-bar">
+                                <container style="h3">
+                                    <label text="${uiLabelMap.WebtoolsReadXPDLFile}"/>
+                                </container>
+                            </container>
+                            <container style="screenlet-body">
+                                <section>
+                                    <widgets>
+                                        <platform-specific>
+                                            <html>
+                                                <html-template location="component://webtools/webapp/webtools/workflow/readxpdl.ftl"/>
+                                            </html>
+                                        </platform-specific>
+                                    </widgets>
+                                </section>
+                            </container>
                         </container>
                     </decorator-section>
                 </decorator-screen>
             </widgets>
         </section>
     </screen>
-
+    
     <screen name="workflowMonitor">
         <section>
             <actions>
@@ -115,27 +115,27 @@
                 <decorator-screen name="main-decorator" location="${parameters.mainDecoratorLocation}">
                     <decorator-section name="body">
                         <container style="screenlet">
-                             <container style="screenlet-title-bar">
-                                 <container style="h3">
-                                     <label text="${uiLabelMap.WebtoolsActiveWorkflowMonitor}"/>
-                                 </container>
-                             </container>
-                             <container style="screenlet-body">
-                                 <section>
-                                     <widgets>
-                                         <platform-specific>
-                                             <html>
-                                                 <html-template location="component://webtools/webapp/webtools/workflow/workflowMonitor.ftl"/>
-                                             </html>
-                                         </platform-specific>
-                                     </widgets>
-                                 </section>
-                             </container>
+                            <container style="screenlet-title-bar">
+                                <container style="h3">
+                                    <label text="${uiLabelMap.WebtoolsActiveWorkflowMonitor}"/>
+                                </container>
+                            </container>
+                            <container style="screenlet-body">
+                                <section>
+                                    <widgets>
+                                        <platform-specific>
+                                            <html>
+                                                <html-template location="component://webtools/webapp/webtools/workflow/workflowMonitor.ftl"/>
+                                            </html>
+                                        </platform-specific>
+                                    </widgets>
+                                </section>
+                            </container>
                         </container>
                     </decorator-section>
                 </decorator-screen>
             </widgets>
         </section>
     </screen>
-
+    
 </screens>