/// <summary>
 /// Constructor with given values.
 /// </summary>
 public OperationContext(ISet <string> filter, bool includeAcls, bool includeAllowableActions,
                         bool includePolicies, IncludeRelationships includeRelationships, ISet <string> renditionFilter,
                         bool includePathSegments, string orderBy, bool cacheEnabled, int maxItemsPerPage)
 {
     this.filter                  = filter;
     this.includeAcls             = includeAcls;
     this.includeAllowableActions = includeAllowableActions;
     this.includePolicies         = includePolicies;
     this.includeRelationships    = includeRelationships;
     this.renditionFilter         = renditionFilter;
     this.includePathSegments     = includePathSegments;
     this.orderBy                 = orderBy;
     this.cacheEnabled            = cacheEnabled;
     this.maxItemsPerPage         = maxItemsPerPage;
 }
Exemple #2
0
 public override NCMIS.ObjectModel.PathedCmisObjectContainer[] GetDescendants(string repositoryId, string folderId, int?depth, string filter, IncludeRelationships includeRelationships, string renditionFilter, bool includeAllowableActions, bool includePathSegment)
 {
     throw new NotSupportedException();
 }
Exemple #3
0
        public override NCMIS.ObjectModel.PathedCmisObjectList GetChildren(string repositoryId, string folderId, int?maxItems, int skipCount, string orderBy, string filter, IncludeRelationships includeRelationships, string renditionFilter, bool includeAllowableActions, bool includePathSegment)
        {
            Kooboo.CMS.Content.Models.Repository repository = new Models.Repository(repositoryId);
            IObjectService folderService = ObjectService.GetService(typeof(Folder));
            string         objectId      = folderId;

            folderService.TryPraseObjectId(objectId, out folderId);

            FolderType folderType = CmisFolderHelper.IdentifyFolderType(repository, folderId);

            PathedCmisObjectList           pathedList = new PathedCmisObjectList();
            IEnumerable <PathedCmisObject> children   = folderService.GetChildren(repositoryId, objectId, filter, includeRelationships)
                                                        .Select(it => new PathedCmisObject()
            {
                Object = it
            });

            var count = children.Count();

            pathedList.NumItems     = count.ToString();
            pathedList.HasMoreItems = false;

            //IEnumerable<ContentBase> contents = new ContentBase[0];
            if (folderType == FolderType.Content_Folder || folderType == FolderType.Media_Folder)
            {
                var folder = CmisFolderHelper.Parse(repository, folderId).AsActual();
                IContentQuery <ContentBase> contentQuery = null;
                if (folder is TextFolder)
                {
                    var textFolder = (TextFolder)folder;
                    var schema     = new Schema(repository, textFolder.SchemaName).AsActual();
                    contentQuery = textFolder.CreateQuery();
                    if (!string.IsNullOrEmpty(filter))
                    {
                        foreach (var item in schema.Columns)
                        {
                            contentQuery = contentQuery.Or(new WhereContainsExpression(null, item.Name, filter));
                        }
                    }
                }
                else
                {
                    var mediaFolder = (TextFolder)folder;
                    contentQuery = mediaFolder.CreateQuery();
                    if (!string.IsNullOrEmpty(filter))
                    {
                        contentQuery = contentQuery.WhereContains("FileName", filter);
                    }
                }
                if (!string.IsNullOrEmpty(orderBy))
                {
                    contentQuery = contentQuery.OrderBy(orderBy);
                }

                count = contentQuery.Count();
                var take = maxItems.HasValue ? maxItems.Value : count;
                pathedList.NumItems     = count.ToString();
                pathedList.HasMoreItems = count > count + take;

                children = children.Concat(contentQuery.Select(it => new PathedCmisObject()
                {
                    Object = ObjectConvertor.ToCmis((TextContent)(it), includeRelationships != IncludeRelationships.None)
                }).Take(take));
            }

            pathedList.Objects = children.ToArray();

            return(pathedList);
        }
Exemple #4
0
 public override NCMIS.ObjectModel.CmisObjectList GetCheckedoutDocs(string repositoryId, string folderId, string filter, string orderBy, bool includeAllowableActions, IncludeRelationships includeRelationships, string renditionFilter, int?maxItems, int skipCount)
 {
     throw new NotSupportedException();
 }
Exemple #5
0
 public override NCMIS.ObjectModel.PathedCmisObject[] GetObjectParents(string repositoryId, string objectId, string filter, IncludeRelationships includeRelationships, string renditionFilter, bool includeAllowableActions, bool includeRelativePathSegment)
 {
     throw new NotSupportedException();
 }
