Fórumok
Linking web content betwenn an organizations
André Gärtner, módosítva 11 év-val korábban
Linking web content betwenn an organizations
New Member Bejegyzések: 5 Csatlakozás dátuma: 2012.10.05. Legújabb bejegyzések
Hi all,
we wrote a hook which should be used to copy the layout from one organization to another. First we tried to use the export capabiltites of liferay but since a copy of the web content have been created instead just to link the web content to the pages we decided to use a hook that copy the pages and link its content.
We are now able to copy the layout (structure / pages) in another organization. We are facing now the problem that we cannot link the web content to the layout / pages but are able to find out which web content / portlets are used on a page.
We are using the following liferay models:
- Layout (LayoutLocalServiceUtil)
- LayoutTypePortlet (Layout.getLayoutType())
- Portlet (LayoutTypePortlet.getPortlets())
Is there anyone that can point to us which further liferay model class we should use so that we can link portlets and web content to a page / layout?
Any information / help is appreciated.
Thank you very much
André
we wrote a hook which should be used to copy the layout from one organization to another. First we tried to use the export capabiltites of liferay but since a copy of the web content have been created instead just to link the web content to the pages we decided to use a hook that copy the pages and link its content.
We are now able to copy the layout (structure / pages) in another organization. We are facing now the problem that we cannot link the web content to the layout / pages but are able to find out which web content / portlets are used on a page.
We are using the following liferay models:
- Layout (LayoutLocalServiceUtil)
- LayoutTypePortlet (Layout.getLayoutType())
- Portlet (LayoutTypePortlet.getPortlets())
Is there anyone that can point to us which further liferay model class we should use so that we can link portlets and web content to a page / layout?
Any information / help is appreciated.
Thank you very much
André
Daphné Bellemin, módosítva 11 év-val korábban
RE: Linking web content betwenn an organizations
New Member Bejegyzések: 5 Csatlakozás dátuma: 2011.05.25. Legújabb bejegyzések
Hello,
If you are using the standart webcontent display portlet (56), the article displayed in the portlet is in PortletPreferences; There are some services to access the preferences.
Daphné
If you are using the standart webcontent display portlet (56), the article displayed in the portlet is in PortletPreferences; There are some services to access the preferences.
Daphné
André Gärtner, módosítva 11 év-val korábban
RE: Linking web content betwenn an organizations
New Member Bejegyzések: 5 Csatlakozás dátuma: 2012.10.05. Legújabb bejegyzések
Hello Daphné,
thank you so munch for your very helpful answer. I could not see the connection between a Portlet, the PortletPreferences and the JournalArticle before.
André
thank you so munch for your very helpful answer. I could not see the connection between a Portlet, the PortletPreferences and the JournalArticle before.
André
André Gärtner, módosítva 11 év-val korábban
RE: Linking web content betwenn an organizations
New Member Bejegyzések: 5 Csatlakozás dátuma: 2012.10.05. Legújabb bejegyzések
I would like to put down the solution of the copy hook here:
Greetings André
- Lookup for an Organization with the specified name an use the CompanyLocalServiceUtil.getCompanyByWebId(companyName)
- Create the target organization with OrganizationLocalServiceUtil.addOrganization(...)
- Get Layouts from the source Organization with LayoutLocalServiceUtil.getLayouts(srcGroupID, ....)
- Copy the layout from the source with LayoutLocalServiceUtil.addLayout(...)
- Check the type of the Layout weather its a 'link_to_layout' or a 'portlet'. We store the linking between the source layouts in a map to link the target layouts an separated step.
- Copy the type settings of a portlet with targetLayout.setTypeSettingsProperties(srcLayout.getTypeSettingsProperties())
- Get the portlet ids from the LayoutTypePortlet of the source layout and iterate them
- With PortletPreferencesLocalServiceUtil.getPreferences(..... , srcLayout.getPlid(), srcPortletId) we get the preferences of a portlet. When we just want to link the uses web content we use the method setValue(key, value) of the javax.portlet.PortletPreferences and set the 'group-id' to the group id of the the target organization.
- Store the PortletPreferences with PortletPreferencesLocalServiceUtil.updatePreferences() where we use the changed Preferences of the source with the Plid of the target layout
- Linking the content is okay when it comes from the global context. When we have a JournalArticle that is private to the source organization, we copy this article before an set the new id of the copied JournalArticle in the PortletPreferences. The Key is 'article-id'.
Greetings André