/[Apache-SVN]
ViewVC logotype

Revision 1762227


Jump to revision: Previous Next
Author: jacopoc
Date: Sun Sep 25 17:20:58 2016 UTC (7 years, 7 months ago)
Changed paths: 15
Log Message:
Improved: cleanups and enhancements in the FreeMarkerWorker class, and client 
code using it, that wraps most of the OFBiz integration with FreeMarker.

This is the list of the main modifications:
* simplified and cleaned up the public methods of FreeMarkerWorker, used to 
retrieve and render Freemarker templates and changed client code accordingly to 
use them
* removed unused methods in FreeMarkerWorker and made some others private
* improved the integration code in FreeMarkerWorker to better use the Freemarker 
API and specifically to leverage the various TemplateLoaders and the Freemarker 
caching mechanism; it is now possible to switch the OFBiz legacy template 
caching mechanism to use the Freemarker one instead
* improved the implementation of Freemarker template rendering from strings 
(used by DataResourceWorker): it now leverages the Freemarker's 
StringTemplateLoader that provides the ability to cache the strings, retrieved 
from DataResources records, based on the timestamp of the last modification
* moved freemarkerImports.properties from "widget" to "base" component, and 
changed its content (and the content of the associated templates 
AutoImportTemplate.ftl and HtmlTemplate.ftl) to remove the dependency from base 
to widget&common; some resources of "widget" and "common" are still referenced 
from AutoImportTemplate.ftl (that is in "base") but even if they are soft 
dependencies: if they are missing the system will load properly without any 
error or warning; before this change it was impossible to use, or unit test, 
FreeMarkerWorker before the "widget" and "common" components were loaded by the 
system, now it is possible
* created a new class for unit tests for FreeMarkerWorker, named 
FreeMarkerWorkerTests: at the moment it contains just one simple unit test but 
more should be implemented
* refactored WebToolsServices.entityImport(...) to leverage the 
FreeMarkerWorker.renderTemplate(...) method to run the Freemarker template, 
rather than dealing with the Freemarker API directly; this is now possible 
thanks to the cleanups and improvements done in the FreeMarkerWorker class; this 
same approach should be implemented for a few other similar integration points 
(mostly in the "content" component); this is a TODO item
* moved the encodeDoubleQuotes(...) method from FreeMarkerWorker to 
MacroFormRenderer and made it private since this is the only calss using it and 
its logic is not related to FreeMarker



Changed paths

Path Details
Directoryofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/data/DataResourceWorker.java modified , text changed
Directoryofbiz/trunk/applications/product/src/main/java/org/apache/ofbiz/shipment/thirdparty/fedex/FedexServices.java modified , text changed
Directoryofbiz/trunk/framework/base/config/AutoImportTemplate.ftl added
Directoryofbiz/trunk/framework/base/config/freemarkerImports.properties
(Copied from ofbiz/trunk/framework/widget/config/freemarkerImports.properties, r1762109)
added , text changed
Directoryofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/template/FreeMarkerWorker.java modified , text changed
Directoryofbiz/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/template/ added
Directoryofbiz/trunk/framework/base/src/test/java/org/apache/ofbiz/base/util/template/FreeMarkerWorkerTests.java added
Directoryofbiz/trunk/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java modified , text changed
Directoryofbiz/trunk/framework/common/template/includes/HtmlTemplate.ftl modified , text changed
Directoryofbiz/trunk/framework/entity/src/test/java/org/apache/ofbiz/entity/DelegatorUnitTests.java modified , text changed
Directoryofbiz/trunk/framework/webapp/src/main/java/org/apache/ofbiz/webapp/ftl/FreeMarkerViewHandler.java modified , text changed
Directoryofbiz/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java modified , text changed
Directoryofbiz/trunk/framework/widget/config/freemarkerImports.properties deleted
Directoryofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/HtmlWidget.java modified , text changed
Directoryofbiz/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/renderer/macro/MacroFormRenderer.java modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26