public CmisObject CreateDocument(string repositoryId, NCMIS.ObjectModel.CmisProperties properties, string folderId, NCMIS.ObjectModel.ContentStream contentStream)
        {
            FolderObjectService folderObjectService = (FolderObjectService)ObjectService.GetService(typeof(Folder));

            if (folderObjectService.IsSystemFolder(folderId))
            {
                throw new Exception("Could not create document under system folder.");
            }
            Kooboo.CMS.Content.Models.Repository repository = new Repository(repositoryId);


            string objectId = folderId;

            folderObjectService.TryPraseObjectId(folderId, out folderId);
            var folder = CmisFolderHelper.Parse(repository, folderId);

            if (folder is TextFolder)
            {
                var textFolder = (TextFolder)folder.AsActual();

                var content = Services.ServiceFactory.TextContentManager.Add(repository, textFolder, UserId, properties.ToNameValueCollection(), contentStream.ToFileCollection(), null);

                return(ObjectConvertor.ToCmis(content, false));
            }
            else if (folder is MediaFolder)
            {
                var mediaFolder = (MediaFolder)folder.AsActual();
                if (contentStream != null)
                {
                    var content = Services.ServiceFactory.MediaContentManager.Add(repository, mediaFolder, UserId, contentStream.Filename, new MemoryStream(contentStream.Stream));
                    return(ObjectConvertor.ToCmis(content, false));
                }
            }
            return(ObjectConvertor.EmptyCmisObject());
        }
示例#2
0
        // [WebGet(UriTemplate = "/{repositoryId}/object/{folderId}/parent")]
        public override NCMIS.ObjectModel.CmisObject GetFolderParent(string repositoryId, string folderId, string filter)
        {
            FolderObjectService folderService = (FolderObjectService)ObjectService.GetService(typeof(Folder));
            string objectId = folderId;

            if (folderService.TryPraseObjectId(objectId, out folderId))
            {
                return(folderService.GetParent(repositoryId, objectId));
            }
            return(ObjectConvertor.EmptyCmisObject());
        }
        public string CopyDocument(string repositoryId, string sourceId, NCMIS.ObjectModel.CmisProperties properties, string folderId)
        {
            string id;

            if (!TryPraseObjectId(sourceId, out id))
            {
                throw new Exception("Invalid docuemnt id. parameter name \"sourceId\"");
            }
            string contentUUID;

            Kooboo.CMS.Content.Models.Repository repository = new Repository(repositoryId);
            var sourceFolder = ParseDocumentId(repository, id, out contentUUID);

            IContentManager             contentManager;
            IContentQuery <ContentBase> contentQuery;

            if (sourceFolder is TextFolder)
            {
                contentManager = ServiceFactory.TextContentManager;
                contentQuery   = ((TextFolder)sourceFolder).CreateQuery().WhereEquals("UUID", contentUUID);
            }
            else
            {
                contentManager = ServiceFactory.MediaContentManager;
                contentQuery   = ((MediaFolder)sourceFolder).CreateQuery().WhereEquals("UUID", contentUUID);
            }
            FolderObjectService folderObjectService = (FolderObjectService)ObjectService.GetService(typeof(Folder));
            string objectId = folderId;

            folderObjectService.TryPraseObjectId(folderId, out folderId);
            var targetFolder = CmisFolderHelper.Parse(repository, folderId);

            var content = contentManager.Copy(contentQuery.First(), targetFolder, null, properties.ToNameValueCollection());

            return(GetObjectId(content));
        }
示例#4
0
        public override NCMIS.ObjectModel.CmisObject CreateFolder(string repositoryId, NCMIS.ObjectModel.CmisProperties properties, string folderId, string[] policies, NCMIS.AccessControl.AccessControlList addACEs, NCMIS.AccessControl.AccessControlList removeACEs)
        {
            FolderObjectService folderObjectService = (FolderObjectService)ObjectService.GetService(typeof(Folder));

            return(folderObjectService.CreateFolder(repositoryId, properties, folderId));
        }