@Override public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse arg2) throws Exception { if (!Constants.UPDATE.equals(actionRequest.getParameter(Constants.CMD))) return; PortletPreferences prefs; String portletResource = ParamUtil.getString(actionRequest, "portletResource"); if (Validator.isNotNull(portletResource)){ prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource); } else { prefs = actionRequest.getPreferences(); } prefs.setValue("numerateModules", actionRequest.getParameter("numerateModules")); prefs.store(); SessionMessages.add(actionRequest,portletConfig.getPortletName() + ".doConfigure"); }
@Override protected PortletPreferences doImportData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences, String data) throws Exception { if (!portletDataContext.getBooleanParameter(NAMESPACE, "task-records")) { return null; } portletDataContext.importPortletPermissions(TimetrackerPortletPermission.RESOURCE_NAME); Element entriesElement = portletDataContext.getImportDataGroupElement(TaskRecord.class); List<Element> entryElements = entriesElement.elements(); for (Element entryElement : entryElements) { StagedModelDataHandlerUtil.importStagedModel(portletDataContext, entryElement); } return null; }
@Override public FlashlightSearchConfiguration readConfiguration(PortletPreferences preferences) { // Get the ADT UUID String adtUUID = preferences.getValue(CONF_KEY_ADT_UUID, StringPool.BLANK); // Perform a search on startup? boolean doSearchOnStartup = preferences.getValue(CONF_KEY_DO_SEARCH_ON_STARTUP, StringPool.FALSE).equals(StringPool.TRUE); String doSearchOnStartupKeywords = preferences.getValue(CONF_KEY_DO_SEARCH_ON_STARTUP_KEYWORDS, FlashlightSearchService.CONFIGURATION_DEFAULT_SEARCH_KEYWORDS); // Get the tabs String[] tabIds = preferences.getValues(CONF_KEY_TABS, EMPTY_ARRAY); int tabIdsLength = tabIds.length; ArrayList<FlashlightSearchConfigurationTab> tabs = new ArrayList<>(tabIdsLength); // For each tabs, get its configuration for(int i = 0; i < tabIdsLength; i++) { tabs.add(this.readTabConfiguration(preferences, tabIds[i])); } return new FlashlightSearchConfiguration(adtUUID, doSearchOnStartup, doSearchOnStartupKeywords, tabs); }
/** * This action saves the Liferay facet configuration for a given tab * * @param request The request * @param response The response * @throws PortletException If something goes wrong * @throws IOException If something goes wrong */ @ProcessAction(name = ACTION_NAME_SAVE_FACET_CONFIG) public void actionSaveFacetConfig(ActionRequest request, ActionResponse response) throws PortletException, IOException { String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK); String facetClassName = ParamUtil.get(request, FORM_FIELD_FACET_CLASS_NAME, StringPool.BLANK); String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK); PortletPreferences preferences = request.getPreferences(); FlashlightSearchConfiguration configuration = this.searchService.readConfiguration(preferences); SearchFacet targetFacet = this.getSearchFacetFromRequest(tabId, facetClassName, configuration); if(targetFacet != null) { JSONObject facetConfiguration = targetFacet.getJSONData(request); targetFacet.getFacetConfiguration().setDataJSONObject(facetConfiguration); this.searchService.saveSearchFacetConfig(configuration.getTabs().get(tabId), targetFacet, preferences); SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED); response.sendRedirect(redirectUrl); } }
/** * Deletes a tab from the configuration * * @param request The request * @param response The response * @throws PortletException If something goes wrong * @throws IOException If something goes wrong */ @ProcessAction(name = ACTION_NAME_DELETE_TAB) public void actionDeleteTab(ActionRequest request, ActionResponse response) throws PortletException, IOException { String tabId = ParamUtil.get(request, PortletRequestParameter.TAB_ID.getName(), StringPool.BLANK); String redirectUrl = ParamUtil.get(request, FORM_FIELD_REDIRECT_URL, StringPool.BLANK); if (tabId != null && PATTERN_UUID.matcher(tabId).matches()) { PortletPreferences preferences = request.getPreferences(); Map<String, FlashlightSearchConfigurationTab> tabs = this.searchService.readConfiguration(preferences).getTabs(); if (tabs.containsKey(tabId)) { this.searchService.deleteConfigurationTab(tabId, preferences); } } SessionMessages.add(request, SESSION_MESSAGE_CONFIG_SAVED); if (!redirectUrl.isEmpty()) { response.sendRedirect(redirectUrl); } }
@Override protected PortletPreferences doImportData(PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences, String data) throws Exception { if (!portletDataContext.getBooleanParameter(NAMESPACE, "contacts")) { return null; } portletDataContext.importPortletPermissions(ContactManagerPortletPermission.RESOURCE_NAME); Element entriesElement = portletDataContext.getImportDataGroupElement(Contact.class); List<Element> entryElements = entriesElement.elements(); for (Element entryElement : entryElements) { StagedModelDataHandlerUtil.importStagedModel(portletDataContext, entryElement); } return null; }
protected PortletPreferences getPortletPreferences(long groupId) throws PortalException { long ownerId = groupId; int ownerType = PortletKeys.PREFS_OWNER_TYPE_GROUP; long plid = 0; PortletPreferences preferences = null; try { com.liferay.portal.kernel.model.PortletPreferences portletPreferences = _portletPreferencesLocalService .getPortletPreferences(ownerId, ownerType, plid, ch.inofix.data.constants.PortletKeys.DATA_MANAGER); preferences = PortletPreferencesFactoryUtil .fromDefaultXML(portletPreferences.getPreferences()); } catch (NoSuchPortletPreferencesException e) { _log.warn(e.getMessage()); } return preferences; }
protected PortletPreferences getPreferences(long groupId) throws PortalException { long ownerId = groupId; int ownerType = PortletKeys.PREFS_OWNER_TYPE_GROUP; long plid = 0; com.liferay.portal.kernel.model.PortletPreferences portletPreferences = _portletPreferencesLocalService .getPortletPreferences(ownerId, ownerType, plid, ch.inofix.data.constants.PortletKeys.DATA_MANAGER); PortletPreferences preferences = PortletPreferencesFactoryUtil .fromDefaultXML(portletPreferences.getPreferences()); return preferences; }
private void _noRetry() { try { PortletPreferences portletPreferences = PrefsPropsUtil.getPreferences(); portletPreferences.setValue( PortletPropsKeys.MQTT_ERRORS_RETRY_CONNECT, String.valueOf(false)); portletPreferences.store(); } catch (Exception e1) { _log.error(e1); } }
private void _setupRetry(Throwable e) { try { PortletPreferences portletPreferences = PrefsPropsUtil.getPreferences(); portletPreferences.setValue( PortletPropsKeys.MQTT_ERRORS_RETRY_CONNECT, String.valueOf(true)); portletPreferences.store(); } catch (Exception e1) { _log.error(e); } }
public void processAction( PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { if (!Constants.UPDATE.equals(actionRequest.getParameter(Constants.CMD))){ return; } PortletPreferences prefs; String portletResource = ParamUtil.getString(actionRequest, "portletResource"); if (Validator.isNotNull(portletResource)){ prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource); } else { prefs = actionRequest.getPreferences(); } prefs.setValue("showActionSocial", actionRequest.getParameter("showActionSocial")); prefs.setValue("showActionAudit", actionRequest.getParameter("showActionAudit")); prefs.store(); SessionMessages.add( actionRequest, portletConfig.getPortletName() + ".doConfigure"); //SessionMessages.add(actionRequest,"success"); }
@Override public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse arg2) throws Exception { if (!Constants.UPDATE.equals(actionRequest.getParameter(Constants.CMD))) return; PortletPreferences prefs; String portletResource = ParamUtil.getString(actionRequest, "portletResource"); if (Validator.isNotNull(portletResource)){ prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource); } else { prefs = actionRequest.getPreferences(); } prefs.setValue("viewAlways", actionRequest.getParameter("viewAlways")); prefs.store(); SessionMessages.add(actionRequest,portletConfig.getPortletName() + ".doConfigure"); }
@Override public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse arg2) throws Exception { if (!Constants.UPDATE.equals(actionRequest.getParameter(Constants.CMD))) return; PortletPreferences prefs; String portletResource = ParamUtil.getString(actionRequest, "portletResource"); if (Validator.isNotNull(portletResource)){ prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource); } else { prefs = actionRequest.getPreferences(); } prefs.setValue("viewMode", actionRequest.getParameter("viewMode")); prefs.setValue("numerateModules", actionRequest.getParameter("numerateModules")); prefs.store(); SessionMessages.add(actionRequest,portletConfig.getPortletName() + ".doConfigure"); }
@Override public void processAction(PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse arg2) throws Exception { if (!Constants.UPDATE.equals(actionRequest.getParameter(Constants.CMD))){ return; } PortletPreferences prefs; String portletResource = ParamUtil.getString(actionRequest, "portletResource"); if (Validator.isNotNull(portletResource)){ prefs = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource); } else { prefs = actionRequest.getPreferences(); } prefs.setValue("showPreviousModuleButton", actionRequest.getParameter("showPreviousModuleButton")); prefs.store(); SessionMessages.add(actionRequest,portletConfig.getPortletName() + ".doConfigure"); }
public void processAction( PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { PortletPreferences portletPreferences = PortletPreferencesFactoryUtil.getPortletSetup( actionRequest, ParamUtil.getString(actionRequest, "portletResource")); /** * boolean showAllways = preferences.getValue("showAllways", "false").equals("true"); boolean showOnlyWhenFinishDate = preferences.getValue("showOnlyWhenFinishDate", "true").equals("true"); */ portletPreferences.setValue("showCalificationMode",ParamUtil.getString(actionRequest, "showCalificationMode")); portletPreferences.store(); SessionMessages.add( actionRequest, portletConfig.getPortletName() + ".doConfigure"); //SessionMessages.add(actionRequest,"success"); }
public void processAction( PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse) throws Exception { PortletPreferences portletPreferences = PortletPreferencesFactoryUtil.getPortletSetup( actionRequest, ParamUtil.getString(actionRequest, "portletResource")); portletPreferences.setValue("myCoursesOrder",Integer.toString(ParamUtil.getInteger(actionRequest, "myCoursesOrder",0))); portletPreferences.store(); SessionMessages.add( actionRequest, portletConfig.getPortletName() + ".doConfigure"); //SessionMessages.add(actionRequest,"success"); }
@ProcessAction(name = "setmodulePref") public void setmodulePref(ActionRequest request, ActionResponse response) throws Exception { String rowsPerPage = ParamUtil.getString(request, "module-rows-per-page"); String dateFormat = ParamUtil.getString(request, "module-date-format"); String datetimeFormat = ParamUtil.getString(request, "module-datetime-format"); ArrayList<String> errors = new ArrayList<String>(); if (moduleValidator.validateEditmodule(rowsPerPage, dateFormat, datetimeFormat, errors)) { response.setRenderParameter("module-rows-per-page", ""); response.setRenderParameter("module-date-format", ""); response.setRenderParameter("module-datetime-format", ""); PortletPreferences prefs = request.getPreferences(); prefs.setValue("module-rows-per-page", rowsPerPage); prefs.setValue("module-date-format", dateFormat); prefs.setValue("module-datetime-format", datetimeFormat); prefs.store(); SessionMessages.add(request, "module-prefs-success"); } }
private SortedSet<Book> loadMyBooks(PortletPreferences prefs) { SortedSet<Book> myBooks = new TreeSet<Book>(); String[] keys = prefs.getValues("myBooks", null); if (keys != null) { for (int i = 0; i < keys.length; i++) { try { Integer key = Integer.valueOf(keys[i]); Book book = bookService.getBook(key); if (book != null) myBooks.add(book); } catch (NumberFormatException ex) { } } } return myBooks; }
public void processActionReset(String action,ActionRequest request, ActionResponse response) throws PortletException, IOException { // TODO: Check Role log.debug("Removing preferences...."); clearSession(request); PortletSession pSession = request.getPortletSession(true); PortletPreferences prefs = request.getPreferences(); try { prefs.reset("sakai.descriptor"); for (String element : fieldList) { prefs.reset("imsti."+element); prefs.reset("sakai:imsti."+element); } log.debug("Preference removed"); } catch (ReadOnlyException e) { setErrorMessage(request, rb.getString("error.modify.prefs")) ; return; } prefs.store(); // Go back to the main edit page pSession.setAttribute("sakai.view", "edit"); }
@Override public E load(final PortletPreferences preferences, final String key, final String defaultValue) { if (preferences.getValue(key, "") == null) { return null; } try { final E value = this.type.newInstance(); PreferenceFieldRegistry.load(preferences, key + '.', value); for (final Method postConstruct : this.postConstructMethods) { postConstruct.setAccessible(true); postConstruct.invoke(value); } return value; } catch (final InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new IllegalArgumentException("Can't instantiate " + this.type, e); } }
@Override public Date load(final PortletPreferences preferences, final String key, final String defaultValue) { final String value = preferences.getValue(key, defaultValue); if (value == null) { return null; } try { return parseValue(value); } catch (final ParseException e) { log.error("Could not parse date object " + key + " from preferences: " + value, e); if (!value.equals(defaultValue)) { // Try to return the default value try { return parseValue(defaultValue); } catch (final ParseException e2) { // Ignore - we already logged an exception } } return null; } }
@Override public void store(final PortletPreferences preferences, final String key, final JournalArticle article) throws ReadOnlyException { String articleResourceUuid = null; String articleId = null; if (article != null) { try { articleResourceUuid = article.getArticleResourceUuid(); articleId = article.getArticleId(); } catch (final PortalException | SystemException e) { log.error("Could not load article resource id for article {}", article.getArticleId(), e); } } preferences.setValue(key + RESOURCE_UUID_SUFFIX, articleResourceUuid); preferences.setValue(key + ARTICLE_ID_SUFFIX, articleId); }
public static void setPortletArticle(String portletId, String articleId, Layout layout, long userId, long groupId, long companyId) { try { long ownerId = PortletKeys.PREFS_OWNER_ID_DEFAULT; int ownerType = PortletKeys.PREFS_OWNER_TYPE_LAYOUT; //Retrieve the portlet preferences for the journal portlet instance just created PortletPreferences prefs = PortletPreferencesLocalServiceUtil.getPreferences(companyId, ownerId, ownerType, layout.getPlid(), portletId); // set desired article id for content display portlet prefs.setValue("articleId", articleId); prefs.setValue("groupId", String.valueOf(groupId)); //update the portlet preferences PortletPreferencesLocalServiceUtil.updatePreferences(ownerId, ownerType, layout .getPlid(), portletId, prefs); } catch (Throwable t) { m_objLog.warn(t); } }
public EditPage() { // Obtém a página de visualização RenderResponse rRes = UIUtils.getRenderResponse(); PortletURL pURL = rRes.createRenderURL(); try { pURL.setPortletMode(PortletMode.VIEW); } catch (PortletModeException e) { } viewUrl = pURL.toString(); PortletPreferences pp = UIUtils.getPortletPreferences(); initFeedbackPanel(); initForm(); initMensagem(pp); initUrl(pp); initVoltar(); }
@Override protected String doExportData( PortletDataContext portletDataContext, String portletId, PortletPreferences portletPreferences) throws Exception { Element rootElement = addExportDataRootElement(portletDataContext); if (portletDataContext.getBooleanParameter(NAMESPACE, "albums")) { ActionableDynamicQuery albumActionableDynamicQuery = new AlbumExportActionableDynamicQuery(portletDataContext); albumActionableDynamicQuery.performActions(); } if (portletDataContext.getBooleanParameter(NAMESPACE, "artists")) { ActionableDynamicQuery artistActionableDynamicQuery = new ArtistExportActionableDynamicQuery(portletDataContext); artistActionableDynamicQuery.performActions(); } return getExportDataRootElementString(rootElement); }
@Override protected void doPrepareManifestSummary( PortletDataContext portletDataContext, PortletPreferences portletPreferences) throws Exception { ActionableDynamicQuery albumActionableDynamicQuery = new AlbumExportActionableDynamicQuery(portletDataContext); albumActionableDynamicQuery.performCount(); ActionableDynamicQuery artistActionableDynamicQuery = new ArtistExportActionableDynamicQuery(portletDataContext); artistActionableDynamicQuery.performCount(); }
@Override public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException { response.setContentType("text/html"); PortletPreferences prefs = request.getPreferences(); Map<String, String[]> map = prefs.getMap(); Map<String, String> prefsMap = new HashMap<>(); for (String key : map.keySet()) { String[] prefValue = map.get(key); prefsMap.put(key, prefValue == null || prefValue[0] == null ? "" : prefValue[0]); } request.setAttribute("prefs", prefsMap); PortletURL editPrefsURL = response.createActionURL(); editPrefsURL.setParameter("action", "editPrefs"); request.setAttribute("actionURL", editPrefsURL.toString()); forward(editJsp, request, response); }
@Override public void processAction(ActionRequest request, ActionResponse response) throws IOException, PortletException { String action = request.getParameter("action"); if ("editPrefs".equals(action)) { PortletPreferences prefs = request.getPreferences(); for (String key : prefs.getMap().keySet()) { String value = request.getParameter(key); prefs.setValue(key, value); } prefs.store(); } else { String url = request.getParameter("URL"); if (!StringUtils.isBlank(url)) { PortletMessaging.publish(request, IFrameGenericPortlet.IFRAME_SRC_URL, url.trim()); } } response.setPortletMode(PortletMode.VIEW); }
/** * Private method that checks if a preference is not defined or has no * value in <code>portlet.xml</code>, the default values are returned. * @param request the portlet request. * @param preferenceName the preference name which is not defined or has no * value in <code>portlet.xml</code>. * @return the test result. */ private TestResult doCheckDefaultPreference(PortletRequest request, String preferenceName) { TestResult result = new TestResult(); result.setDescription("Ensure proper default is returned when " + "a non-existing/value-undefined preference is requested."); result.setSpecPLT("14.1"); PortletPreferences preferences = request.getPreferences(); String value = preferences.getValue(preferenceName, DEF_VALUE); String[] values = preferences.getValues(preferenceName, new String[] { DEF_VALUE }); if (DEF_VALUE.equals(value) && values != null && values.length == 1 && DEF_VALUE.equals(values[0])) { result.setReturnCode(TestResult.PASSED); } else if (!DEF_VALUE.equals(value)) { TestUtils.failOnAssertion("preference value", value, DEF_VALUE, result); } else { TestUtils.failOnAssertion("preference values", values, new String[] { DEF_VALUE }, result); } return result; }
protected TestResult checkSetPreferenceSingleValue(PortletRequest request) { TestResult result = new TestResult(); result.setDescription("Ensure a single preference value can be set."); result.setSpecPLT("14.1"); PortletPreferences preferences = request.getPreferences(); try { preferences.setValue("TEST", "TEST_VALUE"); } catch (ReadOnlyException ex) { TestUtils.failOnException("Unable to set preference value.", ex, result); return result; } String value = preferences.getValue("TEST", DEF_VALUE); if (value != null && value.equals("TEST_VALUE")) { result.setReturnCode(TestResult.PASSED); } else { TestUtils.failOnAssertion("preference value", value, "TEST_VALUE", result); } return result; }
protected TestResult checkSetPreferenceNull(PortletRequest request) { TestResult result = new TestResult(); result.setDescription("Ensure a preference value can be set to null."); result.setSpecPLT("14.1"); PortletPreferences preferences = request.getPreferences(); try { preferences.setValue("TEST", null); } catch (ReadOnlyException ex) { TestUtils.failOnException("Unable to set preference value.", ex, result); return result; } String value = preferences.getValue("TEST", DEF_VALUE); // see PLUTO-609: behavioral change! if (null == value) { result.setReturnCode(TestResult.PASSED); } else { TestUtils.failOnAssertion("preference value", value, null, result); } return result; }
protected TestResult checkSetPreferencesReturnsFirst(PortletRequest request) { TestResult result = new TestResult(); result.setDescription("Ensure the first value set to a given " + "preference is returned first by PortletPreferences.getValue()."); result.setSpecPLT("14.1"); PortletPreferences preferences = request.getPreferences(); try { preferences.setValues("TEST", new String[] { "FIRST", "SECOND" }); } catch (ReadOnlyException ex) { TestUtils.failOnException("Unable to set preference values.", ex, result); return result; } String value = preferences.getValue("TEST", DEF_VALUE); if (value != null && value.equals("FIRST")) { result.setReturnCode(TestResult.PASSED); } else { TestUtils.failOnAssertion("preference value", value, "FIRST", result); } return result; }
protected TestResult checkGetPreferenceNames(PortletRequest request) { TestResult result = new TestResult(); result.setDescription("Ensure returned enumeration is valid."); result.setSpecPLT("14.1"); PortletPreferences preferences = request.getPreferences(); Map<String, String[]> prefMap = preferences.getMap(); boolean hasAll = true; for (Enumeration<String> en = preferences.getNames(); en.hasMoreElements(); ) { if (!prefMap.containsKey(en.nextElement())) { hasAll = false; break; } } if (hasAll) { result.setReturnCode(TestResult.PASSED); } else { result.setReturnCode(TestResult.FAILED); result.setResultMessage("At least one name is not found " + "in the preference map."); } return result; }
/** * Logs out the portlet preferences. * @param preferences PortletPreferences to log. */ protected void logPreferences(PortletPreferences preferences) { StringBuffer buffer = new StringBuffer(); Map<String, String[]> map = preferences.getMap(); for (String key : map.keySet()) { String[] values = (String[]) map.get(key); buffer.append(key).append("="); if (values != null) { buffer.append("{"); for (int i = 0; i < values.length; i++) { buffer.append(values[i]); if (i < values.length - 1) { buffer.append(","); } } buffer.append("}"); } else { // Spec allows null values. buffer.append("NULL"); } buffer.append(";"); } LOG.debug("PortletPreferences: " + buffer.toString()); }
/** * Method that get list of subscribed threads by users */ public static List<MBThread> getSubscribedThreadsList(HttpServletRequest request) throws PortalException{ _log.debug("Entry: getSubscribedThreadsList"); List<MBThread> subscribedThreadList=new ArrayList<>(); ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY); List<Long> categoryIds=new ArrayList<Long>(); PortletPreferences preference=(PortletPreferences)request.getAttribute(CustomConstants.PREFERENCE_REQUEST_ATTRIBUTE); long preferenceCatId=GetterUtil.getLong(preference.getValue(CustomConstants.PREFERENCE_CATEGORYID, String.valueOf(QueryUtil.ALL_POS))); List<MBThread> mbThreadList= MBThreadServiceUtil.getGroupThreads(themeDisplay.getScopeGroupId(), themeDisplay.getUserId(),WorkflowConstants.STATUS_APPROVED , true, QueryUtil.ALL_POS,QueryUtil.ALL_POS); if(preferenceCatId != QueryUtil.ALL_POS){ categoryIds=getPreferenceCatChildList(preferenceCatId, request); for(MBThread mbThread:mbThreadList){ for(Long categoryId:categoryIds){ if(mbThread.getCategoryId() == categoryId){ subscribedThreadList.add(mbThread); } } } } else{ subscribedThreadList=mbThreadList; } _log.debug("List Size:=>"+subscribedThreadList.size()); return subscribedThreadList; }
/** *Method that get list of posts by particular user */ public static List<MBThread> getMyPosts(HttpServletRequest request) throws PortalException{ _log.debug("Entry : getMyPosts"); List<MBThread> myThreadList=new ArrayList<>(); ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY); List<Long> categoryIds=new ArrayList<Long>(); PortletPreferences preference=(PortletPreferences)request.getAttribute(CustomConstants.PREFERENCE_REQUEST_ATTRIBUTE); long preferenceCatId=GetterUtil.getLong(preference.getValue(CustomConstants.PREFERENCE_CATEGORYID, String.valueOf(QueryUtil.ALL_POS))); List<MBThread> mbThreadList=MBThreadServiceUtil.getGroupThreads(themeDisplay.getScopeGroupId(), themeDisplay.getUserId(), WorkflowConstants.STATUS_ANY, QueryUtil.ALL_POS, QueryUtil.ALL_POS); if(preferenceCatId != QueryUtil.ALL_POS){ categoryIds=getPreferenceCatChildList(preferenceCatId, request); for(MBThread mbThread:mbThreadList){ for(Long categoryId:categoryIds){ if(mbThread.getCategoryId() == categoryId){ myThreadList.add(mbThread); } } } } else{ myThreadList=mbThreadList; } _log.debug("List Size:=>"+myThreadList.size()); return myThreadList; }
@Override public void doView(RenderRequest request, RenderResponse response) throws IOException, PortletException { String key; List<CommandBean> commandBeans = new ArrayList<CommandBean>(); PortletPreferences preference = request.getPreferences(); Map<String, String[]> preferenceMap = preference.getMap(); for (Map.Entry<String, String[]> entry : preferenceMap.entrySet()) { key = entry.getKey().trim(); if (!key.isEmpty() && !key.equalsIgnoreCase(SpeechConstants.KEY_PHRASE)) { commandBeans.add(new CommandBeanImpl(entry.getKey(), entry.getValue()[0])); } } request.setAttribute(SpeechConstants.VOICE_COMMAND_COUNT, commandBeans.size()); request.setAttribute(SpeechConstants.VOICE_COMMAND_LIST, commandBeans); SessionMessages.clear(request); super.doView(request, response); }