@Override
  protected String upgradePreferences(
      long companyId, long ownerId, int ownerType, long plid, String portletId, String xml)
      throws Exception {

    PortletPreferences preferences =
        PortletPreferencesFactoryUtil.fromXML(companyId, ownerId, ownerType, plid, portletId, xml);

    if (portletId.startsWith(_PORTLET_ID_ASSET_PUBLISHER)) {
      updatePreferencesClassPKs(preferences, "anyClassTypeJournalArticleAssetRendererFactory");
      updatePreferencesClassPKs(preferences, "classTypeIds");
      updatePreferencesClassPKs(preferences, "classTypeIdsJournalArticleAssetRendererFactory");
    } else if (portletId.startsWith(_PORTLET_ID_JOURNAL_CONTENT)) {
      String templateId = preferences.getValue("templateId", StringPool.BLANK);

      if (Validator.isNotNull(templateId)) {
        preferences.reset("templateId");

        preferences.setValue("ddmTemplateKey", templateId);
      }
    } else if (portletId.startsWith(_PORTLET_ID_JOURNAL_CONTENT_LIST)) {
      String structureId = preferences.getValue("structureId", StringPool.BLANK);

      if (Validator.isNotNull(structureId)) {
        preferences.reset("structureId");

        preferences.setValue("ddmStructureKey", structureId);
      }
    }

    return PortletPreferencesFactoryUtil.toXML(preferences);
  }
