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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Jacques Le Roux
Administrator
Oops, looks like I forgot the best practice here. I should have replaced and not deleted and added. Actually that comes from an
habit got with previous bad experiences when renaming with Subclipse. Sorry for that...

Jacques

> Author: jleroux
> Date: Sat Jul 26 14:05:02 2008
> New Revision: 680047
>
> URL: http://svn.apache.org/viewvc?rev=680047&view=rev
> Log:
> bsh -> groovy conversion
>
> Added:
>    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/Viewdatafile.groovy
> Removed:
>    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.bsh
> Modified:
>    ofbiz/trunk/framework/webtools/widget/MiscScreens.xml
>
> Added: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/Viewdatafile.groovy
> URL:
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/Viewdatafile.groovy?rev=680047&view=auto
> ==============================================================================
> --- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/Viewdatafile.groovy (added)
> +++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/Viewdatafile.groovy Sat Jul 26 14:05:02 2008
> @@ -0,0 +1,98 @@
> +/*
> + * 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.
> + */
> +
> +import java.util.*;
> +import java.net.*;
> +import org.ofbiz.security.*;
> +import org.ofbiz.base.util.*;
> +import org.ofbiz.datafile.*;
> +
> +uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
> +messages = [];
> +
> +dataFileSave = request.getParameter("DATAFILE_SAVE");
> +
> +entityXmlFileSave = request.getParameter("ENTITYXML_FILE_SAVE");
> +
> +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");
> +
> +try {
> +    dataFileUrl = dataFileIsUrl?new URL(dataFileLoc):UtilURL.fromFilename(dataFileLoc);
> +}
> +catch (java.net.MalformedURLException e) {
> +    messages.add(e.getMessage());
> +}
> +
> +try {
> +    definitionUrl = definitionIsUrl?new URL(definitionLoc):UtilURL.fromFilename(definitionLoc);
> +}
> +catch (java.net.MalformedURLException e) {
> +    messages.add(e.getMessage());
> +}
> +
> +definitionNames = null;
> +if (definitionUrl) {
> +    ModelDataFileReader reader = ModelDataFileReader.getModelDataFileReader(definitionUrl);
> +    if (reader) {
> +        definitionNames = ((Collection)reader.getDataFileNames()).iterator();
> +        context.put("definitionNames", definitionNames);
> +    }
> +}
> +
> +dataFile = null;
> +if (dataFileUrl && definitionUrl && definitionNames) {
> +    try {
> +        dataFile = DataFile.readFile(dataFileUrl, definitionUrl, definitionName);
> +        context.put("dataFile", dataFile);
> +    }
> +    catch (Exception e) {
> +        messages.add(e.toString()); Debug.log(e);
> +    }
> +}
> +
> +if (dataFile) {
> +    modelDataFile = dataFile.getModelDataFile();
> +    context.put("modelDataFile", modelDataFile);
> +}
> +
> +if (dataFile && dataFileSave) {
> +    try {
> +        dataFile.writeDataFile(dataFileSave);
> +        messages.add(uiLabelMap.get("WebtoolsDataFileSavedTo") + dataFileSave);
> +    }
> +    catch (Exception e) {
> +        messages.add(e.getMessage());
> +    }
> +}
> +
> +if (dataFile && entityXmlFileSave) {
> +    try {
> +        //dataFile.writeDataFile(entityXmlFileSave);
> +        DataFile2EntityXml.writeToEntityXml(entityXmlFileSave, dataFile);
> +        messages.add(uiLabelMap.get("WebtoolsDataEntityFileSavedTo") + entityXmlFileSave);
> +    }
> +    catch (Exception e) {
> +        messages.add(e.getMessage());
> +    }
> +}
> +context.messages = messages;
>
> Modified: ofbiz/trunk/framework/webtools/widget/MiscScreens.xml
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/MiscScreens.xml?rev=680047&r1=680046&r2=680047&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/webtools/widget/MiscScreens.xml (original)
> +++ ofbiz/trunk/framework/webtools/widget/MiscScreens.xml Sat Jul 26 14:05:02 2008
> @@ -58,7 +58,7 @@
>             <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}">
>
>

Reply | Threaded
Open this post in threaded view
|

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

Jacques Le Roux
Administrator
Corrected in 680062

Jacques

From: "Jacques Le Roux" <[hidden email]>

