コード例 #1
0
  public void restoreArchivedSetup(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    Portlet portlet = ActionUtil.getPortlet(actionRequest);

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    Settings portletInstanceSettings =
        SettingsFactoryUtil.getSettings(
            new PortletInstanceSettingsLocator(themeDisplay.getLayout(), portlet.getPortletId()));

    ModifiableSettings portletInstanceModifiableSettings =
        portletInstanceSettings.getModifiableSettings();

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

    ArchivedSettings archivedSettings =
        SettingsFactoryUtil.getPortletInstanceArchivedSettings(
            themeDisplay.getSiteGroupId(), portlet.getRootPortletId(), name);

    portletInstanceModifiableSettings.reset();

    portletInstanceModifiableSettings.setValues(archivedSettings);

    portletInstanceModifiableSettings.store();

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

    SessionMessages.add(
        actionRequest,
        PortalUtil.getPortletId(actionRequest) + SessionMessages.KEY_SUFFIX_REFRESH_PORTLET,
        portletResource);
  }
コード例 #2
0
  public static BlogsSettings getInstance(long groupId) throws PortalException, SystemException {

    Settings settings =
        SettingsFactoryUtil.getGroupServiceSettings(groupId, BlogsConstants.SERVICE_NAME);

    return new BlogsSettings(settings);
  }
コード例 #3
0
  public void deleteArchivedSetups(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    Portlet portlet = ActionUtil.getPortlet(actionRequest);

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

    String[] names = null;

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

    if (Validator.isNotNull(name)) {
      names = new String[] {name};
    } else {
      names = ParamUtil.getStringValues(actionRequest, "rowIds");
    }

    for (String curName : names) {
      ArchivedSettings archivedSettings =
          SettingsFactoryUtil.getPortletInstanceArchivedSettings(
              themeDisplay.getSiteGroupId(), portlet.getRootPortletId(), curName);

      archivedSettings.delete();
    }
  }
コード例 #4
0
  static {
    FallbackKeys fallbackKeys = _getFallbackKeys();

    SettingsFactory settingsFactory = SettingsFactoryUtil.getSettingsFactory();

    settingsFactory.registerFallbackKeys(BlogsConstants.SERVICE_NAME, fallbackKeys);
  }
コード例 #5
0
  public static BlogsSettings getInstance(long groupId, Map<String, String[]> parameterMap)
      throws PortalException, SystemException {

    Settings settings =
        SettingsFactoryUtil.getGroupServiceSettings(groupId, BlogsConstants.SERVICE_NAME);

    return new BlogsSettings(new ParameterMapSettings(parameterMap, settings));
  }
コード例 #6
0
  public void updateArchivedSetup(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    Portlet portlet = ActionUtil.getPortlet(actionRequest);

    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest.getAttribute(WebKeys.THEME_DISPLAY);

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

    ArchivedSettings archivedSettings =
        SettingsFactoryUtil.getPortletInstanceArchivedSettings(
            themeDisplay.getSiteGroupId(), portlet.getRootPortletId(), name);

    Settings portletInstanceSettings =
        SettingsFactoryUtil.getSettings(
            new PortletInstanceSettingsLocator(themeDisplay.getLayout(), portlet.getPortletId()));

    ModifiableSettings portletInstanceModifiableSettings =
        portletInstanceSettings.getModifiableSettings();

    archivedSettings.setValues(portletInstanceModifiableSettings);

    archivedSettings.store();
  }
  protected void setUpBlogsSettings() throws Exception {
    Settings settings =
        SettingsFactoryUtil.getGroupServiceSettings(
            _group.getGroupId(), BlogsConstants.SERVICE_NAME);

    ModifiableSettings modifiableSettings = settings.getModifiableSettings();

    String subscriptionBodyPreferencesKey =
        LocalizationUtil.getLocalizedName(
            "emailEntryUpdatedBody", LocaleUtil.toLanguageId(LocaleUtil.getDefault()));

    modifiableSettings.setValue(subscriptionBodyPreferencesKey, "[$BLOGS_ENTRY_UPDATE_COMMENT$]");

    modifiableSettings.store();
  }
