Added Query Resources and Iteration Support for SendEmailNotification activity.

This commit is contained in:
NileshGhodekar 2017-07-10 01:15:13 +01:00
Родитель e419078664
Коммит 7748164143
9 изменённых файлов: 1060 добавлений и 104 удалений

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

@ -22,7 +22,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary
/// Build Number (MMDD)
/// Revision (if any on the same day)
/// </summary>
internal const string Version = "2.17.0414.0";
internal const string Version = "2.17.0709.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.17.0414.0";
internal const string FileVersion = "2.17.0709.0";
}
}

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

@ -2138,5 +2138,50 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI {
return ResourceManager.GetString("VerifyResourceUniquenessHelpText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Workflow Lookup Variables.
/// </summary>
internal static string WorkflowDataVariables {
get {
return ResourceManager.GetString("WorkflowDataVariables", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to One or more workflow lookup variable definitions are incomplete.
/// </summary>
internal static string WorkflowDataVariablesDefinitionValidationError {
get {
return ResourceManager.GetString("WorkflowDataVariablesDefinitionValidationError", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Specify the Workflow Lookup Variables to be used in the email template..
/// </summary>
internal static string WorkflowDataVariablesHelpText {
get {
return ResourceManager.GetString("WorkflowDataVariablesHelpText", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Value Expression.
/// </summary>
internal static string WorkflowDataVariablesLeftHeader {
get {
return ResourceManager.GetString("WorkflowDataVariablesLeftHeader", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Target.
/// </summary>
internal static string WorkflowDataVariablesRightHeader {
get {
return ResourceManager.GetString("WorkflowDataVariablesRightHeader", resourceCulture);
}
}
}
}

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

@ -810,4 +810,19 @@
<data name="PowerShellUserPasswordValidationError" xml:space="preserve">
<value>Specify the PowerShell user password.</value>
</data>
<data name="WorkflowDataVariables" xml:space="preserve">
<value>Workflow Lookup Variables</value>
</data>
<data name="WorkflowDataVariablesHelpText" xml:space="preserve">
<value>Specify the Workflow Lookup Variables to be used in the email template.</value>
</data>
<data name="WorkflowDataVariablesLeftHeader" xml:space="preserve">
<value>Value Expression</value>
</data>
<data name="WorkflowDataVariablesRightHeader" xml:space="preserve">
<value>Target</value>
</data>
<data name="WorkflowDataVariablesDefinitionValidationError" xml:space="preserve">
<value>One or more workflow lookup variable definitions are incomplete</value>
</data>
</root>

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

@ -109,8 +109,15 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Defini
public DefinitionsConverter(Hashtable definitionsTable)
{
// This constructor handles a hash table which is deserialized from an activity definition's XOML
// Throw an exception if the hashtable is null or missing the Count key which indicates how many definitions it stores
if (definitionsTable == null || !definitionsTable.ContainsKey("Count"))
// Do nothing if the hashtable is null. This is to allow backward compatibility of the old Activity UI XOML when a newer version is introduced
if (definitionsTable == null)
{
return;
}
// Throw an exception if the hashtable is missing the Count key which indicates how many definitions it stores
if (definitionsTable != null && !definitionsTable.ContainsKey("Count"))
{
throw Logger.Instance.ReportError(new ArgumentException(ActivitySettings.DefinitionsConverter_NullOrEmptyDefinitionsTableError, "definitionsTable"));
}

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

@ -14,12 +14,15 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using System.Workflow.ComponentModel;
using Microsoft.IdentityManagement.WebUI.Controls;
using Microsoft.ResourceManagement.Workflow.Activities;
using MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activities;
using MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common;
using MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Enumerations;
using MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Exceptions;
using MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI;
using MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Definitions;
@ -35,6 +38,11 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
{
#region Declarations
/// <summary>
/// The regex pattern for FIM resource type and attribute validation
/// </summary>
private const string RegexPattern = @"^[(a-z)(A-Z)(_)(:)][(a-z)(A-Z)(0-9)(\-)(.)(_)(:)]*$";
/// <summary>
/// The activity display name textbox
/// </summary>
@ -55,6 +63,26 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
/// </summary>
private readonly ActivityFormController controller = new ActivityFormController(ActivitySettings.SendEmailNotification);
/// <summary>
/// The iteration textbox
/// </summary>
private readonly ActivityTextBox iteration;
/// <summary>
/// The queries definitions controller
/// </summary>
private readonly DefinitionsController queries;
/// <summary>
/// The query resources checkbox
/// </summary>
private readonly ActivityCheckBox queryResources;
/// <summary>
/// The WorkflowData variables definitions controller
/// </summary>
private readonly DefinitionsController workflowDataVariables;
/// <summary>
/// The email template textbox
/// </summary>
@ -98,7 +126,39 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
this.advanced.CheckBoxControl.CheckedChanged += this.Advanced_CheckedChanged;
this.advanced.CheckBoxControl.AutoPostBack = true;
this.queryResources = this.controller.AddCheckBox(ActivitySettings.QueryResources, ActivitySettings.QueryResourcesHelpText, false, false);
this.queryResources.CheckBoxControl.CheckedChanged += this.QueryResources_CheckedChanged;
this.queryResources.CheckBoxControl.AutoPostBack = true;
// Create a new instance of the definitions controller to capture query definitions
// The visibility of the queries control will be governed by the Query Resources checkbox
this.queries = new DefinitionsController("Queries", 150, 430, 0)
{
DisplayName = ActivitySettings.Queries,
Description = ActivitySettings.QueriesHelpText,
LeftHeader = ActivitySettings.QueriesLeftHeader,
RightHeader = ActivitySettings.QueriesRightHeader
};
this.queries.HeaderRow.Visible = false;
this.queries.TableRow.Visible = false;
this.controller.ActivityControlTable.Rows.Add(this.queries.HeaderRow);
this.controller.ActivityControlTable.Rows.Add(this.queries.TableRow);
this.activityExecutionCondition = this.controller.AddTextBox(ActivitySettings.ActivityExecutionCondition, ActivitySettings.ConditionHelpText, false, false);
this.iteration = this.controller.AddTextBox(ActivitySettings.Iteration, ActivitySettings.IterationHelpText, false, false);
// Create a new definitions controller to capture update definitions
this.workflowDataVariables = new DefinitionsController("Workflow Lookup Variables", 330, 250, 70)
{
DisplayName = ActivitySettings.WorkflowDataVariables,
Description = ActivitySettings.WorkflowDataVariablesHelpText,
LeftHeader = ActivitySettings.WorkflowDataVariablesLeftHeader,
RightHeader = ActivitySettings.WorkflowDataVariablesRightHeader,
};
this.workflowDataVariables.HeaderRow.Visible = false;
this.workflowDataVariables.TableRow.Visible = false;
this.controller.ActivityControlTable.Rows.Add(this.workflowDataVariables.HeaderRow);
this.controller.ActivityControlTable.Rows.Add(this.workflowDataVariables.TableRow);
this.emailTemplate = this.controller.AddTextBox(ActivitySettings.SendEmailNotificationEmailTemplate, ActivitySettings.SendEmailNotificationEmailTemplateHelpText, true, true);
this.emailTemplate.TextBoxControl.Width = 300;
@ -159,8 +219,10 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
SendEmailNotification wfa = new SendEmailNotification
{
ActivityDisplayName = this.activityDisplayName.Value,
QueryResources = this.queryResources.Value,
Advanced = this.advanced.Value,
ActivityExecutionCondition = this.activityExecutionCondition.Value,
Iteration = this.iteration.Value,
EmailTemplate = this.emailTemplate.Value,
To = this.to.Value,
CC = this.cc.Value,
@ -168,6 +230,13 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
SuppressException = this.suppressException.Value,
};
// Convert the definition listings (web controls) to hash tables which can be serialized to the XOML workflow definition
// A hash table is used due to issues with deserialization of lists and other structured data
DefinitionsConverter queriesConverter = new DefinitionsConverter(this.queries.DefinitionListings);
DefinitionsConverter workflowDataVariablesConverter = new DefinitionsConverter(this.workflowDataVariables.DefinitionListings);
wfa.QueriesTable = queriesConverter.DefinitionsTable;
wfa.WorkflowDataVariablesTable = workflowDataVariablesConverter.DefinitionsTable;
return wfa;
}
catch (Exception e)
@ -200,13 +269,17 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
// Set form control values based on the activity's dependency properties
this.activityDisplayName.Value = wfa.ActivityDisplayName;
this.queryResources.Value = wfa.QueryResources;
this.advanced.Value = wfa.Advanced;
this.activityExecutionCondition.Value = wfa.ActivityExecutionCondition;
this.iteration.Value = wfa.Iteration;
this.emailTemplate.Value = wfa.EmailTemplate;
this.to.Value = wfa.To;
this.cc.Value = wfa.CC;
this.bcc.Value = wfa.Bcc;
this.suppressException.Value = wfa.SuppressException;
this.queries.LoadActivitySettings(wfa.QueriesTable);
this.workflowDataVariables.LoadActivitySettings(wfa.WorkflowDataVariablesTable);
}
catch (Exception e)
{
@ -232,6 +305,8 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
// Use the controller to persist the settings for standard activity controls
// The definitions controller will manage persistance of associated values
ActivitySettingsPartData data = this.controller.PersistSettings();
data = this.queries.PersistSettings(data);
data = this.workflowDataVariables.PersistSettings(data);
return data;
}
catch (Exception e)
@ -257,6 +332,9 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
{
// Use the controller and definitions controller to restore settings for activity controls
this.controller.RestoreSettings(data);
this.queries.RestoreSettings(data);
this.workflowDataVariables.RestoreSettings(data);
this.ManageQueryControls();
this.ManageAdvancedControls();
}
catch (Exception e)
@ -283,6 +361,8 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
// Use the controller to enable/disable standard activity controls
// the definitions controller will manage the mode of associated controls
this.controller.SwitchMode(mode);
this.queries.SwitchMode(mode);
this.workflowDataVariables.SwitchMode(mode);
}
catch (Exception e)
{
@ -328,6 +408,35 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
if (this.advanced.Value)
{
if (this.queryResources.Value)
{
// Loop through all active query listings and make sure they are valid
foreach (DefinitionListing query in this.queries.DefinitionListings.Where(query => query.Active))
{
// If a value is missing for key or query, the definition
// will be null and the listing fails validation
if (query.Definition == null)
{
this.controller.ValidationError = ActivitySettings.QueryDefinitionValidationError;
return false;
}
// Make sure that the specified query key is properly formatted
if (!Regex.Match(query.Definition.Left, RegexPattern).Success)
{
this.controller.ValidationError = string.Format(CultureInfo.CurrentUICulture, ActivitySettings.QueryDefintionLeftValidationError, query.Definition.Left);
return false;
}
// Make sure that the specified XPath filter is properly formatted
if (!ExpressionEvaluator.IsXPath(query.Definition.Right))
{
this.controller.ValidationError = string.Format(CultureInfo.CurrentUICulture, ActivitySettings.QueryDefintionRightValidationError, query.Definition.Left);
return false;
}
}
}
if (!string.IsNullOrEmpty(this.activityExecutionCondition.Value))
{
evaluator.ParseExpression(this.activityExecutionCondition.Value);
@ -340,8 +449,95 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
}
}
if (!string.IsNullOrEmpty(this.iteration.Value))
{
evaluator.ParseExpression(this.iteration.Value);
}
ParseRecipient(this.cc.Value);
ParseRecipient(this.bcc.Value);
// Loop through all active workflow data listings and make sure they are valid
var activeListings = this.workflowDataVariables.DefinitionListings.Where(workflowDataVariable => workflowDataVariable.Active);
var activeListingsCount = activeListings.Count();
foreach (DefinitionListing workflowDataVariable in activeListings)
{
if (workflowDataVariable.Definition == null)
{
// Allow the listing to be null if the count is only one as it's optional in this activity
if (activeListingsCount == 1)
{
continue;
}
// If a value is missing for source or target, the definition
// will be null and the listing fails validation
this.controller.ValidationError = ActivitySettings.WorkflowDataVariablesDefinitionValidationError;
return false;
}
// Attempt to parse the source expression and target lookup or variable
// Fail validation if an exception is thrown for either
try
{
evaluator.ParseExpression(workflowDataVariable.Definition.Left);
ParameterType targetType = ParameterType.Lookup;
try
{
targetType = ExpressionEvaluator.DetermineParameterType(workflowDataVariable.Definition.Right);
}
catch (WorkflowActivityLibraryException)
{
}
// Target variables are valid
// Target lookups require further evaluation to determine if they represent a valid target
if (targetType != ParameterType.Variable)
{
LookupEvaluator lookup = new LookupEvaluator(workflowDataVariable.Definition.Right);
if (!lookup.IsValidTarget)
{
this.controller.ValidationError = string.Format(CultureInfo.CurrentUICulture, ActivitySettings.TargetLookupValidationError, workflowDataVariable.Definition.Right);
return false;
}
}
}
catch (WorkflowActivityLibraryException ex)
{
this.controller.ValidationError = ex.Message;
return false;
}
}
// Verify that no [//Query/...] or [//Value/...] expressions exist
// if the query resources or iteration options are not enabled, respectively
bool containsQueryExpressions = false;
bool containsValueExpressions = false;
foreach (LookupEvaluator lookup in evaluator.LookupCache.Keys.Select(key => new LookupEvaluator(key)))
{
if (lookup.Parameter == LookupParameter.Queries)
{
containsQueryExpressions = true;
}
if (lookup.Parameter == LookupParameter.Value)
{
containsValueExpressions = true;
}
}
if (!this.queryResources.Value && containsQueryExpressions)
{
this.controller.ValidationError = ActivitySettings.QueryResourcesValidationError;
return false;
}
if (string.IsNullOrEmpty(this.iteration.Value) && containsValueExpressions)
{
this.controller.ValidationError = ActivitySettings.IterationValidationError;
return false;
}
}
else
{
@ -388,6 +584,25 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
}
}
/// <summary>
/// Handles the CheckedChanged event of the QueryResources control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
public void QueryResources_CheckedChanged(object sender, EventArgs e)
{
Logger.Instance.WriteMethodEntry();
try
{
this.ManageQueryControls();
}
finally
{
Logger.Instance.WriteMethodExit();
}
}
/// <summary>
/// Creates the child controls.
/// </summary>
@ -491,10 +706,41 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.UI.Forms
try
{
this.queryResources.Visible = this.advanced.Value;
this.activityExecutionCondition.Visible = this.advanced.Value;
this.iteration.Visible = this.advanced.Value;
this.cc.Visible = this.advanced.Value;
this.bcc.Visible = this.advanced.Value;
this.suppressException.Visible = this.advanced.Value;
this.workflowDataVariables.HeaderRow.Visible = this.advanced.Value;
this.workflowDataVariables.TableRow.Visible = this.advanced.Value;
if (!this.advanced.Value)
{
this.queries.HeaderRow.Visible = false;
this.queries.TableRow.Visible = false;
}
else
{
this.ManageQueryControls();
}
}
finally
{
Logger.Instance.WriteMethodExit();
}
}
/// <summary>
/// Manages the query controls.
/// </summary>
private void ManageQueryControls()
{
Logger.Instance.WriteMethodEntry();
try
{
this.queries.HeaderRow.Visible = this.queryResources.Value;
this.queries.TableRow.Visible = this.queryResources.Value;
}
finally
{

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

@ -30,12 +30,37 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
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();
System.Workflow.ComponentModel.ActivityBind activitybind6 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind7 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind8 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind9 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind10 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind11 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind12 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind13 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind14 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind15 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind16 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();
System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();
System.Workflow.Activities.CodeCondition codecondition3 = new System.Workflow.Activities.CodeCondition();
System.Workflow.Activities.CodeCondition codecondition4 = new System.Workflow.Activities.CodeCondition();
System.Workflow.ComponentModel.ActivityBind activitybind17 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind18 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind19 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind20 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind21 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind22 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind23 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind24 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind25 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind26 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.Activities.CodeCondition codecondition5 = new System.Workflow.Activities.CodeCondition();
System.Workflow.ComponentModel.ActivityBind activitybind5 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind27 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind28 = new System.Workflow.ComponentModel.ActivityBind();
System.Workflow.ComponentModel.ActivityBind activitybind29 = new System.Workflow.ComponentModel.ActivityBind();
System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<System.Guid>> dictionary_21 = new System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<System.Guid>>();
this.ResolveEmailBccRecipients = new System.Workflow.Activities.CodeActivity();
this.CheckEmailBccRecipientResources = new System.Workflow.Activities.CodeActivity();
this.FindEmailBccRecipients = new MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources();
@ -62,10 +87,15 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
this.IfEmailCcIsXPathOrExpression = new System.Workflow.Activities.IfElseActivity();
this.IfEmailToIsXPathOrExpression = new System.Workflow.Activities.IfElseActivity();
this.IfEmailTemplateIsXPathOrExpression = new System.Workflow.Activities.IfElseActivity();
this.ConditionSatisfied = new System.Workflow.Activities.IfElseBranchActivity();
this.IfActivityExecutionConditionSatisfied = new System.Workflow.Activities.IfElseActivity();
this.Update = new MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.UpdateLookups();
this.PrepareUpdate = new System.Workflow.Activities.CodeActivity();
this.ResolveForValue = new MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookups();
this.ProcessMail = new System.Workflow.Activities.SequenceActivity();
this.ForEachIteration = new System.Workflow.Activities.ReplicatorActivity();
this.PrepareIteration = new System.Workflow.Activities.CodeActivity();
this.Resolve = new MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookups();
this.ParseExpressions = new System.Workflow.Activities.CodeActivity();
this.RunQueries = new MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveQueries();
this.Prepare = new System.Workflow.Activities.CodeActivity();
//
// ResolveEmailBccRecipients
//
@ -81,13 +111,20 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
//
this.FindEmailBccRecipients.Attributes = null;
this.FindEmailBccRecipients.ExcludeWorkflowTarget = false;
this.FindEmailBccRecipients.FoundIds = null;
activitybind1.Name = "SendEmailNotification";
activitybind1.Path = "EmailBccRecipientsFoundIds";
this.FindEmailBccRecipients.FoundResources = null;
this.FindEmailBccRecipients.Name = "FindEmailBccRecipients";
this.FindEmailBccRecipients.Value = null;
activitybind1.Name = "SendEmailNotification";
activitybind1.Path = "Bcc";
this.FindEmailBccRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.XPathFilterProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
activitybind2.Name = "RunQueries";
activitybind2.Path = "QueryResults";
activitybind3.Name = "SendEmailNotification";
activitybind3.Path = "Value";
activitybind4.Name = "SendEmailNotification";
activitybind4.Path = "Bcc";
this.FindEmailBccRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.XPathFilterProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind4)));
this.FindEmailBccRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.QueryResultsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
this.FindEmailBccRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));
this.FindEmailBccRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.FoundIdsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
//
// ResolveEmailCcRecipients
//
@ -103,13 +140,20 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
//
this.FindEmailCcRecipients.Attributes = null;
this.FindEmailCcRecipients.ExcludeWorkflowTarget = false;
this.FindEmailCcRecipients.FoundIds = null;
activitybind5.Name = "SendEmailNotification";
activitybind5.Path = "EmailCcRecipientsFoundIds";
this.FindEmailCcRecipients.FoundResources = null;
this.FindEmailCcRecipients.Name = "FindEmailCcRecipients";
this.FindEmailCcRecipients.Value = null;
activitybind2.Name = "SendEmailNotification";
activitybind2.Path = "CC";
this.FindEmailCcRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.XPathFilterProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
activitybind6.Name = "RunQueries";
activitybind6.Path = "QueryResults";
activitybind7.Name = "SendEmailNotification";
activitybind7.Path = "Value";
activitybind8.Name = "SendEmailNotification";
activitybind8.Path = "CC";
this.FindEmailCcRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.XPathFilterProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind8)));
this.FindEmailCcRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.QueryResultsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind6)));
this.FindEmailCcRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind7)));
this.FindEmailCcRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.FoundIdsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind5)));
//
// ResolveEmailToRecipients
//
@ -125,13 +169,20 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
//
this.FindEmailToRecipients.Attributes = null;
this.FindEmailToRecipients.ExcludeWorkflowTarget = false;
this.FindEmailToRecipients.FoundIds = null;
activitybind9.Name = "SendEmailNotification";
activitybind9.Path = "EmailToRecipientsFoundIds";
this.FindEmailToRecipients.FoundResources = null;
this.FindEmailToRecipients.Name = "FindEmailToRecipients";
this.FindEmailToRecipients.Value = null;
activitybind3.Name = "SendEmailNotification";
activitybind3.Path = "To";
this.FindEmailToRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.XPathFilterProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));
activitybind10.Name = "RunQueries";
activitybind10.Path = "QueryResults";
activitybind11.Name = "SendEmailNotification";
activitybind11.Path = "Value";
activitybind12.Name = "SendEmailNotification";
activitybind12.Path = "To";
this.FindEmailToRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.XPathFilterProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind12)));
this.FindEmailToRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.QueryResultsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind10)));
this.FindEmailToRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind11)));
this.FindEmailToRecipients.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.FoundIdsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind9)));
//
// ResolveEmailTemplate
//
@ -147,13 +198,20 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
//
this.FindEmailTemplate.Attributes = null;
this.FindEmailTemplate.ExcludeWorkflowTarget = false;
this.FindEmailTemplate.FoundIds = null;
activitybind13.Name = "SendEmailNotification";
activitybind13.Path = "EmailTemplateFoundIds";
this.FindEmailTemplate.FoundResources = null;
this.FindEmailTemplate.Name = "FindEmailTemplate";
this.FindEmailTemplate.Value = null;
activitybind4.Name = "SendEmailNotification";
activitybind4.Path = "EmailTemplate";
this.FindEmailTemplate.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.XPathFilterProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind4)));
activitybind14.Name = "RunQueries";
activitybind14.Path = "QueryResults";
activitybind15.Name = "SendEmailNotification";
activitybind15.Path = "Value";
activitybind16.Name = "SendEmailNotification";
activitybind16.Path = "EmailTemplate";
this.FindEmailTemplate.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.XPathFilterProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind16)));
this.FindEmailTemplate.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.QueryResultsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind14)));
this.FindEmailTemplate.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind15)));
this.FindEmailTemplate.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.FindResources.FoundIdsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind13)));
//
// EmailBccIsExpression
//
@ -209,12 +267,20 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
//
// SendMail
//
this.SendMail.Bcc = null;
this.SendMail.CC = null;
this.SendMail.EmailTemplate = new System.Guid("00000000-0000-0000-0000-000000000000");
activitybind17.Name = "SendEmailNotification";
activitybind17.Path = "EmailNotificationBccRecipients";
activitybind18.Name = "SendEmailNotification";
activitybind18.Path = "EmailNotificationCcRecipients";
activitybind19.Name = "SendEmailNotification";
activitybind19.Path = "EmailTemplateGuid";
this.SendMail.Name = "SendMail";
this.SendMail.SuppressException = false;
this.SendMail.To = null;
activitybind20.Name = "SendEmailNotification";
activitybind20.Path = "EmailNotificationToRecipients";
this.SendMail.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.EmailNotificationActivity.BccProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind17)));
this.SendMail.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.EmailNotificationActivity.CCProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind18)));
this.SendMail.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.EmailNotificationActivity.ToProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind20)));
this.SendMail.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.EmailNotificationActivity.EmailTemplateProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind19)));
//
// PrepareSendMail
//
@ -245,43 +311,100 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
this.IfEmailTemplateIsXPathOrExpression.Activities.Add(this.EmailTemplateIsExpression);
this.IfEmailTemplateIsXPathOrExpression.Name = "IfEmailTemplateIsXPathOrExpression";
//
// ConditionSatisfied
// Update
//
this.ConditionSatisfied.Activities.Add(this.IfEmailTemplateIsXPathOrExpression);
this.ConditionSatisfied.Activities.Add(this.IfEmailToIsXPathOrExpression);
this.ConditionSatisfied.Activities.Add(this.IfEmailCcIsXPathOrExpression);
this.ConditionSatisfied.Activities.Add(this.IfEmailBccIsXPathOrExpression);
this.ConditionSatisfied.Activities.Add(this.PrepareSendMail);
this.ConditionSatisfied.Activities.Add(this.SendMail);
codecondition5.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ActivityExecutionConditionSatisfied_Condition);
this.ConditionSatisfied.Condition = codecondition5;
this.ConditionSatisfied.Name = "ConditionSatisfied";
this.Update.Actor = new System.Guid("00000000-0000-0000-0000-000000000000");
this.Update.ApplyAuthorizationPolicy = false;
this.Update.Name = "Update";
activitybind21.Name = "RunQueries";
activitybind21.Path = "QueryResults";
activitybind22.Name = "SendEmailNotification";
activitybind22.Path = "LookupUpdates";
activitybind23.Name = "SendEmailNotification";
activitybind23.Path = "Value";
this.Update.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.UpdateLookups.QueryResultsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind21)));
this.Update.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.UpdateLookups.UpdateLookupDefinitionsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind22)));
this.Update.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.UpdateLookups.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind23)));
//
// IfActivityExecutionConditionSatisfied
// PrepareUpdate
//
this.IfActivityExecutionConditionSatisfied.Activities.Add(this.ConditionSatisfied);
this.IfActivityExecutionConditionSatisfied.Name = "IfActivityExecutionConditionSatisfied";
this.PrepareUpdate.Name = "PrepareUpdate";
this.PrepareUpdate.ExecuteCode += new System.EventHandler(this.PrepareUpdate_ExecuteCode);
//
// ResolveForValue
//
this.ResolveForValue.ComparedRequestId = new System.Guid("00000000-0000-0000-0000-000000000000");
activitybind24.Name = "SendEmailNotification";
activitybind24.Path = "ValueExpressions";
this.ResolveForValue.Name = "ResolveForValue";
activitybind25.Name = "RunQueries";
activitybind25.Path = "QueryResults";
activitybind26.Name = "SendEmailNotification";
activitybind26.Path = "Value";
this.ResolveForValue.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookups.LookupsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind24)));
this.ResolveForValue.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookups.QueryResultsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind25)));
this.ResolveForValue.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookups.ValueProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind26)));
//
// ProcessMail
//
this.ProcessMail.Activities.Add(this.ResolveForValue);
this.ProcessMail.Activities.Add(this.PrepareUpdate);
this.ProcessMail.Activities.Add(this.Update);
this.ProcessMail.Activities.Add(this.IfEmailTemplateIsXPathOrExpression);
this.ProcessMail.Activities.Add(this.IfEmailToIsXPathOrExpression);
this.ProcessMail.Activities.Add(this.IfEmailCcIsXPathOrExpression);
this.ProcessMail.Activities.Add(this.IfEmailBccIsXPathOrExpression);
this.ProcessMail.Activities.Add(this.PrepareSendMail);
this.ProcessMail.Activities.Add(this.SendMail);
this.ProcessMail.Name = "ProcessMail";
//
// ForEachIteration
//
this.ForEachIteration.Activities.Add(this.ProcessMail);
this.ForEachIteration.ExecutionType = System.Workflow.Activities.ExecutionType.Sequence;
this.ForEachIteration.Name = "ForEachIteration";
codecondition5.Condition += new System.EventHandler<System.Workflow.Activities.ConditionalEventArgs>(this.ForEachIteration_UntilCondition);
this.ForEachIteration.UntilCondition = codecondition5;
this.ForEachIteration.ChildInitialized += new System.EventHandler<System.Workflow.Activities.ReplicatorChildEventArgs>(this.ForEachIteration_ChildInitialized);
this.ForEachIteration.ChildCompleted += new System.EventHandler<System.Workflow.Activities.ReplicatorChildEventArgs>(this.ForEachIteration_ChildCompleted);
//
// PrepareIteration
//
this.PrepareIteration.Name = "PrepareIteration";
this.PrepareIteration.ExecuteCode += new System.EventHandler(this.PrepareIteration_ExecuteCode);
//
// Resolve
//
this.Resolve.ComparedRequestId = new System.Guid("00000000-0000-0000-0000-000000000000");
activitybind5.Name = "SendEmailNotification";
activitybind5.Path = "ActivityExpressionEvaluator.LookupCache";
activitybind27.Name = "SendEmailNotification";
activitybind27.Path = "ActivityExpressionEvaluator.LookupCache";
this.Resolve.Name = "Resolve";
this.Resolve.QueryResults = null;
activitybind28.Name = "RunQueries";
activitybind28.Path = "QueryResults";
this.Resolve.Value = null;
this.Resolve.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookups.LookupsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind5)));
this.Resolve.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookups.QueryResultsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind28)));
this.Resolve.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveLookups.LookupsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind27)));
//
// ParseExpressions
// RunQueries
//
this.ParseExpressions.Name = "ParseExpressions";
this.ParseExpressions.ExecuteCode += new System.EventHandler(this.ParseExpressions_ExecuteCode);
this.RunQueries.Name = "RunQueries";
activitybind29.Name = "SendEmailNotification";
activitybind29.Path = "Queries";
this.RunQueries.QueryResults = dictionary_21;
this.RunQueries.SetBinding(MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.ComponentActivities.ResolveQueries.QueryDefinitionsProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind29)));
//
// Prepare
//
this.Prepare.Name = "Prepare";
this.Prepare.ExecuteCode += new System.EventHandler(this.Prepare_ExecuteCode);
//
// SendEmailNotification
//
this.Activities.Add(this.ParseExpressions);
this.Activities.Add(this.Prepare);
this.Activities.Add(this.RunQueries);
this.Activities.Add(this.Resolve);
this.Activities.Add(this.IfActivityExecutionConditionSatisfied);
this.Activities.Add(this.PrepareIteration);
this.Activities.Add(this.ForEachIteration);
this.Name = "SendEmailNotification";
this.CanModifyActivities = false;
@ -289,8 +412,15 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
#endregion
private Microsoft.ResourceManagement.Workflow.Activities.EmailNotificationActivity SendMail;
private ComponentActivities.UpdateLookups Update;
private CodeActivity PrepareSendMail;
private CodeActivity PrepareUpdate;
private ComponentActivities.ResolveQueries RunQueries;
private CodeActivity PrepareIteration;
private ComponentActivities.ResolveLookups ResolveForValue;
private SequenceActivity ProcessMail;
private ReplicatorActivity ForEachIteration;
private Microsoft.ResourceManagement.Workflow.Activities.EmailNotificationActivity SendMail;
private CodeActivity ResolveEmailBccRecipients;
private CodeActivity CheckEmailBccRecipientResources;
private ComponentActivities.FindResources FindEmailBccRecipients;
@ -316,8 +446,6 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
private IfElseBranchActivity EmailTemplateIsXPath;
private IfElseActivity IfEmailTemplateIsXPathOrExpression;
private ComponentActivities.FindResources FindEmailTemplate;
private CodeActivity ParseExpressions;
private IfElseBranchActivity ConditionSatisfied;
private IfElseActivity IfActivityExecutionConditionSatisfied;
private CodeActivity Prepare;
}
}

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