Exemple #6
0
 public IEnumerable<NCMIS.ObjectModel.CmisObject> GetChildren(string repositoryId, string objectId, string filter, IncludeRelationships includeRelationships)
 {
     Kooboo.CMS.Content.Models.Repository repository = new Models.Repository(repositoryId);
     string folderId;
     TryPraseObjectId(objectId, out folderId);
     switch (CmisFolderHelper.IdentifyFolderType(repository, folderId))
     {
         case FolderType.Root:
             return new[] {
             CmisFolderHelper.CreateSystemFolderObject(CmisFolderHelper.Content_Folder_Root,CmisFolderHelper.RootFolderName),
            CmisFolderHelper.CreateSystemFolderObject(CmisFolderHelper.Media_Folder_Root,CmisFolderHelper.RootFolderName)
             };
         case FolderType.Content_Folder_Root:
             return ServiceFactory.TextFolderManager.All(repository, filter).Select(it => ObjectConvertor.ToCmis((TextFolder)(it.AsActual()), includeRelationships != IncludeRelationships.None));
         case FolderType.Media_Folder_Root:
             return ServiceFactory.MediaFolderManager.All(repository, filter).Select(it => ObjectConvertor.ToCmis((MediaFolder)(it.AsActual()), includeRelationships != IncludeRelationships.None));
         case FolderType.Content_Folder:
             var textFolder = (TextFolder)CmisFolderHelper.Parse(repository, folderId);
             return ServiceFactory.TextFolderManager.ChildFolders(textFolder, filter).Select(it => ObjectConvertor.ToCmis((TextFolder)(it.AsActual()), includeRelationships != IncludeRelationships.None));
         case FolderType.Media_Folder:
             var mediaFolder = (MediaFolder)CmisFolderHelper.Parse(repository, folderId);
             return ServiceFactory.MediaFolderManager.ChildFolders(mediaFolder, filter).Select(it => ObjectConvertor.ToCmis((MediaFolder)(it.AsActual()), includeRelationships != IncludeRelationships.None));
         default:
             break;
     }
     return new[] { ObjectConvertor.EmptyCmisObject() };
 }
Exemple #7
0
        public override NCMIS.ObjectModel.CmisObject GetObject(string repositoryId, string objectId, string filter, bool includeAllowableActions, IncludeRelationships includeRelationships, string renditionFilter, bool includePolicyIds, bool includeAcl)
        {
            IObjectService objectService = ObjectService.GetService(objectId);

            return(objectService.GetObject(repositoryId, objectId));
        }
Exemple #8
0
 public override NCMIS.ObjectModel.CmisObject GetObjectByPath(string repositoryId, string path, string filter, bool? includeAllowableActions, IncludeRelationships? includeRelationships, string renditionFilter, bool? includePolicyIds, bool? includeACL)
 {
     throw new NotSupportedException();
 }
Exemple #9
0
 public override NCMIS.ObjectModel.CmisObject GetObject(string repositoryId, string objectId, string filter, bool includeAllowableActions, IncludeRelationships includeRelationships, string renditionFilter, bool includePolicyIds, bool includeAcl)
 {
     IObjectService objectService = ObjectService.GetService(objectId);
     return objectService.GetObject(repositoryId, objectId);
 }
 /// <summary>
 /// Creates a new operation defaultContext object with the given parameters.
 /// </summary>
 /// <remarks>
 /// Caching is enabled.
 /// </remarks>
 public static IOperationContext CreateOperationContext(HashSet <string> filter, bool includeAcls,
                                                        bool includeAllowableActions, bool includePolicies, IncludeRelationships includeRelationships,
                                                        HashSet <string> renditionFilter, bool includePathSegments, string orderBy, bool cacheEnabled,
                                                        int maxItemsPerPage)
 {
     return(new OperationContext(filter, includeAcls, includeAllowableActions, includePolicies,
                                 includeRelationships, renditionFilter, includePathSegments, orderBy, cacheEnabled, maxItemsPerPage));
 }
        public IEnumerable <NCMIS.ObjectModel.CmisObject> GetChildren(string repositoryId, string objectId, string filter, IncludeRelationships includeRelationships)
        {
            Kooboo.CMS.Content.Models.Repository repository = new Models.Repository(repositoryId);
            string folderId;

            TryPraseObjectId(objectId, out folderId);
            switch (CmisFolderHelper.IdentifyFolderType(repository, folderId))
            {
            case FolderType.Root:
                return(new[] {
                    CmisFolderHelper.CreateSystemFolderObject(CmisFolderHelper.Content_Folder_Root, CmisFolderHelper.RootFolderName),
                    CmisFolderHelper.CreateSystemFolderObject(CmisFolderHelper.Media_Folder_Root, CmisFolderHelper.RootFolderName)
                });

            case FolderType.Content_Folder_Root:
                return(ServiceFactory.TextFolderManager.All(repository, filter).Select(it => ObjectConvertor.ToCmis((TextFolder)(it.AsActual()), includeRelationships != IncludeRelationships.None)));

            case FolderType.Media_Folder_Root:
                return(ServiceFactory.MediaFolderManager.All(repository, filter).Select(it => ObjectConvertor.ToCmis((MediaFolder)(it.AsActual()), includeRelationships != IncludeRelationships.None)));

            case FolderType.Content_Folder:
                var textFolder = (TextFolder)CmisFolderHelper.Parse(repository, folderId);
                return(ServiceFactory.TextFolderManager.ChildFolders(textFolder, filter).Select(it => ObjectConvertor.ToCmis((TextFolder)(it.AsActual()), includeRelationships != IncludeRelationships.None)));

            case FolderType.Media_Folder:
                var mediaFolder = (MediaFolder)CmisFolderHelper.Parse(repository, folderId);
                return(ServiceFactory.MediaFolderManager.ChildFolders(mediaFolder, filter).Select(it => ObjectConvertor.ToCmis((MediaFolder)(it.AsActual()), includeRelationships != IncludeRelationships.None)));

            default:
                break;
            }
            return(new[] { ObjectConvertor.EmptyCmisObject() });
        }
