Liferay Issues

  • Log In Access more options
    • Online Help
    • GreenHopper Help
    • Agile Answers
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What’s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Agile Access more options (Alt+g)
  • Test Sessions Access more options
    • Getting Started
ZZZ: PUBLIC - Old Liferay Portal (Use Liferay Portal Standard Edition)
  • ZZZ: PUBLIC - Old Liferay Portal (Use Liferay Portal Standard Edition)
  • LEP-841

ServiceBuilder support for BigDecimal

  • Agile Board
  • More Actions
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    Win XP, Tomcat 5.5.15 Liferay 3.6.1,
  • Similar Issues:
    Show 5 results 

    LEP-5169ServiceBuilder should additionally have support for all generated files to be defined on the command-line
    LEP-2138ServiceBuilder now has JSON support
    LEP-857ServiceBuilder persistence update method doesn't support generated keys
    LEP-5168ServiceBuilder should have the support to generate SQL tables based on 'mapping-table' attribute of service.xml
    LEP-1881Enable ServiceBuilder to support long (64-bit) numbers.

Description

Any application or portlet dealing with currencies should really use the java BigDecimal class. It would be nice and fairly trivial for the ServiceBuilder to support this.

I've just done a quick and dirty test and all I needed to do was use type="java.math.BigDecimal" in my service.xml and then modify the ext-hbm.xml to have type="big_decimal" in the appropriate place
(This was with postgresql).

Surely there are other people out there working with currencies within the liferay system that could
benefit as well.

Background: I'm writing a very specialised shopping basket system which is very loosely based on the
Liferay's shopping basket and I've just realised that I shouldn't be using double values and that
it might not be very appropriate for Liferay's shopping basket portlet either (I haven't analysed in detail
how it does its rounding).

  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. GZip Archive
    service_builder_ftl_overrides.tar.gz
    04/Nov/10 11:48 AM
    21 kB
    Reinaldo Silva
  2. Text File
    ServiceBuilder.java.patch
    04/Nov/10 11:48 AM
    2 kB
    Reinaldo Silva

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
  • Transitions Summary
  • Commits
Hide
Permalink
Brian Chan added a comment - 05/Jun/06 10:32 AM

Interesting. Will look into it.

Show
Brian Chan added a comment - 05/Jun/06 10:32 AM Interesting. Will look into it.
Hide
Permalink
Marcel Jansen added a comment - 06/Jun/06 2:27 PM

FYI

It definitely works (combination of "java.math.BigDecimal" and "big_decimal"). Use of
org.apache.commons.validator.routines.CurrencyValidator has also been very useful.

Show
Marcel Jansen added a comment - 06/Jun/06 2:27 PM FYI It definitely works (combination of "java.math.BigDecimal" and "big_decimal"). Use of org.apache.commons.validator.routines.CurrencyValidator has also been very useful.
Hide
Permalink
Reinaldo Silva added a comment - 04/Nov/10 11:48 AM

Patch and FTL service builder templates overrides to make it work on:

  • Liferay 6.1.X (rev. 65274)
  • PostgreSQL 8.4 (should work on Mysql too, but not tested)

Also the following args must be added to "build-common-plugin.xml" SDK:

<target name="build-service">
<java
classname="com.liferay.portal.tools.servicebuilder.ServiceBuilder"
classpathref="service.classpath"
>
<arg value="-Dexternal-properties=com/liferay/portal/tools/dependencies/portal-tools.properties" />
...
<!-- HERE YOUR OVERRIDES -->
<arg value="-Dservice.tpl.hbm_xml=<your_plugin_package_path>/hbm_xml.ftl" />
<arg value="-Dservice.tpl.persistence_impl=<your_plugin_package_path>/persistence_impl.ftl" />
<arg value="-Dservice.tpl.model=<your_plugin_package_path>/model.ftl" />
<arg value="-Dservice.tpl.model_impl=<your_plugin_package_path>/model_impl.ftl" />
<arg value="-Dservice.tpl.model_clp=<your_plugin_package_path>/model_clp.ftl" />
<arg value="-Dservice.tpl.service_clp_serializer=<your_plugin_package_path>/service_clp_serializer.ftl" />
</java>
...
</target>

The database used is NUMERIC and it can be NULL, circunventing the NULL to ZERO default behavior of Liferay numeric fields.

Only issue is that you must explicitly declare the "type='text'" attribute on "<aui:input />" elements to show properly when the field has no value, besides that all work properly.

Also, not tested on special columns (PKs, FKs).

Show
Reinaldo Silva added a comment - 04/Nov/10 11:48 AM Patch and FTL service builder templates overrides to make it work on: Liferay 6.1.X (rev. 65274) PostgreSQL 8.4 (should work on Mysql too, but not tested) Also the following args must be added to "build-common-plugin.xml" SDK: <target name="build-service"> <java classname="com.liferay.portal.tools.servicebuilder.ServiceBuilder" classpathref="service.classpath" > <arg value="-Dexternal-properties=com/liferay/portal/tools/dependencies/portal-tools.properties" /> ... <!-- HERE YOUR OVERRIDES --> <arg value="-Dservice.tpl.hbm_xml=<your_plugin_package_path>/hbm_xml.ftl" /> <arg value="-Dservice.tpl.persistence_impl=<your_plugin_package_path>/persistence_impl.ftl" /> <arg value="-Dservice.tpl.model=<your_plugin_package_path>/model.ftl" /> <arg value="-Dservice.tpl.model_impl=<your_plugin_package_path>/model_impl.ftl" /> <arg value="-Dservice.tpl.model_clp=<your_plugin_package_path>/model_clp.ftl" /> <arg value="-Dservice.tpl.service_clp_serializer=<your_plugin_package_path>/service_clp_serializer.ftl" /> </java> ... </target> The database used is NUMERIC and it can be NULL, circunventing the NULL to ZERO default behavior of Liferay numeric fields. Only issue is that you must explicitly declare the "type='text'" attribute on "<aui:input />" elements to show properly when the field has no value, besides that all work properly. Also, not tested on special columns (PKs, FKs).
Hide
Permalink
Jonas Yuan added a comment - 09/Feb/11 12:06 PM

A proposal was addressed at LPS-15233

Show
Jonas Yuan added a comment - 09/Feb/11 12:06 PM A proposal was addressed at LPS-15233
Hide
Permalink
Robert Seedorff added a comment - 11/Feb/12 3:16 PM

Would be realy great to have this feature for dealing with currency values.

Show
Robert Seedorff added a comment - 11/Feb/12 3:16 PM Would be realy great to have this feature for dealing with currency values.

People

  • Assignee:
    Brian Chan
    Reporter:
    Marcel Jansen
Vote (3)
Watch (7)

Dates

  • Created:
    02/Jun/06 1:28 PM
    Updated:
    11/Feb/12 3:16 PM

Agile

  • View on Board
  • Atlassian JIRA (v5.2.11#854-sha1:ef00d61)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Liferay. Try JIRA - bug tracking software for your team.