@ -17,10 +17,15 @@ 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;
using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
using Microsoft.ResourceManagement.Workflow.Activities;
using MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common;
using MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Definitions;
using MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Enumerations;
using MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Exceptions;
#endregion
@ -36,13 +41,29 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
public static DependencyProperty ActivityDisplayNameProperty =
DependencyProperty.Register("ActivityDisplayName", typeof(string), typeof(SendEmailNotification));
[SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Justification = "DependencyProperty")]
public static DependencyProperty AdvancedProperty =
DependencyProperty.Register("Advanced", typeof(bool), typeof(SendEmailNotification));
[SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Justification = "DependencyProperty")]
public static DependencyProperty QueryResourcesProperty =
DependencyProperty.Register("QueryResources", typeof(bool), typeof(SendEmailNotification));
[SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Justification = "DependencyProperty")]
public static DependencyProperty QueriesTableProperty =
DependencyProperty.Register("QueriesTable", typeof(Hashtable), typeof(SendEmailNotification));
[SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Justification = "DependencyProperty")]
public static DependencyProperty ActivityExecutionConditionProperty =
DependencyProperty.Register("ActivityExecutionCondition", typeof(string), typeof(SendEmailNotification));
[SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Justification = "DependencyProperty")]
public static DependencyProperty AdvancedProperty =
DependencyProperty.Register("Advanced", typeof(bool), typeof(SendEmailNotification));
public static DependencyProperty IterationProperty =
DependencyProperty.Register("Iteration", typeof(string), typeof(SendEmailNotification));
[SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Justification = "DependencyProperty")]
public static DependencyProperty WorkflowDataVariablesTableProperty =
DependencyProperty.Register("WorkflowDataVariablesTable", typeof(Hashtable), typeof(SendEmailNotification));
[SuppressMessage("Microsoft.Usage", "CA2211:NonConstantFieldsShouldNotBeVisible", Justification = "DependencyProperty")]
public static DependencyProperty EmailTemplateProperty =
@ -75,6 +96,28 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public ExpressionEvaluator ActivityExpressionEvaluator;
/// <summary>
/// The query definitions
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
[SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "Used only internally to bind to an activity.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public List<Definition> Queries;
/// <summary>
/// The value.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public object Value;
/// <summary>
/// The value expressions.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public Dictionary<string, object> ValueExpressions;
/// <summary>
/// The email template Guid.
/// </summary>
@ -82,6 +125,85 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public Guid EmailTemplateGuid;
/// <summary>
/// The list of unique identifiers of matching email templates found.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
[SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "Used only internally to bind to an activity.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public List<Guid> EmailTemplateFoundIds;
/// <summary>
/// The list of unique identifiers of matching "To" recipients found.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
[SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "Used only internally to bind to an activity.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public List<Guid> EmailToRecipientsFoundIds;
/// <summary>
/// The list of unique identifiers of matching "CC" recipients found.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
[SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "Used only internally to bind to an activity.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public List<Guid> EmailCcRecipientsFoundIds;
/// <summary>
/// The list of unique identifiers of matching "Bcc" recipients found.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
[SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "Used only internally to bind to an activity.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public List<Guid> EmailBccRecipientsFoundIds;
/// <summary>
/// The list of "To" recipients.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
[SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "Used only internally to bind to an activity.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public string EmailNotificationToRecipients;
/// <summary>
/// The list of "Cc" recipients.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
[SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "Used only internally to bind to an activity.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public string EmailNotificationCcRecipients;
/// <summary>
/// The list of "Bcc" recipients.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
[SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "Used only internally to bind to an activity.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public string EmailNotificationBccRecipients;
/// <summary>
/// The lookup update definitions.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
[SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Justification = "Used only internally to bind to an activity.")]
[SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Reviewed. VS designer renders public properties as dependency property.")]
public List<UpdateLookupDefinition> LookupUpdates;
/// <summary>
/// The workflowDataVariables definitions
/// </summary>
private List<Definition> workflowDataVariables = new List<Definition>();
/// <summary>
/// The number of iterations preformed so far
/// </summary>
private int iterations;
/// <summary>
/// Break iteration if true
/// </summary>
private bool breakIteration;
#endregion
/// <summary>
@ -99,6 +221,21 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
{
this.ActivityExpressionEvaluator = new ExpressionEvaluator();
}
if (this.Queries == null)
{
this.Queries = new List<Definition>();
}
if (this.ValueExpressions == null)
{
this.ValueExpressions = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
}
if (this.LookupUpdates == null)
{
this.LookupUpdates = new List<UpdateLookupDefinition>();
}
}
finally
{
@ -128,6 +265,67 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
}
}
/// <summary>
/// Gets or sets a value indicating whether advanced checkbox is selected.
/// </summary>
[Description("Advanced")]
[Category("Settings")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public bool Advanced
{
get
{
return (bool)this.GetValue(AdvancedProperty);
}
set
{
this.SetValue(AdvancedProperty, value);
}
}
/// <summary>
/// Gets or sets a value indicating whether to query resources.
/// </summary>
[Description("QueryResources")]
[Category("Settings")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public bool QueryResources
{
get
{
return (bool)this.GetValue(QueryResourcesProperty);
}
set
{
this.SetValue(QueryResourcesProperty, value);
}
}
/// <summary>
/// Gets or sets the queries hash table.
/// </summary>
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Reviewed.")]
[Description("QueriesTable")]
[Category("Settings")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Hashtable QueriesTable
{
get
{
return (Hashtable)this.GetValue(QueriesTableProperty);
}
set
{
this.SetValue(QueriesTableProperty, value);
}
}
/// <summary>
/// Gets or sets the condition.
/// </summary>
@ -149,22 +347,43 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
}
/// <summary>
/// Gets or sets a value indicating whether advanced checkbox is selected.
/// Gets or sets the iteration.
/// </summary>
[Description("Advanced")]
[Description("Iteration")]
[Category("Settings")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public bool Advanced
public string Iteration
{
get
{
return (bool)this.GetValue(AdvancedProperty);
return (string)this.GetValue(IterationProperty);
}
set
{
this.SetValue(AdvancedProperty, value);
this.SetValue(IterationProperty, value);
}
}
/// <summary>
/// Gets or sets the WorkflowData variables hash table.
/// </summary>
[SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly", Justification = "Reviewed.")]
[Description("WorkflowDataVariablesTable")]
[Category("Settings")]
[Browsable(true)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
public Hashtable WorkflowDataVariablesTable
{
get
{
return (Hashtable)this.GetValue(WorkflowDataVariablesTableProperty);
}
set
{
this.SetValue(WorkflowDataVariablesTableProperty, value);
}
}
@ -394,7 +613,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void ParseExpressions_ExecuteCode(object sender, EventArgs e)
private void Prepare_ExecuteCode(object sender, EventArgs e)
{
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationParseExpressionsExecuteCode);
@ -404,13 +623,40 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
// clear any supplied advanced settings so they do not impact activity execution
if (!this.Advanced)
{
this.QueryResources = false;
this.ActivityExecutionCondition = null;
this.Iteration = null;
this.CC = null;
this.Bcc = null;
this.SuppressException = false;
}
// If the activity is configured to query for resources,
// convert the queries hash table to a list of definitions that will feed the activity responsible
// for their execution
if (this.QueryResources && this.QueriesTable != null && this.QueriesTable.Count > 0)
{
DefinitionsConverter queriesConverter = new DefinitionsConverter(this.QueriesTable);
this.Queries = queriesConverter.Definitions;
}
// If the activity is configured for iteration or conditional execution, parse the associated expressions
this.ActivityExpressionEvaluator.ParseIfExpression(this.Iteration);
this.ActivityExpressionEvaluator.ParseIfExpression(this.ActivityExecutionCondition);
// Definitions are supplied to the workflow activity in the form of a hash table
// This is necessary due to deserialization issues with lists and custom classes
// Convert the WorkflowData variables hash table to a list of definitions that is easier to work with
DefinitionsConverter workflowDataVariablesConverter = new DefinitionsConverter(this.WorkflowDataVariablesTable);
this.workflowDataVariables = workflowDataVariablesConverter.Definitions;
// Load each source expression into the evaluator so associated lookups can be loaded into the cache for resolution
// For WorkflowData variables, the left side of the definition represents the source expression
foreach (Definition workflowDataVariablesDefinition in this.workflowDataVariables)
{
this.ActivityExpressionEvaluator.ParseExpression(workflowDataVariablesDefinition.Left);
}
this.ActivityExpressionEvaluator.ParseIfExpression(this.To);
this.ActivityExpressionEvaluator.ParseIfExpression(this.CC);
this.ActivityExpressionEvaluator.ParseIfExpression(this.Bcc);
@ -432,34 +678,247 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
}
/// <summary>
/// Handles the Condition event of the ActivityExecutionConditionSatisfied condition.
/// Handles the ExecuteCode event of the PrepareIteration CodeActivity.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="ConditionalEventArgs"/> instance containing the event data.</param>
private void ActivityExecutionConditionSatisfied_Condition(object sender, ConditionalEventArgs e)
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void PrepareIteration_ExecuteCode(object sender, EventArgs e)
{
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationActivityExecutionConditionSatisfiedCondition, "Condition: '{0}'.", this.ActivityExecutionCondition);
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationPrepareIterationExecuteCode, "Iteration: '{0}'. Condition: '{1}'.", this.Iteration, this.ActivityExecutionCondition);
bool submitRequests = false;
List<object> iterationValues = new List<object>();
try
{
// Determine if requests should be submitted based on whether or not a condition was supplied
// and if that condition resolves to true
// Determine if requests should be submitted based on the configuration for conditional execution
// If a condition was specified and that condition resolves to false, no values will be added for iteration
if (string.IsNullOrEmpty(this.ActivityExecutionCondition))
{
e.Result = true;
submitRequests = true;
}
else
{
object resolved = this.ActivityExpressionEvaluator.ResolveExpression(this.ActivityExecutionCondition);
if (resolved is bool && (bool)resolved)
{
e.Result = true;
submitRequests = true;
}
}
if (!submitRequests)
{
return;
}
// If the activity is not configured for iteration, a null value is added to the list
// to ensure a single email is sent
if (string.IsNullOrEmpty(this.Iteration))
{
iterationValues.Add(null);
}
else
{
// If the activity is configured for iteration, resolve the associated expression
object resolved = this.ActivityExpressionEvaluator.ResolveExpression(this.Iteration);
// If the expression resolved to one or more values, add those values to the list for iteration
if (resolved != null)
{
if (resolved.GetType().IsGenericType && resolved.GetType().GetGenericTypeDefinition() == typeof(List<>))
{
iterationValues.AddRange(((IEnumerable)resolved).Cast<object>());
}
else
{
iterationValues.Add(resolved);
}
}
// Pull any [//Value] or [//WorkflowData] expressions from the expression evaluator's lookup cache for
// resolution during iteration
foreach (string key in from key in this.ActivityExpressionEvaluator.LookupCache.Keys let lookup = new LookupEvaluator(key) where lookup.Parameter == LookupParameter.Value || lookup.Parameter == LookupParameter.WorkflowData select key)
{
this.ValueExpressions.Add(key, null);
}
}
// Add the iteration values to the replicator activity if requests should be submitted
this.ForEachIteration.InitialChildData = iterationValues;
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationPrepareIterationExecuteCode, "Iteration: '{0}'. Condition: '{1}'. Submit Request: '{2}'. Total Iterations: '{3}'.", this.Iteration, this.ActivityExecutionCondition, submitRequests, iterationValues.Count);
}
}
/// <summary>
/// Handles the ChildInitialized event of the ForEachIteration ReplicatorActivity.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
private void ForEachIteration_ChildInitialized(object sender, ReplicatorChildEventArgs e)
{
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationForEachIterationChildInitialized, "Current Iteration Value: '{0}'.", e.InstanceData);
try
{
// Get the instance value so it can be used to resolve associated expressions
// and clear previous resolutions
this.Value = e.InstanceData;
// Increment current iteration count
this.iterations += 1;
// Since the WF desinger does not allow binding boolean property SupressException we do it here
foreach (var childActivity in (e.Activity as SequenceActivity).EnabledActivities)
{
var sendMailActivity = childActivity as EmailNotificationActivity;
if (sendMailActivity != null)
{
sendMailActivity.SuppressException = this.SuppressException;
break;
}
}
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationActivityExecutionConditionSatisfiedCondition, "Condition: '{0}'. Condition evaluated '{1}'.", this.ActivityExecutionCondition, e.Result);
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationForEachIterationChildInitialized, "Current Iteration Value: '{0}'.", e.InstanceData);
}
}
/// <summary>
/// Handles the ChildCompleted event of the ForEachIteration ReplicatorActivity.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="ReplicatorChildEventArgs"/> instance containing the event data.</param>
private void ForEachIteration_ChildCompleted(object sender, ReplicatorChildEventArgs e)
{
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationForEachIterationChildCompleted, "Iteration: '{0}' of '{1}'. ", this.iterations, this.ForEachIteration.InitialChildData.Count);
try
{
var variableCache = this.ActivityExpressionEvaluator.VariableCache;
this.breakIteration = Convert.ToBoolean(variableCache[ExpressionEvaluator.ReservedVariableBreakIteration], CultureInfo.InvariantCulture);
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationForEachIterationChildCompleted, "Iteration: '{0}' of '{1}'. Break Iteration '{2}'.", this.iterations, this.ForEachIteration.InitialChildData.Count, this.breakIteration);
}
}
/// <summary>
/// Handles the ExecuteCode event of the PrepareMailTemplate CodeActivity.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void PrepareUpdate_ExecuteCode(object sender, EventArgs e)
{
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationPrepareUpdateExecuteCode);
try
{
// Load resolved value expressions to the expression evaluator
foreach (string key in this.ValueExpressions.Keys)
{
this.ActivityExpressionEvaluator.LookupCache[key] = this.ValueExpressions[key];
}
// Clear the variable cache for the expression evaluator
List<string> variables = this.ActivityExpressionEvaluator.VariableCache.Keys.ToList();
foreach (string variable in variables)
{
this.ActivityExpressionEvaluator.VariableCache[variable] = null;
}
// Loop through each workflow data variable definition to build the
// update resource parameters which will be used to update each target resource
this.LookupUpdates = new List<UpdateLookupDefinition>();
foreach (Definition workflowDataVariableDefinition in this.workflowDataVariables)
{
// Resolve the source expression, including any functions or concatenation,
// to retrieve the typed value that should be assigned to the target attribute
object resolved = null;
if (!ExpressionEvaluator.IsExpression(workflowDataVariableDefinition.Left))
{
// This is a dynamic string for resolution already resolved
// so just retrive the value from cache directly
resolved = this.ActivityExpressionEvaluator.LookupCache[workflowDataVariableDefinition.Left];
}
else
{
resolved = this.ActivityExpressionEvaluator.ResolveExpression(workflowDataVariableDefinition.Left);
}
// Determine if we are targeting a variable
// If not, assume we are targeting an expression which should result in requests or update
// to the workflow dictionary
bool targetVariable = ExpressionEvaluator.DetermineParameterType(workflowDataVariableDefinition.Right) == ParameterType.Variable;
// Only create an update lookup definition if the value is not null, or if the
// update definition is configured to allow null values to be transferred to the target(s)
if (resolved == null && workflowDataVariableDefinition.Check)
{
if (targetVariable)
{
this.ActivityExpressionEvaluator.PublishVariable(workflowDataVariableDefinition.Right, null, UpdateMode.Modify);
}
else
{
this.LookupUpdates.Add(new UpdateLookupDefinition(workflowDataVariableDefinition.Right, null, UpdateMode.Modify));
}
}
else if (resolved != null)
{
if (resolved.GetType() == typeof(InsertedValuesCollection))
{
// If the resolved object is an InsertedValues collection, the source for the update definition includes the InsertValues function
// All associated values should be added to the target
foreach (object o in (InsertedValuesCollection)resolved)
{
if (targetVariable)
{
this.ActivityExpressionEvaluator.PublishVariable(workflowDataVariableDefinition.Right, o, UpdateMode.Insert);
}
else
{
this.LookupUpdates.Add(new UpdateLookupDefinition(workflowDataVariableDefinition.Right, o, UpdateMode.Insert));
}
}
}
else if (resolved.GetType() == typeof(RemovedValuesCollection))
{
// If the resolved object is a RemovedValues collection, the source for the update definition includes the RemoveValues function
// All associated values should be removed from the target
foreach (object o in (RemovedValuesCollection)resolved)
{
if (targetVariable)
{
this.ActivityExpressionEvaluator.PublishVariable(workflowDataVariableDefinition.Right, o, UpdateMode.Remove);
}
else
{
this.LookupUpdates.Add(new UpdateLookupDefinition(workflowDataVariableDefinition.Right, o, UpdateMode.Remove));
}
}
}
else
{
// For all other conditions, update the variable or build a new update request parameter for the target attribute
if (targetVariable)
{
this.ActivityExpressionEvaluator.PublishVariable(workflowDataVariableDefinition.Right, resolved, UpdateMode.Modify);
}
else
{
this.LookupUpdates.Add(new UpdateLookupDefinition(workflowDataVariableDefinition.Right, resolved, UpdateMode.Modify));
}
}
}
}
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationPrepareUpdateExecuteCode);
}
}
@ -493,17 +952,17 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
try
{
if (this.FindEmailTemplate.FoundIds.Count == 0)
if (this.EmailTemplateFoundIds.Count == 0)
{
throw Logger.Instance.ReportError(EventIdentifier.SendEmailNotificationCheckEmailTemplateResourceExecuteCodeError, new WorkflowActivityLibraryException(Messages.SendEmailNotification_MissingEmailTemplateError, this.EmailTemplate));
}
if (this.FindEmailTemplate.FoundIds.Count > 1)
if (this.EmailTemplateFoundIds.Count > 1)
{
throw Logger.Instance.ReportError(EventIdentifier.SendEmailNotificationCheckEmailTemplateResourceExecuteCodeError, new WorkflowActivityLibraryException(Messages.SendEmailNotification_MultipleEmailTemplatesError, this.EmailTemplate));
}
this.EmailTemplateGuid = this.FindEmailTemplate.FoundIds[0];
this.EmailTemplateGuid = this.EmailTemplateFoundIds[0];
}
finally
{
@ -556,24 +1015,24 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void CheckEmailToRecipientResources_ExecuteCode(object sender, EventArgs e)
{
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationCheckEmailToRecipientResourcesExecuteCode, "To recipients count: {0}. Recipient: '{1}'.", this.FindEmailToRecipients.FoundIds.Count, this.To);
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationCheckEmailToRecipientResourcesExecuteCode, "To recipients count: {0}. Recipient: '{1}'.", this.EmailToRecipientsFoundIds.Count, this.To);
try
{
if (this.FindEmailToRecipients.FoundIds.Count == 0)
if (this.EmailToRecipientsFoundIds.Count == 0)
{
Logger.Instance.WriteWarning(EventIdentifier.SendEmailNotificationCheckEmailToRecipientResourcesExecuteCodeWarning, Messages.SendEmailNotification_ToRecipientNotFoundError, this.To);
this.To = null;
this.EmailNotificationToRecipients = null;
}
else
{
string[] recipients = (from id in this.FindEmailToRecipients.FoundIds select id.ToString()).ToArray();
this.To = string.Join(";", recipients);
string[] recipients = (from id in this.EmailToRecipientsFoundIds select id.ToString()).ToArray();
this.EmailNotificationToRecipients = string.Join(";", recipients);
}
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationCheckEmailToRecipientResourcesExecuteCode, "To recipients count: {0}. Recipient: '{1}'.", this.FindEmailToRecipients.FoundIds.Count, this.To);
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationCheckEmailToRecipientResourcesExecuteCode, "To recipients count: {0}. Recipient: '{1}'. Returning: '{2}'.", this.EmailToRecipientsFoundIds.Count, this.To, this.EmailNotificationToRecipients);
}
}
@ -595,11 +1054,11 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
Logger.Instance.WriteWarning(EventIdentifier.SendEmailNotificationResolveEmailToRecipientsExecuteCodeWarning, Messages.SendEmailNotification_ToRecipientNotFoundError, this.To);
}
this.To = recipient;
this.EmailNotificationToRecipients = recipient;
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationResolveEmailToRecipientsExecuteCode, "To Recipients: '{0}'.", this.To);
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationResolveEmailToRecipientsExecuteCode, "To Recipients: '{0}'. Returning: '{1}'.", this.To, this.EmailNotificationToRecipients);
}
}
@ -629,23 +1088,23 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void CheckEmailCcRecipientResources_ExecuteCode(object sender, EventArgs e)
{
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationCheckEmailCcRecipientResourcesExecuteCode, "CC recipients count: {0}. Recipient: '{1}'.", this.FindEmailCcRecipients.FoundIds.Count, this.CC);
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationCheckEmailCcRecipientResourcesExecuteCode, "CC recipients count: {0}. Recipient: '{1}'.", this.EmailCcRecipientsFoundIds.Count, this.CC);
try
{
if (this.FindEmailCcRecipients.FoundIds.Count == 0)
if (this.EmailCcRecipientsFoundIds.Count == 0)
{
this.CC = null;
this.EmailNotificationCcRecipients = null;
}
else
{
string[] recipients = (from id in this.FindEmailCcRecipients.FoundIds select id.ToString()).ToArray();
this.CC = string.Join(";", recipients);
string[] recipients = (from id in this.EmailCcRecipientsFoundIds select id.ToString()).ToArray();
this.EmailNotificationCcRecipients = string.Join(";", recipients);
}
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationCheckEmailCcRecipientResourcesExecuteCode, "CC recipients count: {0}. Recipient: '{1}'.", this.FindEmailCcRecipients.FoundIds.Count, this.CC);
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationCheckEmailCcRecipientResourcesExecuteCode, "CC recipients count: {0}. Recipient: '{1}'. Returning: '{2}'.", this.EmailCcRecipientsFoundIds.Count, this.CC, this.EmailNotificationCcRecipients);
}
}
@ -660,11 +1119,11 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
try
{
this.CC = this.FormatRecipient(this.CC);
this.EmailNotificationCcRecipients = this.FormatRecipient(this.CC);
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationResolveEmailCcRecipientsExecuteCode, "CC Recipients: '{0}'.", this.CC);
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationResolveEmailCcRecipientsExecuteCode, "CC Recipients: '{0}'. Returning: '{1}'.", this.CC, this.EmailNotificationCcRecipients);
}
}
@ -694,23 +1153,23 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void CheckEmailBccRecipientResources_ExecuteCode(object sender, EventArgs e)
{
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationCheckEmailBccRecipientResourcesExecuteCode, "Bcc recipients count: {0}. Recipient: '{1}'.", this.FindEmailTemplate.FoundIds.Count, this.Bcc);
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationCheckEmailBccRecipientResourcesExecuteCode, "Bcc recipients count: {0}. Recipient: '{1}'.", this.EmailBccRecipientsFoundIds.Count, this.Bcc);
try
{
if (this.FindEmailBccRecipients.FoundIds.Count == 0)
if (this.EmailBccRecipientsFoundIds.Count == 0)
{
this.Bcc = null;
this.EmailNotificationBccRecipients = null;
}
else
{
string[] recipients = (from id in this.FindEmailBccRecipients.FoundIds select id.ToString()).ToArray();
this.Bcc = string.Join(";", recipients);
string[] recipients = (from id in this.EmailBccRecipientsFoundIds select id.ToString()).ToArray();
this.EmailNotificationBccRecipients = string.Join(";", recipients);
}
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationCheckEmailBccRecipientResourcesExecuteCode, "Bcc recipients count: {0}. Recipient: '{1}'.", this.FindEmailTemplate.FoundIds.Count, this.Bcc);
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationCheckEmailBccRecipientResourcesExecuteCode, "Bcc recipients count: {0}. Recipient: '{1}'. Returning: '{2}'.", this.EmailBccRecipientsFoundIds.Count, this.Bcc, this.EmailNotificationBccRecipients);
}
}
@ -725,11 +1184,11 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
try
{
this.Bcc = this.FormatRecipient(this.Bcc);
this.EmailNotificationBccRecipients = this.FormatRecipient(this.Bcc);
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationResolveEmailBccRecipientsExecuteCode, "Bcc Recipients: '{0}'.", this.Bcc);
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationResolveEmailBccRecipientsExecuteCode, "Bcc Recipients: '{0}'. Returning: '{1}'.", this.Bcc, this.EmailNotificationBccRecipients);
}
}
@ -740,7 +1199,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void PrepareSendMail_ExecuteCode(object sender, EventArgs e)
{
var traceData = new object[] { this.To, this.CC, this.Bcc, this.EmailTemplate, this.EmailTemplateGuid, this.SuppressException };
var traceData = new object[] { this.EmailNotificationToRecipients, this.EmailNotificationCcRecipients, this.EmailNotificationBccRecipients, this.EmailTemplate, this.EmailTemplateGuid, this.SuppressException };
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationPrepareSendMailExecuteCode, "To: '{0}'. CC: '{1}'. BCC: '{2}'. Email Template: '{3}'. Email Template Guid: '{4}'. Suppress Exception: '{5}'.", traceData);
@ -748,11 +1207,14 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
// we might as well do tracing as well as all binding here.
try
{
// Since we are now using replicator activity, this does not work any more and must be done via WF designer
/*
this.SendMail.To = this.To;
this.SendMail.CC = this.CC;
this.SendMail.Bcc = this.Bcc;
this.SendMail.EmailTemplate = this.EmailTemplateGuid;
this.SendMail.SuppressException = this.SuppressException;
*/
}
finally
{
@ -760,6 +1222,34 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activitie
}
}
#region Conditions
/// <summary>
/// Handles the UntilCondition event of the ForEachIteration ReplicatorActivity.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="ConditionalEventArgs"/> instance containing the event data.</param>
private void ForEachIteration_UntilCondition(object sender, ConditionalEventArgs e)
{
Logger.Instance.WriteMethodEntry(EventIdentifier.SendEmailNotificationForEachIterationUntilCondition, "Iteration: '{0}' of '{1}'. ", this.iterations, this.ForEachIteration.InitialChildData == null ? 0 : this.ForEachIteration.InitialChildData.Count);
int maxIterations = 0;
try
{
maxIterations = this.ForEachIteration.InitialChildData == null ? 0 : this.ForEachIteration.InitialChildData.Count;
if (this.iterations == maxIterations || this.breakIteration)
{
e.Result = true;
}
}
finally
{
Logger.Instance.WriteMethodExit(EventIdentifier.SendEmailNotificationForEachIterationUntilCondition, "Iteration: '{0}' of '{1}'. Condition evaluated '{2}'.", this.iterations, maxIterations, e.Result);
}
}
#endregion
#endregion
}
}

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

