Sometimes we have to know which liferay version we are using, so how can we know? We can know the liferay version in different ways. 1. Liferay has provided some utility methods to know the which liferay version we are using , Here is the utility method ReleaseInfo.getReleaseInfo() It prints this statement " Liferay Portal Community Edition 6.2 CE GA2 (Newton / Build 6201 / March 20, 2014) " as i am using community version it shoes as CE. 2. Also we can also identify by response headers as below screenshot. If your using the chrome, right click on the browser and click inscept element , and navigate to the network . you will see the URLS , click on the any url. 3. Also we can see during server startup as below statement Liferay Portal Community Edition 6.2 CE GA2 (Newton / Build 6201 / March 20, 2014)
In Liferay we can exceute the background task asynchrously. The Background Task framework allows the developers to create and manage any kind of tasks that need to be run in a separated thread without the need of knowing anything about JAVA threading or concurrency Here the code ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY); Map taskContextMap = null; String taskName = null; String servletContextNames [] = new String[1] ; Portlet portlet = PortletLocalServiceUtil.getPortletById(request.getAttribute(WebKeys.PORTLET_ID).toString()); servletContextNames[0] = portlet.getContextName(); try { BackgroundTaskLocalServiceUtil.addBackgroundTask(themeDisplay.getUserId(), themeDisplay.getScopeGroupId(), taskName, servletContextNames,TestBackgroundTaskExecutor.class, taskContextMap,new ServiceContext()); } catch (PortalException e) { e.printStackTrace(); } catch (SystemException e) { e.printStackTrace(); } ...
Whenever we create finder method by default it generates many methods associating with it starts by method name as findBy ..... Sometimes it may requires you to display the results in the ASC/DESC. So we have one method which accepts OrderByComparator as parameter. Below example explains you how to retrieve the Title in the Ascending order. OrderByComparator comparator = OrderByComparatorFactoryUtil.create(TestModelImpl.TABLE_NAME, "title", orderByType.equals("asc")) jsonTestEntryPersistance.findByTitle("name",comparator);
Comments
Post a Comment