liferay-6

Testing for custom plugin portlet: BeanLocatorException and Transaction roll-back for services testing

寵の児 提交于 2019-11-30 12:30:51
问题 My Problems: I can test successfully for CRUD services operation. I was doing an insert on @Before [setUp()] and delete of same data on @After [tearDown()] but going forward I would need to support Transactions rather than writing code for insert and delete. I am successful in fetching single records of my entity but when I fire a search query or try to fetch more than one of my entities I get: com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet

Programmatically get the url of a page in liferay

寵の児 提交于 2019-11-30 08:27:49
I want to create a link in a portlet so that I can navigate to a different page in the liferay portal. I order to do that I am looking for an API (can be liferay specific) that given a page name, would return it's url (it can be the friendlyURL as well). The API to access pages in Liferay is the LayoutService. However, page names are not unique in Liferay and furthermore they are internationalized. So you need some unique property for a page to retrieve its url, besides its name. If you really only have the page name, you can use LayoutLocalServiceUtil.getLayouts(...) to loop over all Layouts

How can I get the current user in Liferay?

丶灬走出姿态 提交于 2019-11-30 06:49:06
How can I get the current user connected to a Liferay portal with a simple Java code? I'm using Liferay 6.0.6 Simply: User currentUser = PortalUtil.getUser(request); Ravi Kumar Gupta In your doView/processAction method do following User user = (User) request.getAttribute(WebKeys.USER); or use the ThemeDisplay object. It contains another information like companyId, groupId, ... ThemeDisplay td =(ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY); User user = td.getUser(); Classes ThemeDisplay, User and WebKeys are part of portal-service.jar. If you need just some id to identify current

extend session of Liferay when performing AJAX call

柔情痞子 提交于 2019-11-30 05:27:05
I created a portlet that uses AJAX every function. That is, the portlet is only rendered once and i didnt utilize processAction or the like. Is there a way to extend the user's session using built in Liferay function using javascript? I tried Liferay.Session.extend(); but it does not seem to work.. I also tried a solution in the ICEfaces forum, which is if (Liferay.Session._stateCheck) { window.clearTimeout(Liferay.Session._stateCheck); Liferay.Session._stateCheck = null; } Liferay.Session.init({ autoExtend: false, timeout: Liferay.Session._timeout, timeoutWarning: Liferay.Session._warning })

Is it possible to add Extra Fields Under Create User in Liferay

微笑、不失礼 提交于 2019-11-30 05:12:41
I am using Liferay 6 for portal Development . During Creating Users under Liferay , i need to add some extra Fields also ?? Please let me know if this is ppossible or not ?? Please see the screen shot attached here , and also please let me know in which table this will be stored in Database ?? Yes, you can use Custom Attributes functionality for liferay entities (in your case, User) and can add as many extra fields as necessary for each liferay entity. Custom field for the user-entity can be created through: Control Panel -> Portal -> Custom Fields -> User . And programmatically can be created

“A is not defined” inside of <aui:script> block

ぐ巨炮叔叔 提交于 2019-11-30 02:47:22
问题 I'm trying to extend some functionality of an existing Liferay portlet. As part of this, I would like to use Alloy UI to modify the value of a field in the portlet. There's a pre-existing <aui:script> block where I would like to define my custom function. I went ahead and tried using A.one('element') , but I am receiving the error "A is not defined." A.one() is used elsewhere in the same .jsp file, though not in an <aui:script> block, and it functions as expected. I have tried Googling this

Testing for custom plugin portlet: BeanLocatorException and Transaction roll-back for services testing

廉价感情. 提交于 2019-11-30 02:21:08
My Problems: I can test successfully for CRUD services operation. I was doing an insert on @Before [setUp()] and delete of same data on @After [tearDown()] but going forward I would need to support Transactions rather than writing code for insert and delete. I am successful in fetching single records of my entity but when I fire a search query or try to fetch more than one of my entities I get: com.liferay.portal.kernel.bean.BeanLocatorException: BeanLocator has not been set for servlet context MyCustom-portlet I have followed some of the following links to set-up Junit with Liferay: Liferay

How to add custom portlet in Control Panel section

不羁岁月 提交于 2019-11-29 20:55:20
问题 How can I add a custom portlet to the Portal section of the Control Panel, as shown in the following figure: 回答1: Here is how to do it: In your portlet's liferay-portlet.xml (you can check the DTD of this xml for more information on other tags) include two tags in your <portlet> tag as shown: <portlet> <portlet-name>MyCustomPortlet</portlet-name> <icon>/mycustom.png</icon> <!-- These are the two entries which are required for the portlet to appear in the control panel --> <!-- Set the control

How can I run some action when my plugin was deployed to Liferay?

烈酒焚心 提交于 2019-11-29 15:55:30
I want to run some code as soon as my plugin ( portlet , hook or theme ) is available in Liferay. I can't find anything like a startup listener in liferay-plugin-package.xml , liferay-portlet.xml , liferay-hook.xml or liferay-look-and-feel.xml . There is another way. You could utilize the StartupAction. It is merely an Event, which get's triggered on every startup of a plugin. This method will only get triggered once on a server start or deploy. Recognize, that the doRun method get's a String array of companyIds as an argument. A companyId is representing a portal instance (the Liferay

How to create a download button for multiple files using Liferay and JavaScript?

天大地大妈咪最大 提交于 2019-11-29 12:36:12
I am trying to make a button when clicking, it downloads the files in a zip file. I tried to load the files into the Zip from given url. I am using Liferay 6.1 . Is the script declaration in the JSP file correct? I have already specified jszip.js in liferay-portlet.xml. <footer-portlet-javascript>/js/jszip.js</footer-portlet-javascript> Do I have to use the Liferay AUI Taglib tag or a simple javaScript tag should do the work? <aui:script></aui:script> or <script type="text/javascript"></script> or liferay-portlet.xml Is my script to download multi-files correct? <c:if test="<%= multi_files