@ -1551,6 +1551,31 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
/// </summary>
public const int SendEmailNotificationGetEmailTemplateGuid = 12624;
/// <summary>
/// The event identifier for SendEmailNotification PrepareIterationExecuteCode events
/// </summary>
public const int SendEmailNotificationPrepareIterationExecuteCode = 12625;
/// <summary>
/// The event identifier for SendEmailNotification ForEachIterationChildInitialized events
/// </summary>
public const int SendEmailNotificationForEachIterationChildInitialized = 12626;
/// <summary>
/// The event identifier for SendEmailNotification ForEachIterationChildCompleted events
/// </summary>
public const int SendEmailNotificationForEachIterationChildCompleted = 12627;
/// <summary>
/// The event identifier for SendEmailNotification ForEachIterationUntilCondition events
/// </summary>
public const int SendEmailNotificationForEachIterationUntilCondition = 12628;
/// <summary>
/// The event identifier for SendEmailNotification PrepareMailTemplate_ExecuteCode events
/// </summary>
public const int SendEmailNotificationPrepareUpdateExecuteCode = 12629;
/// <summary>
/// The event identifier for RequestApproval Constructor events
/// </summary>

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

@ -366,7 +366,7 @@ namespace MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Common
{
try
{
paramString += Convert.ToString(parameter) + "',";
paramString += Convert.ToString(parameter, CultureInfo.InvariantCulture) + "',";
}
catch (Exception)
{