Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Alexey Kakunin
ext-model-hints.xml refreshed after each ServiceBuilder run
August 22, 2009 1:54 PM
Answer

Alexey Kakunin

Rank: Expert

Posts: 484

Join Date: July 7, 2008

Recent Posts

Hi!
I'm developing customized installation of Liferay with using ext-environment. We have several portlets and several service.xml in it. For one entity I'm using Date field and I need to enter only Date (without time) in liferay-ui:input-field tag.

So, I edited my ext-model-hists.xml and added <hint name="show-time">false</hint> there.

But, problem is - every time, I run ServiceBuilder for all services in project (we have it in our build file to refresh DB & SQL scripts) - that hints file regenereated - and my changes lost.

Are there any way to set hints in service.xml (for example), so every time I generate service with ServiceBuilder - they will go into model-hints file?

Thank you for any advice!
Wilson Man
RE: ext-model-hints.xml refreshed after each ServiceBuilder run
August 22, 2009 9:12 PM
Answer

Wilson Man

LIFERAY STAFF

Rank: Liferay Master

Posts: 580

Join Date: June 21, 2006

Recent Posts

I believe you can override your ext-model-hints.xml file with your own by adding this to your portal-ext.properties:

 1##
 2## Model Hints
 3##
 4
 5    #
 6    # Input a list of comma delimited model hints configurations.
 7    #
 8    model.hints.configs=\
 9        META-INF/portal-model-hints.xml,\
10        META-INF/ext-model-hints.xml,\
11        META-INF/portlet-model-hints.xml,\
12        META-INF/your-custom-model-hints.xml


and in the file, copy and paste the <model> section you want to override and then make your modifications there.

(I haven't actually tried that myself, but it should work ...)
Nagendra Kumar Busam
RE: ext-model-hints.xml refreshed after each ServiceBuilder run
October 6, 2009 3:03 AM
Answer

Nagendra Kumar Busam

Rank: Liferay Master

Posts: 645

Join Date: July 7, 2009

Recent Posts

I have a requirement for changing one of the liferay table's column from varchar(75) to longtext.

I tried this using ext-model-hints.xml, after required changes if i try to re-build the service it is overriding the changes i made in ext-model-hints.xml

By default in liferay, portal-model-hints.xml it is some thing like this
1    <model name="com.liferay.portlet.journal.model.JournalFeed">
2        <field name="type" type="String" />
3    </model>


I changed it as below in ext-model-hints.xml
1    <model name="com.liferay.portlet.journal.model.JournalFeed">
2        <field name="type" type="String">
3            <hint-collection name="TEXTAREA" />
4        </field>
5    </model>


I have seen some relevant issue in JIRA @ LEP-7406

Please guide me how can i achieve the required functionality

Thanks in advance

- Nagendra Kumar
Wilson Man
RE: ext-model-hints.xml refreshed after each ServiceBuilder run
October 6, 2009 8:44 AM
Answer

Wilson Man

LIFERAY STAFF

Rank: Liferay Master

Posts: 580

Join Date: June 21, 2006

Recent Posts

have you created a custom model-hints.xml file outlined in my previous post? you need to make your changes there and not in ext-model-hints.xml directly.

OR

as Minhchau pointed out in a separate thread, if you make the changes in the "classes" folder instead of the "src" folder, your changes should persist.
Nagendra Kumar Busam
RE: ext-model-hints.xml refreshed after each ServiceBuilder run
October 6, 2009 8:53 AM
Answer

Nagendra Kumar Busam

Rank: Liferay Master

Posts: 645

Join Date: July 7, 2009

Recent Posts

Hi,

Thank you very much for the prompt reply.

If we go with classes way of approach every time we do ant clean operation at ext/ext-impl level we have to do build & rebuild (ant compile build-services) services. Every time we need to change the *.model-hints.xml file manually? I think without this change it may not be possible to do.


Regards,
- Nagendra Kumar
Wilson Man
RE: ext-model-hints.xml refreshed after each ServiceBuilder run
October 6, 2009 9:08 AM
Answer

Wilson Man

LIFERAY STAFF

Rank: Liferay Master

Posts: 580

Join Date: June 21, 2006

Recent Posts

so have you tried adding your own model-hints.xml file in the src and place the name of your file into the portal-ext.properties outlined in my first post? Or did that not work?
Nagendra Kumar Busam
RE: ext-model-hints.xml refreshed after each ServiceBuilder run
October 6, 2009 9:16 AM
Answer

Nagendra Kumar Busam

Rank: Liferay Master

Posts: 645

Join Date: July 7, 2009

Recent Posts

Even in this case also if we do ant clean it will be same right?
Wilson Man
RE: ext-model-hints.xml refreshed after each ServiceBuilder run
October 6, 2009 9:43 AM
Answer

Wilson Man

LIFERAY STAFF

Rank: Liferay Master

Posts: 580

Join Date: June 21, 2006

Recent Posts

not if your file is in "src" and also your portal-ext.properties ... you only lose generated files when doing a clean ... and ext-model-hints.xml is generated.
Daniele Segato
RE: ext-model-hints.xml refreshed after each ServiceBuilder run
December 2, 2009 6:13 AM
Answer

Daniele Segato

Rank: New Member

Posts: 12

Join Date: October 5, 2009

Recent Posts

Alexey Kakunin:
Hi!
So, I edited my ext-model-hists.xml and added <hint name="show-time">false</hint> there.

But, problem is - every time, I run ServiceBuilder for all services in project (we have it in our build file to refresh DB & SQL scripts) - that hints file regenereated - and my changes lost.

Are there any way to set hints in service.xml (for example), so every time I generate service with ServiceBuilder - they will go into model-hints file?

Thank you for any advice!



Hi,

we had the same problem.

After a lot of debugging I found out the problem is that it doesn't read the "modified" ext-model-hints.xml file in the Ext environment.

The proposed solution to add a new file to the model.hints.configs isn't suitable for me, mainly for two reason:

1. it doesn't work for automatically creating database scripts (if you don't want allow schema creation at runtime)
2. you had to keep updated the new file if you modify a service.xml which you have added some hint.


The solution is to simply add this to the app.server.ext.properties (I think it could also work with build.ext.properties):
1classpath.ext=${project.dir}/ext-impl/src;${project.dir}/ext-service/src


then modify your hints directly in your ext environment at ext-impl/src/META-INF/ext-model-hints.xml and re-launch the service builder.
The hints will be kept and you can later execute the sql build-db target to create database scripts according to your hints.

I'm a little disappointed of the lack of reply from Liferay here.

regards,
Daniele
SZ khan
RE: ext-model-hints.xml refreshed after each ServiceBuilder run
April 1, 2010 2:54 AM
Answer

SZ khan

Rank: Regular Member

Posts: 148

Join Date: October 31, 2009

Recent Posts

thankx daniele ...it worked
kailash b
RE: ext-model-hints.xml refreshed after each ServiceBuilder run
March 28, 2013 1:03 AM
Answer

kailash b

Rank: New Member

Posts: 14

Join Date: November 12, 2012

Recent Posts

Thanks for all
Vaibhav Patil
RE: ext-model-hints.xml refreshed after each ServiceBuilder run
August 13, 2013 2:20 AM
Answer

Vaibhav Patil

Rank: Junior Member

Posts: 30

Join Date: July 7, 2013

Recent Posts

kailash b:
Thanks for all


emoticon

Thanks we refer this and come to final find solution is that ,emoticon
1 Build service 1 st time
2 It will generate META-INF
3 Copy META-INF at SRC level and add hint xml file
rebuild service it will ref hint xml

emoticon