Liferay 7 LogFactoryUtil.getLogFactory().setLevel method - liferay-7

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.

Related

Accessing E4PartWrapper's MPart in Eclipse 3.x RCP application

I am using the ability to add an Eclipse 4.x part to an Eclipse 3.x RCP application's perspective as described in the Vogella chapter on RCP migration. All is well, I can create an 4.x part and view it in a 3.x perspective.
I'd like to access the instantiated 4.x POJO (in my case it contains a Browser widget) and set some parameters for display (the browser URL). However when I try to probe the constructed ViewPart what I have to deal with is an E4PartWrapper object:
E4PartWrapper newPart =
window.getActivePage().
showView(ViewEclipse4x.ID,
String.valueOf(nextId),
IWorkbenchPage.VIEW_ACTIVATE);
I can see from the code that E4PartWrapper does contain the wrapped part, but I don't see a way to access this object.
Is there an alternative to accessing the 4.x POJO underlying the constructed 3.x ViewPart?
Thank you.
Carlos S. Zamudio
Sorry. I can see the MPart can be found using the PartService:
EPartService partService = (EPartService) viewSite.getService(EPartService.class);
MPart part = partService.findPart(partName);

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. :-(

Wicket 1.4 EJB Support

I tried implementing the JavaEE Inject jar from Wicket Stuff. (glassfish v3, wicket 1.4)
- however, the code given in the tutorial doesn't work
method
addComponentInstantiationListener in
class org.apache.wicket.Application
cannot be applied to given types
required:
org.apache.wicket.application.IComponentInstantiationListener
found:
org.wicketstuff.javaee.injection.JavaEEComponentInjector
looks to me like the API has changed. The JIRA link inside
http://wicketstuff.org/confluence/display/STUFFWIKI/JavaEE+Inject
and the Repository link are both broken. Is it still maintained?
Another short question: Is it possible to populate ListView directly with entity beans? I'd like to avoid too many proxy classes.
Thanks in advance
Yes, you can inject a ListView with entity beans. You should do so by creating an implementation of IDataProvider (or one of it's sub-interfaces) for the iterator and have it wrap the entities with LoadableDetachableModel so they can be reloaded instead of serialized as a part of the session.
Figured it out: I didn't expect there to be a difference between 1.4.13 and 1.4.14 but apparently the API changed there significantly.

Where is the jar file for EJB3 annotations for JBoss 5?

This should be simple, but I'm at a complete loss.
I'm working through a tutorial for setting up some MBeans in JBoss 5.0. It has an example like this:
#Remote
public interface Calculator {
public double getInterestRate();
public double calculateTotalInterest(double presentValue, int years);
public double calculateFutureValue(double presentValue, int years);
}
I'm trying to find the jar file that contains the data for the #Remote annotation, and I cannot seem to find which jar file I need. A google search gives me little to nothing that seems to apply to JBoss 5.0. Any help would be much appreciated.
It's smuggled away inside common/lib/jboss-javaee.jar, along with the rest of the JavaEE API. This JAR is for use by the JBoss server.
Another copy is kept inside client/jboss-javaee.jar, for use by clients.
Both are copies of the same classes.
And if you are in a similar situation in future, go to www.findjar.com, type in the name of the class, and the search engine would find the jar for you. That website has served me countless times.