掲示板

Liferay Hook - Customizing the Organization form - Details Section ?

12年前 に Nagaraj Desingurajan によって更新されました。

Liferay Hook - Customizing the Organization form - Details Section ?

Junior Member 投稿: 31 参加年月日: 11/02/21 最新の投稿
Hi,

I'am trying to customize the Organization management in liferay.

First I wil put my question directly,

Can we override, com.liferay.portal.model.Organization and add few new columns in the organization table of the
liferay database?

All I'am trying to do is, I want to add new fields to the Add/Edit Organization - Details section of liferay UI

So, I trying to write a hook which will override the following,
- /html/portlet/users_admin/organization/details.jsp (add new fields which needs to be mandatory)
- edit_organization_action.java(if required)
- OrganizationLocalService.java(the override part will have the new fields I added to the details.jsp)
- com.liferay.portal.model.Organization.java (if possible)

I will really appreciate, any direct/indirect solution (or) any small/big references to the solution (or) even about the possibility/not.

I'am really stuck.

Thanks,
Nagaraj.
thumbnail
12年前 に Juhi Kumari によって更新されました。

RE: Liferay Hook - Customizing the Organization form - Details Section ?

Expert 投稿: 347 参加年月日: 11/12/12 最新の投稿
Hi Nagaraj,

You are not suppose to change anything in liferay core, so customize the existing organization table. Create a new tables with primary key as
organizationId and give the reference to existing organization table. Generate the service layer for that table. In serviceImpl override the existing method with your
new values and call this method in your action.

Regards
Juhi
12年前 に Nagaraj Desingurajan によって更新されました。

RE: Liferay Hook - Customizing the Organization form - Details Section ?

Junior Member 投稿: 31 参加年月日: 11/02/21 最新の投稿
Hi Juhi,

Thanks for your response. I will try as per your comments.

When you say, "In serviceImpl override the existing method with your new values...", do you mean we generate/override existing persistence(DAO) layer as well ?
Means, I will to have to create new "Organization" data model bean overriding the existing com.liferay.portal.model.Orhganization.java. Right ?

I ask this question because when u say to create new table(having refrence to exisiting org. table) you will thave to create new datamodel beans carrying fields for the
new columns on the new table right ?

I hope you understood my question. If not please you can reply back.

And, one more thing I have been searching for this two days. I believe liferay has a scattered documentation so every time we want new information I dont know from where I have to start my search.

I started learning about liferay in this way,

first I went thorugh Liferay in Action book. Then I start learning things from the existing community plugins (downloads section) of liferay site.
Am I following the right way or is there any other document which will help me get more idea on each concept of liferay, If possible can you guide me on this also?

Thanks,
Nagaraj.
thumbnail
12年前 に Juhi Kumari によって更新されました。

RE: Liferay Hook - Customizing the Organization form - Details Section ?

Expert 投稿: 347 参加年月日: 11/12/12 最新の投稿
Hi Nagaraj,

Create new model class like NewOrganization.i.e.,
<entity name="NewOrganization" local-service="true" remote-service="true">
		<!-- PK fields -->
		<column name="organizationId" type="long" primary="true" />

		<!-- Extra fields -->
		<column name="newColumn" type="String" />
			
		<!-- reference -->
		<reference package-path="com.liferay.portal" entity="Organization" />
	</entity>


Now in youe newly generated NewOrganizationLocalServiceImpl override the existing addOrganization(..,..,..,......) pass an extra argument of NewOrganization type.
Now call this method in your action.


Regards
Juhi
12年前 に Nagaraj Desingurajan によって更新されました。

RE: Liferay Hook - Customizing the Organization form - Details Section ?

Junior Member 投稿: 31 参加年月日: 11/02/21 最新の投稿
So juhi, you are saying I have to create a service builder inside my hook right ?
thumbnail
12年前 に Juhi Kumari によって更新されました。

RE: Liferay Hook - Customizing the Organization form - Details Section ?

Expert 投稿: 347 参加年月日: 11/12/12 最新の投稿
Hi Nagaraj,

Better to use ext plugins instead of hooks, because you have to override action also.

Regards
Juhi
12年前 に Nagaraj Desingurajan によって更新されました。

RE: Liferay Hook - Customizing the Organization form - Details Section ?

Junior Member 投稿: 31 参加年月日: 11/02/21 最新の投稿
Hey Juhi,

Thank you very much for your response. It looks like I have to create both hook and ext plugin.
Beacuse, service builders are deprecated in ext plugin. So, what I'am planning to do is,

write a ext plugin which takes care of the action part.
write a hook plugin which will have the service builder part.

And I will have to make the **-service.jar available to ext plugin.

Please correct me ?

I will just to remind about the whole task I'am trying to achieve here, again.

I have to add some new fields in the details section of the organization form of Liferay portal(remember I'am not adding them as custom fields). This means that I have to override all the layers of the liferay code right from jsp, action, service, persistence and data model(correct me). This is what I'am assuming and I'am going to further proceed like said above, I'am going to create both EXT plugin and Hook.

Please give your comments (if any) before I start.

Again, Thanks for the responses juhi. Will get back for sure.

-Nagaraj.
thumbnail
12年前 に Juhi Kumari によって更新されました。

RE: Liferay Hook - Customizing the Organization form - Details Section ?

Expert 投稿: 347 参加年月日: 11/12/12 最新の投稿
Hi,
Exactly the same I am telling. Hope it should work.

Regards
Juhi