Exemple #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);
        }
Exemple #2
0
        private void ExecuteSearchIntent()
        {
            ExternalDataSubsetIdentifier token;

            if (String.IsNullOrEmpty(mAcxiomTransformSourcePath))
            {
                token = new ExternalDataSubsetIdentifier(SearchTermValues, SubsetName); //NO XsltTransformPath needed, use search string only, Name is used to label the Daod Intent tab
            }
            else
            {
                token = new ExternalDataSubsetIdentifier(SearchTermValues + ";" + mAcxiomTransformSourcePath, SubsetName); //SearchTermPath and XsltTransformPath with Full qualify path, Name is used to label the Daod Intent tab
            }

            mExploreConfigBuilder.StartNew().SetExternalDataSubsetIdentifier(token);

            //Search using External Data source ( i.e, daod, acxiom ) so that a browse, Property or Visual search can be performed
            string usingDataSourceName = string.Format(AcxiomStringResources.DataSourceName, mDataSource.Name);

            mNotificationService.PresentAutoExpireSuccessfulActionNotificationToUser(usingDataSourceName);

            var ec = mExploreConfigBuilder
                     .SetDataSource(mDataSource)
                     .Build();

            if (IsPropertySearch)
            {
                PBSSuccess(token, ec);//launch the data intent as "Property Search View"
            }
            else if (IsVisualQuerySearch)
            {
                VQSuccess(token, ec);  //launch the data intent as "Visual Query Search View"
            }
            else
            {
                BrowseSuccess(token, ec);   //this is the default - launch the data intent as "Browse View"
            }
        }
        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);
        }
        /// <inheritdoc />
        public void ProcessSearch(string searchType, string searchTermValues, string subsetName)
        {
            var acxiomSearchTermValues = searchTermValues;
            if (!String.IsNullOrEmpty(mAcxiomConstants.AcxiomDaodTransformSourcePath))
            {
                acxiomSearchTermValues = string.Format("{0}{1};{2}", mAcxiomConstants.AcxiomDaodXmlSourcePath, acxiomSearchTermValues, mAcxiomConstants.AcxiomDaodTransformSourcePath);
            }

            var externalDataSubsetIdentifier = new ExternalDataSubsetIdentifier(acxiomSearchTermValues, subsetName);

            var usingDataSourceName = string.Format(AcxiomStringResources.DataSourceName, mDataSource.Name);
            mNotificationService.PresentAutoExpireSuccessfulActionNotificationToUser(usingDataSourceName);

            //Search using External Data source ( i.e, daod, acxiom ) so that a browse, Property or Visual search can be performed
            switch (searchType)
            {
                case ACXIOM_BROWSE_SEARCH_TYPE:
                    BrowseSuccess(externalDataSubsetIdentifier);
                    break;

                case ACXIOM_PROPERTY_SEARCH_TYPE:
                    PBSSuccess(externalDataSubsetIdentifier);
                    break;

                case ACXIOM_QUERY_SEARCH_TYPE:
                    VQSuccess(externalDataSubsetIdentifier);
                    break;

                default:  //not a valid option, default to browse
                    BrowseSuccess(externalDataSubsetIdentifier);
                    break;
            }
        }
        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);
        }
        private void ExecuteSearchIntent()
        {
            ExternalDataSubsetIdentifier token;
            if (String.IsNullOrEmpty(mAcxiomTransformSourcePath))
            {
                token = new ExternalDataSubsetIdentifier(SearchTermValues, SubsetName); //NO XsltTransformPath needed, use search string only, Name is used to label the Daod Intent tab
            }
            else
            {
                token = new ExternalDataSubsetIdentifier(SearchTermValues + ";" + mAcxiomTransformSourcePath, SubsetName); //SearchTermPath and XsltTransformPath with Full qualify path, Name is used to label the Daod Intent tab
            }

            mExploreConfigBuilder.StartNew().SetExternalDataSubsetIdentifier(token);

            //Search using External Data source ( i.e, daod, acxiom ) so that a browse, Property or Visual search can be performed
            string usingDataSourceName = string.Format(AcxiomStringResources.DataSourceName, mDataSource.Name);
            mNotificationService.PresentAutoExpireSuccessfulActionNotificationToUser(usingDataSourceName);

            var ec = mExploreConfigBuilder
                    .SetDataSource(mDataSource)
                    .Build();

            if (IsPropertySearch)
            {
                PBSSuccess(token, ec);//launch the data intent as "Property Search View"
            }
            else if (IsVisualQuerySearch)
              {
                  VQSuccess(token, ec);//launch the data intent as "Visual Query Search View"
              }
              else
              {
                  BrowseSuccess(token, ec); //this is the default - launch the data intent as "Browse View"
              }
        }
        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);
        }