Fóruns

Início » Liferay Portal » English » 3. Development

Visualização combinada Visão plana Exibição em árvore
Tópicos [ Anterior | Próximo ]
Jonas Yuan
Supporting datatype BigDecimal in ServiceBuilder
6 de Fevereiro de 2011 21:56
Resposta

Jonas Yuan

Ranking: Liferay Master

Mensagens: 993

Data de entrada: 26 de Abril de 2007

Mensagens recentes

Any application or portlet dealing with currencies should really use the java BigDecimal class. Thus It would be nice for the Service-Builder to support data-type BigDecimal. Refer to Service Builder support for BigDecimal. Thanks to Marcel Jansen.

Is it Interesting? Hope that you can share your thoughts / ideas, etc.

First of all, let me share a proposal as follows.

1) provide data type called big_decimal in service-builder DTD

e.g.,
1<column name="field6" type="big_decimal" convert-null="false" />
2<column name="field7" type="big_decimal" convert-null="true" />

2) add new data type in Liferay core called BigDecimalType, where specifies default value;

3) map big_decimal into NUMERIC or DECIMAL as part of SQL scripts

4) map big_decimal into data type BigDecimalType

In above four steps, we could make data-type BigDecimal supported via Service-Builder.

You may refer to new features Service-Builder improvement for the element convert-null.

Your suggestions?

Thanks

Jonas Yuan

==================
The Author of Liferay Books:
Liferay User Interface Development
Liferay Portal 6 Enterprise Intranets
Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets
Jonas Yuan
RE: Supporting datatype BigDecimal in ServiceBuilder
6 de Fevereiro de 2011 22:17
Resposta

Jonas Yuan

Ranking: Liferay Master

Mensagens: 993

Data de entrada: 26 de Abril de 2007

Mensagens recentes

It would be better to add two elements for type BigDecimal in service-builder.

constraint-precision: the precision
constraint-scale: the scale

For example,

1salary DECIMAL(5,2)


constraint-precision: 5
constraint-scale: 2
Hitoshi Ozawa
RE: Supporting datatype BigDecimal in ServiceBuilder
7 de Dezembro de 2011 14:32
Resposta

Hitoshi Ozawa

Ranking: Liferay Legend

Mensagens: 8000

Data de entrada: 23 de Março de 2010

Mensagens recentes

Jonas, are you going to attach a patch as you've wrote in the LPS?

http://issues.liferay.com/browse/LPS-15233
Jonas Yuan
RE: Supporting datatype BigDecimal in ServiceBuilder
7 de Dezembro de 2011 18:13
Resposta

Jonas Yuan

Ranking: Liferay Master

Mensagens: 993

Data de entrada: 26 de Abril de 2007

Mensagens recentes

Hi Hitoshi,

Thanks to reminder me. Yes, I do have a plan to generate a fix patch for this.

http://issues.liferay.com/browse/LPS-15233

But there are several patches pending in my plates. I will try do this as early as possible.

Thanks

Jonas

==================
The Author of Liferay Books:
Liferay development cookbook: Liferay Portal Systems Development (for liferay portal 6.1 or above version)
Liferay User Interface Development
Liferay Portal 6 Enterprise Intranets
Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets
Suman Kumar
RE: Supporting datatype BigDecimal in ServiceBuilder
7 de Dezembro de 2011 04:55
Resposta

Suman Kumar

Ranking: Junior Member

Mensagens: 34

Data de entrada: 21 de Outubro de 2011

Mensagens recentes

Hi Yaun,

You have suggested the steps below but you have not mentioned in which files we have to make these changes.

Also I want the support for TimeStamp datatype. Please guide me what I need to do make it work with service builder or in Liferay?

Thanks and Regards
Suman Kumar
Jonas Yuan
RE: Supporting datatype BigDecimal in ServiceBuilder
7 de Dezembro de 2011 18:17
Resposta

Jonas Yuan

Ranking: Liferay Master

Mensagens: 993

Data de entrada: 26 de Abril de 2007

Mensagens recentes

Hi Suman

Thanks, good point to support "TimeStamp".

Can you please add more details about "TimeStamp"? It would be nice that you could provide real example from your requirements.

