[jbosstools-issues] [JBoss JIRA] Commented: (JBIDE-5293) Need way to control FreeMarker template variable formatting

Tom Fennelly (JIRA) jira-events at lists.jboss.org
Mon Jan 25 11:10:19 EST 2010


    [ https://jira.jboss.org/jira/browse/JBIDE-5293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12508141#action_12508141 ] 

Tom Fennelly commented on JBIDE-5293:
-------------------------------------

Prior to making the changes for this JIRA, the generated templates had no real formatting on the freemarker variables (everything was a "string")... like the following:

<?xml version="1.0" encoding="UTF-8"?>
<purchaseOrder orderDate="${header.date!?string}">
    <items>
        <#list orderItemList as orderItem>
        <item partNum="${orderItem.productId!?string}">
            <quantity>${orderItem.quantity!?string}</quantity>            
            <USPrice>${orderItem.price!?string}</USPrice>            
            <comment>${customer.userName!?string}</comment>            
        </item>
        </#list>        
    </items>    
</purchaseOrder>

Since making the change, we include formatting directives on the freemarker variables, for dates, numerics etc.  So the above now looks like the following:

<?xml version="1.0" encoding="UTF-8"?>
<purchaseOrder orderDate="${header.date!?string('EEE MMM dd HH:mm:ss z yyyy')}">
    <items>
        <#list orderItemList as orderItem>
        <item partNum="${orderItem.productId!?string}">
            <quantity>${orderItem.quantity!?c}</quantity>            
            <USPrice>${orderItem.price!?c}</USPrice>            
            <comment>${customer.userName!?string}</comment>            
        </item>
        </#list>        
    </items>    
</purchaseOrder>

The default formatting comes from the decodeParams, but can be modified by the user.  We only support manual modification at the moment e.g. to modify the data format you need perform the mapping in the editor and then modify the date format in the source.  Obviously, adding a Properties view (like the decode params) would be good for this (next release).

> Need way to control FreeMarker template variable formatting
> -----------------------------------------------------------
>
>                 Key: JBIDE-5293
>                 URL: https://jira.jboss.org/jira/browse/JBIDE-5293
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: smooks
>            Reporter: Tom Fennelly
>            Assignee: Tom Fennelly
>            Priority: Blocker
>             Fix For: 3.1.0.CR2
>
>   Original Estimate: 0 minutes
>  Remaining Estimate: 0 minutes
>
> Need to stop FreeMarker from formatting e.g. numeric 123456 as "123,456".
> Might need to include src data type param in the value mappings.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list