示例#2
0
  public void EditPreferenceAction(ActionRequest req, ActionResponse res) {
    String cmd = ParamUtil.getString(req, Constants.CMD);

    if (!cmd.equals(Constants.UPDATE)) {
      return;
    }

    PortletPreferences prefs = req.getPreferences();
    int displayStyle = ParamUtil.getInteger(req, "displayStyle");
    // String styleSelected = ParamUtil.getString(req, "displayStyle","1");
    String[] selectCategories = req.getParameterValues("selectCategories");
    String defaultSize = ParamUtil.getString(req, "defaultSize");
    String widthSize = ParamUtil.getString(req, "widthSize");
    String heightSize = ParamUtil.getString(req, "heightSize");
    try {
      prefs.setValues("selectCategories", selectCategories);
      prefs.setValue("displayStyleExt", String.valueOf(displayStyle));
      prefs.setValue("defaultSize", defaultSize);
      prefs.setValue("widthSize", widthSize);
      prefs.setValue("heightSize", heightSize);

      prefs.store();
      res.setRenderParameter("jspPage", "/html/portlet/view_vclip/view.jsp");
    } catch (Exception e) {
      // TODO: handle exception
    }
  }
  public void processAction(
      PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    if (!cmd.equals(Constants.UPDATE)) {
      return;
    }

    String selectionMethod = ParamUtil.getString(actionRequest, "selectionMethod");
    String organizationId = ParamUtil.getString(actionRequest, "organizationId");
    String displayStyle = ParamUtil.getString(actionRequest, "displayStyle");
    int max = ParamUtil.getInteger(actionRequest, "max");

    String portletResource = ParamUtil.getString(actionRequest, "portletResource");

    PortletPreferences preferences =
        PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);

    preferences.setValue("selection-method", selectionMethod);
    preferences.setValue("organization-id", organizationId);
    preferences.setValue("display-style", displayStyle);
    preferences.setValue("max", String.valueOf(max));

    preferences.store();

    SessionMessages.add(actionRequest, portletConfig.getPortletName() + ".doConfigure");
  }
  protected String addJournalContentPortletToLayout(
      long userId, Layout layout, JournalArticle journalArticle, String columnId) throws Exception {

    LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout.getLayoutType();

    String journalPortletId =
        layoutTypePortlet.addPortletId(userId, PortletKeys.JOURNAL_CONTENT, columnId, -1);

    LayoutLocalServiceUtil.updateLayout(
        layout.getGroupId(),
        layout.isPrivateLayout(),
        layout.getLayoutId(),
        layout.getTypeSettings());

    javax.portlet.PortletPreferences prefs =
        getPortletPreferences(layout.getCompanyId(), layout.getPlid(), journalPortletId);

    prefs.setValue("articleId", journalArticle.getArticleId());
    prefs.setValue("groupId", String.valueOf(journalArticle.getGroupId()));
    prefs.setValue("showAvailableLocales", Boolean.TRUE.toString());

    updatePortletPreferences(layout.getPlid(), journalPortletId, prefs);

    return journalPortletId;
  }
  @RequestMapping(params = "action=save")
  public void saveConfiguration(
      ActionRequest request,
      ActionResponse response,
      @ModelAttribute("form") SearchPortletConfigurationForm form)
      throws PortletModeException {

    PortletPreferences prefs = request.getPreferences();

    try {

      prefs.setValue("gsaEnabled", String.valueOf(form.isGsaEnabled()));
      prefs.setValue("gsaBaseUrl", form.getGsaBaseUrl());
      prefs.setValue("gsaSite", form.getGsaSite());
      prefs.setValue("directoryEnabled", String.valueOf(form.isDirectoryEnabled()));
      prefs.setValue("portletRegistryEnabled", String.valueOf(form.isPortletRegistryEnabled()));
      prefs.store();

    } catch (ValidatorException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    } catch (ReadOnlyException e) {
      e.printStackTrace();
    }

    response.setPortletMode(PortletMode.VIEW);
  }
  /*
   * Process the "finished" action for the edit page. Set the "url" to the value specified in the
   * edit page.
   */
  private void processEditFinishedAction(ActionRequest request, ActionResponse response)
      throws PortletException {
    String nbPublis = request.getParameter(TEXTBOX_NB_ITEMS);
    String maxAge = request.getParameter(TEXTBOX_MAX_AGE);
    String displayDescription = request.getParameter("displayDescription");

    // Check if it is a number
    try {
      int nb = Integer.parseInt(nbPublis);
      Integer.parseInt(maxAge);
      if (nb < 0 || nb > 30) {
        throw new NumberFormatException();
      }
      // store preference
      PortletPreferences pref = request.getPreferences();
      try {
        pref.setValue("nbPublis", nbPublis);
        pref.setValue("maxAge", maxAge);
        pref.setValue("displayDescription", displayDescription);
        pref.store();
      } catch (ValidatorException ve) {
        log("could not set nbPublis", ve);
        throw new PortletException("IFramePortlet.processEditFinishedAction", ve);
      } catch (IOException ioe) {
        log("could not set nbPublis", ioe);
        throw new PortletException("IFramePortlet.prcoessEditFinishedAction", ioe);
      }
      response.setPortletMode(PortletMode.VIEW);

    } catch (NumberFormatException e) {
      response.setRenderParameter(ERROR_BAD_VALUE, "true");
      response.setPortletMode(PortletMode.EDIT);
    }
  }
  protected void updateCaptcha(ActionRequest actionRequest, PortletPreferences preferences)
      throws Exception {

    boolean reCaptchaEnabled = ParamUtil.getBoolean(actionRequest, "reCaptchaEnabled");
    String reCaptchaPrivateKey = ParamUtil.getString(actionRequest, "reCaptchaPrivateKey");
    String reCaptchaPublicKey = ParamUtil.getString(actionRequest, "reCaptchaPublicKey");

    Captcha captcha = null;

    if (reCaptchaEnabled) {
      captcha = new ReCaptchaImpl();
    } else {
      captcha = new SimpleCaptchaImpl();
    }

    validateCaptcha(actionRequest);

    if (SessionErrors.isEmpty(actionRequest)) {
      preferences.setValue(PropsKeys.CAPTCHA_ENGINE_IMPL, captcha.getClass().getName());
      preferences.setValue(PropsKeys.CAPTCHA_ENGINE_RECAPTCHA_KEY_PRIVATE, reCaptchaPrivateKey);
      preferences.setValue(PropsKeys.CAPTCHA_ENGINE_RECAPTCHA_KEY_PUBLIC, reCaptchaPublicKey);

      preferences.store();

      CaptchaImpl captchaImpl = (CaptchaImpl) CaptchaUtil.getCaptcha();

      captchaImpl.setCaptcha(captcha);
    }
  }