Exemple #12
0
 public override NCMIS.ObjectModel.PathedCmisObjectContainer[] GetDescendants(string repositoryId, string folderId, int? depth, string filter, IncludeRelationships includeRelationships, string renditionFilter, bool includeAllowableActions, bool includePathSegment)
 {
     throw new NotSupportedException();
 }
Exemple #13
0
        public override NCMIS.ObjectModel.PathedCmisObjectList GetChildren(string repositoryId, string folderId, int? maxItems, int skipCount, string orderBy, string filter, IncludeRelationships includeRelationships, string renditionFilter, bool includeAllowableActions, bool includePathSegment)
        {
            Kooboo.CMS.Content.Models.Repository repository = new Models.Repository(repositoryId);
            IObjectService folderService = ObjectService.GetService(typeof(Folder));
            string objectId = folderId;
            folderService.TryPraseObjectId(objectId, out folderId);

            FolderType folderType = CmisFolderHelper.IdentifyFolderType(repository, folderId);

            PathedCmisObjectList pathedList = new PathedCmisObjectList();
            IEnumerable<PathedCmisObject> children = folderService.GetChildren(repositoryId, objectId, filter, includeRelationships)
                .Select(it => new PathedCmisObject() { Object = it });

            var count = children.Count();
            pathedList.NumItems = count.ToString();
            pathedList.HasMoreItems = false;

            //IEnumerable<ContentBase> contents = new ContentBase[0];
            if (folderType == FolderType.Content_Folder || folderType == FolderType.Media_Folder)
            {
                var folder = CmisFolderHelper.Parse(repository, folderId).AsActual();
                IContentQuery<ContentBase> contentQuery = null;
                if (folder is TextFolder)
                {
                    var textFolder = (TextFolder)folder;
                    var schema = new Schema(repository, textFolder.SchemaName).AsActual();
                    contentQuery = textFolder.CreateQuery();
                    if (!string.IsNullOrEmpty(filter))
                    {
                        foreach (var item in schema.Columns)
                        {
                            contentQuery = contentQuery.Or(new WhereContainsExpression(null, item.Name, filter));
                        }
                    }
                }
                else
                {
                    var mediaFolder = (TextFolder)folder;
                    contentQuery = mediaFolder.CreateQuery();
                    if (!string.IsNullOrEmpty(filter))
                    {
                        contentQuery = contentQuery.WhereContains("FileName", filter);
                    }
                }
                if (!string.IsNullOrEmpty(orderBy))
                {
                    contentQuery = contentQuery.OrderBy(orderBy);
                }

                count = contentQuery.Count();
                var take = maxItems.HasValue ? maxItems.Value : count;
                pathedList.NumItems = count.ToString();
                pathedList.HasMoreItems = count > count + take;

                children = children.Concat(contentQuery.Select(it => new PathedCmisObject()
                {
                    Object = ObjectConvertor.ToCmis((TextContent)(it), includeRelationships != IncludeRelationships.None)
                }).Take(take));
            }

            pathedList.Objects = children.ToArray();

            return pathedList;
        }
Exemple #14
0
 public override NCMIS.ObjectModel.CmisObjectList GetCheckedoutDocs(string repositoryId, string folderId, string filter, string orderBy, bool includeAllowableActions, IncludeRelationships includeRelationships, string renditionFilter, int? maxItems, int skipCount)
 {
     throw new NotSupportedException();
 }
Exemple #15
0
 public override NCMIS.ObjectModel.PathedCmisObject[] GetObjectParents(string repositoryId, string objectId, string filter, IncludeRelationships includeRelationships, string renditionFilter, bool includeAllowableActions, bool includeRelativePathSegment)
 {
     throw new NotSupportedException();
 }