Пример #1
0
  public void getFoldersAndFiles(
      CommandArgument argument, HttpServletRequest request, HttpServletResponse response) {

    Document doc = _createDocument();

    Node root =
        _createRoot(
            doc,
            argument.getCommand(),
            argument.getType(),
            argument.getCurrentFolder(),
            getPath(argument));

    getFoldersAndFiles(argument, doc, root);

    _writeDocument(doc, response);
  }
Пример #2
0
  public void createFolder(
      CommandArgument argument, HttpServletRequest request, HttpServletResponse response) {

    Document doc = _createDocument();

    Node root =
        _createRoot(
            doc,
            argument.getCommand(),
            argument.getType(),
            argument.getCurrentFolder(),
            StringPool.BLANK);

    Element errorEl = doc.createElement("Error");

    root.appendChild(errorEl);

    String returnValue = "0";

    try {
      returnValue = createFolder(argument);
    } catch (FCKException fcke) {
      Throwable cause = fcke.getCause();

      returnValue = "110";

      if (cause != null) {
        String causeString = GetterUtil.getString(cause.toString());

        if (causeString.indexOf("DuplicateFolderNameException") != -1) {
          returnValue = "101";
        } else if (causeString.indexOf("FolderNameException") != -1) {
          returnValue = "102";
        } else if (causeString.indexOf("NoSuchGroupException") != -1) {
          returnValue = "103";
        } else {
          throw fcke;
        }
      }
    }

    errorEl.setAttribute("number", returnValue);

    _writeDocument(doc, response);
  }