> Oops, looks like I forgot the best practice here. I should have replaced and not deleted and added. Actually that comes from an
> habit got with previous bad experiences when renaming with Subclipse. Sorry for that...
>
> Jacques
>
>> Author: jleroux
>> Date: Sat Jul 26 14:05:02 2008
>> New Revision: 680047
>>
>> URL: http://svn.apache.org/viewvc?rev=680047&view=rev
>> Log:
>> bsh -> groovy conversion
>>
>> Added:
>>    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/Viewdatafile.groovy
>> Removed:
>>    ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/viewdatafile.bsh
>> Modified:
>>    ofbiz/trunk/framework/webtools/widget/MiscScreens.xml
>>
>> Added: ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/Viewdatafile.groovy
>> URL:
>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/Viewdatafile.groovy?rev=680047&view=auto
>> ==============================================================================
>> --- ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/Viewdatafile.groovy (added)
>> +++ ofbiz/trunk/framework/webtools/webapp/webtools/WEB-INF/actions/datafile/Viewdatafile.groovy Sat Jul 26 14:05:02 2008
>> @@ -0,0 +1,98 @@
>> +/*
>> + * 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.
>> + */
>> +
>> +import java.util.*;
>> +import java.net.*;
>> +import org.ofbiz.security.*;
>> +import org.ofbiz.base.util.*;
>> +import org.ofbiz.datafile.*;
>> +
>> +uiLabelMap = UtilProperties.getResourceBundleMap("WebtoolsUiLabels", locale);
>> +messages = [];
>> +
>> +dataFileSave = request.getParameter("DATAFILE_SAVE");
>> +
>> +entityXmlFileSave = request.getParameter("ENTITYXML_FILE_SAVE");
>> +
>> +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");
>> +
>> +try {
>> +    dataFileUrl = dataFileIsUrl?new URL(dataFileLoc):UtilURL.fromFilename(dataFileLoc);
>> +}
>> +catch (java.net.MalformedURLException e) {
>> +    messages.add(e.getMessage());
>> +}
>> +
>> +try {
>> +    definitionUrl = definitionIsUrl?new URL(definitionLoc):UtilURL.fromFilename(definitionLoc);
>> +}
>> +catch (java.net.MalformedURLException e) {
>> +    messages.add(e.getMessage());
>> +}
>> +
>> +definitionNames = null;
>> +if (definitionUrl) {
>> +    ModelDataFileReader reader = ModelDataFileReader.getModelDataFileReader(definitionUrl);
>> +    if (reader) {
>> +        definitionNames = ((Collection)reader.getDataFileNames()).iterator();
>> +        context.put("definitionNames", definitionNames);
>> +    }
>> +}
>> +
>> +dataFile = null;
>> +if (dataFileUrl && definitionUrl && definitionNames) {
>> +    try {
>> +        dataFile = DataFile.readFile(dataFileUrl, definitionUrl, definitionName);
>> +        context.put("dataFile", dataFile);
>> +    }
>> +    catch (Exception e) {
>> +        messages.add(e.toString()); Debug.log(e);
>> +    }
>> +}
>> +
>> +if (dataFile) {
>> +    modelDataFile = dataFile.getModelDataFile();
>> +    context.put("modelDataFile", modelDataFile);
>> +}
>> +
>> +if (dataFile && dataFileSave) {
>> +    try {
>> +        dataFile.writeDataFile(dataFileSave);
>> +        messages.add(uiLabelMap.get("WebtoolsDataFileSavedTo") + dataFileSave);
>> +    }
>> +    catch (Exception e) {
>> +        messages.add(e.getMessage());
>> +    }
>> +}
>> +
>> +if (dataFile && entityXmlFileSave) {
>> +    try {
>> +        //dataFile.writeDataFile(entityXmlFileSave);
>> +        DataFile2EntityXml.writeToEntityXml(entityXmlFileSave, dataFile);
>> +        messages.add(uiLabelMap.get("WebtoolsDataEntityFileSavedTo") + entityXmlFileSave);
>> +    }
>> +    catch (Exception e) {
>> +        messages.add(e.getMessage());
>> +    }
>> +}
>> +context.messages = messages;
>>
>> Modified: ofbiz/trunk/framework/webtools/widget/MiscScreens.xml
>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/widget/MiscScreens.xml?rev=680047&r1=680046&r2=680047&view=diff
>> ==============================================================================
>> --- ofbiz/trunk/framework/webtools/widget/MiscScreens.xml (original)
>> +++ ofbiz/trunk/framework/webtools/widget/MiscScreens.xml Sat Jul 26 14:05:02 2008
>> @@ -58,7 +58,7 @@
>>             <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}">
>>
>>
>