Jacques, could you please provide more details about the issues you are experiencing?
Jacopo On Apr 3, 2012, at 12:57 PM, Jacques Le Roux wrote: > OK I had to revert my tools/ changes in trunk-manual.sh. Else it runs in the > terminal and I have no more time to spend on this today. So I used the good > old ./ like before. Note that OOTB "ant start" (or later ofbiz start) should > generate the same issue. > > We could of course change that but I finally think Hans is right with his > *pragmatic* approach of keeping at least start/stopofbiz.sh in OFBiz root... > I will avoid much issues for people running under Linux, ie almost all of > OFBiz users... > Then this *should be documented* (why it's there and not with other scripts > in tools) and we could remove start/stopofbiz.sh from tools to keep only one > version of each start/stopofbiz.sh scripts. > > Note that this is not a problem for Windows users: startofbiz.bat scripts > works the same from tools > > Jacques > > From: "Jacques Le Roux" <[email protected]> >> When the start/stopofbiz.sh will be removed from root and ant.sh renamed >> ofbiz.sh, remember to change the related demo scripts >> >> I already done for tools and load-demo in trunk-manual.sh >> >> Will be soon restarting >> >> Jacques >> >> From: "Jacques Le Roux" <[email protected]> >>> From: "Jacques Le Roux" <[email protected]> >>>> OK I think it's not a code issue but only a conflict in >>>> applications/product/config/ProductUiLabels.xml. >>>> >>>> I really wonder how that is possible, but anyway I'm handling it >>> >>> Certainly someone used the label manager and we then got a conflict >>> >>> Jacques >>> >>>> Jacques >>>> >>>> From: "Jacopo Cappellato" <[email protected]> >>>>> are we using the system ant? >>>>> >>>>> Jacopo >>>>> >>>>> On Apr 3, 2012, at 12:15 PM, Jacques Le Roux wrote: >>>>> >>>>>> Also got this there >>>>>> >>>>>> $ ant svninfo >>>>>> Buildfile: build.xml >>>>>> >>>>>> BUILD FAILED >>>>>> /home/ofbiz/trunk/build.xml:25: The following error occurred while >>>>>> executing this line: >>>>>> /home/ofbiz/trunk/macros.xml:186: taskdef class >>>>>> org.codehaus.groovy.ant.Groovyc cannot be found >>>>>> >>>>>> I will try to rebuild by hand to more clearly see what happens there.. >>>>>> >>>>>> Jacques >>>>>> >>>>>> From: "Jacques Le Roux" <[email protected]> >>>>>>> Actually it seems that Markus had a good intuition about >>>>>>> PartyScreens.xml#postalAddressHtmlFormatter >>>>>>> >>>>>>> We got this in trunk demo console.log. >>>>>>> >>>>>>> 14898505 [ajp-bio-0.0.0.0-8009-exec-332] INFO >>>>>>> org.ofbiz.webapp.control.ControlServlet - >>>>>>> [[[viewprofile(Domain:https://demo-trunk.ofbiz.apache.org)] Request >>>>>>> Begun, encoding=[UTF-8]- total:0.0,since last(Begin):0.0]] >>>>>>> 14898509 [ajp-bio-0.0.0.0-8009-exec-332] INFO >>>>>>> org.ofbiz.webapp.control.RequestHandler - Rendering View [viewprofile], >>>>>>> sessionId=07489422955774E49691F6362C9B028D.jvm1 >>>>>>> 14898580 [ajp-bio-0.0.0.0-8009-exec-332] INFO >>>>>>> org.ofbiz.widget.screen.ScreenFactory - Got 37 screens in 0.069s from: >>>>>>> file:/home/ofbiz/trunk/applications/party/widget/partymgr/PartyScreens.xml >>>>>>> 14898709 [ajp-bio-0.0.0.0-8009-exec-332] INFO >>>>>>> org.ofbiz.service.eca.ServiceEcaRule - For Service ECA >>>>>>> [partyBasePermissionCheck] on [return] got false for condition: >>>>>>> [hasPermission][equals][false][true][Boolean] >>>>>>> 14898712 [ajp-bio-0.0.0.0-8009-exec-332] INFO >>>>>>> org.ofbiz.service.eca.ServiceEcaRule - For Service ECA >>>>>>> [partyBasePermissionCheck] on [return] got false for condition: >>>>>>> [hasPermission][equals][false][true][Boolean] >>>>>>> 14898714 [ajp-bio-0.0.0.0-8009-exec-332] INFO >>>>>>> org.ofbiz.service.eca.ServiceEcaRule - For Service ECA >>>>>>> [partyBasePermissionCheck] on [return] got false for condition: >>>>>>> [hasPermission][equals][false][true][Boolean] >>>>>>> 14898717 [ajp-bio-0.0.0.0-8009-exec-332] INFO >>>>>>> org.ofbiz.service.eca.ServiceEcaRule - For Service ECA >>>>>>> [partyBasePermissionCheck] on [return] got false for condition: >>>>>>> [hasPermission][equals][false][true][Boolean] >>>>>>> 14898741 [ajp-bio-0.0.0.0-8009-exec-332] INFO >>>>>>> org.ofbiz.service.eca.ServiceEcaRule - For Service ECA >>>>>>> [partyBasePermissionCheck] on [return] got false for condition: >>>>>>> [hasPermission][equals][false][true][Boolean] >>>>>>> 14898777 [ajp-bio-0.0.0.0-8009-exec-332] INFO >>>>>>> org.ofbiz.widget.screen.ScreenFactory - Got 23 screens in 0.01s from: >>>>>>> file:/home/ofbiz/trunk/applications/party/widget/partymgr/ProfileScreens.xml >>>>>>> 14899015 [ajp-bio-0.0.0.0-8009-exec-332] ERROR freemarker.runtime - >>>>>>> 14899061 [ajp-bio-0.0.0.0-8009-exec-332] ERROR >>>>>>> org.ofbiz.widget.screen.ModelScreen - Error rendering screen >>>>>>> [component://party/widget/partymgr/PartyScreens.xml#postalAddressHtmlFormatter]: >>>>>>> java.lang.IllegalArgumentException: Rendering not yet supported for >>>>>>> the template at location: >>>>>>> component://party/webapp/partymgr/party/contactmechtemplates/. Rolling >>>>>>> back transaction. >>>>>>> 14899066 [ajp-bio-0.0.0.0-8009-exec-332] WARN >>>>>>> org.ofbiz.entity.transaction.TransactionUtil - >>>>>>> ---- exception report >>>>>>> ---------------------------------------------------------- >>>>>>> [TransactionUtil.setRollbackOnly] Calling transaction setRollbackOnly; >>>>>>> this stack trace shows where this is happening: >>>>>>> Exception: java.lang.Exception >>>>>>> Message: Error rendering screen >>>>>>> [component://party/widget/partymgr/PartyScreens.xml#postalAddressHtmlFormatter]: >>>>>>> java.lang.IllegalArgumentException: Rendering not yet supported for >>>>>>> the template at location: >>>>>>> component://party/webapp/partymgr/party/contactmechtemplates/ >>>>>>> ---- stack trace >>>>>>> --------------------------------------------------------------- >>>>>>> java.lang.Exception: Error rendering screen >>>>>>> [component://party/widget/partymgr/PartyScreens.xml#postalAddressHtmlFormatter]: >>>>>>> java.lang.IllegalArgumentException: Rendering not yet supported for >>>>>>> the template at location: >>>>>>> component://party/webapp/partymgr/party/contactmechtemplates/ >>>>>>> >>>>>>> HTH >>>>>>> >>>>>>> BTW I found weird that we have only console.log in trunk demo and not >>>>>>> any of ofbiz, debug or error logs. Is that wanted? >>>>>>> >>>>>>> Jacques >>>>>>> >>>>>>> From: "Jacopo Cappellato" <[email protected]> >>>>>>>> Is it possible that we had a deployment issue in the demo server? >>>>>>>> >>>>>>>> Jacopo >>>>>>>> >>>>>>>> On Apr 2, 2012, at 11:31 PM, Jacques Le Roux wrote: >>>>>>>> >>>>>>>>> It seems more related to the introduction of setContextField >>>>>>>>> transform. But could be also due another changes since... >>>>>>>>> >>>>>>>>> see >>>>>>>>>>>> - ${setRequestAttribute("postalAddress", >>>>>>>>>>>> postalAddress)} >>>>>>>>>>>> + ${setContextField("postalAddress", >>>>>>>>>>>> postalAddress)} >>>>>>>>> >>>>>>>>> Jacques >>>>>>>>> >>>>>>>>> From: "Markus M. May" <[email protected]> >>>>>>>>>> Hi, >>>>>>>>>> >>>>>>>>>> could this be related to the PostalAddress fix for the area specific >>>>>>>>>> Address Templates we did? >>>>>>>>>> >>>>>>>>>> I guess the issue is OFBIZ-4715. >>>>>>>>>> >>>>>>>>>> R, >>>>>>>>>> >>>>>>>>>> Markus >>>>>>>>>> >>>>>>>>>> Am 02.04.2012 um 19:54 schrieb Jacopo Cappellato >>>>>>>>>> <[email protected]>: >>>>>>>>>> >>>>>>>>>>> Hi Jacques, >>>>>>>>>>> >>>>>>>>>>> could you please send me the url? >>>>>>>>>>> >>>>>>>>>>> Jacopo >>>>>>>>>>> >>>>>>>>>>> On Apr 2, 2012, at 7:37 PM, Jacques Le Roux wrote: >>>>>>>>>>> >>>>>>>>>>>> I did not look into details but we get this on trunk demo >>>>>>>>>>>> >>>>>>>>>>>> Expression setContextField is undefined on line 62, column 27 in >>>>>>>>>>>> component://party/webapp/partymgr/party/profileblocks/Contact.ftl. >>>>>>>>>>>> The problematic instruction: ---------- ==> >>>>>>>>>>>> ${setContextField("postalAddress", postalAddress)} [on line 62, >>>>>>>>>>>> column 25 in >>>>>>>>>>>> >>>>>>>>>>>> I don't locally with trunk HEAD >>>>>>>>>>>> >>>>>>>>>>>> Jacques >>>>>>>>>>>> >>>>>>>>>>>> From: <[email protected]> >>>>>>>>>>>>> Author: jacopoc >>>>>>>>>>>>> Date: Fri Mar 30 07:28:39 2012 >>>>>>>>>>>>> New Revision: 1307288 >>>>>>>>>>>>> >>>>>>>>>>>>> URL: http://svn.apache.org/viewvc?rev=1307288&view=rev >>>>>>>>>>>>> Log: >>>>>>>>>>>>> Implemented new Freemarker transform to set a context variable. >>>>>>>>>>>>> The transform is now used to pass the "postalAddress" to the >>>>>>>>>>>>> context of the postal address formatter screen. >>>>>>>>>>>>> This should fix the issue, reported by Chatree, that prevented to >>>>>>>>>>>>> render the localized address when the screen was rendered from >>>>>>>>>>>>> the send mail service (no request object was available). >>>>>>>>>>>>> >>>>>>>>>>>>> Added: >>>>>>>>>>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/SetContextFieldTransform.java >>>>>>>>>>>>> Modified: >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/order/companyHeader.fo.ftl >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/order/ordercontactinfo.ftl >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/quote/quoteReportContactMechs.fo.ftl >>>>>>>>>>>>> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPostalAddressTemplate.groovy >>>>>>>>>>>>> ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Contact.ftl >>>>>>>>>>>>> ofbiz/trunk/framework/webapp/config/freemarkerTransforms.properties >>>>>>>>>>>>> >>>>>>>>>>>>> Modified: >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/order/companyHeader.fo.ftl >>>>>>>>>>>>> URL: >>>>>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/companyHeader.fo.ftl?rev=1307288&r1=1307287&r2=1307288&view=diff >>>>>>>>>>>>> ============================================================================== >>>>>>>>>>>>> --- >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/order/companyHeader.fo.ftl >>>>>>>>>>>>> (original) >>>>>>>>>>>>> +++ >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/order/companyHeader.fo.ftl >>>>>>>>>>>>> Fri Mar 30 07:28:39 2012 >>>>>>>>>>>>> @@ -26,7 +26,7 @@ under the License. >>>>>>>>>>>>> <fo:block>${companyName}</fo:block> >>>>>>>>>>>>> <#if postalAddress?exists> >>>>>>>>>>>>> <#if postalAddress?has_content> >>>>>>>>>>>>> - ${setRequestAttribute("postalAddress", >>>>>>>>>>>>> postalAddress)} >>>>>>>>>>>>> + ${setContextField("postalAddress", postalAddress)} >>>>>>>>>>>>> >>>>>>>>>>>>> ${screens.render("component://party/widget/partymgr/PartyScreens.xml#postalAddressPdfFormatter")} >>>>>>>>>>>>> </#if> >>>>>>>>>>>>> <#else> >>>>>>>>>>>>> >>>>>>>>>>>>> Modified: >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/order/ordercontactinfo.ftl >>>>>>>>>>>>> URL: >>>>>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/ordercontactinfo.ftl?rev=1307288&r1=1307287&r2=1307288&view=diff >>>>>>>>>>>>> ============================================================================== >>>>>>>>>>>>> --- >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/order/ordercontactinfo.ftl >>>>>>>>>>>>> (original) >>>>>>>>>>>>> +++ >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/order/ordercontactinfo.ftl >>>>>>>>>>>>> Fri Mar 30 07:28:39 2012 >>>>>>>>>>>>> @@ -117,7 +117,7 @@ under the License. >>>>>>>>>>>>> <#assign postalAddress = >>>>>>>>>>>>> orderContactMechValueMap.postalAddress> >>>>>>>>>>>>> <#if postalAddress?has_content> >>>>>>>>>>>>> <div> >>>>>>>>>>>>> - ${setRequestAttribute("postalAddress", >>>>>>>>>>>>> postalAddress)} >>>>>>>>>>>>> + ${setContextField("postalAddress", >>>>>>>>>>>>> postalAddress)} >>>>>>>>>>>>> >>>>>>>>>>>>> ${screens.render("component://party/widget/partymgr/PartyScreens.xml#postalAddressHtmlFormatter")} >>>>>>>>>>>>> </div> >>>>>>>>>>>>> <@updateOrderContactMech >>>>>>>>>>>>> orderHeader=orderHeader?if_exists >>>>>>>>>>>>> contactMechTypeId=contactMech.contactMechTypeId >>>>>>>>>>>>> contactMechList=postalContactMechList?if_exists >>>>>>>>>>>>> contactMechPurposeTypeId=contactMechPurpose.contactMechPurposeTypeId?if_exists >>>>>>>>>>>>> contactMechAddress=postalAddress?if_exists /> >>>>>>>>>>>>> >>>>>>>>>>>>> Modified: >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/quote/quoteReportContactMechs.fo.ftl >>>>>>>>>>>>> URL: >>>>>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/quote/quoteReportContactMechs.fo.ftl?rev=1307288&r1=1307287&r2=1307288&view=diff >>>>>>>>>>>>> ============================================================================== >>>>>>>>>>>>> --- >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/quote/quoteReportContactMechs.fo.ftl >>>>>>>>>>>>> (original) >>>>>>>>>>>>> +++ >>>>>>>>>>>>> ofbiz/trunk/applications/order/webapp/ordermgr/quote/quoteReportContactMechs.fo.ftl >>>>>>>>>>>>> Fri Mar 30 07:28:39 2012 >>>>>>>>>>>>> @@ -39,8 +39,8 @@ under the License. >>>>>>>>>>>>> <fo:table-cell> >>>>>>>>>>>>> <fo:block> >>>>>>>>>>>>> <#if toPostalAddress?exists> >>>>>>>>>>>>> - >>>>>>>>>>>>> ${setRequestAttribute("postalAddress", toPostalAddress)} >>>>>>>>>>>>> - >>>>>>>>>>>>> ${screens.render("component://party/widget/partymgr/PartyScreens.xml#postalAddressPdfFormatter")} >>>>>>>>>>>>> + >>>>>>>>>>>>> ${setContextField("postalAddress", toPostalAddress)} >>>>>>>>>>>>> + >>>>>>>>>>>>> ${screens.render("component://party/widget/partymgr/PartyScreens.xml#postalAddressPdfFormatter")} >>>>>>>>>>>>> </#if> >>>>>>>>>>>>> </fo:block> >>>>>>>>>>>>> </fo:table-cell> >>>>>>>>>>>>> >>>>>>>>>>>>> Modified: >>>>>>>>>>>>> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPostalAddressTemplate.groovy >>>>>>>>>>>>> URL: >>>>>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPostalAddressTemplate.groovy?rev=1307288&r1=1307287&r2=1307288&view=diff >>>>>>>>>>>>> ============================================================================== >>>>>>>>>>>>> --- >>>>>>>>>>>>> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPostalAddressTemplate.groovy >>>>>>>>>>>>> (original) >>>>>>>>>>>>> +++ >>>>>>>>>>>>> ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetPostalAddressTemplate.groovy >>>>>>>>>>>>> Fri Mar 30 07:28:39 2012 >>>>>>>>>>>>> @@ -17,7 +17,7 @@ >>>>>>>>>>>>> * under the License. >>>>>>>>>>>>> */ >>>>>>>>>>>>> >>>>>>>>>>>>> -postalAddressForTemplate = request.getAttribute("postalAddress"); >>>>>>>>>>>>> +postalAddressForTemplate = context.postalAddress; >>>>>>>>>>>>> postalAddressTemplateSuffix = context.postalAddressTemplateSuffix; >>>>>>>>>>>>> >>>>>>>>>>>>> if (!postalAddressTemplateSuffix) { >>>>>>>>>>>>> >>>>>>>>>>>>> Modified: >>>>>>>>>>>>> ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Contact.ftl >>>>>>>>>>>>> URL: >>>>>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Contact.ftl?rev=1307288&r1=1307287&r2=1307288&view=diff >>>>>>>>>>>>> ============================================================================== >>>>>>>>>>>>> --- >>>>>>>>>>>>> ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Contact.ftl >>>>>>>>>>>>> (original) >>>>>>>>>>>>> +++ >>>>>>>>>>>>> ofbiz/trunk/applications/party/webapp/partymgr/party/profileblocks/Contact.ftl >>>>>>>>>>>>> Fri Mar 30 07:28:39 2012 >>>>>>>>>>>>> @@ -59,7 +59,7 @@ under the License. >>>>>>>>>>>>> <#if "POSTAL_ADDRESS" = contactMech.contactMechTypeId> >>>>>>>>>>>>> <#if contactMechMap.postalAddress?has_content> >>>>>>>>>>>>> <#assign postalAddress = contactMechMap.postalAddress> >>>>>>>>>>>>> - ${setRequestAttribute("postalAddress", >>>>>>>>>>>>> postalAddress)} >>>>>>>>>>>>> + ${setContextField("postalAddress", >>>>>>>>>>>>> postalAddress)} >>>>>>>>>>>>> >>>>>>>>>>>>> ${screens.render("component://party/widget/partymgr/PartyScreens.xml#postalAddressHtmlFormatter")} >>>>>>>>>>>>> <#if postalAddress.geoPointId?has_content> >>>>>>>>>>>>> <#if contactMechPurposeType?has_content> >>>>>>>>>>>>> >>>>>>>>>>>>> Modified: >>>>>>>>>>>>> ofbiz/trunk/framework/webapp/config/freemarkerTransforms.properties >>>>>>>>>>>>> URL: >>>>>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/config/freemarkerTransforms.properties?rev=1307288&r1=1307287&r2=1307288&view=diff >>>>>>>>>>>>> ============================================================================== >>>>>>>>>>>>> --- >>>>>>>>>>>>> ofbiz/trunk/framework/webapp/config/freemarkerTransforms.properties >>>>>>>>>>>>> (original) >>>>>>>>>>>>> +++ >>>>>>>>>>>>> ofbiz/trunk/framework/webapp/config/freemarkerTransforms.properties >>>>>>>>>>>>> Fri Mar 30 07:28:39 2012 >>>>>>>>>>>>> @@ -27,3 +27,4 @@ ofbizCurrency=org.ofbiz.webapp.ftl.Ofbiz >>>>>>>>>>>>> ofbizAmount=org.ofbiz.webapp.ftl.OfbizAmountTransform >>>>>>>>>>>>> setRequestAttribute=org.ofbiz.webapp.ftl.SetRequestAttributeMethod >>>>>>>>>>>>> renderWrappedText=org.ofbiz.webapp.ftl.RenderWrappedTextTransform >>>>>>>>>>>>> +setContextField=org.ofbiz.webapp.ftl.SetContextFieldTransform >>>>>>>>>>>>> >>>>>>>>>>>>> Added: >>>>>>>>>>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/SetContextFieldTransform.java >>>>>>>>>>>>> URL: >>>>>>>>>>>>> http://svn.apache.org/viewvc/ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/SetContextFieldTransform.java?rev=1307288&view=auto >>>>>>>>>>>>> ============================================================================== >>>>>>>>>>>>> --- >>>>>>>>>>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/SetContextFieldTransform.java >>>>>>>>>>>>> (added) >>>>>>>>>>>>> +++ >>>>>>>>>>>>> ofbiz/trunk/framework/webapp/src/org/ofbiz/webapp/ftl/SetContextFieldTransform.java >>>>>>>>>>>>> Fri Mar 30 07:28:39 2012 >>>>>>>>>>>>> @@ -0,0 +1,64 @@ >>>>>>>>>>>>> +/******************************************************************************* >>>>>>>>>>>>> + * 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. >>>>>>>>>>>>> + >>>>>>>>>>>>> *******************************************************************************/ >>>>>>>>>>>>> +package org.ofbiz.webapp.ftl; >>>>>>>>>>>>> + >>>>>>>>>>>>> +import freemarker.core.Environment; >>>>>>>>>>>>> +import freemarker.ext.beans.BeanModel; >>>>>>>>>>>>> +import freemarker.template.*; >>>>>>>>>>>>> + >>>>>>>>>>>>> +import java.util.List; >>>>>>>>>>>>> +import java.util.Map; >>>>>>>>>>>>> + >>>>>>>>>>>>> +/** >>>>>>>>>>>>> + * SetRequestAttributeMethod - Freemarker Method for setting >>>>>>>>>>>>> context fields >>>>>>>>>>>>> + */ >>>>>>>>>>>>> +public class SetContextFieldTransform implements >>>>>>>>>>>>> TemplateMethodModelEx { >>>>>>>>>>>>> + >>>>>>>>>>>>> + public static final String module = >>>>>>>>>>>>> SetContextFieldTransform.class.getName(); >>>>>>>>>>>>> + >>>>>>>>>>>>> + /* >>>>>>>>>>>>> + * @see >>>>>>>>>>>>> freemarker.template.TemplateMethodModel#exec(java.util.List) >>>>>>>>>>>>> + */ >>>>>>>>>>>>> + @SuppressWarnings("unchecked") >>>>>>>>>>>>> + public Object exec(List args) throws TemplateModelException { >>>>>>>>>>>>> + if (args == null || args.size() != 2) >>>>>>>>>>>>> + throw new TemplateModelException("Invalid number of >>>>>>>>>>>>> arguements"); >>>>>>>>>>>>> + if (!(args.get(0) instanceof TemplateScalarModel)) >>>>>>>>>>>>> + throw new TemplateModelException("First argument not >>>>>>>>>>>>> an instance of TemplateScalarModel"); >>>>>>>>>>>>> + if (!(args.get(1) instanceof BeanModel) && !(args.get(1) >>>>>>>>>>>>> instanceof TemplateNumberModel) && !(args.get(1) instanceof >>>>>>>>>>>>> TemplateScalarModel)) >>>>>>>>>>>>> + throw new TemplateModelException("Second argument >>>>>>>>>>>>> not an instance of BeanModel nor TemplateNumberModel nor >>>>>>>>>>>>> TemplateScalarModel"); >>>>>>>>>>>>> + >>>>>>>>>>>>> + Environment env = Environment.getCurrentEnvironment(); >>>>>>>>>>>>> + BeanModel req = (BeanModel)env.getVariable("context"); >>>>>>>>>>>>> + Map context = (Map) req.getWrappedObject(); >>>>>>>>>>>>> + >>>>>>>>>>>>> + String name = ((TemplateScalarModel) >>>>>>>>>>>>> args.get(0)).getAsString(); >>>>>>>>>>>>> + Object value = null; >>>>>>>>>>>>> + if (args.get(1) instanceof TemplateScalarModel) >>>>>>>>>>>>> + value = ((TemplateScalarModel) >>>>>>>>>>>>> args.get(1)).getAsString(); >>>>>>>>>>>>> + if (args.get(1) instanceof TemplateNumberModel) >>>>>>>>>>>>> + value = ((TemplateNumberModel) >>>>>>>>>>>>> args.get(1)).getAsNumber(); >>>>>>>>>>>>> + if (args.get(1) instanceof BeanModel) >>>>>>>>>>>>> + value = ((BeanModel) args.get(1)).getWrappedObject(); >>>>>>>>>>>>> + >>>>>>>>>>>>> + context.put(name, value); >>>>>>>>>>>>> + return new SimpleScalar(""); >>>>>>>>>>>>> + } >>>>>>>>>>>>> + >>>>>>>>>>>>> +} >>>>>>>>>>>>> >>>>>>>>>>> >>>>>>>> >>>>>
