Login  Register

Dev - FreeMarkerWorker flexibility

Posted by Oleg Kozyrev Jr. on Apr 17, 2006; 12:34pm
URL: http://ofbiz.116.s1.nabble.com/Dev-Bug-in-the-updateCreditCard-service-tp167652p167653.html

Hello all,

Ftl transforms loading in org.ofbiz.base.util.template.FreeMarkerWorker is not really flexible at the moment.
Now classes to load are hard-coded, like this:
   ftlTransforms.put("ofbizUrl", loader.loadClass("org.ofbiz.webapp.ftl.OfbizUrlTransform").newInstance());
   ftlTransforms.put("ofbizContentUrl", loader.loadClass("org.ofbiz.webapp.ftl.OfbizContentTransform").newInstance());
   ftlTransforms.put("ofbizCurrency", loader.loadClass("org.ofbiz.webapp.ftl.OfbizCurrencyTransform").newInstance());
   ftlTransforms.put("ofbizAmount", loader.loadClass("org.ofbiz.webapp.ftl.OfbizAmountTransform").newInstance());

So, if we need to add new class we need to recompile all the component. This is not right way, I think.

I suggest to create separate properties file, like:
ofbizUrl=org.ofbiz.webapp.ftl.OfbizUrlTransform
ofbizContentUrl=org.ofbiz.webapp.ftl.OfbizContentTransform
ofbizCurrency=org.ofbiz.webapp.ftl.OfbizCurrencyTransform

and load them using UtilProperties class.

If nobody is against I can create a Jira issue with patches. What do you think?

Oleg.
 
_______________________________________________
Dev mailing list
[hidden email]
http://lists.ofbiz.org/mailman/listinfo/dev