Added support for cascaded queries so that data from the first query could also be used in the filter criteria for the second query providing for the ability to further refine the result set.

Plus some additional instrumentation.
This commit is contained in:
Nilesh Ghodekar 2016-01-05 11:54:32 +00:00
Родитель 07f1f769df
Коммит d9f39d676a
8 изменённых файлов: 60 добавлений и 11 удалений

Просмотреть файл

@ -22,7 +22,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary
/// Build Number (MMDD)
/// Revision (if any on the same day)
/// </summary>
internal const string Version = "2.15.0104.0";
internal const string Version = "2.15.0105.0";
/// <summary>
/// File Version information for the assembly consists of the following four values:
@ -31,6 +31,6 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary
/// Build Number (MMDD)
/// Revision (if any on the same day)
/// </summary>
internal const string FileVersion = "2.15.0104.0";
internal const string FileVersion = "2.15.0105.0";
}
}

Просмотреть файл

@ -17,6 +17,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Workflow.Activities;
using System.Workflow.ComponentModel;
@ -755,7 +756,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
try
{
var variableCache = this.ActivityExpressionEvaluator.VariableCache;
this.breakIteration = Convert.ToBoolean(variableCache[ExpressionEvaluator.ReservedVariableBreakIteration]);
this.breakIteration = Convert.ToBoolean(variableCache[ExpressionEvaluator.ReservedVariableBreakIteration], CultureInfo.InvariantCulture);
}
finally
{

Просмотреть файл

@ -17,6 +17,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Workflow.Activities;
using System.Workflow.ComponentModel;
@ -571,7 +572,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
try
{
var variableCache = this.ActivityExpressionEvaluator.VariableCache;
this.breakIteration = Convert.ToBoolean(variableCache[ExpressionEvaluator.ReservedVariableBreakIteration]);
this.breakIteration = Convert.ToBoolean(variableCache[ExpressionEvaluator.ReservedVariableBreakIteration], CultureInfo.InvariantCulture);
}
finally
{

Просмотреть файл

@ -30,6 +30,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Component
System.Workflow.ComponentModel.ActivityBind activitybind2 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind3 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind4 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind5 = new System.Workflow.ComponentModel.ActivityBind();
this.ReadFoundResource = new System.Workflow.Activities.CodeActivity();
this.Find = new Microsoft.ResourceManagement.Workflow.Activities.EnumerateResourcesActivity();
this.ResolveFilter = new MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookupString();
@ -65,8 +66,11 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Component
activitybind3.Path = "XPathFilter";
activitybind4.Name = "FindResources";
activitybind4.Path = "Value";
activitybind5.Name = "FindResources";
activitybind5.Path = "QueryResults";
this.ResolveFilter.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookupString.StringForResolutionProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));
this.ResolveFilter.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookupString.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind4)));
this.ResolveFilter.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookupString.QueryResultsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind5)));
//
// Prepare
//

Просмотреть файл

@ -55,6 +55,10 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Component
public static DependencyProperty FoundIdsProperty =
DependencyProperty.Register("FoundIds", typeof(List<Guid>), typeof(FindResources));
[SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Justification = "DependencyProperty")]
public static DependencyProperty QueryResultsProperty =
DependencyProperty.Register("QueryResults", typeof(Dictionary<string, List<Guid>>), typeof(FindResources));
#endregion
#region Declarations
@ -214,7 +218,30 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Component
this.SetValue(FoundIdsProperty, value);
}
}
/// <summary>
/// Gets or sets the results for any queries which should be used for [//Queries/...] lookup resolution.
/// </summary>
/// <value>
/// The query results.
/// </value>
[Description("The results for any queries which should be used for [//Queries/...] lookup resolution.")]
[Category("Input")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Dictionary<string, List<Guid>> QueryResults
{
get
{
return (Dictionary<string, List<Guid>>)this.GetValue(QueryResultsProperty);
}
set
{
this.SetValue(QueryResultsProperty, value);
}
}
#endregion
#region Methods
@ -291,7 +318,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Component
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.FindResourcesPrepareExecuteCode);
Logger.Instance.WriteMethodExit(EventIdentifier.FindResourcesPrepareExecuteCode, "XPathFilter to Resolve: '{0}'. Attributes to Read: '{1}'.", this.XPathFilter, string.Join(",", this.Find.Selection));
}
}

Просмотреть файл

@ -248,18 +248,22 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Component
{
Logger.Instance.WriteMethodEntry(EventIdentifier.ResolveLookupStringGenerateLookupKey, "Lookup: '{0}'.", lookup);
string lookupKey = lookup;
try
{
// Generate a lookup key which will replace the lookup in the working string
// To make the string identifiable, the lookup will be made upper case and the "[//...]" syntax will be replaced with "~//...~"
// This will ensure the while loop condition does not find the string and attempt to reprocess it
// For example, "[//Delta/ExplicitMember/Added/DisplayName]" becomes "~//DELTA/EXLICITMEMBER/ADDED/DISPLAYNAME~"
return lookup.ToUpperInvariant().Replace("[", "~").Replace("]", "~");
lookupKey = lookup.ToUpperInvariant().Replace("[", "~").Replace("]", "~");
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.ResolveLookupStringGenerateLookupKey, "Returning: '{0}'.", lookup);
Logger.Instance.WriteMethodExit(EventIdentifier.ResolveLookupStringGenerateLookupKey, "Returning: '{0}'.", lookupKey);
}
return lookupKey;
}
/// <summary>

Просмотреть файл

@ -481,11 +481,18 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Component
// If necessary, add the supplied query results to the resource dictionary
// to support resolution of [//Queries/...] lookups
if (this.parameters.Contains(LookupParameter.Queries) && this.QueryResults != null)
if (this.parameters.Contains(LookupParameter.Queries))
{
foreach (string query in this.QueryResults.Keys)
if (this.QueryResults != null)
{
this.Publish(string.Format(CultureInfo.InvariantCulture, "{0}/{1}", LookupParameter.Queries, query), this.QueryResults[query]);
foreach (string query in this.QueryResults.Keys)
{
this.Publish(string.Format(CultureInfo.InvariantCulture, "{0}/{1}", LookupParameter.Queries, query), this.QueryResults[query]);
}
}
else
{
Logger.Instance.WriteVerbose(EventIdentifier.ResolveLookupsPrepareExecuteCode, "The [//Queries/...] lookup(s) don't have any supplied results.");
}
}

Просмотреть файл

@ -162,6 +162,11 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Component
queryXPathFilter = definition.Right;
runQuery.XPathFilter = queryXPathFilter;
// Also add results from any previous queries
// so that the first query could also be used in the filter criteria for the second query
// providing for the ability to further refine the result set.
runQuery.QueryResults = this.QueryResults;
}
finally
{