コード例 #1
0
ファイル: NodeBase.cs プロジェクト: webkeg/AlfrescoFramework
        public RepositoryWebService.Reference GetReferenceFromResultSetRow(ResultSetRow row)
        {
            RepositoryWebService.Reference reference = null;

            reference       = new Alfresco.RepositoryWebService.Reference();
            reference.uuid  = row.node.id;
            reference.store = spacesStore;

            NamedValue[] namedValues = row.columns;

            Dictionary <string, string> namedValuesMap = new Dictionary <string, string>();

            // iterate through the columns of the result set to extract specific named values

            foreach (NamedValue namedValue in namedValues)
            {
                namedValuesMap.Add(namedValue.name, namedValue.value);
            }
            String path = namedValuesMap["{http://www.alfresco.org/model/content/1.0}path"];

            name = namedValuesMap["{http://www.alfresco.org/model/content/1.0}name"];

            reference.path = PathUtils.CovertFromModelPathToRepositoryPath(path);

            return(reference);
        }
コード例 #2
0
ファイル: NodeBase.cs プロジェクト: webkeg/AlfrescoFramework
        public void DeleteNodeByPath(string path)
        {
            var reference = new RepositoryWebService.Reference();

            reference.store = spacesStore;             //la definicion del store la explico mas abajo
            reference.path  = path;
            DeleteNodes(new RepositoryWebService.Reference[] { reference });
        }
コード例 #3
0
ファイル: NodeBase.cs プロジェクト: webkeg/AlfrescoFramework
        public void DeleteNodeById(string id)
        {
            var reference = new RepositoryWebService.Reference();

            reference.store = spacesStore;             //la definicion del store la explico mas abajo
            reference.uuid  = id;
            DeleteNodes(new Alfresco.RepositoryWebService.Reference[] { reference });
        }
コード例 #4
0
ファイル: FileNode.cs プロジェクト: webkeg/AlfrescoFramework
        /// <summary>
        /// Guarda un fichero en el nodo especificado
        /// </summary>
        /// <param name="parentId">uuid del nodo donde queremos guardar el documento</param>
        /// <param name="documentPath">Ruta local de la que se debe sacar el fichero, aquí se devuelve la ruta del repositorio donde se ha guardado el  documento</param>
        /// <param name="document">raw document, si este valor es null se intentará leer el documento del documentPath</param>
        /// <returns>uuid del documento que se ha salvado</returns>
        public string CreateFileByParentId(string parentId, ref string documentName, byte[] document)
        {
            if (document == null)
            {
                return(null);
            }

            string documentId = null;
            var    mimeType   = new MimetypeMap();

            try
            {
                UpdateResult[] updateResult = CreateNode(parentId, null, Constants.TYPE_CONTENT);

                // work around to cast Alfresco.RepositoryWebService.Reference to Alfresco.ContentWebService.Reference
                RepositoryWebService.Reference rwsRef         = updateResult[0].destination;
                ContentWebService.Reference    newContentNode = new Alfresco.ContentWebService.Reference();
                newContentNode.path = rwsRef.path;
                newContentNode.uuid = rwsRef.uuid;
                ContentWebService.Store cwsStore = new Alfresco.ContentWebService.Store();
                cwsStore.address     = Constants.SPACES_STORE;
                newContentNode.store = cwsStore;

                var contentFormat = new Alfresco.ContentWebService.ContentFormat();
                contentFormat.mimetype = mimeType.GuessMimetype(Name);

                Content lContent = WebServiceFactory.getContentService().write(newContentNode, Constants.PROP_CONTENT, document, contentFormat);
                documentName = ISO9075.Decode(PathUtils.ConvertFromRepositoryPath(lContent.node.path));
                documentId   = lContent.node.uuid;
            }
            catch (SoapException ex)
            {
                if (ex.Detail.InnerText.Contains("DuplicateChildNodeNameException"))
                {
                    var node     = new NodeBase();
                    var nodePath = String.Format("{0}/{1}", node.GetPathById(parentId), System.IO.Path.GetFileName(documentName));
                    var id       = node.GetIdByPath(nodePath);

                    throw new DuplicateDocumentException(id, nodePath);
                }
                else
                {
                    throw ex;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(documentId);
        }
コード例 #5
0
 public void DeleteNodeByPath(string path)
 {
     var reference = new RepositoryWebService.Reference();
     reference.store = spacesStore; //la definicion del store la explico mas abajo
     reference.path = path;
     DeleteNodes(new RepositoryWebService.Reference[] { reference });
 }
コード例 #6
0
 public void DeleteNodeById(string id)
 {
     var reference = new RepositoryWebService.Reference();
     reference.store = spacesStore; //la definicion del store la explico mas abajo
     reference.uuid = id;
     DeleteNodes(new Alfresco.RepositoryWebService.Reference[] { reference });
 }