List of usage examples for com.liferay.portal.kernel.util JavaConstants JAVAX_PORTLET_CONFIG
String JAVAX_PORTLET_CONFIG
To view the source code for com.liferay.portal.kernel.util JavaConstants JAVAX_PORTLET_CONFIG.
Click Source Link
From source file:it.infn.ct.indigo.futuregateway.portlet.action.FGAddAppMVCActionCommandTest.java
License:Apache License
/** * Prepare the environment./*from w w w .j a v a2 s .c o m*/ * @throws Exception In case of a problem to replicate Liferay context */ @Before public final void setUp() throws Exception { JSONFactoryUtil jsonFactoryUtil = new JSONFactoryUtil(); jsonFactoryUtil.setJSONFactory(new JSONFactoryImpl()); PortalUtil pu = new PortalUtil(); pu.setPortal(portalImpl); Mockito.when(themeDisplay.getCompanyId()).thenReturn(0L); Mockito.when(themeDisplay.getUserId()).thenReturn(0L); Mockito.when(themeDisplay.getLayout()).thenReturn(layout); Mockito.when(layout.isTypeControlPanel()).thenReturn(true); Mockito.when(actionRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG)).thenReturn(portletConfig); Mockito.when(portletConfig.getInitParameter("add-process-action-success-action")).thenReturn("true"); Mockito.when(actionRequest.getAttribute(WebKeys.THEME_DISPLAY)).thenReturn(themeDisplay); Mockito.when(actionRequest.getParameter("redirect")).thenReturn(null); Mockito.when(portalImpl.getUploadPortletRequest(Mockito.any(PortletRequest.class))) .thenReturn(uploadRequest); Mockito.when(portalImpl.getHttpServletRequest(Mockito.any(PortletRequest.class))).thenReturn(httpRequest); Mockito.when(portalImpl.getOriginalServletRequest(Mockito.any(HttpServletRequest.class))) .thenReturn(httpRequest); Mockito.when(liferayRequest.getPortletName()).thenReturn(""); Mockito.when(portalImpl.getLiferayPortletRequest(Mockito.any(PortletRequest.class))) .thenReturn(liferayRequest); }
From source file:it.infn.ct.indigo.futuregateway.portlet.action.FGAddInfraMVCActionCommandTest.java
License:Apache License
/** * Prepare the environment./*w w w . ja v a 2 s . com*/ * @throws Exception In case of a problem to replicate Liferay context */ @Before public final void setUp() throws Exception { JSONFactoryUtil jsonFactoryUtil = new JSONFactoryUtil(); jsonFactoryUtil.setJSONFactory(new JSONFactoryImpl()); PortalUtil pu = new PortalUtil(); pu.setPortal(portalImpl); Mockito.when(themeDisplay.getCompanyId()).thenReturn(0L); Mockito.when(themeDisplay.getUserId()).thenReturn(0L); Mockito.when(themeDisplay.getLayout()).thenReturn(layout); Mockito.when(layout.isTypeControlPanel()).thenReturn(true); Mockito.when(actionRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG)).thenReturn(portletConfig); Mockito.when(portletConfig.getInitParameter("add-process-action-success-action")).thenReturn("true"); Mockito.when(actionRequest.getAttribute(WebKeys.THEME_DISPLAY)).thenReturn(themeDisplay); Mockito.when(actionRequest.getParameter("redirect")).thenReturn(null); Mockito.when(portalImpl.getHttpServletRequest(Mockito.any(PortletRequest.class))).thenReturn(httpRequest); Mockito.when(portalImpl.getOriginalServletRequest(Mockito.any(HttpServletRequest.class))) .thenReturn(httpRequest); Mockito.when(liferayRequest.getPortletName()).thenReturn(""); Mockito.when(portalImpl.getLiferayPortletRequest(Mockito.any(PortletRequest.class))) .thenReturn(liferayRequest); }
From source file:jorgediazest.missingrefchecker.portlet.MissingReferencesCheckerPortlet.java
License:Open Source License
@SuppressWarnings("unchecked") public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { PortletConfig portletConfig = (PortletConfig) renderRequest .getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); List<String> outputList = null; List<MissingRefInfo> listMissingRefInfo = (List<MissingRefInfo>) renderRequest .getAttribute("missingReferencesList"); if (listMissingRefInfo != null) { outputList = MissingRefCheckerOutput.generateCSVOutputCheckReferences(portletConfig, renderRequest.getLocale(), listMissingRefInfo); }//from ww w . j a v a 2s .c o m Map<Reference, Reference> references = (Map<Reference, Reference>) renderRequest .getAttribute("referencesMap"); if (references != null) { outputList = MissingRefCheckerOutput.generateCSVOutputMappingList(portletConfig, renderRequest.getLocale(), references); } String outputScript = OutputUtils.listStringToString(outputList); FileEntry exportCsvFileEntry = null; try { InputStream inputStream = null; if (Validator.isNotNull(outputScript)) { inputStream = new ByteArrayInputStream(outputScript.getBytes(StringPool.UTF8)); } String portletId = portletConfig.getPortletName(); Repository repository = OutputUtils.getPortletRepository(portletId); OutputUtils.cleanupPortletFileEntries(repository, 8 * 60); long userId = PortalUtil.getUserId(renderRequest); String fileName = "missing-references_output_" + userId + "_" + System.currentTimeMillis() + ".csv"; exportCsvFileEntry = OutputUtils.addPortletFileEntry(repository, inputStream, userId, fileName, "text/plain"); if (exportCsvFileEntry != null) { ResourceURL exportCsvResourceURL = renderResponse.createResourceURL(); exportCsvResourceURL.setResourceID(exportCsvFileEntry.getTitle()); renderRequest.setAttribute("exportCsvResourceURL", exportCsvResourceURL.toString()); } } catch (Exception e) { _log.error(e, e); } super.doView(renderRequest, renderResponse); }
From source file:jorgediazest.missingrefchecker.portlet.MissingReferencesCheckerPortlet.java
License:Open Source License
public void serveResource(ResourceRequest request, ResourceResponse response) throws IOException, PortletException { PortletConfig portletConfig = (PortletConfig) request.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); String resourceId = request.getResourceID(); String portletId = portletConfig.getPortletName(); OutputUtils.servePortletFileEntry(portletId, resourceId, response); }
From source file:jorgediazest.stagingchecker.portlet.StagingCheckerPortlet.java
License:Open Source License
public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException { PortletConfig portletConfig = (PortletConfig) renderRequest .getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); List<String> outputList = StagingCheckerOutput.generateCSVOutput(portletConfig, renderRequest); String outputScript = OutputUtils.listStringToString(outputList); FileEntry exportCsvFileEntry = null; try {//from w w w .ja v a 2s .c o m InputStream inputStream = null; if (Validator.isNotNull(outputScript)) { inputStream = new ByteArrayInputStream(outputScript.getBytes(StringPool.UTF8)); } String portletId = portletConfig.getPortletName(); Repository repository = OutputUtils.getPortletRepository(portletId); OutputUtils.cleanupPortletFileEntries(repository, 8 * 60); long userId = PortalUtil.getUserId(renderRequest); String fileName = "staging-checker_output_" + userId + "_" + System.currentTimeMillis() + ".csv"; exportCsvFileEntry = OutputUtils.addPortletFileEntry(repository, inputStream, userId, fileName, "text/plain"); if (exportCsvFileEntry != null) { ResourceURL exportCsvResourceURL = renderResponse.createResourceURL(); exportCsvResourceURL.setResourceID(exportCsvFileEntry.getTitle()); renderRequest.setAttribute("exportCsvResourceURL", exportCsvResourceURL.toString()); } } catch (Exception e) { _log.error(e, e); } try { List<Long> siteGroupIds = this.getSiteGroupIds(); renderRequest.setAttribute("groupIdList", siteGroupIds); List<String> groupDescriptionList = getSiteGroupDescriptions(siteGroupIds); renderRequest.setAttribute("groupDescriptionList", groupDescriptionList); } catch (SystemException se) { throw new PortletException(se); } try { List<Model> modelList = this.getModelList(); renderRequest.setAttribute("modelList", modelList); } catch (SystemException se) { throw new PortletException(se); } int numberOfThreads = getNumberOfThreads(renderRequest); renderRequest.setAttribute("numberOfThreads", numberOfThreads); super.doView(renderRequest, renderResponse); }
From source file:org.oep.cmon.admin.portlet.action.AdminActionPortlet.java
License:Apache License
/** * This is function add role for Agency Manager * Version: 1.0//from ww w . jav a 2s . co m * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @throws Exception */ public void addQuyenToCoQuanQuanLy(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { new CoQuanQuanLyAction().addQuyenToCoQuanQuanLy(actionRequest, actionResponse); PortletConfig portletConfig = (PortletConfig) actionRequest .getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE); }
From source file:org.oep.cmon.admin.portlet.action.AdminActionPortlet.java
License:Apache License
/** * This is function load role Agency Manager * Version: 1.0/*from ww w . j av a2 s. c o m*/ * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @throws Exception */ public void reloadQuyenToCoQuanQuanLy(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { new CoQuanQuanLyAction().reloadQuyenToCoQuanQuanLy(actionRequest, actionResponse); PortletConfig portletConfig = (PortletConfig) actionRequest .getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE); }
From source file:org.oep.cmon.admin.portlet.action.AdminActionPortlet.java
License:Apache License
/** * This is function delete role Agency Manager * Version: 1.0/*from w w w. ja v a 2s. com*/ * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @throws Exception */ public void deleteQuyenToCoQuanQuanLy(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { new CoQuanQuanLyAction().deleteQuyenToCoQuanQuanLy(actionRequest, actionResponse); PortletConfig portletConfig = (PortletConfig) actionRequest .getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE); }
From source file:org.oep.cmon.admin.portlet.action.AdminActionPortlet.java
License:Apache License
/** * This is function add edit Agency Manager * Version: 1.0/* www . j a va2 s .c o m*/ * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @throws Exception */ public void addEditCoQuanQuanLy(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { new CoQuanQuanLyAction().addEditCoQuanQuanLy(actionRequest, actionResponse); PortletConfig portletConfig = (PortletConfig) actionRequest .getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE); }
From source file:org.oep.cmon.admin.portlet.action.AdminActionPortlet.java
License:Apache License
/** * This is function edit or add role request * Version: 1.0/*from w ww.jav a 2 s . c o m*/ * * History: * DATE AUTHOR DESCRIPTION * ------------------------------------------------- * 3-March-2013 Nam Dinh Create new * @param actionRequest * @param actionResponse * @throws Exception */ public void editOrAddVaiTroRequest(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { VaiTroAction action = new VaiTroAction(); action.editOrAddVaiTroRequest(actionRequest, actionResponse); PortletConfig portletConfig = (PortletConfig) actionRequest .getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG); SessionMessages.add(actionRequest, portletConfig.getPortletName() + SessionMessages.KEY_SUFFIX_HIDE_DEFAULT_ERROR_MESSAGE); }