Package javax.portlet

Examples of javax.portlet.PortletPreferences


      TestResult result = new TestResult();
      result.setDescription("Preferences values are not modified if "
          + "the values in the returned preference Map are altered.");
      result.setSpecPLT("14.1");
     
      PortletPreferences preferences = request.getPreferences();
        if (LOG.isDebugEnabled()) {
          LOG.debug("Original Preferences:");
          logPreferences(preferences);
        }
       
        // Modify the returned preference map.
      Map prefMap = preferences.getMap();
      String[] values = (String[]) prefMap.get(PREF_NAME);
      String originalValue = null;
      String modifiedValue = "Value modified in preferences map.";
      if (values != null && values.length == 1) {
        originalValue = values[0];
        values[0] = modifiedValue;
      }
     
      // Check if the value held by portlet preferences is modified.
        if (LOG.isDebugEnabled()) {
          LOG.debug("Modified Preferences:");
          logPreferences(preferences);
        }
      String newValue = preferences.getValue(PREF_NAME, DEF_VALUE);
      if (newValue != null && newValue.equals(originalValue)) {
        result.setReturnCode(TestResult.PASSED);
      } else {
        result.setReturnCode(TestResult.FAILED);
        result.setResultMessage("Preference value modified according to "
View Full Code Here


    result.setDescription("Ensure that if the store() method is invoked "
        + "within render() method, an IllegalStateException will be "
        + "thrown out.");
    result.setSpecPLT("14.1");
   
    PortletPreferences preferences = request.getPreferences();
        boolean exceptionThrown = false;
       
        // Store preferences and wait for IllegalStateException.
        try {
            preferences.store();
        } catch (ValidatorException ex) {
          TestUtils.failOnException("Unable to store preferences.", ex, result);
          return result;
        } catch (IOException ex) {
          TestUtils.failOnException("Unable to store preferences.", ex, result);
View Full Code Here

   {
      String zip = actionRequest.getParameter(ZIP);

      if (null != zip)
      {
         PortletPreferences prefs = actionRequest.getPreferences();
         prefs.setValue(ZIP, zip);
         prefs.store();
      }

      // set zip as render parameter
      actionResponse.setRenderParameter(ZIP, zip);
View Full Code Here

        return nodes;
    }

    private boolean getShowEmptyCategory(PortletRequest request){
        PortletPreferences portletPreferences = request.getPreferences();
        String showEmptyCategoryStringValue = portletPreferences.getValue(EMPTY_CATEGORY_PROPERTY_NAME, "false");
        return Boolean.valueOf(showEmptyCategoryStringValue);
    }
View Full Code Here

    }

    @Override
    public void serveResource(ResourceRequest request, ResourceResponse response) throws PortletException, IOException {

        PortletPreferences portletPreferences = request.getPreferences();

        String contentType = request.getParameter("type");

        if ("blog".equals(contentType)){
            String urlRssBlog = portletPreferences.getValue(URL_RSS_BLOG, DEFAULT_URL);
            String urlContentBlog = portletPreferences.getValue(URL_CONTENT_BLOG, DEFAULT_URL);
            String pfxBlogAuthor = portletPreferences.getValue(PFX_BLOG_AUTHOR, "");

            RssReaderBean gateInBlogRssReader = makeReaderBean(urlRssBlog, urlContentBlog, 2, pfxBlogAuthor);
            request.setAttribute("blogRSSBean", gateInBlogRssReader);

            PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/feedBlog.jsp");
            prd.include(request, response);
        } else if ("vimeo".equals(contentType)) {
            String urlRssVimeo = portletPreferences.getValue(URL_RSS_VIMEO, DEFAULT_URL);
            String urlContentVimeo = portletPreferences.getValue(URL_CONTENT_VIMEO, DEFAULT_URL);

            RssReaderBean gateInVimeoRssReader = makeReaderBean(urlRssVimeo, urlContentVimeo, 2, null);
            request.setAttribute("vimeoRSSBean", gateInVimeoRssReader);

            PortletRequestDispatcher prd = getPortletContext().getRequestDispatcher("/jsp/feedVimeo.jsp");
View Full Code Here

public class UIApplicationRegistryEditMode extends UIForm {
    public static final String SHOW_IMPORT = "showImport";

    public UIApplicationRegistryEditMode() {
        PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
        PortletPreferences pref = pcontext.getRequest().getPreferences();
        boolean isShowImport = Boolean.parseBoolean(pref.getValue(SHOW_IMPORT, "true"));
        addUIFormInput(new UIFormCheckBoxInput<Boolean>(SHOW_IMPORT, SHOW_IMPORT, isShowImport).setValue(isShowImport));
    }
View Full Code Here

        public void execute(Event<UIApplicationRegistryEditMode> event) throws Exception {
            // TODO Auto-generated method stub
            UIApplicationRegistryEditMode uiForm = event.getSource();
            boolean isShowImport = uiForm.getUIFormCheckBoxInput(SHOW_IMPORT).isChecked();
            PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
            PortletPreferences pref = pcontext.getRequest().getPreferences();
            pref.setValue(SHOW_IMPORT, Boolean.toString(isShowImport));
            pref.store();
            UIPortalApplication portalApp = Util.getUIPortalApplication();
            if (portalApp.getModeState() == UIPortalApplication.NORMAL_MODE)
                pcontext.setApplicationMode(PortletMode.VIEW);

        }
View Full Code Here

        }
    }

    public boolean isShowImport() {
        PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
        PortletPreferences pref = pcontext.getRequest().getPreferences();
        return Boolean.parseBoolean(pref.getValue("showImport", "true"));
    }
View Full Code Here

    public BasePartialUpdateToolbar() throws Exception {
        int level = DEFAULT_LEVEL;
        try {
            PortletRequestContext context = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
            PortletRequest prequest = context.getRequest();
            PortletPreferences prefers = prequest.getPreferences();

            level = Integer.valueOf(prefers.getValue("level", String.valueOf(DEFAULT_LEVEL)));
        } catch (Exception ex) {
            log.warn("Preference for navigation level can only be integer");
        }

        if (level <= 0) {
View Full Code Here

    public static final int DEFAULT_LEVEL = 2;

    public UIGroupNavigationPortlet() throws Exception {
        PortletRequestContext context = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
        PortletRequest prequest = context.getRequest();
        PortletPreferences prefers = prequest.getPreferences();
        int level = DEFAULT_LEVEL;
        try {
            level = Integer.valueOf(prefers.getValue("level", String.valueOf(DEFAULT_LEVEL)));
        } catch (Exception ex) {
            log.warn("Preference for navigation level can only be integer");
        }

        UIGroupNavigationManagement groupNavigationManagement = addChild(UIGroupNavigationManagement.class, null, null);
View Full Code Here

TOP

Related Classes of javax.portlet.PortletPreferences

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.