Foros de discusión

LRF DXP ExportImportLifecycleListener Equivalent in Liferay 6.2

thumbnail
Jiří Kadlec, modificado hace 6 años.

LRF DXP ExportImportLifecycleListener Equivalent in Liferay 6.2

New Member Mensajes: 2 Fecha de incorporación: 3/08/12 Mensajes recientes
Hello,

I would like to ask, if there is any equivalent for ExportImportLifecycleListener from Liferay (DXP/7.0) in version 6.2?

My Use case:
I need to do some extra work, when the staged model (eg. JournalArcitle) is successfully published, something like set expand at the staging variant of this staged model. It worked perfectly on Liferay DXP, but now I need similar solution on 6.2.

May be StagedModelDataHandler and doImportStagedModel(…) method?

Thanks for recommendation.

Jiri
thumbnail
Andrew Jardine, modificado hace 6 años.

RE: LRF DXP ExportImportLifecycleListener Equivalent in Liferay 6.2

Liferay Legend Mensajes: 2416 Fecha de incorporación: 22/12/10 Mensajes recientes
I've never tried what you are trying, but I am wondering if you can accomplish it with a Struts Action override? I am looking at the GA6 conde base for 6.2 and I have found class called ExportImportAction.java. In the processAction method I can see --

...
				}
				else if (cmd.equals("publish_to_live")) {
					hideDefaultSuccessMessage(actionRequest);

					StagingUtil.publishToLive(actionRequest, portlet);

					sendRedirect(actionRequest, actionResponse);
				}
...


though given the path and parameters, that looks like it might be specific to portlets? I can also see a class JournalArticleStagedModelDataHandler which aligns a bit better with what you are saying, so perhaps that is what you are looking for? If it is, then the updates might be a challenge because that class is in the portal-impl and is being referenced in the liferay-portlet.xml

<staged-model-data-handler-class>com.liferay.portlet.journal.lar.JournalArticleStagedModelDataHandler</staged-model-data-handler-class>


One option is to use an EXT plugin -- but I hate them, as do most I think. Another option which I have used before (to avoid EXTs), though I am not sure I should sanction it emoticon, is to tap into the *Registry class. A lot of the classes that are found in the liferay-portlet.xml are recorded in a registry when deployment occurs. The good news is that the RegistryUtil classes are almost always in the portal-service so you can access them in your code.

I have, for example, used this approach in the past to change the handler class that is registered for one of the models to change the way the item renders in the Activity Feed portlet. You could have a look at the com.liferay.portal.kernel.lar.StagedModelDataHandlerRegistryUtil and then maybe use a startup hook to register your custom StagedModelDataHandler with the logic you need?
thumbnail
Jiří Kadlec, modificado hace 6 años.

RE: LRF DXP ExportImportLifecycleListener Equivalent in Liferay 6.2

New Member Mensajes: 2 Fecha de incorporación: 3/08/12 Mensajes recientes
Hi Andrew, thank you for response.

I have succeeded with CustomPortletDataHandler. I have managed to get published journalArcitles ids and Layout Ids through portletDataContext.getNewPrimaryKeysMap(JournalArticle.class) and so on.
My new problem is connected with referenced JournalArticles. If you publish page with Journal display portlet and do not check web contents in publication dialog, it publishes only content referenced by Journal display portlet (by stored ID in portet preferences).
Do you happen to know, how to get this information too? So how to get ID of referenced content in my custom data handler? portletDataContext.getNewPrimaryKeysMap(JournalArticle.class) doesn’t provide ids of referenced content.
Thank you
Jiri