コード例 #1
0
  public static Map<String, String[]> getDefaultPublishingParameters(
      PortletRequest portletRequest) {

    Map<String, String[]> parameterMap =
        ExportImportConfigurationParameterMapFactory.buildParameterMap(portletRequest);

    return addDefaultPublishingParameters(parameterMap);
  }
  /**
   * Returns an export layout settings map if the type is {@link
   * ExportImportConfigurationConstants#TYPE_EXPORT_LAYOUT}; otherwise, returns either a local or
   * remote publish layout settings map, depending on the staging type.
   *
   * @param portletRequest the portlet request
   * @param groupId the primary key of the group
   * @param type the export/import option type
   * @return an export layout settings map if the type is an export layout; otherwise, returns
   *     either a local or remote publish layout settings map, depending on the staging type
   */
  public static Map<String, Serializable> buildSettingsMap(
      PortletRequest portletRequest, long groupId, int type) throws PortalException {

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

    boolean privateLayout = ParamUtil.getBoolean(portletRequest, "privateLayout");

    Map<Long, Boolean> layoutIdMap = ExportImportHelperUtil.getLayoutIdMap(portletRequest);

    if (type == ExportImportConfigurationConstants.TYPE_EXPORT_LAYOUT) {
      long[] layoutIds = ExportImportHelperUtil.getLayoutIds(layoutIdMap);

      return buildExportLayoutSettingsMap(
          themeDisplay.getUserId(),
          groupId,
          privateLayout,
          layoutIds,
          portletRequest.getParameterMap(),
          themeDisplay.getLocale(),
          themeDisplay.getTimeZone());
    }

    Group stagingGroup = GroupLocalServiceUtil.getGroup(groupId);

    Group liveGroup = stagingGroup.getLiveGroup();

    Map<String, String[]> parameterMap =
        ExportImportConfigurationParameterMapFactory.buildParameterMap(portletRequest);

    if (liveGroup != null) {
      long[] layoutIds = ExportImportHelperUtil.getLayoutIds(layoutIdMap, liveGroup.getGroupId());

      return buildPublishLayoutLocalSettingsMap(
          themeDisplay.getUserId(),
          stagingGroup.getGroupId(),
          liveGroup.getGroupId(),
          privateLayout,
          layoutIds,
          parameterMap,
          themeDisplay.getLocale(),
          themeDisplay.getTimeZone());
    }

    UnicodeProperties groupTypeSettingsProperties = stagingGroup.getTypeSettingsProperties();

    String remoteAddress =
        ParamUtil.getString(
            portletRequest,
            "remoteAddress",
            groupTypeSettingsProperties.getProperty("remoteAddress"));

    remoteAddress = StagingUtil.stripProtocolFromRemoteAddress(remoteAddress);

    int remotePort =
        ParamUtil.getInteger(
            portletRequest,
            "remotePort",
            GetterUtil.getInteger(groupTypeSettingsProperties.getProperty("remotePort")));
    String remotePathContext =
        ParamUtil.getString(
            portletRequest,
            "remotePathContext",
            groupTypeSettingsProperties.getProperty("remotePathContext"));
    boolean secureConnection =
        ParamUtil.getBoolean(
            portletRequest,
            "secureConnection",
            GetterUtil.getBoolean(groupTypeSettingsProperties.getProperty("secureConnection")));
    long remoteGroupId =
        ParamUtil.getLong(
            portletRequest,
            "remoteGroupId",
            GetterUtil.getLong(groupTypeSettingsProperties.getProperty("remoteGroupId")));
    boolean remotePrivateLayout = ParamUtil.getBoolean(portletRequest, "remotePrivateLayout");

    StagingUtil.validateRemote(
        groupId, remoteAddress, remotePort, remotePathContext, secureConnection, remoteGroupId);

    return buildPublishLayoutRemoteSettingsMap(
        themeDisplay.getUserId(),
        groupId,
        privateLayout,
        layoutIdMap,
        parameterMap,
        remoteAddress,
        remotePort,
        remotePathContext,
        secureConnection,
        remoteGroupId,
        remotePrivateLayout,
        themeDisplay.getLocale(),
        themeDisplay.getTimeZone());
  }
コード例 #3
0
  protected static Map<String, String[]> getDefaultPublishingParameters() {
    Map<String, String[]> parameterMap =
        ExportImportConfigurationParameterMapFactory.buildParameterMap();

    return addDefaultPublishingParameters(parameterMap);
  }