//todo: if issue with data, don't just hang visualiser
        private async Task <IEnumerable <IQuery <object?> > > BuildVisualisationCommands(
            string contentItemId,
            IContentItemVersion contentItemVersion)
        {
            ContentItem?contentItem = await contentItemVersion.GetContentItem(_contentManager, contentItemId);

            if (contentItem == null)
            {
                return(Enumerable.Empty <IQuery <INodeAndOutRelationshipsAndTheirInRelationships> >());
            }
            //todo: best to not use dynamic
            dynamic?graphSyncPartContent = contentItem.Content[nameof(GraphSyncPart)];

            _syncNameProvider.ContentType = contentItem.ContentType;

            string?sourceNodeId = _syncNameProvider.GetNodeIdPropertyValue(graphSyncPartContent, contentItemVersion);
            IEnumerable <string> sourceNodeLabels = await _syncNameProvider.NodeLabels();

            string sourceNodeIdPropertyName = _syncNameProvider.IdPropertyName();

            var rootContext = await _describeContentItemHelper.BuildRelationships(
                contentItem, sourceNodeIdPropertyName, sourceNodeId, sourceNodeLabels, _syncNameProvider,
                _contentManager, contentItemVersion, null, _serviceProvider);

            //todo: return relationships - can we do it without creating cypher outside of a query?

            if (rootContext == null)
            {
                return(Enumerable.Empty <IQuery <object?> >());
            }

            //todo: should create relationships in here
            return(await _describeContentItemHelper.GetRelationshipCommands(rootContext));
        }
Exemplo n.º 2
0
        private async Task <ContentItem?> GetTaxonomyContentItem(
            JObject contentItemField,
            IContentItemVersion contentItemVersion,
            IContentManager contentManager)
        {
            string taxonomyContentItemId = contentItemField[TaxonomyContentItemId]?.ToObject <string>() !;

            //todo: null?

            //todo: need to really think this through/test it
            return(await contentItemVersion.GetContentItem(contentManager, taxonomyContentItemId));
        }
Exemplo n.º 3
0
        //todo: if issue with data, don't just hang visualiser
        private async Task <IEnumerable <IQuery <object?> > > BuildVisualisationCommands(
            string contentItemId,
            IContentItemVersion contentItemVersion)
        {
            ContentItem?contentItem = await contentItemVersion.GetContentItem(_contentManager, contentItemId);

            if (contentItem == null)
            {
                return(Enumerable.Empty <IQuery <INodeAndOutRelationshipsAndTheirInRelationships> >());
            }
            //todo: best to not use dynamic
            dynamic?graphSyncPartContent = contentItem.Content[nameof(GraphSyncPart)];

            _syncNameProvider.ContentType = contentItem.ContentType;

            string?sourceNodeId = _syncNameProvider.GetNodeIdPropertyValue(graphSyncPartContent, contentItemVersion);
            IEnumerable <string> sourceNodeLabels = await _syncNameProvider.NodeLabels();

            string sourceNodeIdPropertyName = _syncNameProvider.IdPropertyName();

            var rootContext = await _describeContentItemHelper.BuildRelationships(
                contentItem, sourceNodeIdPropertyName, sourceNodeId, sourceNodeLabels, _syncNameProvider,
                _contentManager, contentItemVersion, null, _serviceProvider);

            //todo: return relationships - can we do it without creating cypher outside of a query?
            //todo: current depth is always 0, so deep nodes like PersonalityQuestionSet returns masses of data
            //todo: depth cut-off is done after build relationships, so does more work than is necessary
            //var relationships = new List<ContentItemRelationship>();

            if (rootContext == null)
            {
                return(Enumerable.Empty <IQuery <object?> >());
            }

            //todo: should create relationships in here
            return(await _describeContentItemHelper.GetRelationshipCommands(rootContext));
        }