Esempio n. 1
0
        private void ProcessJsonIntent(string data)
        {
            var jsonIntent = mJsonSerializerWrapper.Deserialize <JsonSubsetIntent>(data);

            var dataSource = mDataSourcesAndSchema.DataSources.SingleOrDefault(x => x.Id.Equals(jsonIntent.DataSourceId));

            if (dataSource == null)
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
                                                          "Unable to find datasource with id '{0}'",
                                                          jsonIntent.DataSourceId));
            }

            var token = new ExternalDataSubsetIdentifier(jsonIntent.Token, jsonIntent.SubsetName);

            IIntent intent;

            // Switch based on the string defined in the DomainTools.html
            switch (jsonIntent.PortalIntentToLaunch)
            {
            case "VisualQuery":
                var networkSearchConfig = mNetworkSearchConfigBuilder
                                          .StartNew()
                                          .SetDataSource(dataSource)
                                          .SetExternalDataSubsetIdentifier(token)
                                          .Build();

                intent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
                break;

            case "Browse":
                var exploreConfig = mExploreConfigBuilder
                                    .StartNew()
                                    .SetDataSource(dataSource)
                                    .SetExternalDataSubsetIdentifier(token)
                                    .Build();

                intent = mExplorationIntentFactory.CreateExploreIntent(exploreConfig);
                break;

            default:
                throw new ArgumentException("Unknown portal intent to launch: " + jsonIntent.PortalIntentToLaunch);
            }

            // Open the tab next to the current one
            var openTabOptions = new OpenTabOptions
            {
                Location = OpenTabLocation.OpenNearCurrent
            };

            mIntentManager.Run(intent, openTabOptions);
        }
