Пример #1
0
  public static Folder getGadgetEditorRootFolder(long repositoryId) throws Exception {

    Folder folder = null;

    try {
      folder =
          DLAppServiceUtil.getFolder(
              repositoryId,
              DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
              _GADGET_EDITOR_ROOT_FOLDER_NAME);
    } catch (Exception e) {
    }

    if (folder == null) {
      ServiceContext serviceContext = new ServiceContext();

      serviceContext.setAddGroupPermissions(true);
      serviceContext.setAddGuestPermissions(true);
      serviceContext.setScopeGroupId(repositoryId);

      folder =
          DLAppServiceUtil.addFolder(
              repositoryId,
              DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
              _GADGET_EDITOR_ROOT_FOLDER_NAME,
              StringPool.BLANK,
              serviceContext);
    }

    return folder;
  }
  protected String createFolder(CommandArgument commandArgument) {
    try {
      Group group = commandArgument.getCurrentGroup();

      Folder folder =
          _getFolder(group.getGroupId(), StringPool.SLASH + commandArgument.getCurrentFolder());

      long parentFolderId = folder.getFolderId();
      String name = commandArgument.getNewFolder();
      String description = StringPool.BLANK;

      ServiceContext serviceContext = new ServiceContext();

      serviceContext.setAddCommunityPermissions(true);
      serviceContext.setAddGuestPermissions(true);

      DLAppServiceUtil.addFolder(
          group.getGroupId(), parentFolderId, name, description, serviceContext);
    } catch (Exception e) {
      throw new FCKException(e);
    }

    return "0";
  }