Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Nagendra Kumar Busam
JSONSerializer obsolete
August 23, 2012 5:42 AM
Answer

Nagendra Kumar Busam

Rank: Liferay Master

Posts: 598

Join Date: July 7, 2009

Recent Posts

I have a portlet which was developed in Liferay 5.2 EE SP3,

I am trying to migrate the same to Liferay 6.1 EE GA1, I have JSONSerializer's for my custom enitities generated through service builder in 5.2 EE SP3 - where as using Liferay 6.1 EE GA1 it is not generating any of those.

How can i generate the same.

It seems this feature is obsolete now - I am not quite sure though, http://issues.liferay.com/browse/LPS-17433

From liferay-service-builder_6_1_0.dtd

The json-enabled value specifies whether or not the entity should be annotated
for JSON serialization. By default, if the remote-service value is true, then
the json-enabled value is true.


I have remote-service value as true, even though it is not generating

Thanks,
- Nagendra Kumar
David H Nebinger
RE: JSONSerializer obsolete
August 23, 2012 6:15 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6242

Join Date: September 1, 2006

Recent Posts

I'm thinking maybe you're bringing over an artifact from 5.2 that is affecting your 6.1 build...

For this sort of migration you should start with a new portlet plugin in the new sdk. Copy *only* your service.xml file in, and no other existing source from your 5.2 service plugin.

Build the service stuff in the new plugin. This will give you basically a blank template that is 6.1-ready.

Then merge in your service impl classes and rebuild again.

See if this resolves your issues.
Nagendra Kumar Busam
RE: JSONSerializer obsolete
August 23, 2012 9:39 PM
Answer

Nagendra Kumar Busam

Rank: Liferay Master

Posts: 598

Join Date: July 7, 2009

Recent Posts

Thank you very much for the quick response.

That is the way even I tried to migrate.

Here are the steps I followed
>I have created a blank new portlet & copied service.xml contents to new portlet created (I changed the new DTD for 6.1 though), build the portlet using - ant build-service command
> Copied my XXXLocalServiceImpl.java & XXXFinderImpl.java classes from older version to new version (@ the same directory path), build the portlet using - ant build-service command

I have some entities in service.xml which are remote-service="true", In 5.2 EE SP3 it is generating XXXJSONSerializers for respective entities - where as it is not generating the same for Liferay 6.1

I tried to copy XXXJSONSerializers from old version to latest version, build the portlet using - ant build-service command. After building the portlet using that command service builder is deleting the manually copied files from old version (XXXJSONSerializers)
David H Nebinger
RE: JSONSerializer obsolete
August 24, 2012 6:48 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6242

Join Date: September 1, 2006

Recent Posts

I think you can bring over your finders and local service impls, as those shouldn't be a problem.

For the service impls (non-local, remote service guys) you may want to rework them under the 6.x system rather than try to pull them as-is.
Run China
RE: JSONSerializer obsolete
August 27, 2012 9:01 AM
Answer

Run China

Rank: New Member

Posts: 2

Join Date: August 27, 2012

Recent Posts

Because ServiceBuilder have delete the JSONSerializer file.
private void _createServiceJsonSerializer(Entity entity);

System.out.println("Removing deprecated " + ejbFile);
Nagendra Kumar Busam
RE: JSONSerializer obsolete
August 27, 2012 10:28 PM
Answer

Nagendra Kumar Busam

Rank: Liferay Master

Posts: 598

Join Date: July 7, 2009

Recent Posts

I checked that but I am looking for a way to generate them automatically in 6.1
Run China
RE: JSONSerializer obsolete
September 3, 2012 3:54 AM
Answer

Run China

Rank: New Member

Posts: 2

Join Date: August 27, 2012

Recent Posts

Then, you can read the wiki page

Simple use JSONFactoryUtil.looseSerialize(object); get the Json object
Harish Kumar
RE: JSONSerializer obsolete
September 3, 2012 4:26 AM
Answer

Harish Kumar

Rank: Expert

Posts: 327

Join Date: July 31, 2010

Recent Posts

In our case, we are required to have different properties in json response based on the action in the service method so we choose manual serialization as specified in this wiki link