Anyway, you can add your comments or requirements in the ticket.
http://issues.liferay.com/browse/LPS-15233

Thanks

Jonas
Suman Kumar
RE: Supporting datatype BigDecimal in ServiceBuilder
7 de Dezembro de 2011 22:08
Resposta

Suman Kumar

Ranking: Junior Member

Mensagens: 34

Data de entrada: 21 de Outubro de 2011

Mensagens recentes

Hi Jonas,

In our project we have display many reports which are time based like, How many P1 alerts came in past 30 mins or 1 hr etc?

So I have to maintain the time details in the createdDate column. So TimeStamp will be helpfull in all the cases where we are doing this hourly based reporting.

Also in the record detail we need to show the proper time of creation of the record.

I am sure people must be using the time components (hh:mm:ss AM) in there project. If its currently not supported in Liferay then I will like to know what alternate option we have?

Thanks and Regards
Suman Kumar
Jonas Yuan
RE: Supporting datatype BigDecimal in ServiceBuilder
8 de Dezembro de 2011 12:34
Resposta

Jonas Yuan

Ranking: Liferay Master

Mensagens: 993

Data de entrada: 26 de Abril de 2007

Mensagens recentes

Hi Suman,

Your requirements have been supported in the LR OOB.

You can call API like to get DateTime and display it as whatever format you expected

For example,
1Format dateFormatDateTime = FastDateFormatFactoryUtil.getDateTime(locale, timeZone);


Hope that it helps,

Jonas

==================
The Author of Liferay Books:
Liferay development cookbook: Liferay Portal Systems Development (for liferay portal 6.1 or above version)
Liferay User Interface Development
Liferay Portal 6 Enterprise Intranets
Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets
Suman Kumar
RE: Supporting datatype BigDecimal in ServiceBuilder
8 de Dezembro de 2011 22:50
Resposta

Suman Kumar

Ranking: Junior Member

Mensagens: 34

Data de entrada: 21 de Outubro de 2011

Mensagens recentes

Hi Jones,

My requriement is not jsut to display the data time, But to also save and retrive it. So please clarify the below query

Suppose I have a table column 'createdDate' with datatype 'TIMESTAMP' in MySQL db

and below is the sample service.xml for it.

<entity name="Bike" local-service="true" remote-service="false">
<column name="bikeId" type="long" primary="true"/>
<column name="createdDate" type="Date"/>
</entity>

So now BikeLocalServiceUtil.getBike(id) will return Bike object and now if I use the below code I should get the TimeStamp value as saved in the db.

dateFormatDateTime.format(bike.getCreatedDate()) //using FastDateFormatFactoryUtil

Will I get the TimeStamp value?

I tried to under the FastDateFormatFactoryUtil implementation but it doen't have documentation so I am unable to understand it.
Please confirm my above undertatnding. I am also trying out one sample at my end.

Thanks and Regards
Suman Kumar
Suman Kumar
RE: Supporting datatype BigDecimal in ServiceBuilder
12 de Dezembro de 2011 05:14
Resposta

Suman Kumar

Ranking: Junior Member

Mensagens: 34

Data de entrada: 21 de Outubro de 2011

Mensagens recentes

Hi Jones,

I tried the sample for TIMESTAMP datatype and its working for me as I thought in my previous post.

Thanks Jones for the FastDateFormatFactoryUtil class info.

And I will like to mention that the service builder is not overriding the ext-model-hint.xml

Another thing I noticed that in portlet-hbm.xml file the Date field gets mapped to TimestampType.

With Regards
Suman Kumar
Jonas Yuan
RE: Supporting datatype BigDecimal in ServiceBuilder
1 de Fevereiro de 2012 23:35
Resposta

Jonas Yuan

Ranking: Liferay Master

Mensagens: 993

Data de entrada: 26 de Abril de 2007

Mensagens recentes

Thanks, Suman,

You would see more about Service-Builder improvement at

LPS-15136

Jonas

==================
The Author of Liferay Books:
Liferay 6.1 cookbook: Liferay Portal Systems Development
Liferay User Interface Development
Liferay Portal 6 Enterprise Intranets
Liferay Portal 5.2 Systems Development
Liferay Portal Enterprise Intranets