How can I get the IDs of all installed portlets in Liferay 6.2? - liferay-6

In Liferay 6.1 one could get the identifiers of installed portlets with Liferay.Portlet.runtimePortletIds or WebKeys.RUNTIME_PORTLET_IDS.
However in Liferay 6.2 this forms have disappeared.
Can anyone tell me a way to get the same results as with the methods discussed above in Liferay 6.2?

You can access nearly every model object in Liferay with a ...LocalServiceUtil. In your case the PortletLocalServiceUtil:
List<Portlet> installedPortlets = PortletLocalServiceUtil.getPortlets();
for (Portlet installedPortlet : installedPortlets) {
String portletId = installedPortlet.getPortletId();
...
}

Related

Disabling SPA at porlet level

I have an WAR style application that has been converted from Liferay 6.2 to 7.1. it needs to have SPA turned off and has been tested successfully when turning off SPA at the portal level but would like to turn off at the portlet level.
have tried adding the false property to the object in liferay-portlet.xml but the app doesn't load into Liferay correctly after that and complains.
this appears to be the recommended approach from https://portal.liferay.dev/docs/7-0/tutorials/-/knowledge_base/t/automatic-single-page-applications. there may be some "order" necessary to these properties? I can't determine exactly what that might be from this DTD https://docs.liferay.com/ce/portal/7.1-latest/definitions/liferay-portlet-app_7_1_0.dtd.html#single-page-application.
a further inspection of the error message that occurs when the portlet is loading provides help that indicates the properties order that should appear in the liferay-portlet.xml. I'm able to deploy the portlet without error now.
unfortunately, the portlet still does not act properly. its an EXTJs front end and there are consistent "The schema can only be reconfigured once" and "duplicate object" errors reported in the browser console. reloading the entire page works fine.
how might one start to debug this issue?
I disabled SPA in a WAR application by setting <single-page-application> to false in liferay-portlet.xml
See: https://github.com/jorgediaz-lr/index-checker/blob/master/docroot/WEB-INF/liferay-portlet.xml#L18
<portlet>
<portlet-name>index_checker</portlet-name>
<icon>/icon.png</icon>
<configuration-action-class>com.liferay.portal.kernel.portlet.DefaultConfigurationAction</configuration-action-class>
<control-panel-entry-category>
apps
</control-panel-entry-category>
<control-panel-entry-weight>1.5</control-panel-entry-weight>
<control-panel-entry-class>
jorgediazest.indexchecker.portlet.IndexCheckerControlPanelEntry
</control-panel-entry-class>
<preferences-company-wide>true</preferences-company-wide>
<preferences-unique-per-layout>false</preferences-unique-per-layout>
<single-page-application>false</single-page-application>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>
/js/main.js
</footer-portlet-javascript>
<css-class-wrapper>index_checker-portlet</css-class-wrapper>
</portlet>
If that setting is not working to you and causes errors, please copy your log traces with the problems.

Liferay 7 LogFactoryUtil.getLogFactory().setLevel method

In liferay 6.2, I have been using the method:
LogFactoryUtil.getLogFactory().setLevel(String string , String string ,boolean boolean );
I try to use the same method in Liferay 7 but it is not included. I want to set the log level in my portlet but i can't find a method that can do that.
Thank you in advance!
Sorry to bring this to you but as it turned out, the setLevel() method is removed from the LogFactory interface of Liferay. If you will look into the source code you will find that in Liferay 7, the LogFactory interface only has two overloaded versions of the method getLog(). You should post your question in Liferay community and they might provide you an alternative to this if there is any.

Migrating to E4 - equivalent of PlatformUI.isWorkbenchRunning

In our Eclipse RCP 3.7 application we have quite a few calls to PlatformUI.isWorkbenchRunning().
For example most of the calls are guards around Workbench API calls, along the lines of
`
if (PlatformUI.isWorkbenchRunning()) {
display = PlatformUI.getWorkbench().getDisplay();
} else {
display = Display.getDefault();
}
We're migrating now to Eclipse RCP 4.4 and I can't find the correct way to replace these calls with RCP 4 compliant code.
I'm guessing I should inject some service / component and use that, but which component? IWorkbench cannot tell me whether it's running or not.
I would expect it to be quite a common problem, but could not find a solution by googling. Anyone solved this already?
e4 does not currently run headless so there isn't really an equivalent.
For access to the Display you can use
Display.getDefault()
everywhere.
If you have a class derived from SWT Control available you can also use Control.getDisplay()
If you want to use the asyncExec or syncExec methods of Display you can use UISynchronize as an alternative:
#Inject
UISynchronize uiSynch;
uiSynch.asyncExec(runnable);

unable to find DLFileEntryLocalServiceUtil.getFileEntryByTitle() in liferay 6.1

Is there any direct api to fetch a file entry by title with given folder id.
I have tried DynamicQueryFactoryUtil, apart from this is there anything to fetch DLFileEntries by title.
I believe DLFileEntryLocalServiceUtil.getFileEntryByTitle() is not there anymore in Liferay 6.1
In Liferay 6.1.0, I can see there is
com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil.getFileEntryByName(groupId, folderId, name), as I get from lib/ext/portal-service.jar
You can also see the official documentation here
I think you start by making sure you have the correct libraries imported
EDIT:
I guess that the parent folder and groupID are needed as more than 2 DLFileEntries can have the same title/name. If you need exactly 1 result, and giving only 1 attribute, you can use getDLFileEntry(long fileEntryId). If this doesn't help either, you should tell us some more on what you want to do , and what information you have available (except the title of course)
Liferay has a strange compatibility policy.
Seems like they renamed the getFileEntry to getFileEntryByName and getFileEntryByTitle to getFileEntry. The old and new getFileEntry both share the same singature, but the parameter name is different. :-(

Typo3 tt-news categories

My client wants to update an old tt-news installation version 2.x. Unfortunately the former maintainer of the site quit the job and let me do his job and although there is a huge category tree of news none of the categories are selected in the plugin configuration dialog at several locations. This seems to work with an older Typo3 4.1.3 but not when I update to a newer version. My question is it possible the tell tt-news with Typoscript or with a constant the current news category and how?
plugin.tt_news {
categorySelection = 2,3
# show only selected categories
categoryMode = 1
}
Details about this: http://typo3.org/documentation/document-library/extension-manuals/tt_news/3.1.0/view/1/4/