Inheritance: WebDavTypedCommand
        //**********************************************************************
        // Creates the Node corresponding to the released document
        //**********************************************************************
        private void ProcessDocumentNodeCreation()
        {
            // Display the status
            SendMessage("Creating document node in the JCR...");

            // Create the folder
            MkColCommand mkCol = new MkColCommand(GetDavContext());
            mkCol.setResourcePath(GetDocumentPath());
            mkCol.setNodeType(Helper.GetCustomProperty(
                this.data.CustomProperties,
                Helper.CUSTOM_PROP_DESTINATION_TYPE));

            // Determine if the WebDAV command worked successfully
            if(mkCol.execute() != DavStatus.CREATED)
            {
                throw new Exception(
                    "MKCOL returned a wrong status : "
                    + mkCol.getStatus()
                    + " "
                    + Helper.WebDAVStatusToString(mkCol.getStatus()));
            }
        }
示例#2
0
        public int createFolder(String name)
        {
            for (int i = 0; i <= NodeTree.SelectedNode.Nodes.Count - 1; i++)
            {
                if (NodeTree.SelectedNode.Nodes[i].Text.ToLower() == name.ToLower()) {
                    MessageBox.Show("The folder with such name already exist", "Error");
                    return -1;
                }
            }

            try
            {
                DavContext context = (DavContext)application.getContext();

                MkColCommand makeCol = new MkColCommand(context);
                makeCol.setResourcePath(currentPath + "/" + name);
                int status = makeCol.execute();

                String serverPrefix = application.getContext().getContextHref();
                String path = NodeTree.SelectedNode.FullPath;

                path = path.Replace("\\", "/");

                if (path.StartsWith(serverPrefix)) {
                    path = path.Substring(serverPrefix.Length);

                    if (path == "") {
                        path = "/";
                    }

                    status = getFileList(path);

                    if (status == DavStatus.MULTISTATUS)
                    {
                        fillTreeList(NodeTree.SelectedNode);
                        NodeTree.SelectedNode.Expand();
                    }
                    else
                    {
                        Utils.showMessageStatus(status);
                    }
                }

                return status;
            }
            catch (Exception e) {
                return -1;
                MessageBox.Show("Failed", "Error");
            }
        }