public void copyApplications(ActionRequest actionRequest, ActionResponse actionResponse)
      throws Exception {

    long groupId = ParamUtil.getLong(actionRequest, "groupId");
    boolean privateLayout = ParamUtil.getBoolean(actionRequest, "privateLayout");
    long layoutId = ParamUtil.getLong(actionRequest, "layoutId");

    Layout layout = layoutLocalService.getLayout(groupId, privateLayout, layoutId);

    if (!layout.getType().equals(LayoutConstants.TYPE_PORTLET)) {
      return;
    }

    long copyLayoutId = ParamUtil.getLong(actionRequest, "copyLayoutId");

    if ((copyLayoutId == 0) || (copyLayoutId == layout.getLayoutId())) {
      return;
    }

    Layout copyLayout = layoutLocalService.fetchLayout(groupId, privateLayout, copyLayoutId);

    if ((copyLayout == null) || !copyLayout.isTypePortlet()) {
      return;
    }

    ActionUtil.removePortletIds(actionRequest, layout);

    ActionUtil.copyPreferences(actionRequest, layout, copyLayout);

    SitesUtil.copyLookAndFeel(layout, copyLayout);
  }
예제 #2
0
  public static void removePortletIds(PortletRequest portletRequest, Layout layout)
      throws Exception {

    HttpServletRequest request = PortalUtil.getHttpServletRequest(portletRequest);

    removePortletIds(request, layout);
  }