示例#8
0
 /**
  * Process an action request.
  *
  * @see javax.portlet.Portlet#processAction(javax.portlet.ActionRequest,
  *     javax.portlet.ActionResponse)
  */
 public void processAction(ActionRequest request, ActionResponse response)
     throws PortletException, java.io.IOException {
   if (request.getParameter(FORM_SUBMIT) != null) {
     // Set form text in the session bean
     Vlado2PortletSessionBean sessionBean = getSessionBean(request);
     if (sessionBean != null) sessionBean.setFormText(request.getParameter(FORM_TEXT));
   }
   if (request.getParameter(EDIT_SUBMIT) != null) {
     PortletPreferences prefs = request.getPreferences();
     try {
       prefs.setValue(EDIT_KEY, request.getParameter(EDIT_TEXT));
       prefs.store();
     } catch (ReadOnlyException roe) {
     } catch (ValidatorException ve) {
     }
   }
   if (request.getParameter(CONFIG_SUBMIT) != null) {
     PortletPreferences prefs = request.getPreferences();
     try {
       prefs.setValue(CONFIG_KEY, request.getParameter(CONFIG_TEXT));
       prefs.store();
     } catch (ReadOnlyException roe) {
     } catch (ValidatorException ve) {
     }
   }
 }
  protected PortletPreferences doDeleteData(
      PortletDataContext context, String portletId, PortletPreferences preferences)
      throws Exception {

    preferences.setValue("group-id", StringPool.BLANK);
    preferences.setValue("article-id", StringPool.BLANK);

    return preferences;
  }
示例#10
0
  public static void configureAssetPublisher(Layout layout) throws Exception {
    PortletPreferences portletSetup =
        PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, "101_INSTANCE_abcd");

    portletSetup.setValue("displayStyle", "title-list");
    portletSetup.setValue("assetLinkBehaviour", "viewInPortlet");

    portletSetup.store();
  }
示例#11
0
  public static void configureBlogsAggregator(Layout layout) throws Exception {

    PortletPreferences portletSetup =
        PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, PortletKeys.BLOGS_AGGREGATOR);

    portletSetup.setValue("enableRssSubscription", "false");
    portletSetup.setValue("selectionMethod", "scope");

    portletSetup.store();
  }
