public IItemEnumerable <IQueryResult> Query(string statement, bool searchAllVersions, IOperationContext context) { IDiscoveryService service = Binding.GetDiscoveryService(); IOperationContext ctxt = new OperationContext(context); PageFetcher <IQueryResult> .FetchPage fetchPageDelegate = delegate(long maxNumItems, long skipCount) { // fetch the data IObjectList resultList = service.Query(RepositoryId, statement, searchAllVersions, ctxt.IncludeAllowableActions, ctxt.IncludeRelationships, ctxt.RenditionFilterString, maxNumItems, skipCount, null); // convert query results IList <IQueryResult> page = new List <IQueryResult>(); if (resultList.Objects != null) { foreach (IObjectData objectData in resultList.Objects) { if (objectData == null) { continue; } page.Add(ObjectFactory.ConvertQueryResult(objectData)); } } return(new PageFetcher <IQueryResult> .Page <IQueryResult>(page, resultList.NumItems, resultList.HasMoreItems)); }; return(new CollectionEnumerable <IQueryResult>(new PageFetcher <IQueryResult>(DefaultContext.MaxItemsPerPage, fetchPageDelegate))); }
public IItemEnumerable <IObjectType> GetTypeChildren(string typeId, bool includePropertyDefinitions) { IRepositoryService service = Binding.GetRepositoryService(); PageFetcher <IObjectType> .FetchPage fetchPageDelegate = delegate(long maxNumItems, long skipCount) { // fetch the data ITypeDefinitionList tdl = service.GetTypeChildren(RepositoryId, typeId, includePropertyDefinitions, maxNumItems, skipCount, null); // convert type definitions int count = (tdl != null && tdl.List != null ? tdl.List.Count : 0); IList <IObjectType> page = new List <IObjectType>(count); if (count > 0) { foreach (ITypeDefinition typeDefinition in tdl.List) { page.Add(ObjectFactory.ConvertTypeDefinition(typeDefinition)); } } return(new PageFetcher <IObjectType> .Page <IObjectType>(page, tdl.NumItems, tdl.HasMoreItems)); }; return(new CollectionEnumerable <IObjectType>(new PageFetcher <IObjectType>(DefaultContext.MaxItemsPerPage, fetchPageDelegate))); }
public IItemEnumerable <IDocument> GetCheckedOutDocs(IOperationContext context) { INavigationService service = Binding.GetNavigationService(); IOperationContext ctxt = new OperationContext(context); PageFetcher <IDocument> .FetchPage fetchPageDelegate = delegate(long maxNumItems, long skipCount) { // get all checked out documents IObjectList checkedOutDocs = service.GetCheckedOutDocs(RepositoryId, null, ctxt.FilterString, ctxt.OrderBy, ctxt.IncludeAllowableActions, ctxt.IncludeRelationships, ctxt.RenditionFilterString, maxNumItems, skipCount, null); // convert objects IList <IDocument> page = new List <IDocument>(); if (checkedOutDocs.Objects != null) { foreach (IObjectData objectData in checkedOutDocs.Objects) { IDocument doc = ObjectFactory.ConvertObject(objectData, ctxt) as IDocument; if (doc == null) { // should not happen... continue; } page.Add(doc); } } return(new PageFetcher <IDocument> .Page <IDocument>(page, checkedOutDocs.NumItems, checkedOutDocs.HasMoreItems)); }; return(new CollectionEnumerable <IDocument>(new PageFetcher <IDocument>(DefaultContext.MaxItemsPerPage, fetchPageDelegate))); }
public override bool MoveNext() { PageFetcher <T> .Page <T> page = GetCurrentPage(); if (page == null) { return(false); } IList <T> items = page.Items; if (items == null || items.Count == 0) { return(false); } if (SkipOffset == items.Count) { if (!HasMoreItems) { return(false); } page = IncrementPage(); items = page == null ? null : page.Items; } if (items == null || items.Count == 0 || SkipOffset == items.Count) { return(false); } current = items[IncrementSkipOffset()]; return(true); }
public IItemEnumerable <IRelationship> GetRelationships(IObjectId objectId, bool includeSubRelationshipTypes, RelationshipDirection?relationshipDirection, IObjectType type, IOperationContext context) { if (objectId == null || objectId.Id == null) { throw new ArgumentException("Invalid object id!"); } string id = objectId.Id; string typeId = (type == null ? null : type.Id); IRelationshipService service = Binding.GetRelationshipService(); IOperationContext ctxt = new OperationContext(context); PageFetcher <IRelationship> .FetchPage fetchPageDelegate = delegate(long maxNumItems, long skipCount) { // fetch the relationships IObjectList relList = service.GetObjectRelationships(RepositoryId, id, includeSubRelationshipTypes, relationshipDirection, typeId, ctxt.FilterString, ctxt.IncludeAllowableActions, maxNumItems, skipCount, null); // convert relationship objects IList <IRelationship> page = new List <IRelationship>(); if (relList.Objects != null) { foreach (IObjectData rod in relList.Objects) { IRelationship relationship = GetObject(CreateObjectId(rod.Id), ctxt) as IRelationship; if (relationship == null) { throw new CmisRuntimeException("Repository returned an object that is not a relationship!"); } page.Add(relationship); } } return(new PageFetcher <IRelationship> .Page <IRelationship>(page, relList.NumItems, relList.HasMoreItems)); }; return(new CollectionEnumerable <IRelationship>(new PageFetcher <IRelationship>(DefaultContext.MaxItemsPerPage, fetchPageDelegate))); }
public CollectionPageEnumerator(long skipCount, PageFetcher <T> pageFetcher) : base(skipCount, pageFetcher) { }
public CollectionPageEnumerable(long position, PageFetcher <T> pageFetcher) : base(position, pageFetcher) { }
public CollectionPageEnumerable(PageFetcher <T> pageFetcher) : this(0, pageFetcher) { }
public AbstractEnumerator(long skipCount, PageFetcher <T> pageFetcher) { this.SkipCount = skipCount; this.pageFetcher = pageFetcher; }
protected AbstractEnumerable(long position, PageFetcher <T> pageFetcher) { this.PageFetcher = pageFetcher; this.SkipCount = position; }
public AbstractEnumerable(PageFetcher <T> pageFetcher) : this(0, pageFetcher) { }