コード例 #8
0
  @Override
  protected boolean isRSSFeedsEnabled(HttpServletRequest request) throws Exception {

    SettingsFactory settingsFactory = SettingsFactoryUtil.getSettingsFactory();

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    BlogsGroupServiceSettings rssBlogsGroupServiceSettings =
        settingsFactory.getSettings(
            BlogsGroupServiceSettings.class,
            new GroupServiceSettingsLocator(
                themeDisplay.getSiteGroupId(), BlogsConstants.SERVICE_NAME));

    return rssBlogsGroupServiceSettings.enableRss();
  }
コード例 #9
0
  public boolean isShowActions() throws PortalException {
    PortletDisplay portletDisplay = _themeDisplay.getPortletDisplay();

    String portletName = portletDisplay.getPortletName();

    if (portletName.equals(DLPortletKeys.DOCUMENT_LIBRARY_ADMIN)) {
      return true;
    }

    Settings settings =
        SettingsFactoryUtil.getSettings(
            new PortletInstanceSettingsLocator(_themeDisplay.getLayout(), portletDisplay.getId()));

    TypedSettings typedSettings = new TypedSettings(settings);

    return typedSettings.getBooleanValue("showActions");
  }
コード例 #10
0
 static {
   SettingsFactoryUtil.registerSettingsMetadata(
       BlogsGroupServiceSettings.class, null, _getFallbackKeys());
 }
コード例 #11
0
  protected void getLayoutPortlets(
      PortletDataContext portletDataContext,
      long[] layoutIds,
      Map<String, Object[]> portletIds,
      Layout layout)
      throws Exception {

    if (!ArrayUtil.contains(layoutIds, layout.getLayoutId())) {
      return;
    }

    if (!prepareLayoutStagingHandler(portletDataContext, layout)
        || !layout.isSupportsEmbeddedPortlets()) {

      // Only portlet type layouts support page scoping

      return;
    }

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

    // The getAllPortlets method returns all effective nonsystem portlets
    // for any layout type, including embedded portlets, or in the case of
    // panel type layout, selected portlets

    for (Portlet portlet : layoutTypePortlet.getAllPortlets(false)) {
      String portletId = portlet.getPortletId();

      Settings portletInstanceSettings =
          SettingsFactoryUtil.getSettings(new PortletInstanceSettingsLocator(layout, portletId));

      String scopeType = portletInstanceSettings.getValue("lfrScopeType", null);
      String scopeLayoutUuid = portletInstanceSettings.getValue("lfrScopeLayoutUuid", null);

      long scopeGroupId = portletDataContext.getScopeGroupId();

      if (Validator.isNotNull(scopeType)) {
        Group scopeGroup = null;

        if (scopeType.equals("company")) {
          scopeGroup = _groupLocalService.getCompanyGroup(layout.getCompanyId());
        } else if (scopeType.equals("layout")) {
          Layout scopeLayout = null;

          scopeLayout =
              _layoutLocalService.fetchLayoutByUuidAndGroupId(
                  scopeLayoutUuid,
                  portletDataContext.getGroupId(),
                  portletDataContext.isPrivateLayout());

          if (scopeLayout == null) {
            continue;
          }

          scopeGroup = scopeLayout.getScopeGroup();
        } else {
          throw new IllegalArgumentException("Scope type " + scopeType + " is invalid");
        }

        if (scopeGroup != null) {
          scopeGroupId = scopeGroup.getGroupId();
        }
      }

      String key = PortletPermissionUtil.getPrimaryKey(layout.getPlid(), portletId);

      portletIds.put(
          key,
          new Object[] {portletId, layout.getPlid(), scopeGroupId, scopeType, scopeLayoutUuid});
    }
  }