Esempio n. 2
0
        //Launch Daod Intent in visual query mode
        private void VQSuccess(IExternalDataSubsetIdentifier t, IExploreConfig exploreConfig)
        {
            var networkSearchConfig = mNetworkSearchConfigBuilder
                                      .StartNew()
                                      .SetDataSource(exploreConfig.DataSource)
                                      .SetExternalDataSubsetIdentifier(t)
                                      .Build();

            var visualQuerySearchIntent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
            // Open the tab next to the current one
            var openTabOptions = new OpenTabOptions
            {
                Location = OpenTabLocation.OpenNearCurrent
            };

            mIntentManager.Run(visualQuerySearchIntent, openTabOptions);
        }
        private void ProcessJsonIntent(string data)
        {
            // We are expecting to receive strings that represent serialized
            // JsonSubsetIntent classes.
            var jsonIntent = mJsonSerializerWrapper.Deserialize<JsonSubsetIntent>(data);

            // Determine which data source the intent refers to.
            var dataSource = mDataSourcesAndSchema.DataSources.SingleOrDefault(x => x.Id.Equals(jsonIntent.DataSourceId));

            if (dataSource == null)
            {
                // No data source matched the intent, so throw an exception.
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
                                                          "Unable to find data source with ID '{0}'",
                                                          jsonIntent.DataSourceId));
            }

            // Generate a subset identifier from the token and the name in the
            // intent. The identifier ensures that any Browse or Visual Query
            // operation runs over the subset that the token defines. The name
            // is displayed to the user to identify which subset they are
            // working with.
            var externalDataSubsetIdentifier = new ExternalDataSubsetIdentifier(jsonIntent.Token, jsonIntent.SubsetName);

            IIntent intent;

            // Generate an appropriate intent, according to the analytic
            // operation that the user selected in SubsettingHtml.html.
            switch (jsonIntent.PortalIntentToLaunch)
            {
                case VisualQueryIntentType:
                    var networkSearchConfig = mNetworkSearchConfigBuilder
                        .StartNew()
                        .SetDataSource(dataSource)
                        .SetExternalDataSubsetIdentifier(externalDataSubsetIdentifier)
                        .Build();

                    intent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
                    break;

                case BrowseIntentType:
                    var exploreConfig = mExploreConfigBuilder
                        .StartNew()
                        .SetDataSource(dataSource)
                        .SetExternalDataSubsetIdentifier(externalDataSubsetIdentifier)
                        .Build();

                    intent = mExplorationIntentFactory.CreateExploreIntent(exploreConfig);
                    break;
                default:
                    throw new ArgumentException("Unknown Portal intent: " + jsonIntent.PortalIntentToLaunch);
            }

            // Open the tab for the results, next to the current tab.
            var openTabOptions = new OpenTabOptions
                                     {
                                         Location = OpenTabLocation.OpenNearCurrent
                                     };

            // Fire off the intent.
            mIntentManager.Run(intent, openTabOptions);
        }
        // Launch Daod Intent in visual query mode
        private void VQSuccess(IExternalDataSubsetIdentifier externalDataSubsetIdentifier)
        {
            var networkSearchConfig = mNetworkSearchConfigBuilder
                .StartNew()
                .SetDataSource(mDataSource)
                .SetExternalDataSubsetIdentifier(externalDataSubsetIdentifier)
                .Build();

            var visualQuerySearchIntent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);

            RunIntentNearCurrent(visualQuerySearchIntent);
        }
        private void ProcessJsonIntent(string data)
        {
            // We are expecting to receive strings that represent serialized
            // JsonSubsetIntent classes.
            var jsonIntent = mJsonSerializerWrapper.Deserialize <JsonSubsetIntent>(data);

            // Determine which data source the intent refers to.
            var dataSource = mDataSourcesAndSchema.DataSources.SingleOrDefault(x => x.Id.Equals(jsonIntent.DataSourceId));

            if (dataSource == null)
            {
                // No data source matched the intent, so throw an exception.
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
                                                          "Unable to find data source with ID '{0}'",
                                                          jsonIntent.DataSourceId));
            }

            // Generate a subset identifier from the token and the name in the
            // intent. The identifier ensures that any Browse or Visual Query
            // operation runs over the subset that the token defines. The name
            // is displayed to the user to identify which subset they are
            // working with.
            var externalDataSubsetIdentifier = new ExternalDataSubsetIdentifier(jsonIntent.Token, jsonIntent.SubsetName);

            IIntent intent;

            // Generate an appropriate intent, according to the analytic
            // operation that the user selected in SubsettingHtml.html.
            switch (jsonIntent.PortalIntentToLaunch)
            {
            case VisualQueryIntentType:
                var networkSearchConfig = mNetworkSearchConfigBuilder
                                          .StartNew()
                                          .SetDataSource(dataSource)
                                          .SetExternalDataSubsetIdentifier(externalDataSubsetIdentifier)
                                          .Build();

                intent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
                break;

            case BrowseIntentType:
                var exploreConfig = mExploreConfigBuilder
                                    .StartNew()
                                    .SetDataSource(dataSource)
                                    .SetExternalDataSubsetIdentifier(externalDataSubsetIdentifier)
                                    .Build();

                intent = mExplorationIntentFactory.CreateExploreIntent(exploreConfig);
                break;

            default:
                throw new ArgumentException("Unknown Portal intent: " + jsonIntent.PortalIntentToLaunch);
            }

            // Open the tab for the results, next to the current tab.
            var openTabOptions = new OpenTabOptions
            {
                Location = OpenTabLocation.OpenNearCurrent
            };

            // Fire off the intent.
            mIntentManager.Run(intent, openTabOptions);
        }
        //Launch Daod Intent in visual query mode
        private void VQSuccess(IExternalDataSubsetIdentifier t, IExploreConfig exploreConfig)
        {
            var networkSearchConfig = mNetworkSearchConfigBuilder
                .StartNew()
                .SetDataSource(exploreConfig.DataSource)
                .SetExternalDataSubsetIdentifier(t)
                .Build();

            var visualQuerySearchIntent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
            // Open the tab next to the current one
            var openTabOptions = new OpenTabOptions
                                    {
                                        Location = OpenTabLocation.OpenNearCurrent
                                    };

            mIntentManager.Run(visualQuerySearchIntent, openTabOptions);
        }
        private void ProcessJsonIntent(string data)
        {
            var jsonIntent = mJsonSerializerWrapper.Deserialize<JsonSubsetIntent>(data);

            var dataSource = mDataSourcesAndSchema.DataSources.SingleOrDefault(x => x.Id.Equals(jsonIntent.DataSourceId));

            if (dataSource == null)
            {
                throw new ArgumentException(string.Format(CultureInfo.InvariantCulture,
                                                          "Unable to find datasource with id '{0}'",
                                                          jsonIntent.DataSourceId));
            }

            var token = new ExternalDataSubsetIdentifier(jsonIntent.Token, jsonIntent.SubsetName);

            IIntent intent;

            // Switch based on the string defined in the DomainTools.html
            switch (jsonIntent.PortalIntentToLaunch)
            {
                case "VisualQuery":
                    var networkSearchConfig = mNetworkSearchConfigBuilder
                        .StartNew()
                        .SetDataSource(dataSource)
                        .SetExternalDataSubsetIdentifier(token)
                        .Build();

                    intent = new OpenNetworkSearchWithConfig(networkSearchConfig, false);
                    break;

                case "Browse":
                    var exploreConfig = mExploreConfigBuilder
                        .StartNew()
                        .SetDataSource(dataSource)
                        .SetExternalDataSubsetIdentifier(token)
                        .Build();

                    intent = mExplorationIntentFactory.CreateExploreIntent(exploreConfig);
                    break;
                default:
                    throw new ArgumentException("Unknown portal intent to launch: " + jsonIntent.PortalIntentToLaunch);
            }

            // Open the tab next to the current one
            var openTabOptions = new OpenTabOptions
                                     {
                                         Location = OpenTabLocation.OpenNearCurrent
                                     };

            mIntentManager.Run(intent, openTabOptions);
        }