示例#12
0
 public static void saveFAQPortletPreference(List<String> list, boolean useAjax) throws Exception {
   PortletRequestContext pcontext =
       (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
   PortletPreferences portletPref = pcontext.getRequest().getPreferences();
   String str = list.toString();
   str = str.replace("[", "").replace("]", "").replaceAll(" ", "");
   portletPref.setValue("displayCategories", str);
   portletPref.setValue("useAjax", String.valueOf(useAjax));
   portletPref.store();
 }
  protected void updateFacebook(ActionRequest actionRequest, PortletPreferences portletPreferences)
      throws Exception {

    String facebookAPIKey = ParamUtil.getString(actionRequest, "facebookAPIKey");
    String facebookCanvasPageURL = ParamUtil.getString(actionRequest, "facebookCanvasPageURL");
    boolean facebookShowAddAppLink = ParamUtil.getBoolean(actionRequest, "facebookShowAddAppLink");

    portletPreferences.setValue("lfrFacebookApiKey", facebookAPIKey);
    portletPreferences.setValue("lfrFacebookCanvasPageUrl", facebookCanvasPageURL);
    portletPreferences.setValue(
        "lfrFacebookShowAddAppLink", String.valueOf(facebookShowAddAppLink));
  }
  protected void updateRssSettings(ActionRequest actionRequest, PortletPreferences preferences)
      throws Exception {

    boolean enableRSS = ParamUtil.getBoolean(actionRequest, "enableRSS");
    int rssDelta = ParamUtil.getInteger(actionRequest, "rssDelta");
    String rssDisplayStyle = ParamUtil.getString(actionRequest, "rssDisplayStyle");
    String rssFormat = ParamUtil.getString(actionRequest, "rssFormat");
    String rssName = ParamUtil.getString(actionRequest, "rssName");

    preferences.setValue("enable-rss", String.valueOf(enableRSS));
    preferences.setValue("rss-delta", String.valueOf(rssDelta));
    preferences.setValue("rss-display-style", rssDisplayStyle);
    preferences.setValue("rss-format", rssFormat);
    preferences.setValue("rss-name", rssName);
  }
  protected void doTestPortletPreferencesPropagation(boolean linkEnabled, boolean globalScope)
      throws Exception {

    setLinkEnabled(linkEnabled);

    PortletPreferences layoutSetPrototypePortletPreferences =
        LayoutTestUtil.getPortletPreferences(prototypeLayout, journalContentPortletId);

    MergeLayoutPrototypesThreadLocal.clearMergeComplete();

    layoutSetPrototypePortletPreferences.setValue("articleId", StringPool.BLANK);

    layoutSetPrototypePortletPreferences.setValue("showAvailableLocales", Boolean.FALSE.toString());

    if (globalScope) {
      layoutSetPrototypePortletPreferences.setValue("groupId", String.valueOf(globalGroupId));
      layoutSetPrototypePortletPreferences.setValue("lfrScopeType", "company");
    }

    layoutSetPrototypePortletPreferences.store();

    layout = propagateChanges(layout);

    PortletPreferences portletPreferences =
        LayoutTestUtil.getPortletPreferences(layout, journalContentPortletId);

    if (linkEnabled) {
      if (globalScope) {
        Assert.assertEquals(
            StringPool.BLANK, portletPreferences.getValue("articleId", StringPool.BLANK));
      } else {

        // Changes in preferences of local ids are not propagated

        Assert.assertEquals(
            journalArticle.getArticleId(),
            portletPreferences.getValue("articleId", StringPool.BLANK));
      }

      Assert.assertEquals(
          Boolean.FALSE.toString(),
          portletPreferences.getValue("showAvailableLocales", StringPool.BLANK));
    } else {
      Assert.assertEquals(
          journalArticle.getArticleId(),
          portletPreferences.getValue("articleId", StringPool.BLANK));
    }
  }
  protected void updateGoogleGadget(
      ActionRequest actionRequest, PortletPreferences portletPreferences) throws Exception {

    boolean iGoogleShowAddAppLink = ParamUtil.getBoolean(actionRequest, "iGoogleShowAddAppLink");

    portletPreferences.setValue("lfrIgoogleShowAddAppLink", String.valueOf(iGoogleShowAddAppLink));
  }
  private void _setTemporaryValue(PortletPreferences portletPreferences, String key, String value)
      throws ReadOnlyException {

    _oldValues.put(key, PrefsPropsUtil.getString(key));

    portletPreferences.setValue(key, value);
  }
 void setProperty(final String key, final Object value) {
   try {
     if (!preferences.isReadOnly(key)) preferences.setValue(key, value.toString());
   } catch (final ReadOnlyException e) {
     if (logger.isErrorEnabled()) logger.error(e);
   }
 }
  private void exportRolesAndPermissions(
      PortletDataContext context,
      String portletId,
      PortletPreferences preferences,
      long communityId)
      throws ReadOnlyException, PortalException, SystemException {

    PortletConfig portletConfig =
        configurationService.getPortletConfig(portletId, communityId).getPortletConfig();

    if (portletConfig.getRoles() != null) {
      List<RoleConfig> roleList = collectPortletRoles(portletConfig.getRoles().getRole());
      String[] roleNames = new String[roleList.size()];
      int idx = 0;
      for (RoleConfig role : roleList) {
        long primkey =
            configurationService.readRoleResourceIdPrimKey(portletId, communityId, role.getName());

        roleNames[idx++] = role.getName();

        preferences.setValue(ROLE_PREF_PREFIX + String.valueOf(primkey), role.getName());

        context.addPermissions(PortletRole.RESOURCE_KEY, primkey);
      }
      preferences.setValues(ROLE_NAMES_PREF, roleNames);
    }
  }
  @Override
  protected PortletPreferences doProcessImportPortletPreferences(
      PortletDataContext portletDataContext,
      String portletId,
      PortletPreferences portletPreferences)
      throws Exception {

    portletDataContext.importPortletPermissions(WikiPermission.RESOURCE_NAME);

    StagedModelDataHandlerUtil.importReferenceStagedModels(portletDataContext, WikiNode.class);

    StagedModelDataHandlerUtil.importReferenceStagedModels(portletDataContext, WikiPage.class);

    long nodeId = GetterUtil.getLong(portletPreferences.getValue("nodeId", StringPool.BLANK));

    if (nodeId > 0) {
      Map<Long, Long> nodeIds =
          (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(WikiNode.class);

      nodeId = MapUtil.getLong(nodeIds, nodeId, nodeId);

      portletPreferences.setValue("nodeId", String.valueOf(nodeId));
    }

    return portletPreferences;
  }
  public void processAction(
      PortletConfig portletConfig, ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    String cmd = ParamUtil.getString(actionRequest, Constants.CMD);

    if (!cmd.equals(Constants.UPDATE)) {
      return;
    }

    boolean allAssetVocabularies = ParamUtil.getBoolean(actionRequest, "allAssetVocabularies");
    long[] assetVocabularyIds =
        StringUtil.split(ParamUtil.getString(actionRequest, "assetVocabularyIds"), 0L);

    String portletResource = ParamUtil.getString(actionRequest, "portletResource");

    PortletPreferences preferences =
        PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portletResource);

    preferences.setValue("all-asset-vocabularies", String.valueOf(allAssetVocabularies));
    preferences.setValues("asset-vocabulary-ids", ArrayUtil.toStringArray(assetVocabularyIds));

    preferences.store();

    SessionMessages.add(actionRequest, portletConfig.getPortletName() + ".doConfigure");
  }
  @Override
  public String doExportData(
      PortletDataContext context, String portletId, PortletPreferences preferences)
      throws PortletDataException {

    long communityId = context.getScopeGroupId();

    LOGGER.debug(
        "Exporting CRUD portlet data for portletId {}, communityId {}", portletId, communityId);

    try {
      preferences.setValue("VERSION", String.valueOf(EXPORT_VERSION));

      if (configurationService.hasConfigData(portletId, communityId)) {

        exportRolesAndPermissions(context, portletId, preferences, communityId);

        exportConfig(context, portletId, communityId);

        preferences.store();

        ConfigurationMetaData metaData =
            configurationService.getConfigurationMetaData(portletId, communityId);
        return metaData.getFileName();
      } else {
        preferences.store();
        return "Keine Konfiguration vorhanden";
      }

    } catch (Exception e) {
      throw new PortletDataException("Error exporting portlet " + portletId + "/" + communityId, e);
    }
  }
  @Override
  protected PortletPreferences doDeleteData(
      PortletDataContext portletDataContext,
      String portletId,
      PortletPreferences portletPreferences)
      throws Exception {

    if (portletPreferences == null) {
      return portletPreferences;
    }

    portletPreferences.setValue("title", StringPool.BLANK);
    portletPreferences.setValue("nodeId", StringPool.BLANK);

    return portletPreferences;
  }
  public void updateAnyWebsite(ActionRequest actionRequest, PortletPreferences portletPreferences)
      throws Exception {

    boolean widgetShowAddAppLink = ParamUtil.getBoolean(actionRequest, "widgetShowAddAppLink");

    portletPreferences.setValue("lfrWidgetShowAddAppLink", String.valueOf(widgetShowAddAppLink));
  }
示例#25
0
 @Action
 public Response updateGrade(String grade, String location)
     throws java.io.IOException, javax.portlet.PortletException {
   preferences.setValue("grade", grade);
   preferences.store();
   return Weather_.index(location);
 }
  protected void updateNetvibes(ActionRequest actionRequest, PortletPreferences portletPreferences)
      throws Exception {

    boolean netvibesShowAddAppLink = ParamUtil.getBoolean(actionRequest, "netvibesShowAddAppLink");

    portletPreferences.setValue(
        "lfrNetvibesShowAddAppLink", String.valueOf(netvibesShowAddAppLink));
  }
  @Test
  public void testExportImportPortletPreferences() throws Exception {

    // Check preferences after site creation

    JournalArticle journalArticle =
        JournalArticleLocalServiceUtil.getArticleByUrlTitle(
            _group.getGroupId(), _layoutSetPrototypeJournalArticle.getUrlTitle());

    Layout layout =
        LayoutLocalServiceUtil.getFriendlyURLLayout(
            _group.getGroupId(), false, _layoutSetPrototypeLayout.getFriendlyURL());

    javax.portlet.PortletPreferences jxPreferences =
        getPortletPreferences(
            layout.getCompanyId(), layout.getPlid(), _layoutSetPrototypeJournalContentPortletId);

    Assert.assertEquals(
        journalArticle.getArticleId(), jxPreferences.getValue("articleId", StringPool.BLANK));

    Assert.assertEquals(
        String.valueOf(journalArticle.getGroupId()),
        jxPreferences.getValue("groupId", StringPool.BLANK));

    Assert.assertEquals(
        String.valueOf(true), jxPreferences.getValue("showAvailableLocales", StringPool.BLANK));

    // Update site template preferences

    javax.portlet.PortletPreferences layoutSetprototypeJxPreferences =
        getPortletPreferences(
            _layoutSetPrototypeLayout.getCompanyId(),
            _layoutSetPrototypeLayout.getPlid(),
            _layoutSetPrototypeJournalContentPortletId);

    layoutSetprototypeJxPreferences.setValue("showAvailableLocales", String.valueOf(false));

    updatePortletPreferences(
        _layoutSetPrototypeLayout.getPlid(),
        _layoutSetPrototypeJournalContentPortletId,
        layoutSetprototypeJxPreferences);

    // Check preferences after layout reset

    SitesUtil.resetPrototype(layout);

    jxPreferences =
        getPortletPreferences(
            _group.getCompanyId(), layout.getPlid(), _layoutSetPrototypeJournalContentPortletId);

    Assert.assertEquals(
        journalArticle.getArticleId(), jxPreferences.getValue("articleId", StringPool.BLANK));
    Assert.assertEquals(
        String.valueOf(journalArticle.getGroupId()),
        jxPreferences.getValue("groupId", StringPool.BLANK));
    Assert.assertEquals(
        Boolean.FALSE.toString(), jxPreferences.getValue("showAvailableLocales", StringPool.BLANK));
  }
  public void editPublicRenderParameters(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    Portlet portlet = ActionUtil.getPortlet(actionRequest);

    PortletPreferences portletPreferences =
        ActionUtil.getLayoutPortletSetup(actionRequest, portlet);

    actionRequest = ActionUtil.getWrappedActionRequest(actionRequest, portletPreferences);

    Enumeration<String> enu = portletPreferences.getNames();

    while (enu.hasMoreElements()) {
      String name = enu.nextElement();

      if (name.startsWith(PublicRenderParameterConfiguration.IGNORE_PREFIX)
          || name.startsWith(PublicRenderParameterConfiguration.MAPPING_PREFIX)) {

        portletPreferences.reset(name);
      }
    }

    for (PublicRenderParameter publicRenderParameter : portlet.getPublicRenderParameters()) {

      String ignoreKey = PublicRenderParameterConfiguration.getIgnoreKey(publicRenderParameter);

      boolean ignoreValue = ParamUtil.getBoolean(actionRequest, ignoreKey);

      if (ignoreValue) {
        portletPreferences.setValue(ignoreKey, String.valueOf(Boolean.TRUE));
      } else {
        String mappingKey = PublicRenderParameterConfiguration.getMappingKey(publicRenderParameter);

        String mappingValue = ParamUtil.getString(actionRequest, mappingKey);

        if (Validator.isNotNull(mappingValue)) {
          portletPreferences.setValue(mappingKey, mappingValue);
        }
      }
    }

    if (SessionErrors.isEmpty(actionRequest)) {
      portletPreferences.store();
    }
  }
  protected void updateConfiguration(ActionRequest req, PortletPreferences prefs) throws Exception {

    String[] urls = req.getParameterValues("url");
    String[] titles = req.getParameterValues("title");
    int entriesPerFeed = ParamUtil.getInteger(req, "entriesPerFeed", 4);
    boolean showFeedTitle = ParamUtil.getBoolean(req, "showFeedTitle");
    boolean showFeedPublishedDate = ParamUtil.getBoolean(req, "showFeedPublishedDate");
    boolean showFeedDescription = ParamUtil.getBoolean(req, "showFeedDescription");
    boolean showFeedImage = ParamUtil.getBoolean(req, "showFeedImage");
    String feedImageAlignment = ParamUtil.getString(req, "feedImageAlignment");
    long headerArticleResouceId = ParamUtil.getLong(req, "headerArticleResouceId");
    long footerArticleResouceId = ParamUtil.getLong(req, "footerArticleResouceId");

    if (urls != null && titles != null) {
      prefs.setValues("urls", urls);
      prefs.setValues("titles", titles);
    } else {
      prefs.setValues("urls", new String[0]);
      prefs.setValues("titles", new String[0]);
    }

    prefs.setValue("items-per-channel", String.valueOf(entriesPerFeed));
    prefs.setValue("show-feed-title", String.valueOf(showFeedTitle));
    prefs.setValue("show-feed-published-date", String.valueOf(showFeedPublishedDate));
    prefs.setValue("show-feed-description", String.valueOf(showFeedDescription));
    prefs.setValue("show-feed-image", String.valueOf(showFeedImage));
    prefs.setValue("feed-image-alignment", String.valueOf(feedImageAlignment));
    prefs.setValue("header-article-resouce-id", String.valueOf(headerArticleResouceId));
    prefs.setValue("footer-article-resouce-id", String.valueOf(footerArticleResouceId));
  }
示例#30
0
  public static void removePortletBorder(Layout layout, String portletId) throws Exception {

    PortletPreferences portletSetup =
        PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, portletId);

    portletSetup.setValue("portletSetupShowBorders", String.valueOf(Boolean.FALSE));

    portletSetup.store();
  }