예제 #1
0
  protected void updateUserGroup(Group group) throws Exception {
    LayoutLocalServiceUtil.deleteLayouts(group.getGroupId(), false, new ServiceContext());

    LayoutSetPrototypeUtil.updateLayoutSetPrototype(
        group, false, SocialOfficeConstants.LAYOUT_SET_PROTOTYPE_KEY_USER_PUBLIC);

    LayoutSet publicLayoutSet = LayoutSetLocalServiceUtil.getLayoutSet(group.getGroupId(), false);

    PortalClassInvoker.invoke(
        true, _mergeLayoutSetPrototypeLayoutsMethodKey, group, publicLayoutSet);

    LayoutLocalServiceUtil.deleteLayouts(group.getGroupId(), true, new ServiceContext());

    LayoutSetPrototypeUtil.updateLayoutSetPrototype(
        group, true, SocialOfficeConstants.LAYOUT_SET_PROTOTYPE_KEY_USER_PRIVATE);

    LayoutSet privateLayoutSet = LayoutSetLocalServiceUtil.getLayoutSet(group.getGroupId(), true);

    PortalClassInvoker.invoke(
        true, _mergeLayoutSetPrototypeLayoutsMethodKey, group, privateLayoutSet);

    SocialOfficeUtil.enableSocialOffice(group);
  }
  protected void doAddLayouts(InputStream inputStream) throws Exception {
    String sitemapJSON = getSitemapJSON(inputStream);

    JSONObject sitemapJSONObject = JSONFactoryUtil.createJSONObject(sitemapJSON);

    LayoutLocalServiceUtil.deleteLayouts(groupId, privateLayout, new ServiceContext());

    _defaultLayoutTemplateId = sitemapJSONObject.getString("layoutTemplateId", StringPool.BLANK);

    updateLayoutSetThemeId(sitemapJSONObject);

    JSONArray layoutsJSONArray = sitemapJSONObject.getJSONArray("layouts");

    addLayouts(LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, layoutsJSONArray);
  }