diff --git a/..svnbridge/Granfeldt.FIM.ActivityLibrary.v11.suo b/..svnbridge/Granfeldt.FIM.ActivityLibrary.v11.suo
new file mode 100644
index 0000000..81efb3c
--- /dev/null
+++ b/..svnbridge/Granfeldt.FIM.ActivityLibrary.v11.suo
@@ -0,0 +1 @@
+svn:mime-typeapplication/octet-stream
\ No newline at end of file
diff --git a/..svnbridge/Granfeldt.FIM.ActivityLibrary.v12.suo b/..svnbridge/Granfeldt.FIM.ActivityLibrary.v12.suo
new file mode 100644
index 0000000..81efb3c
--- /dev/null
+++ b/..svnbridge/Granfeldt.FIM.ActivityLibrary.v12.suo
@@ -0,0 +1 @@
+svn:mime-typeapplication/octet-stream
\ No newline at end of file
diff --git a/.vs/Granfeldt.FIM.ActivityLibrary/v14/..svnbridge/.suo b/.vs/Granfeldt.FIM.ActivityLibrary/v14/..svnbridge/.suo
new file mode 100644
index 0000000..81efb3c
--- /dev/null
+++ b/.vs/Granfeldt.FIM.ActivityLibrary/v14/..svnbridge/.suo
@@ -0,0 +1 @@
+svn:mime-typeapplication/octet-stream
\ No newline at end of file
diff --git a/.vs/Granfeldt.FIM.ActivityLibrary/v14/.suo b/.vs/Granfeldt.FIM.ActivityLibrary/v14/.suo
new file mode 100644
index 0000000..53b64d8
Binary files /dev/null and b/.vs/Granfeldt.FIM.ActivityLibrary/v14/.suo differ
diff --git a/Granfeldt.FIM.ActivityLibrary.v11.suo b/Granfeldt.FIM.ActivityLibrary.v11.suo
new file mode 100644
index 0000000..d7a02e3
Binary files /dev/null and b/Granfeldt.FIM.ActivityLibrary.v11.suo differ
diff --git a/Granfeldt.FIM.ActivityLibrary.v12.suo b/Granfeldt.FIM.ActivityLibrary.v12.suo
new file mode 100644
index 0000000..2545fa7
Binary files /dev/null and b/Granfeldt.FIM.ActivityLibrary.v12.suo differ
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberActivity.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberActivity.cs
new file mode 100644
index 0000000..ee814dc
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberActivity.cs
@@ -0,0 +1,197 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Linq;
+using System.Workflow.Activities;
+using System.Workflow.Activities.Rules;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Compiler;
+using System.Workflow.ComponentModel.Design;
+using System.Workflow.ComponentModel.Serialization;
+using System.Workflow.Runtime;
+using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
+using Microsoft.ResourceManagement.Workflow.Activities;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ public partial class BackReferenceUpdateMemberActivity : SequenceActivity
+ {
+ public BackReferenceUpdateMemberActivity()
+ {
+ InitializeComponent();
+ }
+
+ public static DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(BackReferenceUpdateMemberActivity));
+
+ [Description("Title")]
+ [Category("Title Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public string Title
+ {
+ get
+ {
+ return ((string)(base.GetValue(BackReferenceUpdateMemberActivity.TitleProperty)));
+ }
+ set
+ {
+ base.SetValue(BackReferenceUpdateMemberActivity.TitleProperty, value);
+ }
+ }
+
+ public static DependencyProperty ActionProperty = DependencyProperty.Register("Action", typeof(string), typeof(BackReferenceUpdateMemberActivity));
+ [Description("Action")]
+ [Category("Action Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public string Action
+ {
+ get
+ {
+ return ((string)(base.GetValue(BackReferenceUpdateMemberActivity.ActionProperty)));
+ }
+ set
+ {
+ base.SetValue(BackReferenceUpdateMemberActivity.ActionProperty, value);
+ }
+ }
+
+ public static DependencyProperty SourceProperty = DependencyProperty.Register("Source", typeof(string), typeof(BackReferenceUpdateMemberActivity));
+ [Description("Source")]
+ [Category("Source Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public string Source
+ {
+ get
+ {
+ return ((string)(base.GetValue(BackReferenceUpdateMemberActivity.SourceProperty)));
+ }
+ set
+ {
+ base.SetValue(BackReferenceUpdateMemberActivity.SourceProperty, value);
+ }
+ }
+
+ public static DependencyProperty DestinationProperty = DependencyProperty.Register("Destination", typeof(string), typeof(BackReferenceUpdateMemberActivity));
+ [Description("Destination")]
+ [Category("Destination Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public string Destination
+ {
+ get
+ {
+ return ((string)(base.GetValue(BackReferenceUpdateMemberActivity.DestinationProperty)));
+ }
+ set
+ {
+ base.SetValue(BackReferenceUpdateMemberActivity.DestinationProperty, value);
+ }
+ }
+
+ public List GroupToUpdate = null;
+ public Guid CurrentGroupToUpdate;
+
+ private void ForEveryAdd_Condition(object sender, ConditionalEventArgs e)
+ {
+ Debugging.Log("Enter::ForEveryAdd_Condition");
+ // if not initialized, then initialize and load value into List
+ if (GroupToUpdate == null)
+ {
+ GroupToUpdate = new List(this.GetReferenceUpdates.AddedReferences);
+ }
+
+ Debugging.Log(string.Format("Count: {0}", GroupToUpdate.Count));
+ if (GroupToUpdate.Count > 0)
+ {
+ // removed processed item
+ CurrentGroupToUpdate = GroupToUpdate[0];
+ GroupToUpdate.RemoveAt(0);
+ e.Result = true;
+ }
+ else
+ {
+ // no more items to process
+ e.Result = false;
+ }
+ Debugging.Log("Exit::ForEveryAdd_Condition");
+ }
+
+ private void PrepareGroupOperation_ExecuteCode(object sender, EventArgs e)
+ {
+ Debugging.Log("Enter::PrepareGroupOperation_ExecuteCode");
+ try
+ {
+ // since we're in a while loop, we have to grab the instantiated workflow activity UpdateResourceActivity
+ SequenceActivity currentParentSequenceActivity = (SequenceActivity)((CodeActivity)sender).Parent;
+
+ UpdateReferenceAttributesAsNeededActivity currentUpdateResourceActivity = currentParentSequenceActivity.Activities.OfType().First();
+
+ SequentialWorkflow containingWorkflow = null;
+ if (!SequentialWorkflow.TryGetContainingWorkflow(this, out containingWorkflow))
+ {
+ throw new InvalidOperationException("Could not get parent workflow!");
+ }
+
+ Debugging.Log(string.Format("Resource Id: {0}", CurrentGroupToUpdate));
+ currentUpdateResourceActivity.ActorId = WellKnownGuids.BuiltInSynchronizationAccount;
+ currentUpdateResourceActivity.ResourceId = CurrentGroupToUpdate;
+ currentUpdateResourceActivity.AttributeName = this.Destination;
+ if (this.Action.ToLower() == "add")
+ {
+ Debugging.Log(string.Format("Add member: {0}", this.GetReferenceUpdates.ResourceId.ToString()));
+ currentUpdateResourceActivity.UpdateMode = UpdateMode.Insert;
+ }
+ else
+ {
+ Debugging.Log(string.Format("Remove member: {0}", this.GetReferenceUpdates.ResourceId.ToString()));
+ currentUpdateResourceActivity.UpdateMode = UpdateMode.Remove;
+ }
+ currentUpdateResourceActivity.Values = new Guid[] { this.GetReferenceUpdates.ResourceId };
+ }
+ catch (Exception ex)
+ {
+ Debugging.Log(string.Format("Error: {0}", ex.Message));
+ }
+ Debugging.Log("Exit::PrepareGroupOperation_ExecuteCode");
+ }
+
+ private void SetupClearMV_ExecuteCode(object sender, EventArgs e)
+ {
+ Debugging.Log("Enter::SetupClearMV_ExecuteCode");
+ try
+ {
+ SequentialWorkflow containingWorkflow = null;
+ if (!SequentialWorkflow.TryGetContainingWorkflow(this, out containingWorkflow))
+ {
+ throw new InvalidOperationException("Could not get parent workflow!");
+ }
+ ClearMVOnResource.ActorId = WellKnownGuids.BuiltInSynchronizationAccount;
+ ClearMVOnResource.ResourceId = containingWorkflow.TargetId;
+ int numOfElements = this.GetReferenceUpdates.AddedReferences.ToList().Count;
+ Debugging.Log(string.Format("List count: {0}", this.GetReferenceUpdates.AddedReferences.ToList().Count));
+ Debugging.Log(string.Format("Remove elements: {0}", numOfElements));
+
+ List ps = new List();
+ foreach (Guid value in this.GetReferenceUpdates.AddedReferences.ToList())
+ {
+ Debugging.Log(string.Format("Removing: {0}", value));
+ UpdateRequestParameter p = new UpdateRequestParameter();
+ p.PropertyName = this.Source;
+ p.Mode = UpdateMode.Remove;
+ p.Value = value;
+ ps.Add(p);
+ }
+ ClearMVOnResource.UpdateParameters = ps.ToArray();
+ }
+ catch (Exception ex)
+ {
+ Debugging.Log(string.Format("Error: {0}", ex.Message));
+ }
+ Debugging.Log("Exit::SetupClearMV_ExecuteCode");
+ }
+ }
+}
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberActivity.designer.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberActivity.designer.cs
new file mode 100644
index 0000000..a560017
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberActivity.designer.cs
@@ -0,0 +1,206 @@
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Collections;
+using System.Reflection;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Design;
+using System.Workflow.ComponentModel.Compiler;
+using System.Workflow.ComponentModel.Serialization;
+using System.Workflow.Runtime;
+using System.Workflow.Activities;
+using System.Workflow.Activities.Rules;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ public partial class BackReferenceUpdateMemberActivity
+ {
+ #region Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ [System.Diagnostics.DebuggerNonUserCode]
+ [System.CodeDom.Compiler.GeneratedCode("", "")]
+ private void InitializeComponent()
+ {
+ this.CanModifyActivities = true;
+ System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();
+ System.Workflow.Activities.CodeCondition codecondition2 = new System.Workflow.Activities.CodeCondition();
+ System.Workflow.Activities.Rules.RuleConditionReference ruleconditionreference1 = new System.Workflow.Activities.Rules.RuleConditionReference();
+ System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
+ this.RemoveFromTarget = new Granfeldt.FIM.ActivityLibrary.UpdateReferenceAttributesAsNeededActivity();
+ this.PrepareGroupRemoveOperation = new System.Workflow.Activities.CodeActivity();
+ this.AddToTarget = new Granfeldt.FIM.ActivityLibrary.UpdateReferenceAttributesAsNeededActivity();
+ this.PrepareGroupAddOperation = new System.Workflow.Activities.CodeActivity();
+ this.RemoveActivity = new System.Workflow.Activities.SequenceActivity();
+ this.AddingActivity = new System.Workflow.Activities.SequenceActivity();
+ this.ForEachMemberToRemove = new System.Workflow.Activities.WhileActivity();
+ this.ForEachMemberToAdd = new System.Workflow.Activities.WhileActivity();
+ this.ClearMVOnResource = new Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity();
+ this.SetupClearMV = new System.Workflow.Activities.CodeActivity();
+ this.Remove = new System.Workflow.Activities.IfElseBranchActivity();
+ this.Add = new System.Workflow.Activities.IfElseBranchActivity();
+ this.ClearMultivalueAttribute = new System.Workflow.Activities.SequenceActivity();
+ this.ifElseActivity1 = new System.Workflow.Activities.IfElseActivity();
+ this.GetReferenceUpdates = new Granfeldt.FIM.ActivityLibrary.GetUpdatesToReferenceAttributeActivity();
+ //
+ // RemoveFromTarget
+ //
+ this.RemoveFromTarget.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.RemoveFromTarget.AttributeName = null;
+ this.RemoveFromTarget.Name = "RemoveFromTarget";
+ this.RemoveFromTarget.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.RemoveFromTarget.UpdateMode = Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateMode.Modify;
+ this.RemoveFromTarget.Values = null;
+ //
+ // PrepareGroupRemoveOperation
+ //
+ this.PrepareGroupRemoveOperation.Name = "PrepareGroupRemoveOperation";
+ this.PrepareGroupRemoveOperation.ExecuteCode += new System.EventHandler(this.PrepareGroupOperation_ExecuteCode);
+ //
+ // AddToTarget
+ //
+ this.AddToTarget.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.AddToTarget.AttributeName = null;
+ this.AddToTarget.Name = "AddToTarget";
+ this.AddToTarget.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.AddToTarget.UpdateMode = Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateMode.Modify;
+ this.AddToTarget.Values = null;
+ //
+ // PrepareGroupAddOperation
+ //
+ this.PrepareGroupAddOperation.Name = "PrepareGroupAddOperation";
+ this.PrepareGroupAddOperation.ExecuteCode += new System.EventHandler(this.PrepareGroupOperation_ExecuteCode);
+ //
+ // RemoveActivity
+ //
+ this.RemoveActivity.Activities.Add(this.PrepareGroupRemoveOperation);
+ this.RemoveActivity.Activities.Add(this.RemoveFromTarget);
+ this.RemoveActivity.Name = "RemoveActivity";
+ //
+ // AddingActivity
+ //
+ this.AddingActivity.Activities.Add(this.PrepareGroupAddOperation);
+ this.AddingActivity.Activities.Add(this.AddToTarget);
+ this.AddingActivity.Name = "AddingActivity";
+ //
+ // ForEachMemberToRemove
+ //
+ this.ForEachMemberToRemove.Activities.Add(this.RemoveActivity);
+ codecondition1.Condition += new System.EventHandler(this.ForEveryAdd_Condition);
+ this.ForEachMemberToRemove.Condition = codecondition1;
+ this.ForEachMemberToRemove.Name = "ForEachMemberToRemove";
+ //
+ // ForEachMemberToAdd
+ //
+ this.ForEachMemberToAdd.Activities.Add(this.AddingActivity);
+ codecondition2.Condition += new System.EventHandler(this.ForEveryAdd_Condition);
+ this.ForEachMemberToAdd.Condition = codecondition2;
+ this.ForEachMemberToAdd.Name = "ForEachMemberToAdd";
+ //
+ // ClearMVOnResource
+ //
+ this.ClearMVOnResource.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.ClearMVOnResource.Name = "ClearMVOnResource";
+ this.ClearMVOnResource.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.ClearMVOnResource.UpdateParameters = null;
+ //
+ // SetupClearMV
+ //
+ this.SetupClearMV.Name = "SetupClearMV";
+ this.SetupClearMV.ExecuteCode += new System.EventHandler(this.SetupClearMV_ExecuteCode);
+ //
+ // Remove
+ //
+ this.Remove.Activities.Add(this.ForEachMemberToRemove);
+ this.Remove.Name = "Remove";
+ //
+ // Add
+ //
+ this.Add.Activities.Add(this.ForEachMemberToAdd);
+ ruleconditionreference1.ConditionName = "Condition1";
+ this.Add.Condition = ruleconditionreference1;
+ this.Add.Name = "Add";
+ //
+ // ClearMultivalueAttribute
+ //
+ this.ClearMultivalueAttribute.Activities.Add(this.SetupClearMV);
+ this.ClearMultivalueAttribute.Activities.Add(this.ClearMVOnResource);
+ this.ClearMultivalueAttribute.Name = "ClearMultivalueAttribute";
+ //
+ // ifElseActivity1
+ //
+ this.ifElseActivity1.Activities.Add(this.Add);
+ this.ifElseActivity1.Activities.Add(this.Remove);
+ this.ifElseActivity1.Name = "ifElseActivity1";
+ //
+ // GetReferenceUpdates
+ //
+ this.GetReferenceUpdates.AddedReferences = null;
+ activitybind1.Name = "BackReferenceUpdateMemberActivity";
+ activitybind1.Path = "Source";
+ this.GetReferenceUpdates.ModifiedReferences = null;
+ this.GetReferenceUpdates.Name = "GetReferenceUpdates";
+ this.GetReferenceUpdates.OperationType = Microsoft.ResourceManagement.WebServices.WSResourceManagement.OperationType.Create;
+ this.GetReferenceUpdates.RemovedReferences = null;
+ this.GetReferenceUpdates.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.GetReferenceUpdates.SetBinding(Granfeldt.FIM.ActivityLibrary.GetUpdatesToReferenceAttributeActivity.AttributeNameProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
+ //
+ // BackReferenceUpdateMemberActivity
+ //
+ this.Activities.Add(this.GetReferenceUpdates);
+ this.Activities.Add(this.ifElseActivity1);
+ this.Activities.Add(this.ClearMultivalueAttribute);
+ this.Name = "BackReferenceUpdateMemberActivity";
+ this.CanModifyActivities = false;
+
+ }
+
+ #endregion
+
+ private CodeActivity SetupClearMV;
+
+ private SequenceActivity ClearMultivalueAttribute;
+
+ private Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity ClearMVOnResource;
+
+ private IfElseBranchActivity Remove;
+
+ private IfElseBranchActivity Add;
+
+ private IfElseActivity ifElseActivity1;
+
+ private UpdateReferenceAttributesAsNeededActivity RemoveFromTarget;
+
+ private CodeActivity PrepareGroupRemoveOperation;
+
+ private SequenceActivity RemoveActivity;
+
+ private WhileActivity ForEachMemberToRemove;
+
+ private UpdateReferenceAttributesAsNeededActivity AddToTarget;
+
+ private CodeActivity PrepareGroupAddOperation;
+
+ private SequenceActivity AddingActivity;
+
+ private WhileActivity ForEachMemberToAdd;
+
+ private GetUpdatesToReferenceAttributeActivity GetReferenceUpdates;
+
+
+
+
+
+
+
+
+
+
+
+
+
+ }
+}
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberActivity.rules b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberActivity.rules
new file mode 100644
index 0000000..9b9296b
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberActivity.rules
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+ add
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberSettingsPart.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberSettingsPart.cs
new file mode 100644
index 0000000..300b2f0
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/BackReferenceUpdateMemberSettingsPart.cs
@@ -0,0 +1,197 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.Workflow.ComponentModel;
+using Microsoft.IdentityManagement.WebUI.Controls;
+using Microsoft.ResourceManagement.Workflow.Activities;
+
+namespace Granfeldt.FIM.ActivityLibrary.WebUIs
+{
+ class BackReferenceUpdateMemberActivitySettingsPart : ActivitySettingsPart
+ {
+
+ ///
+ /// Creates a Table that contains the controls used by the activity UI
+ /// in the Workflow Designer of the FIM portal. Adds that Table to the
+ /// collection of Controls that defines each activity that can be selected
+ /// in the Workflow Designer of the FIM Portal. Calls the base class of
+ /// ActivitySettingsPart to render the controls in the UI.
+ ///
+ protected override void CreateChildControls()
+ {
+ Table controlLayoutTable;
+ controlLayoutTable = new Table();
+
+ //Width is set to 100% of the control size
+ controlLayoutTable.Width = Unit.Percentage(100.0);
+ controlLayoutTable.BorderWidth = 0;
+ controlLayoutTable.CellPadding = 2;
+ //Add a TableRow for each textbox in the UI
+ controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Title:", "txtTitle", 400, 100, false, ""));
+ controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Source reference attribute:", "txtSource", 400, 100, false, ""));
+ controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Destination attribute:", "txtDestination", 400, 100, false, ""));
+ controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Action (type 'add' or 'remove'):", "txtAction", 400, 100, false, ""));
+ this.Controls.Add(controlLayoutTable);
+
+ base.CreateChildControls();
+ }
+
+ #region Utility Functions
+
+ //Create a TableRow that contains a label and a textbox.
+ private TableRow AddTableRowTextBox(String labelText, String controlID, int width, int maxLength, Boolean multiLine, String defaultValue)
+ {
+ TableRow row = new TableRow();
+ TableCell labelCell = new TableCell();
+ TableCell controlCell = new TableCell();
+ Label oLabel = new Label();
+ TextBox oText = new TextBox();
+
+ oLabel.Text = labelText;
+ oLabel.CssClass = base.LabelCssClass;
+ labelCell.Controls.Add(oLabel);
+ oText.ID = controlID;
+ oText.CssClass = base.TextBoxCssClass;
+ oText.Text = defaultValue;
+ oText.MaxLength = maxLength;
+ oText.Width = width;
+ if (multiLine)
+ {
+ oText.TextMode = TextBoxMode.MultiLine;
+ oText.Rows = System.Math.Min(6, (maxLength + 60) / 60);
+ oText.Wrap = true;
+ }
+ controlCell.Controls.Add(oText);
+ row.Cells.Add(labelCell);
+ row.Cells.Add(controlCell);
+ return row;
+ }
+
+ string GetText(string textBoxID)
+ {
+ TextBox textBox = (TextBox)this.FindControl(textBoxID);
+ return textBox.Text ?? String.Empty;
+ }
+ void SetText(string textBoxID, string text)
+ {
+ TextBox textBox = (TextBox)this.FindControl(textBoxID);
+ if (textBox != null)
+ textBox.Text = text;
+ else
+ textBox.Text = "";
+ }
+
+ //Set the text box to read mode or read/write mode
+ void SetTextBoxReadOnlyOption(string textBoxID, bool readOnly)
+ {
+ TextBox textBox = (TextBox)this.FindControl(textBoxID);
+ textBox.ReadOnly = readOnly;
+ }
+ #endregion
+
+ ///
+ /// Called when a user clicks the Save button in the Workflow Designer.
+ /// Returns an instance of the RequestLoggingActivity class that
+ /// has its properties set to the values entered into the text box controls
+ /// used in the UI of the activity.
+ ///
+ public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow)
+ {
+ if (!this.ValidateInputs())
+ {
+ return null;
+ }
+ BackReferenceUpdateMemberActivity ThisActivity = new BackReferenceUpdateMemberActivity();
+ ThisActivity.Title = this.GetText("txtTitle");
+ ThisActivity.Source = this.GetText("txtSource");
+ ThisActivity.Destination = this.GetText("txtDestination");
+ ThisActivity.Action = this.GetText("txtAction");
+ return ThisActivity;
+ }
+
+ public override void LoadActivitySettings(Activity activity)
+ {
+ BackReferenceUpdateMemberActivity ThisActivity = activity as BackReferenceUpdateMemberActivity;
+ if (ThisActivity != null)
+ {
+ this.SetText("txtTitle", ThisActivity.Title);
+ this.SetText("txtSource", ThisActivity.Source);
+ this.SetText("txtDestination", ThisActivity.Destination);
+ this.SetText("txtAction", ThisActivity.Action);
+ }
+ }
+
+ ///
+ /// Saves the activity settings.
+ ///
+ public override ActivitySettingsPartData PersistSettings()
+ {
+ ActivitySettingsPartData data = new ActivitySettingsPartData();
+ data["Title"] = this.GetText("txtTitle");
+ data["Source"] = this.GetText("txtSource");
+ data["Attribute"] = this.GetText("txtDestination");
+ data["Action"] = this.GetText("txtAction");
+ return data;
+ }
+
+ ///
+ /// Restores the activity settings in the UI
+ ///
+ public override void RestoreSettings(ActivitySettingsPartData data)
+ {
+ if (null != data)
+ {
+ this.SetText("txtTitle", (string)data["Title"]);
+ this.SetText("txtSource", (string)data["Source"]);
+ this.SetText("txtDestination", (string)data["Attribute"]);
+ this.SetText("txtAction", (string)data["Action"]);
+ }
+ }
+
+ ///
+ /// Switches the activity between read only and read/write mode
+ ///
+ public override void SwitchMode(ActivitySettingsPartMode mode)
+ {
+ bool readOnly = (mode == ActivitySettingsPartMode.View);
+ this.SetTextBoxReadOnlyOption("txtTitle", readOnly);
+ this.SetTextBoxReadOnlyOption("txtDestination", readOnly);
+ this.SetTextBoxReadOnlyOption("txtSource", readOnly);
+ this.SetTextBoxReadOnlyOption("txtAction", readOnly);
+ }
+
+ ///
+ /// Returns the activity name.
+ ///
+ public override string Title
+ {
+ get
+ {
+ return string.Format("Add Remove Value: {0}", this.GetText("txtTitle"));
+ }
+ }
+
+ ///
+ /// In general, this method should be used to validate information entered
+ /// by the user when the activity is added to a workflow in the Workflow
+ /// Designer.
+ /// We could add code to verify that the log file path already exists on
+ /// the server that is hosting the FIM Portal and check that the activity
+ /// has permission to write to that location. However, the code
+ /// would only check if the log file path exists when the
+ /// activity is added to a workflow in the workflow designer. This class
+ /// will not be used when the activity is actually run.
+ /// For this activity we will just return true.
+ ///
+ public override bool ValidateInputs()
+ {
+ return true;
+ }
+
+ }
+
+
+}
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetReferenceValuesFromObjectActivity.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetReferenceValuesFromObjectActivity.cs
new file mode 100644
index 0000000..eb84ca1
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetReferenceValuesFromObjectActivity.cs
@@ -0,0 +1,147 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Linq;
+using System.Workflow.Activities;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Design;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ [Designer(typeof(ActivityDesigner), typeof(IDesigner))]
+ public partial class GetReferenceValuesFromObjectActivity: SequenceActivity
+ {
+ #region Properties
+
+
+ public static DependencyProperty ObjectIDProperty = DependencyProperty.Register("ObjectID", typeof(Guid), typeof(GetReferenceValuesFromObjectActivity));
+
+ [Description("ObjectID")]
+ [Category("Input")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public Guid ObjectID
+ {
+ get
+ {
+ return ((Guid)(base.GetValue(GetReferenceValuesFromObjectActivity.ObjectIDProperty)));
+ }
+ set
+ {
+ base.SetValue(GetReferenceValuesFromObjectActivity.ObjectIDProperty, value);
+ }
+ }
+
+ public static DependencyProperty AttributeNameProperty = DependencyProperty.Register("AttributeName", typeof(String), typeof(GetReferenceValuesFromObjectActivity));
+
+ [Description("AttributeName")]
+ [Category("Input")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public String AttributeName
+ {
+ get
+ {
+ return ((String)(base.GetValue(GetReferenceValuesFromObjectActivity.AttributeNameProperty)));
+ }
+ set
+ {
+ base.SetValue(GetReferenceValuesFromObjectActivity.AttributeNameProperty, value);
+ }
+ }
+
+ public static DependencyProperty ActorIdProperty = DependencyProperty.Register("ActorId", typeof(Guid), typeof(GetReferenceValuesFromObjectActivity));
+
+ [Description("ActorId")]
+ [Category("Input")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public Guid ActorId
+ {
+ get
+ {
+ return ((Guid)(base.GetValue(GetReferenceValuesFromObjectActivity.ActorIdProperty)));
+ }
+ set
+ {
+ base.SetValue(GetReferenceValuesFromObjectActivity.ActorIdProperty, value);
+ }
+ }
+
+ public static DependencyProperty CurrentValuesProperty = DependencyProperty.Register("CurrentValues", typeof(Guid[]), typeof(GetReferenceValuesFromObjectActivity));
+
+ [Description("CurrentValues")]
+ [Category("Output")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public Guid[] CurrentValues
+ {
+ get
+ {
+ return ((Guid[])(base.GetValue(GetReferenceValuesFromObjectActivity.CurrentValuesProperty)));
+ }
+ set
+ {
+ base.SetValue(GetReferenceValuesFromObjectActivity.CurrentValuesProperty, value);
+ }
+ }
+
+ #endregion
+
+ public GetReferenceValuesFromObjectActivity()
+ {
+ InitializeComponent();
+ }
+
+ public String[] SelectionAttributes = default(System.String[]);
+ public Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType CurrentResource = new Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType();
+
+ private void PrepareReading_ExecuteCode(object sender, EventArgs e)
+ {
+ this.SelectionAttributes = new string[] {this.AttributeName};
+ }
+
+ private void ProcessResults_ExecuteCode(object sender, EventArgs e)
+ {
+ object PropertyValue = this.CurrentResource[this.AttributeName];
+ List currentValues = new List();
+
+ if (null != PropertyValue)
+ {
+ if (PropertyValue.GetType().FullName.StartsWith("System.Collections.Generic.List") ||
+ PropertyValue.GetType().FullName.EndsWith("[]"))
+ {
+ foreach (object myObject in (IEnumerable) PropertyValue)
+ {
+ if (myObject is Microsoft.ResourceManagement.WebServices.UniqueIdentifier)
+ {
+ currentValues.Add(
+ ((Microsoft.ResourceManagement.WebServices.UniqueIdentifier) myObject).GetGuid());
+ }
+ if (myObject is System.Guid)
+ {
+ currentValues.Add((System.Guid) myObject);
+ }
+
+ }
+ }
+ else
+ {
+ if (PropertyValue is Microsoft.ResourceManagement.WebServices.UniqueIdentifier)
+ {
+ currentValues.Add(
+ ((Microsoft.ResourceManagement.WebServices.UniqueIdentifier) PropertyValue).GetGuid());
+ }
+ if (PropertyValue is System.Guid)
+ {
+ currentValues.Add((System.Guid) PropertyValue);
+ }
+ }
+ }
+
+ this.CurrentValues = currentValues.Distinct().ToArray();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetReferenceValuesFromObjectActivity.designer.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetReferenceValuesFromObjectActivity.designer.cs
new file mode 100644
index 0000000..4a043b7
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetReferenceValuesFromObjectActivity.designer.cs
@@ -0,0 +1,75 @@
+using System.Workflow.Activities;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ public partial class GetReferenceValuesFromObjectActivity
+ {
+ #region Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ [System.Diagnostics.DebuggerNonUserCode]
+ private void InitializeComponent()
+ {
+ this.CanModifyActivities = true;
+ System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
+ 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();
+ this.ProcessResults = new System.Workflow.Activities.CodeActivity();
+ this.ReadResource = new Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity();
+ this.PrepareReading = new System.Workflow.Activities.CodeActivity();
+ //
+ // ProcessResults
+ //
+ this.ProcessResults.Name = "ProcessResults";
+ this.ProcessResults.ExecuteCode += new System.EventHandler(this.ProcessResults_ExecuteCode);
+ //
+ // ReadResource
+ //
+ activitybind1.Name = "GetReferenceValuesFromObjectActivity";
+ activitybind1.Path = "ActorId";
+ this.ReadResource.Name = "ReadResource";
+ activitybind2.Name = "GetReferenceValuesFromObjectActivity";
+ activitybind2.Path = "CurrentResource";
+ activitybind3.Name = "GetReferenceValuesFromObjectActivity";
+ activitybind3.Path = "ObjectID";
+ activitybind4.Name = "GetReferenceValuesFromObjectActivity";
+ activitybind4.Path = "SelectionAttributes";
+ this.ReadResource.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity.ActorIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
+ this.ReadResource.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity.ResourceIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));
+ //this.ReadResource.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity.SelectionAttributesProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind4)));
+ this.ReadResource.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity.ResourceProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
+ //
+ // PrepareReading
+ //
+ this.PrepareReading.Name = "PrepareReading";
+ this.PrepareReading.ExecuteCode += new System.EventHandler(this.PrepareReading_ExecuteCode);
+ //
+ // GetReferenceValuesFromObjectActivity
+ //
+ this.Activities.Add(this.PrepareReading);
+ this.Activities.Add(this.ReadResource);
+ this.Activities.Add(this.ProcessResults);
+ this.Name = "GetReferenceValuesFromObjectActivity";
+ this.CanModifyActivities = false;
+
+ }
+
+ #endregion
+
+ private CodeActivity PrepareReading;
+ private CodeActivity ProcessResults;
+ private Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity ReadResource;
+
+
+
+
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetUpdatesToReferenceAttributeActivity.Designer.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetUpdatesToReferenceAttributeActivity.Designer.cs
new file mode 100644
index 0000000..83a9cc1
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetUpdatesToReferenceAttributeActivity.Designer.cs
@@ -0,0 +1,48 @@
+using System.Workflow.Activities;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ public partial class GetUpdatesToReferenceAttributeActivity
+ {
+ #region Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ [System.Diagnostics.DebuggerNonUserCode]
+ private void InitializeComponent()
+ {
+ this.CanModifyActivities = true;
+ System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
+ this.ExtractDataFromRequest = new System.Workflow.Activities.CodeActivity();
+ this.GetCurrentRequest = new Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity();
+ //
+ // ExtractDataFromRequest
+ //
+ this.ExtractDataFromRequest.Name = "ExtractDataFromRequest";
+ this.ExtractDataFromRequest.ExecuteCode += new System.EventHandler(this.ExtractDataFromRequest_ExecuteCode);
+ //
+ // GetCurrentRequest
+ //
+ activitybind1.Name = "GetUpdatesToReferenceAttributeActivity";
+ activitybind1.Path = "CurrentRequest";
+ this.GetCurrentRequest.Name = "GetCurrentRequest";
+ this.GetCurrentRequest.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity.CurrentRequestProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
+ //
+ // GetUpdatesToReferenceAttributeActivity
+ //
+ this.Activities.Add(this.GetCurrentRequest);
+ this.Activities.Add(this.ExtractDataFromRequest);
+ this.Name = "GetUpdatesToReferenceAttributeActivity";
+ this.CanModifyActivities = false;
+
+ }
+
+ #endregion
+
+ private CodeActivity ExtractDataFromRequest;
+ private Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity GetCurrentRequest;
+
+ }
+}
\ No newline at end of file
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetUpdatesToReferenceAttributeActivity.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetUpdatesToReferenceAttributeActivity.cs
new file mode 100644
index 0000000..ffd6c5d
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/GetUpdatesToReferenceAttributeActivity.cs
@@ -0,0 +1,289 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Linq;
+using System.Workflow.Activities;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Design;
+using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ [Designer(typeof(ActivityDesigner), typeof(IDesigner))]
+ public partial class GetUpdatesToReferenceAttributeActivity : SequenceActivity
+ {
+
+ #region Properties
+ public static DependencyProperty AddedReferencesProperty = DependencyProperty.Register("AddedReferences", typeof(Guid[]), typeof(GetUpdatesToReferenceAttributeActivity));
+
+ [Description("AddedReferences")]
+ [Category("Output")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public Guid[] AddedReferences
+ {
+ get
+ {
+ return ((Guid[])(base.GetValue(GetUpdatesToReferenceAttributeActivity.AddedReferencesProperty)));
+ }
+ set
+ {
+ base.SetValue(GetUpdatesToReferenceAttributeActivity.AddedReferencesProperty, value);
+ }
+ }
+
+ public static DependencyProperty ModifiedReferencesProperty = DependencyProperty.Register("ModifiedReferences", typeof(Guid[]), typeof(GetUpdatesToReferenceAttributeActivity));
+
+ [DescriptionAttribute("ModifiedReferences")]
+ [CategoryAttribute("Output")]
+ [BrowsableAttribute(true)]
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
+ public Guid[] ModifiedReferences
+ {
+ get
+ {
+ return ((Guid[])(base.GetValue(GetUpdatesToReferenceAttributeActivity.ModifiedReferencesProperty)));
+ }
+ set
+ {
+ base.SetValue(GetUpdatesToReferenceAttributeActivity.ModifiedReferencesProperty, value);
+ }
+ }
+
+ public static DependencyProperty RemovedReferencesProperty = DependencyProperty.Register("RemovedReferences", typeof(Guid[]), typeof(GetUpdatesToReferenceAttributeActivity));
+
+ public static DependencyProperty ResourceIdProperty = DependencyProperty.Register("ResourceId", typeof(Guid), typeof(GetUpdatesToReferenceAttributeActivity));
+
+ [Description("ResourceId")]
+ [Category("Output")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public Guid ResourceId
+ {
+ get
+ {
+ return ((Guid)(base.GetValue(GetUpdatesToReferenceAttributeActivity.ResourceIdProperty)));
+ }
+ set
+ {
+ base.SetValue(GetUpdatesToReferenceAttributeActivity.ResourceIdProperty, value);
+ }
+ }
+
+ [Description("RemovedReferences")]
+ [Category("Output")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public Guid[] RemovedReferences
+ {
+ get
+ {
+ return ((Guid[])(base.GetValue(GetUpdatesToReferenceAttributeActivity.RemovedReferencesProperty)));
+ }
+ set
+ {
+ base.SetValue(GetUpdatesToReferenceAttributeActivity.RemovedReferencesProperty, value);
+ }
+ }
+
+ public static DependencyProperty AttributeNameProperty = DependencyProperty.Register("AttributeName", typeof(string), typeof(GetUpdatesToReferenceAttributeActivity));
+
+ [Description("AttributeName")]
+ [Category("Input")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public string AttributeName
+ {
+ get
+ {
+ return ((string)(base.GetValue(GetUpdatesToReferenceAttributeActivity.AttributeNameProperty)));
+ }
+ set
+ {
+ base.SetValue(GetUpdatesToReferenceAttributeActivity.AttributeNameProperty, value);
+ }
+ }
+
+ public static DependencyProperty OperationTypeProperty = DependencyProperty.Register("OperationType", typeof(OperationType), typeof(GetUpdatesToReferenceAttributeActivity));
+
+ [Description("OperationType")]
+ [Category("Output")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public OperationType OperationType
+ {
+ get
+ {
+ return ((OperationType)(base.GetValue(GetUpdatesToReferenceAttributeActivity.OperationTypeProperty)));
+ }
+ set
+ {
+ base.SetValue(GetUpdatesToReferenceAttributeActivity.OperationTypeProperty, value);
+ }
+ }
+
+ #endregion
+
+ public GetUpdatesToReferenceAttributeActivity()
+ {
+ InitializeComponent();
+ }
+
+ public Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType CurrentRequest = null;
+
+ private void ExtractDataFromRequest_ExecuteCode(object sender, EventArgs e)
+ {
+ this.ResourceId = this.CurrentRequest.Target.GetGuid();
+ this.OperationType = this.CurrentRequest.Operation;
+ List toAdd = new List();
+ List toRemove = new List();
+ List toModify = new List();
+
+ if (this.CurrentRequest.Operation == OperationType.Create)
+ {
+ ReadOnlyCollection myParameters =
+ this.CurrentRequest.ParseParameters();
+
+ foreach (CreateRequestParameter myParameter in myParameters)
+ {
+ if (String.Equals(this.AttributeName, myParameter.PropertyName,
+ StringComparison.InvariantCultureIgnoreCase))
+ {
+ if (myParameter.Value.GetType().FullName.StartsWith("System.Collections.Generic.List") ||
+ myParameter.Value.GetType().FullName.EndsWith("[]"))
+ {
+ foreach (object myObject in (IEnumerable)myParameter.Value)
+ {
+
+ if (myObject is Microsoft.ResourceManagement.WebServices.UniqueIdentifier)
+ toAdd.Add(
+ ((Microsoft.ResourceManagement.WebServices.UniqueIdentifier)myObject).GetGuid());
+ if (myObject is System.Guid)
+ toAdd.Add((System.Guid)myObject);
+ }
+ }
+ else
+ {
+ if (myParameter.Value is Microsoft.ResourceManagement.WebServices.UniqueIdentifier)
+ toAdd.Add(
+ ((Microsoft.ResourceManagement.WebServices.UniqueIdentifier)myParameter.Value).
+ GetGuid());
+ if (myParameter.Value is System.Guid)
+ toAdd.Add((System.Guid)myParameter.Value);
+ }
+ }
+ }
+ }
+
+ if (this.CurrentRequest.Operation == OperationType.Put)
+ {
+ ReadOnlyCollection myParameters =
+ this.CurrentRequest.ParseParameters();
+
+ foreach (UpdateRequestParameter myParameter in myParameters)
+ {
+ if (myParameter.Mode == UpdateMode.Insert)
+ {
+ if (String.Equals(this.AttributeName, myParameter.PropertyName,
+ StringComparison.InvariantCultureIgnoreCase))
+ {
+ if (myParameter.Value.GetType().FullName.StartsWith("System.Collections.Generic.List") ||
+ myParameter.Value.GetType().FullName.EndsWith("[]"))
+ {
+ foreach (object myObject in (IEnumerable)myParameter.Value)
+ {
+ if (myObject is Microsoft.ResourceManagement.WebServices.UniqueIdentifier)
+ toAdd.Add(
+ ((Microsoft.ResourceManagement.WebServices.UniqueIdentifier)myObject).
+ GetGuid());
+ if (myObject is System.Guid)
+ toAdd.Add((System.Guid)myObject);
+ }
+ }
+ else
+ {
+ if (myParameter.Value is Microsoft.ResourceManagement.WebServices.UniqueIdentifier)
+ toAdd.Add(
+ ((Microsoft.ResourceManagement.WebServices.UniqueIdentifier)myParameter.Value).
+ GetGuid());
+ if (myParameter.Value is System.Guid)
+ toAdd.Add((System.Guid)myParameter.Value);
+ }
+ }
+ }
+
+ if (myParameter.Mode == UpdateMode.Modify)
+ {
+ if (String.Equals(this.AttributeName, myParameter.PropertyName,
+ StringComparison.InvariantCultureIgnoreCase))
+ {
+ // Actually never going to happen, but who knows ?
+ if (myParameter.Value.GetType().FullName.StartsWith("System.Collections.Generic.List") ||
+ myParameter.Value.GetType().FullName.EndsWith("[]"))
+ {
+ foreach (object myObject in (IEnumerable)myParameter.Value)
+ {
+
+ if (myObject is Microsoft.ResourceManagement.WebServices.UniqueIdentifier)
+ toModify.Add(
+ ((Microsoft.ResourceManagement.WebServices.UniqueIdentifier)myObject).
+ GetGuid());
+ if (myObject is System.Guid)
+ toModify.Add((System.Guid)myObject);
+ }
+ }
+ else
+ {
+ if (myParameter.Value is Microsoft.ResourceManagement.WebServices.UniqueIdentifier)
+ toModify.Add(
+ ((Microsoft.ResourceManagement.WebServices.UniqueIdentifier)myParameter.Value).
+ GetGuid());
+ if (myParameter.Value is System.Guid)
+ toModify.Add((System.Guid)myParameter.Value);
+ }
+ }
+ }
+
+
+ if (myParameter.Mode == UpdateMode.Remove)
+ {
+ if (String.Equals(this.AttributeName, myParameter.PropertyName,
+ StringComparison.InvariantCultureIgnoreCase))
+ {
+ if (myParameter.Value.GetType().FullName.StartsWith("System.Collections.Generic.List") ||
+ myParameter.Value.GetType().FullName.EndsWith("[]"))
+ {
+ foreach (object myObject in (IEnumerable)myParameter.Value)
+ {
+
+ if (myObject is Microsoft.ResourceManagement.WebServices.UniqueIdentifier)
+ toRemove.Add(
+ ((Microsoft.ResourceManagement.WebServices.UniqueIdentifier)myObject).
+ GetGuid());
+ if (myObject is System.Guid)
+ toRemove.Add((System.Guid)myObject);
+ }
+ }
+ else
+ {
+ if (myParameter.Value is Microsoft.ResourceManagement.WebServices.UniqueIdentifier)
+ toRemove.Add(
+ ((Microsoft.ResourceManagement.WebServices.UniqueIdentifier)myParameter.Value).
+ GetGuid());
+ if (myParameter.Value is System.Guid)
+ toRemove.Add((System.Guid)myParameter.Value);
+ }
+ }
+ }
+
+ }
+ }
+ this.AddedReferences=toAdd.Distinct().ToArray();
+ this.RemovedReferences=toRemove.Distinct().ToArray();
+ this.ModifiedReferences = toModify.Distinct().ToArray();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributeActivity.Designer.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributeActivity.Designer.cs
new file mode 100644
index 0000000..9305d43
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributeActivity.Designer.cs
@@ -0,0 +1,90 @@
+using System.Workflow.Activities;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ public partial class UpdateReferenceAttributeActivity
+ {
+ #region Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ [System.Diagnostics.DebuggerNonUserCode]
+ private void InitializeComponent()
+ {
+ this.CanModifyActivities = true;
+ System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
+ System.Workflow.ComponentModel.ActivityBind activitybind2 = new System.Workflow.ComponentModel.ActivityBind();
+ System.Workflow.ComponentModel.ActivityBind activitybind3 = new System.Workflow.ComponentModel.ActivityBind();
+ System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();
+ this.UpdateResource = new Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity();
+ this.PrepareUpdate = new System.Workflow.Activities.CodeActivity();
+ this.ValuesAreNotPresent = new System.Workflow.Activities.IfElseBranchActivity();
+ this.ValuesPresent = new System.Workflow.Activities.IfElseBranchActivity();
+ this.CheckIfAnyValuesPresent = new System.Workflow.Activities.IfElseActivity();
+ //
+ // UpdateResource
+ //
+ activitybind1.Name = "UpdateReferenceAttributeActivity";
+ activitybind1.Path = "ActorId";
+ this.UpdateResource.Name = "UpdateResource";
+ activitybind2.Name = "UpdateReferenceAttributeActivity";
+ activitybind2.Path = "ResourceId";
+ activitybind3.Name = "UpdateReferenceAttributeActivity";
+ activitybind3.Path = "UpdateParameters";
+ this.UpdateResource.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity.ActorIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
+ this.UpdateResource.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity.ResourceIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
+ this.UpdateResource.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity.UpdateParametersProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));
+ //
+ // PrepareUpdate
+ //
+ this.PrepareUpdate.Name = "PrepareUpdate";
+ this.PrepareUpdate.ExecuteCode += new System.EventHandler(this.PrepareUpdate_ExecuteCode);
+ //
+ // ValuesAreNotPresent
+ //
+ this.ValuesAreNotPresent.Name = "ValuesAreNotPresent";
+ //
+ // ValuesPresent
+ //
+ this.ValuesPresent.Activities.Add(this.PrepareUpdate);
+ this.ValuesPresent.Activities.Add(this.UpdateResource);
+ codecondition1.Condition += new System.EventHandler(this.AreValuesPresent);
+ this.ValuesPresent.Condition = codecondition1;
+ this.ValuesPresent.Name = "ValuesPresent";
+ //
+ // CheckIfAnyValuesPresent
+ //
+ this.CheckIfAnyValuesPresent.Activities.Add(this.ValuesPresent);
+ this.CheckIfAnyValuesPresent.Activities.Add(this.ValuesAreNotPresent);
+ this.CheckIfAnyValuesPresent.Name = "CheckIfAnyValuesPresent";
+ //
+ // UpdateReferenceAttributeActivity
+ //
+ this.Activities.Add(this.CheckIfAnyValuesPresent);
+ this.Name = "UpdateReferenceAttributeActivity";
+ this.CanModifyActivities = false;
+
+ }
+
+ #endregion
+
+ private IfElseBranchActivity ValuesAreNotPresent;
+ private IfElseBranchActivity ValuesPresent;
+ private IfElseActivity CheckIfAnyValuesPresent;
+ private CodeActivity PrepareUpdate;
+ private Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity UpdateResource;
+
+
+
+
+
+
+
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributeActivity.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributeActivity.cs
new file mode 100644
index 0000000..513527d
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributeActivity.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Workflow.Activities;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Design;
+using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ [Designer(typeof(ActivityDesigner), typeof(IDesigner))]
+ public partial class UpdateReferenceAttributeActivity : SequenceActivity
+ {
+ #region Properties
+ public static DependencyProperty ActorIdProperty = DependencyProperty.Register("ActorId", typeof(Guid), typeof(UpdateReferenceAttributeActivity));
+
+ [Description("ActorId")]
+ [Category("ActorId Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public Guid ActorId
+ {
+ get
+ {
+ return ((Guid)(base.GetValue(UpdateReferenceAttributeActivity.ActorIdProperty)));
+ }
+ set
+ {
+ base.SetValue(UpdateReferenceAttributeActivity.ActorIdProperty, value);
+ }
+ }
+
+ public static DependencyProperty ResourceIdProperty = DependencyProperty.Register("ResourceId", typeof(Guid), typeof(UpdateReferenceAttributeActivity));
+
+ [Description("ResourceId")]
+ [Category("ResourceId Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public Guid ResourceId
+ {
+ get
+ {
+ return ((Guid)(base.GetValue(UpdateReferenceAttributeActivity.ResourceIdProperty)));
+ }
+ set
+ {
+ base.SetValue(UpdateReferenceAttributeActivity.ResourceIdProperty, value);
+ }
+ }
+
+ public static DependencyProperty ValuesProperty = DependencyProperty.Register("Values", typeof(Guid[]), typeof(UpdateReferenceAttributeActivity));
+
+ public static DependencyProperty AttributeNameProperty = DependencyProperty.Register("AttributeName", typeof(string), typeof(UpdateReferenceAttributeActivity));
+
+ [Description("AttributeName")]
+ [Category("AttributeName Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public string AttributeName
+ {
+ get
+ {
+ return ((string)(base.GetValue(UpdateReferenceAttributeActivity.AttributeNameProperty)));
+ }
+ set
+ {
+ base.SetValue(UpdateReferenceAttributeActivity.AttributeNameProperty, value);
+ }
+ }
+
+ [Description("Values")]
+ [Category("Values Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public Guid[] Values
+ {
+ get
+ {
+ return ((Guid[])(base.GetValue(UpdateReferenceAttributeActivity.ValuesProperty)));
+ }
+ set
+ {
+ base.SetValue(UpdateReferenceAttributeActivity.ValuesProperty, value);
+ }
+ }
+
+ public static DependencyProperty UpdateModeProperty = DependencyProperty.Register("UpdateMode", typeof(Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateMode), typeof(UpdateReferenceAttributeActivity));
+
+ [Description("UpdateMode")]
+ [Category("UpdateMode Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public UpdateMode UpdateMode
+ {
+ get
+ {
+ return ((Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateMode)(base.GetValue(UpdateReferenceAttributeActivity.UpdateModeProperty)));
+ }
+ set
+ {
+ base.SetValue(UpdateReferenceAttributeActivity.UpdateModeProperty, value);
+ }
+ }
+ #endregion
+
+ public UpdateReferenceAttributeActivity()
+ {
+ InitializeComponent();
+ }
+
+ private void PrepareUpdate_ExecuteCode(object sender, EventArgs e)
+ {
+ List tempParameters = new List();
+ foreach (Guid guid in this.Values)
+ {
+ tempParameters.Add(new UpdateRequestParameter(this.AttributeName, this.UpdateMode, guid));
+ }
+
+ this.UpdateParameters = tempParameters.ToArray();
+ }
+
+ public UpdateRequestParameter[] UpdateParameters = null;
+
+ private void AreValuesPresent(object sender, ConditionalEventArgs e)
+ {
+ if (this.Values != null && this.Values.Length > 0)
+ e.Result = true;
+ else
+ e.Result = false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributesAsNeededActivity.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributesAsNeededActivity.cs
new file mode 100644
index 0000000..6cd8ea8
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributesAsNeededActivity.cs
@@ -0,0 +1,141 @@
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Linq;
+using System.Workflow.Activities;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Design;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ [Designer(typeof(ActivityDesigner), typeof(IDesigner))]
+ public partial class UpdateReferenceAttributesAsNeededActivity: SequenceActivity
+ {
+ public UpdateReferenceAttributesAsNeededActivity()
+ {
+ InitializeComponent();
+ }
+
+ public static DependencyProperty ActorIdProperty = DependencyProperty.Register("ActorId", typeof(System.Guid), typeof(UpdateReferenceAttributesAsNeededActivity));
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ [Browsable(true)]
+ [Category("ActorId Category")]
+ public Guid ActorId
+ {
+ get
+ {
+ return ((System.Guid)(base.GetValue(UpdateReferenceAttributesAsNeededActivity.ActorIdProperty)));
+ }
+ set
+ {
+ base.SetValue(UpdateReferenceAttributesAsNeededActivity.ActorIdProperty, value);
+ }
+ }
+
+ public static DependencyProperty ResourceIdProperty = DependencyProperty.Register("ResourceId", typeof(System.Guid), typeof(UpdateReferenceAttributesAsNeededActivity));
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ [Browsable(true)]
+ [Category("ResourceId Category")]
+ public Guid ResourceId
+ {
+ get
+ {
+ return ((System.Guid)(base.GetValue(UpdateReferenceAttributesAsNeededActivity.ResourceIdProperty)));
+ }
+ set
+ {
+ base.SetValue(UpdateReferenceAttributesAsNeededActivity.ResourceIdProperty, value);
+ }
+ }
+
+ public static DependencyProperty UpdateModeProperty = DependencyProperty.Register("UpdateMode", typeof(Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateMode), typeof(UpdateReferenceAttributesAsNeededActivity));
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ [Browsable(true)]
+ [Category("UpdateMode Category")]
+ public Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateMode UpdateMode
+ {
+ get
+ {
+ return ((Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateMode)(base.GetValue(UpdateReferenceAttributesAsNeededActivity.UpdateModeProperty)));
+ }
+ set
+ {
+ base.SetValue(UpdateReferenceAttributesAsNeededActivity.UpdateModeProperty, value);
+ }
+ }
+
+ public static DependencyProperty ValuesProperty = DependencyProperty.Register("Values", typeof(System.Guid[]), typeof(UpdateReferenceAttributesAsNeededActivity));
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ [Browsable(true)]
+ [Category("Values Category")]
+ public Guid[] Values
+ {
+ get
+ {
+ return ((System.Guid[])(base.GetValue(UpdateReferenceAttributesAsNeededActivity.ValuesProperty)));
+ }
+ set
+ {
+ base.SetValue(UpdateReferenceAttributesAsNeededActivity.ValuesProperty, value);
+ }
+ }
+
+ public static DependencyProperty AttributeNameProperty = DependencyProperty.Register("AttributeName", typeof(System.String), typeof(UpdateReferenceAttributesAsNeededActivity));
+
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ [Browsable(true)]
+ [Category("AttributeName Category")]
+ public String AttributeName
+ {
+ get
+ {
+ return ((string)(base.GetValue(UpdateReferenceAttributesAsNeededActivity.AttributeNameProperty)));
+ }
+ set
+ {
+ base.SetValue(UpdateReferenceAttributesAsNeededActivity.AttributeNameProperty, value);
+ }
+ }
+
+ public Guid[] ValuesToSet = default(System.Guid[]);
+
+ private void FindOutIfThereIsAPointInDoingAnything(object sender, ConditionalEventArgs e)
+ {
+ if(null==this.Values || this.Values.Length==0)
+ {
+ e.Result = false;
+ return;
+ }
+ switch (this.UpdateMode)
+ {
+ case Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateMode.Insert:
+ this.ValuesToSet = this.Values.Except(this.CurrentValues).ToArray();
+ e.Result = true;
+ break;
+ case Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateMode.Modify:
+ if (this.CurrentValues.Except(this.Values).Count()>0 ||
+ this.Values.Except(this.CurrentValues).Count()>0)
+ {
+ this.ValuesToSet = this.Values;
+ e.Result = true;
+
+ }
+ else
+ {
+ e.Result = false;
+ }
+ break;
+ case Microsoft.ResourceManagement.WebServices.WSResourceManagement.UpdateMode.Remove:
+ this.ValuesToSet = this.Values.Intersect(this.CurrentValues).ToArray();
+ e.Result = true;
+ break;
+ }
+ }
+
+ public Guid[] CurrentValues = default(System.Guid[]);
+ }
+}
\ No newline at end of file
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributesAsNeededActivity.designer.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributesAsNeededActivity.designer.cs
new file mode 100644
index 0000000..85c2412
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddBackReference/UpdateReferenceAttributesAsNeededActivity.designer.cs
@@ -0,0 +1,102 @@
+using System.Workflow.Activities;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ public partial class UpdateReferenceAttributesAsNeededActivity
+ {
+ #region Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ [System.Diagnostics.DebuggerNonUserCode]
+ private void InitializeComponent()
+ {
+ this.CanModifyActivities = true;
+ System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
+ 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.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();
+ 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();
+ this.UpdateReferences = new UpdateReferenceAttributeActivity();
+ this.NotAtAll = new System.Workflow.Activities.IfElseBranchActivity();
+ this.Probably = new System.Workflow.Activities.IfElseBranchActivity();
+ this.IsTherePointInDoingAnything = new System.Workflow.Activities.IfElseActivity();
+ this.GetCurrentReferences = new Granfeldt.FIM.ActivityLibrary.GetReferenceValuesFromObjectActivity();
+ //
+ // UpdateReferences
+ //
+ activitybind1.Name = "UpdateReferenceAttributesAsNeededActivity";
+ activitybind1.Path = "ActorId";
+ activitybind2.Name = "UpdateReferenceAttributesAsNeededActivity";
+ activitybind2.Path = "AttributeName";
+ this.UpdateReferences.Name = "UpdateReferences";
+ activitybind3.Name = "UpdateReferenceAttributesAsNeededActivity";
+ activitybind3.Path = "ResourceId";
+ activitybind4.Name = "UpdateReferenceAttributesAsNeededActivity";
+ activitybind4.Path = "UpdateMode";
+ activitybind5.Name = "UpdateReferenceAttributesAsNeededActivity";
+ activitybind5.Path = "ValuesToSet";
+ this.UpdateReferences.SetBinding(UpdateReferenceAttributeActivity.ActorIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
+ this.UpdateReferences.SetBinding(UpdateReferenceAttributeActivity.ResourceIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));
+ this.UpdateReferences.SetBinding(UpdateReferenceAttributeActivity.UpdateModeProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind4)));
+ this.UpdateReferences.SetBinding(UpdateReferenceAttributeActivity.ValuesProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind5)));
+ this.UpdateReferences.SetBinding(UpdateReferenceAttributeActivity.AttributeNameProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
+ //
+ // NotAtAll
+ //
+ this.NotAtAll.Name = "NotAtAll";
+ //
+ // Probably
+ //
+ this.Probably.Activities.Add(this.UpdateReferences);
+ codecondition1.Condition += new System.EventHandler(this.FindOutIfThereIsAPointInDoingAnything);
+ this.Probably.Condition = codecondition1;
+ this.Probably.Name = "Probably";
+ //
+ // IsTherePointInDoingAnything
+ //
+ this.IsTherePointInDoingAnything.Activities.Add(this.Probably);
+ this.IsTherePointInDoingAnything.Activities.Add(this.NotAtAll);
+ this.IsTherePointInDoingAnything.Name = "IsTherePointInDoingAnything";
+ //
+ // GetCurrentReferences
+ //
+ activitybind6.Name = "UpdateReferenceAttributesAsNeededActivity";
+ activitybind6.Path = "ActorId";
+ activitybind7.Name = "UpdateReferenceAttributesAsNeededActivity";
+ activitybind7.Path = "AttributeName";
+ activitybind8.Name = "UpdateReferenceAttributesAsNeededActivity";
+ activitybind8.Path = "CurrentValues";
+ this.GetCurrentReferences.Name = "GetCurrentReferences";
+ activitybind9.Name = "UpdateReferenceAttributesAsNeededActivity";
+ activitybind9.Path = "ResourceId";
+ this.GetCurrentReferences.SetBinding(Granfeldt.FIM.ActivityLibrary.GetReferenceValuesFromObjectActivity.ActorIdProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind6)));
+ this.GetCurrentReferences.SetBinding(Granfeldt.FIM.ActivityLibrary.GetReferenceValuesFromObjectActivity.AttributeNameProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind7)));
+ this.GetCurrentReferences.SetBinding(Granfeldt.FIM.ActivityLibrary.GetReferenceValuesFromObjectActivity.CurrentValuesProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind8)));
+ this.GetCurrentReferences.SetBinding(Granfeldt.FIM.ActivityLibrary.GetReferenceValuesFromObjectActivity.ObjectIDProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind9)));
+ //
+ // UpdateReferenceAttributesAsNeededActivity
+ //
+ this.Activities.Add(this.GetCurrentReferences);
+ this.Activities.Add(this.IsTherePointInDoingAnything);
+ this.Name = "UpdateReferenceAttributesAsNeededActivity";
+ this.CanModifyActivities = false;
+
+ }
+
+ #endregion
+
+ private GetReferenceValuesFromObjectActivity GetCurrentReferences;
+ private IfElseBranchActivity NotAtAll;
+ private IfElseBranchActivity Probably;
+ private IfElseActivity IsTherePointInDoingAnything;
+ private UpdateReferenceAttributeActivity UpdateReferences;
+ }
+}
\ No newline at end of file
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddRemoveFromMultivalue/Activity.AddRemoveFromMultiValue.Designer.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddRemoveFromMultivalue/Activity.AddRemoveFromMultiValue.Designer.cs
new file mode 100644
index 0000000..b46c0d8
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddRemoveFromMultivalue/Activity.AddRemoveFromMultiValue.Designer.cs
@@ -0,0 +1,204 @@
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Collections;
+using System.Reflection;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Design;
+using System.Workflow.ComponentModel.Compiler;
+using System.Workflow.ComponentModel.Serialization;
+using System.Workflow.Runtime;
+using System.Workflow.Activities;
+using System.Workflow.Activities.Rules;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ public partial class AddRemoveFromMultiValueActivity
+ {
+ #region Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ [System.Diagnostics.DebuggerNonUserCode]
+ [System.CodeDom.Compiler.GeneratedCode("", "")]
+ private void InitializeComponent()
+ {
+ this.CanModifyActivities = true;
+ System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();
+ System.Collections.Generic.List list_11 = new System.Collections.Generic.List();
+ System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
+ 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.LogException = new System.Workflow.Activities.CodeActivity();
+ this.LogArgumentException = new System.Workflow.Activities.CodeActivity();
+ this.faultHandlerGeneralException = new System.Workflow.ComponentModel.FaultHandlerActivity();
+ this.faultHandlerArgumentException = new System.Workflow.ComponentModel.FaultHandlerActivity();
+ this.UpdateMVOnTarget = new Granfeldt.FIM.ActivityLibrary.AddRemoveMultiValueActivityAsNeeded();
+ this.faultHandlersActivity1 = new System.Workflow.ComponentModel.FaultHandlersActivity();
+ this.LoopAndUpdateAllTargets = new System.Workflow.Activities.WhileActivity();
+ this.Enumerate = new Granfeldt.FIM.ActivityLibrary.FindResourcesActivity();
+ this.SetupVariablesActivity = new System.Workflow.Activities.CodeActivity();
+ this.ResolveValueToAdd = new Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity();
+ this.ResolveLookupXPath = new Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity();
+ this.GetCurrentRequest = new Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity();
+ //
+ // LogException
+ //
+ this.LogException.Name = "LogException";
+ this.LogException.ExecuteCode += new System.EventHandler(this.LogException_ExecuteCode);
+ //
+ // LogArgumentException
+ //
+ this.LogArgumentException.Name = "LogArgumentException";
+ this.LogArgumentException.ExecuteCode += new System.EventHandler(this.LogArgumentException_ExecuteCode);
+ //
+ // faultHandlerGeneralException
+ //
+ this.faultHandlerGeneralException.Activities.Add(this.LogException);
+ this.faultHandlerGeneralException.FaultType = typeof(System.Exception);
+ this.faultHandlerGeneralException.Name = "faultHandlerGeneralException";
+ //
+ // faultHandlerArgumentException
+ //
+ this.faultHandlerArgumentException.Activities.Add(this.LogArgumentException);
+ this.faultHandlerArgumentException.FaultType = typeof(System.ArgumentException);
+ this.faultHandlerArgumentException.Name = "faultHandlerArgumentException";
+ //
+ // UpdateMVOnTarget
+ //
+ this.UpdateMVOnTarget.Action = null;
+ this.UpdateMVOnTarget.Destination = null;
+ this.UpdateMVOnTarget.Name = "UpdateMVOnTarget";
+ this.UpdateMVOnTarget.TargetIdToUpdate = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.UpdateMVOnTarget.TargetResource = null;
+ this.UpdateMVOnTarget.ValueToAddOrRemove = null;
+ //
+ // faultHandlersActivity1
+ //
+ this.faultHandlersActivity1.Activities.Add(this.faultHandlerArgumentException);
+ this.faultHandlersActivity1.Activities.Add(this.faultHandlerGeneralException);
+ this.faultHandlersActivity1.Name = "faultHandlersActivity1";
+ //
+ // LoopAndUpdateAllTargets
+ //
+ this.LoopAndUpdateAllTargets.Activities.Add(this.UpdateMVOnTarget);
+ codecondition1.Condition += new System.EventHandler(this.MoreTargetsToUpdate_Condition);
+ this.LoopAndUpdateAllTargets.Condition = codecondition1;
+ this.LoopAndUpdateAllTargets.Name = "LoopAndUpdateAllTargets";
+ //
+ // Enumerate
+ //
+ this.Enumerate.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.Enumerate.Attributes = null;
+ this.Enumerate.EnumeratedResourceIDs = null;
+ this.Enumerate.EnumeratedResources = list_11;
+ this.Enumerate.Name = "Enumerate";
+ this.Enumerate.PageSize = 0;
+ this.Enumerate.SortingAttributes = null;
+ this.Enumerate.TotalResultsCount = 0;
+ this.Enumerate.XPathFilter = null;
+ //
+ // SetupVariablesActivity
+ //
+ this.SetupVariablesActivity.Name = "SetupVariablesActivity";
+ this.SetupVariablesActivity.ExecuteCode += new System.EventHandler(this.SetupVariablesActivity_ExecuteCode);
+ //
+ // ResolveValueToAdd
+ //
+ activitybind1.Name = "AddRemoveFromMultiValueActivity";
+ activitybind1.Path = "ValueToAddRemove";
+ this.ResolveValueToAdd.Name = "ResolveValueToAdd";
+ activitybind2.Name = "AddRemoveFromMultiValueActivity";
+ activitybind2.Path = "ValueToAddRemoveResolved";
+ this.ResolveValueToAdd.WorkflowDictionaryKey = null;
+ this.ResolveValueToAdd.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity.GrammarExpressionProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
+ this.ResolveValueToAdd.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity.ResolvedExpressionProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind2)));
+ //
+ // ResolveLookupXPath
+ //
+ activitybind3.Name = "AddRemoveFromMultiValueActivity";
+ activitybind3.Path = "LookupXPath";
+ this.ResolveLookupXPath.Name = "ResolveLookupXPath";
+ activitybind4.Name = "AddRemoveFromMultiValueActivity";
+ activitybind4.Path = "ResolvedLookupXPath";
+ this.ResolveLookupXPath.WorkflowDictionaryKey = null;
+ this.ResolveLookupXPath.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity.GrammarExpressionProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind3)));
+ this.ResolveLookupXPath.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity.ResolvedExpressionProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind4)));
+ //
+ // GetCurrentRequest
+ //
+ activitybind5.Name = "AddRemoveFromMultiValueActivity";
+ activitybind5.Path = "CurrentRequest";
+ this.GetCurrentRequest.Name = "GetCurrentRequest";
+ this.GetCurrentRequest.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity.CurrentRequestProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind5)));
+ //
+ // AddRemoveFromMultiValueActivity
+ //
+ this.Activities.Add(this.GetCurrentRequest);
+ this.Activities.Add(this.ResolveLookupXPath);
+ this.Activities.Add(this.ResolveValueToAdd);
+ this.Activities.Add(this.SetupVariablesActivity);
+ this.Activities.Add(this.Enumerate);
+ this.Activities.Add(this.LoopAndUpdateAllTargets);
+ this.Activities.Add(this.faultHandlersActivity1);
+ this.Name = "AddRemoveFromMultiValueActivity";
+ this.CanModifyActivities = false;
+
+ }
+
+ #endregion
+
+ private CodeActivity LogException;
+
+ private FaultHandlerActivity faultHandlerGeneralException;
+
+ private CodeActivity LogArgumentException;
+
+ private FaultHandlerActivity faultHandlerArgumentException;
+
+ private FaultHandlersActivity faultHandlersActivity1;
+
+ private Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity ResolveValueToAdd;
+
+ private AddRemoveMultiValueActivityAsNeeded UpdateMVOnTarget;
+
+ private WhileActivity LoopAndUpdateAllTargets;
+
+ private Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity GetCurrentRequest;
+
+ private FindResourcesActivity Enumerate;
+
+ private CodeActivity SetupVariablesActivity;
+
+ private Microsoft.ResourceManagement.Workflow.Activities.ResolveGrammarActivity ResolveLookupXPath;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ }
+}
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddRemoveFromMultivalue/Activity.AddRemoveFromMultiValue.SettingsPart.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddRemoveFromMultivalue/Activity.AddRemoveFromMultiValue.SettingsPart.cs
new file mode 100644
index 0000000..b1dbfd7
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddRemoveFromMultivalue/Activity.AddRemoveFromMultiValue.SettingsPart.cs
@@ -0,0 +1,121 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Web.UI.WebControls;
+using System.Workflow.ComponentModel;
+using Microsoft.IdentityManagement.WebUI.Controls;
+using Microsoft.ResourceManagement.Workflow.Activities;
+
+namespace Granfeldt.FIM.ActivityLibrary.WebUIs
+{
+ class AddRemoveFromMultiValueActivitySettingsPart : BaseActivitySettingsPart
+ {
+
+ const string LookupXPath = "TargetObjects";
+ const string ValueToAddRemove = "ValueToAddRemove";
+ const string MultivalueAttributeName = "TargetMultivalueAttributename";
+ const string HandleDuplicates = "HandleDuplicates";
+ const string Action = "Action";
+ const string Actor = "Actor";
+
+ protected override void CreateChildControls()
+ {
+ Table layoutTable;
+ layoutTable = new Table();
+
+ // width is set to 100% of the control size
+ layoutTable.Width = Unit.Percentage(100.0);
+ layoutTable.BorderWidth = 0;
+ layoutTable.CellPadding = 2;
+
+ // add a TableRow for each textbox in the UI
+ layoutTable.Rows.Add(this.AddTableRowTextBox("Target object(s) (XPath Filter):", "txt" + LookupXPath, 400, 1000, false, ""));
+ layoutTable.Rows.Add(this.AddTableRowTextBox("Value to add, i.e. [//Target/ObjectID]:", "txt" + ValueToAddRemove, 400, 100, false, ""));
+ layoutTable.Rows.Add(this.AddTableRowTextBox("Target multi-value attributename:", "txt" + MultivalueAttributeName, 400, 100, false, ""));
+ layoutTable.Rows.Add(this.AddAddRemoveDropDownList("Action:", "txt" + Action, 400, "Add"));
+ layoutTable.Rows.Add(this.AddCheckbox("Add/remove duplicates", "txt" + HandleDuplicates, false));
+ layoutTable.Rows.Add(this.AddActorDropDownList("Actor (run as):", "txt" + Actor, 400, WellKnownGuids.FIMServiceAccount.ToString()));
+ this.Controls.Add(layoutTable);
+ base.CreateChildControls();
+ }
+
+ public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow)
+ {
+ Debugging.Log("GenerateActivityOnWorkflow");
+ if (!this.ValidateInputs())
+ {
+ return null;
+ }
+ AddRemoveFromMultiValueActivity act = new AddRemoveFromMultiValueActivity();
+ act.ValueToAddRemove = this.GetText("txt" + ValueToAddRemove);
+ act.LookupXPath = this.GetText("txt" + LookupXPath);
+ act.MultivalueAttributeName = this.GetText("txt" + MultivalueAttributeName);
+ act.Actor = this.GetActorDropDownList("txt" + Actor);
+ act.AddRemoveAction = this.GetAddRemoveDropDownList("txt" + Action);
+ return act;
+ }
+
+ public override void LoadActivitySettings(Activity activity)
+ {
+ Debugging.Log("LoadActivitySettings");
+ AddRemoveFromMultiValueActivity thisActivity = activity as AddRemoveFromMultiValueActivity;
+ if (thisActivity != null)
+ {
+ this.SetText("txt" + LookupXPath, thisActivity.LookupXPath);
+ this.SetText("txt" + ValueToAddRemove, thisActivity.ValueToAddRemove);
+ this.SetText("txt" + MultivalueAttributeName, thisActivity.MultivalueAttributeName);
+ this.SetActorDropDownList("txt" + Actor, thisActivity.Actor);
+ this.SetAddRemoveDropDownList("txt" + Action, thisActivity.AddRemoveAction);
+ }
+ }
+
+ public override ActivitySettingsPartData PersistSettings()
+ {
+ Debugging.Log("PersistSettings");
+ ActivitySettingsPartData data = new ActivitySettingsPartData();
+ data[LookupXPath] = this.GetText("txt" + LookupXPath);
+ data[MultivalueAttributeName] = this.GetText("txt" + MultivalueAttributeName);
+ data[ValueToAddRemove] = this.GetText("txt" + ValueToAddRemove);
+ data[Actor] = this.GetActorDropDownList("txt" + Actor);
+ data[Action] = this.GetAddRemoveDropDownList("txt" + Action);
+ return data;
+ }
+
+ public override void RestoreSettings(ActivitySettingsPartData data)
+ {
+ Debugging.Log("RestoreSettings");
+ if (null != data)
+ {
+ this.SetText("txt" + LookupXPath, (string)data[LookupXPath]);
+ this.SetText("txt" + MultivalueAttributeName, (string)data[MultivalueAttributeName]);
+ this.SetText("txt" + ValueToAddRemove, (string)data[ValueToAddRemove]);
+ this.SetActorDropDownList("txt" + Actor, (string)data[Actor]);
+ this.SetAddRemoveDropDownList("txt" + Action, (string)data[Action]);
+ }
+ }
+
+ public override void SwitchMode(ActivitySettingsPartMode mode)
+ {
+ Debugging.Log("SwitchMode");
+ bool isDisabled = (mode != ActivitySettingsPartMode.Edit);
+ this.SetTextBoxReadOnlyOption("txt" + LookupXPath, isDisabled);
+ this.SetTextBoxReadOnlyOption("txt" + MultivalueAttributeName, isDisabled);
+ this.SetTextBoxReadOnlyOption("txt" + ValueToAddRemove, isDisabled);
+ this.SetDropDownListDisabled("txt" + Actor, isDisabled);
+ this.SetDropDownListDisabled("txt" + Action, isDisabled);
+ }
+
+ public override string Title
+ {
+ get { return "Add or Remove to/from multi-value"; }
+ }
+
+ public override bool ValidateInputs()
+ {
+ Debugging.Log("ValidateInputs");
+ return true;
+ }
+ }
+}
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.AddRemoveFromMultivalue/Activity.AddRemoveFromMultiValue.cs b/Granfeldt.FIM.ActivityLibrary/Activity.AddRemoveFromMultivalue/Activity.AddRemoveFromMultiValue.cs
new file mode 100644
index 0000000..381c7c7
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.AddRemoveFromMultivalue/Activity.AddRemoveFromMultiValue.cs
@@ -0,0 +1,230 @@
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Collections;
+using System.Linq;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Design;
+using System.Workflow.ComponentModel.Compiler;
+using System.Workflow.ComponentModel.Serialization;
+using System.Workflow.Runtime;
+using System.Workflow.Activities;
+using System.Workflow.Activities.Rules;
+using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ public partial class AddRemoveFromMultiValueActivity : SequenceActivity
+ {
+
+ #region Properties
+
+ public AddRemoveFromMultiValueActivity()
+ {
+ InitializeComponent();
+ }
+
+ public static DependencyProperty HandleDuplicateProperty = DependencyProperty.Register("HandleDuplicate", typeof(string), typeof(AddRemoveFromMultiValueActivity));
+ [Description("HandleDuplicate")]
+ [Category("HandleDuplicate Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public string HandleDuplicate
+ {
+ get
+ {
+ return ((string)(base.GetValue(AddRemoveFromMultiValueActivity.HandleDuplicateProperty)));
+ }
+ set
+ {
+ base.SetValue(AddRemoveFromMultiValueActivity.HandleDuplicateProperty, value);
+ }
+ }
+
+ public static DependencyProperty ActorProperty = DependencyProperty.Register("Actor", typeof(string), typeof(AddRemoveFromMultiValueActivity));
+ [Description("Actor")]
+ [Category("Actor Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public string Actor
+ {
+ get
+ {
+ return ((string)(base.GetValue(AddRemoveFromMultiValueActivity.ActorProperty)));
+ }
+ set
+ {
+ base.SetValue(AddRemoveFromMultiValueActivity.ActorProperty, value);
+ }
+ }
+
+ public static DependencyProperty LookupXPathProperty = DependencyProperty.Register("LookupXPath", typeof(System.String), typeof(AddRemoveFromMultiValueActivity));
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
+ [BrowsableAttribute(true)]
+ [CategoryAttribute("Misc")]
+ public String LookupXPath
+ {
+ get
+ {
+ return ((string)(base.GetValue(LookupXPathProperty)));
+ }
+ set
+ {
+ base.SetValue(LookupXPathProperty, value);
+ }
+ }
+
+ public static DependencyProperty ResolvedLookupXPathProperty = DependencyProperty.Register("ResolvedLookupXPath", typeof(System.String), typeof(AddRemoveFromMultiValueActivity));
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
+ [BrowsableAttribute(true)]
+ [CategoryAttribute("Misc")]
+ public String ResolvedLookupXPath
+ {
+ get
+ {
+ return ((string)(base.GetValue(AddRemoveFromMultiValueActivity.ResolvedLookupXPathProperty)));
+ }
+ set
+ {
+ base.SetValue(AddRemoveFromMultiValueActivity.ResolvedLookupXPathProperty, value);
+ }
+ }
+
+ public static DependencyProperty ValueToAddRemoveProperty = DependencyProperty.Register("ValueToAddRemove", typeof(string), typeof(AddRemoveFromMultiValueActivity));
+ [Description("ValueToAddRemove")]
+ [Category("ValueToAddRemove Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public string ValueToAddRemove
+ {
+ get
+ {
+ return ((string)(base.GetValue(AddRemoveFromMultiValueActivity.ValueToAddRemoveProperty)));
+ }
+ set
+ {
+ base.SetValue(AddRemoveFromMultiValueActivity.ValueToAddRemoveProperty, value);
+ }
+ }
+
+ public static DependencyProperty MultivalueAttributeNameProperty = DependencyProperty.Register("MultivalueAttributeName", typeof(string), typeof(AddRemoveFromMultiValueActivity));
+ [Description("MultivalueAttributeName")]
+ [Category("MultivalueAttributeName Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public string MultivalueAttributeName
+ {
+ get
+ {
+ return ((string)(base.GetValue(AddRemoveFromMultiValueActivity.MultivalueAttributeNameProperty)));
+ }
+ set
+ {
+ base.SetValue(AddRemoveFromMultiValueActivity.MultivalueAttributeNameProperty, value);
+ }
+ }
+
+ public static DependencyProperty AddRemoveActionProperty = DependencyProperty.Register("AddRemoveAction", typeof(string), typeof(AddRemoveFromMultiValueActivity));
+ [Description("AddRemoveAction")]
+ [Category("AddRemoveAction Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public string AddRemoveAction
+ {
+ get
+ {
+ return ((string)(base.GetValue(AddRemoveFromMultiValueActivity.AddRemoveActionProperty)));
+ }
+ set
+ {
+ base.SetValue(AddRemoveFromMultiValueActivity.AddRemoveActionProperty, value);
+ }
+ }
+
+
+ public static DependencyProperty CurrentRequestProperty = DependencyProperty.Register("CurrentRequest", typeof(Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType), typeof(AddRemoveFromMultiValueActivity));
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
+ [BrowsableAttribute(true)]
+ [CategoryAttribute("Misc")]
+ public RequestType CurrentRequest
+ {
+ get
+ {
+ return ((Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType)(base.GetValue(CurrentRequestProperty)));
+ }
+ set
+ {
+ base.SetValue(CurrentRequestProperty, value);
+ }
+ }
+
+ #endregion
+
+ private void SetupVariablesActivity_ExecuteCode(object sender, EventArgs e)
+ {
+ foreach (CreateRequestParameter u in this.CurrentRequest.ParseParameters())
+ {
+ }
+
+ Debugging.Log("Enter SetupVariablesActivity_ExecuteCode");
+ Enumerate.ActorId = new Guid(this.Actor);
+ Debugging.Log("XPath (resolved)", this.ResolvedLookupXPath);
+ Enumerate.XPathFilter = this.ResolvedLookupXPath;
+ Enumerate.Attributes = new string[] { this.MultivalueAttributeName };
+ Enumerate.PageSize = 100;
+ Debugging.Log("Leave SetupVariablesActivity_ExecuteCode");
+ }
+
+ private void MoreTargetsToUpdate_Condition(object sender, ConditionalEventArgs e)
+ {
+ Debugging.Log("Enter SetupVariablesActivity_ExecuteCode");
+ // return true if there are any more source values to resolve
+ e.Result = Enumerate.EnumeratedResources != null ? Enumerate.EnumeratedResources.Count() > 0 : false;
+
+ if (e.Result)
+ {
+ Debugging.Log("Update target(s) left", Enumerate.EnumeratedResources.Count());
+ ResourceType resource = Enumerate.EnumeratedResources[0];
+ Enumerate.EnumeratedResources.RemoveAt(0);
+
+ UpdateMVOnTarget.Action = this.AddRemoveAction;
+ UpdateMVOnTarget.Destination = this.MultivalueAttributeName;
+ UpdateMVOnTarget.ValueToAddOrRemove = this.ValueToAddRemoveResolved;
+ UpdateMVOnTarget.TargetIdToUpdate = resource.ObjectID.GetGuid();
+ }
+ else
+ {
+ Debugging.Log("No more source values to resolve");
+ }
+ }
+
+ public static DependencyProperty ValueToAddRemoveResolvedProperty = DependencyProperty.Register("ValueToAddRemoveResolved", typeof(object), typeof(Granfeldt.FIM.ActivityLibrary.AddRemoveFromMultiValueActivity));
+
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
+ [BrowsableAttribute(true)]
+ [CategoryAttribute("Misc")]
+ public String ValueToAddRemoveResolved
+ {
+ get
+ {
+ return ((string)(base.GetValue(Granfeldt.FIM.ActivityLibrary.AddRemoveFromMultiValueActivity.ValueToAddRemoveResolvedProperty)));
+ }
+ set
+ {
+ base.SetValue(Granfeldt.FIM.ActivityLibrary.AddRemoveFromMultiValueActivity.ValueToAddRemoveResolvedProperty, value);
+ }
+ }
+
+ private void LogArgumentException_ExecuteCode(object sender, EventArgs e)
+ {
+ Debugging.Log(sender.ToString());
+ Debugging.Log(faultHandlerArgumentException.Fault);
+ }
+
+ private void LogException_ExecuteCode(object sender, EventArgs e)
+ {
+ Debugging.Log(sender.ToString());
+ Debugging.Log(faultHandlerGeneralException.Fault);
+ }
+ }
+}
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.ClearSingleValueAttribute/Activity.ClearSingleValuedAttribute.Designer.cs b/Granfeldt.FIM.ActivityLibrary/Activity.ClearSingleValueAttribute/Activity.ClearSingleValuedAttribute.Designer.cs
new file mode 100644
index 0000000..1d09bda
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.ClearSingleValueAttribute/Activity.ClearSingleValuedAttribute.Designer.cs
@@ -0,0 +1,133 @@
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Collections;
+using System.Drawing;
+using System.Reflection;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Design;
+using System.Workflow.ComponentModel.Compiler;
+using System.Workflow.ComponentModel.Serialization;
+using System.Workflow.Runtime;
+using System.Workflow.Activities;
+using System.Workflow.Activities.Rules;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ public partial class ClearSingleValuedAttributeActivity
+ {
+ #region Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ [System.Diagnostics.DebuggerNonUserCode]
+ private void InitializeComponent()
+ {
+ this.CanModifyActivities = true;
+ System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();
+ System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
+ this.UpdateResource = new Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity();
+ this.NoActionNeeded = new System.Workflow.Activities.IfElseBranchActivity();
+ this.ThereWasValue = new System.Workflow.Activities.IfElseBranchActivity();
+ this.EndGracefully = new System.Workflow.Activities.CodeActivity();
+ this.IsRemovalNeeded = new System.Workflow.Activities.IfElseActivity();
+ this.ReadResource = new Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity();
+ this.PrepareReading = new System.Workflow.Activities.CodeActivity();
+ this.GetCurrentRequest = new Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity();
+ //
+ // UpdateResource
+ //
+ this.UpdateResource.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.UpdateResource.ApplyAuthorizationPolicy = false;
+ this.UpdateResource.Name = "UpdateResource";
+ this.UpdateResource.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.UpdateResource.UpdateParameters = null;
+ //
+ // NoActionNeeded
+ //
+ this.NoActionNeeded.Name = "NoActionNeeded";
+ //
+ // ThereWasValue
+ //
+ this.ThereWasValue.Activities.Add(this.UpdateResource);
+ codecondition1.Condition += new System.EventHandler(this.ThereWasValue_Condition);
+ this.ThereWasValue.Condition = codecondition1;
+ this.ThereWasValue.Name = "ThereWasValue";
+ //
+ // EndGracefully
+ //
+ this.EndGracefully.Name = "EndGracefully";
+ this.EndGracefully.ExecuteCode += new System.EventHandler(this.EndGracefully_ExecuteCode);
+ //
+ // IsRemovalNeeded
+ //
+ this.IsRemovalNeeded.Activities.Add(this.ThereWasValue);
+ this.IsRemovalNeeded.Activities.Add(this.NoActionNeeded);
+ this.IsRemovalNeeded.Name = "IsRemovalNeeded";
+ //
+ // ReadResource
+ //
+ this.ReadResource.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.ReadResource.Name = "ReadResource";
+ this.ReadResource.Resource = null;
+ this.ReadResource.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.ReadResource.SelectionAttributes = null;
+ //
+ // PrepareReading
+ //
+ this.PrepareReading.Name = "PrepareReading";
+ this.PrepareReading.ExecuteCode += new System.EventHandler(this.PrepareReading_ExecuteCode);
+ //
+ // GetCurrentRequest
+ //
+ activitybind1.Name = "ClearSingleValuedAttributeActivity";
+ activitybind1.Path = "CurrentRequest";
+ this.GetCurrentRequest.Name = "GetCurrentRequest";
+ this.GetCurrentRequest.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity.CurrentRequestProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
+ //
+ // ClearSingleValuedAttributeActivity
+ //
+ this.Activities.Add(this.GetCurrentRequest);
+ this.Activities.Add(this.PrepareReading);
+ this.Activities.Add(this.ReadResource);
+ this.Activities.Add(this.IsRemovalNeeded);
+ this.Activities.Add(this.EndGracefully);
+ this.Name = "ClearSingleValuedAttributeActivity";
+ this.CanModifyActivities = false;
+
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #endregion
+
+ private Microsoft.ResourceManagement.Workflow.Activities.CurrentRequestActivity GetCurrentRequest;
+ private CodeActivity EndGracefully;
+ private Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity ReadResource;
+ private Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity UpdateResource;
+ private IfElseBranchActivity ThereWasValue;
+ private IfElseActivity IsRemovalNeeded;
+ private IfElseBranchActivity NoActionNeeded;
+ private CodeActivity PrepareReading;
+ }
+}
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.ClearSingleValueAttribute/Activity.ClearSingleValuedAttribute.cs b/Granfeldt.FIM.ActivityLibrary/Activity.ClearSingleValueAttribute/Activity.ClearSingleValuedAttribute.cs
new file mode 100644
index 0000000..dee99fe
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.ClearSingleValueAttribute/Activity.ClearSingleValuedAttribute.cs
@@ -0,0 +1,180 @@
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Collections;
+using System.Drawing;
+using System.Linq;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Design;
+using System.Workflow.ComponentModel.Compiler;
+using System.Workflow.ComponentModel.Serialization;
+using System.Workflow.Runtime;
+using System.Workflow.Activities;
+using System.Workflow.Activities.Rules;
+using Microsoft.ResourceManagement.Workflow.Activities;
+using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+
+ public partial class ClearSingleValuedAttributeActivity : SequenceActivity
+ {
+
+ #region Properties
+
+ public static DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(System.String), typeof(ClearSingleValuedAttributeActivity));
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
+ [BrowsableAttribute(true)]
+ [CategoryAttribute("Misc")]
+ public String Title
+ {
+ get
+ {
+ return ((string)(base.GetValue(TitleProperty)));
+ }
+ set
+ {
+ base.SetValue(TitleProperty, value);
+ }
+ }
+
+ public static DependencyProperty CurrentRequestProperty = DependencyProperty.Register("CurrentRequest", typeof(Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType), typeof(ClearSingleValuedAttributeActivity));
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
+ [BrowsableAttribute(true)]
+ [CategoryAttribute("Misc")]
+ public Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType CurrentRequest
+ {
+ get
+ {
+ return ((Microsoft.ResourceManagement.WebServices.WSResourceManagement.RequestType)(base.GetValue(CurrentRequestProperty)));
+ }
+ set
+ {
+ base.SetValue(CurrentRequestProperty, value);
+ }
+ }
+
+ public static DependencyProperty AttributeNameProperty = DependencyProperty.Register("AttributeName", typeof(string), typeof(ClearSingleValuedAttributeActivity));
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ [Category("Properties")]
+ public string AttributeName
+ {
+ get
+ {
+ return (string)base.GetValue(AttributeNameProperty);
+ }
+ set
+ {
+ base.SetValue(AttributeNameProperty, value);
+ }
+ }
+
+ public static DependencyProperty TargetIdProperty = DependencyProperty.Register("TargetId", typeof(Guid), typeof(ClearSingleValuedAttributeActivity));
+ [Description("TargetId")]
+ [Category("TargetId Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public Guid TargetId
+ {
+ get
+ {
+ return ((Guid)(base.GetValue(ClearSingleValuedAttributeActivity.TargetIdProperty)));
+ }
+ set
+ {
+ base.SetValue(ClearSingleValuedAttributeActivity.TargetIdProperty, value);
+ }
+ }
+
+ #endregion
+
+ public ClearSingleValuedAttributeActivity()
+ {
+ InitializeComponent();
+ }
+
+ void ActivityStatus(object sender, ActivityExecutionStatusChangedEventArgs e)
+ {
+ Tracer.TraceInformation("execution-status name: {0}, status: {1}, result: {2}", e.Activity.Name, e.ExecutionStatus, e.ExecutionResult);
+ }
+
+ private void PrepareReading_ExecuteCode(object sender, EventArgs e)
+ {
+ Tracer.Enter("preparereading_executecode");
+ try
+ {
+ ReadResource.ActorId = WellKnownGuids.FIMServiceAccount;
+ Tracer.TraceInformation("actor-objectid: {0}", ReadResource.ActorId);
+ ReadResource.ResourceId = CurrentRequest.Target.GetGuid();
+ Tracer.TraceInformation("target-objectid: {0}", ReadResource.ResourceId);
+ ReadResource.SelectionAttributes = new string[] { this.AttributeName, "DisplayName" };
+ Tracer.TraceInformation("attribute: {0}", ReadResource.SelectionAttributes.FirstOrDefault());
+
+ ReadResource.Executing += new System.EventHandler(ActivityStatus);
+ ReadResource.Faulting += new System.EventHandler(ActivityStatus);
+ ReadResource.StatusChanged += new System.EventHandler(ActivityStatus);
+ ReadResource.Canceling += new System.EventHandler(ActivityStatus);
+ ReadResource.Compensating += new System.EventHandler(ActivityStatus);
+ ReadResource.Closed += new System.EventHandler(ActivityStatus);
+ }
+ catch (Exception ex)
+ {
+ Tracer.TraceError("preparereading_executecode", ex);
+ }
+ Tracer.Exit("preparereading_executecode");
+ }
+
+ private void ThereWasValue_Condition(object sender, ConditionalEventArgs e)
+ {
+ try
+ {
+ Tracer.Enter("therewasvalue_condition");
+ object displayName = ReadResource.Resource["DisplayName"];
+ object myValue = ReadResource.Resource[this.AttributeName];
+ Tracer.TraceInformation("target-displayname {0}", displayName);
+ if (null != myValue)
+ {
+ Tracer.TraceInformation("current-value: {0}", ReadResource.Resource[this.AttributeName]);
+ UpdateResource.ActorId = WellKnownGuids.FIMServiceAccount;
+ Tracer.TraceInformation("actor-objectid: {0}", UpdateResource.ActorId);
+ UpdateResource.ResourceId = CurrentRequest.Target.GetGuid();
+ Tracer.TraceInformation("target-objectid: {0}", UpdateResource.ResourceId);
+ UpdateRequestParameter[] UpdateParameters = new UpdateRequestParameter[] {
+ new UpdateRequestParameter(
+ this.AttributeName,
+ UpdateMode.Remove,
+ myValue)};
+ UpdateResource.UpdateParameters = UpdateParameters;
+
+ UpdateResource.Executing += new System.EventHandler(ActivityStatus);
+ UpdateResource.Faulting += new System.EventHandler(ActivityStatus);
+ UpdateResource.StatusChanged += new System.EventHandler(ActivityStatus);
+ UpdateResource.Canceling += new System.EventHandler(ActivityStatus);
+ UpdateResource.Compensating += new System.EventHandler(ActivityStatus);
+ UpdateResource.Closed += new System.EventHandler(ActivityStatus);
+
+ e.Result = true;
+ }
+ else
+ {
+ Tracer.TraceInformation("no-current-value-to-remove");
+ e.Result = false;
+ }
+ }
+ catch (Exception ex)
+ {
+ Tracer.TraceError("therewasvalue_condition'", ex);
+ }
+ Tracer.Exit("therewasvalue_condition");
+ }
+
+ private void EndGracefully_ExecuteCode(object sender, EventArgs e)
+ {
+ Tracer.TraceInformation("done");
+ }
+
+
+ }
+
+}
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.ClearSingleValueAttribute/ClearSingleValuedAttributeActivitySettingsPart.cs b/Granfeldt.FIM.ActivityLibrary/Activity.ClearSingleValueAttribute/ClearSingleValuedAttributeActivitySettingsPart.cs
new file mode 100644
index 0000000..26445a9
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.ClearSingleValueAttribute/ClearSingleValuedAttributeActivitySettingsPart.cs
@@ -0,0 +1,182 @@
+using System;
+using System.Linq;
+using System.Collections.Generic;
+using System.Text;
+using System.Web.UI.WebControls;
+using System.Workflow.ComponentModel;
+using Microsoft.IdentityManagement.WebUI.Controls;
+using Microsoft.ResourceManagement.Workflow.Activities;
+
+namespace Granfeldt.FIM.ActivityLibrary.WebUIs
+{
+
+ class ClearSingleValuedAttributeActivitySettingsPart : ActivitySettingsPart
+ {
+
+ ///
+ /// Creates a Table that contains the controls used by the activity UI
+ /// in the Workflow Designer of the FIM portal. Adds that Table to the
+ /// collection of Controls that defines each activity that can be selected
+ /// in the Workflow Designer of the FIM Portal. Calls the base class of
+ /// ActivitySettingsPart to render the controls in the UI.
+ ///
+ protected override void CreateChildControls()
+ {
+ Table controlLayoutTable;
+ controlLayoutTable = new Table();
+
+ //Width is set to 100% of the control size
+ controlLayoutTable.Width = Unit.Percentage(100.0);
+ controlLayoutTable.BorderWidth = 0;
+ controlLayoutTable.CellPadding = 2;
+ //Add a TableRow for each textbox in the UI
+ controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Title:", "txtTitle", 400, 100, false, ""));
+ controlLayoutTable.Rows.Add(this.AddTableRowTextBox("Attribute:", "txtDestination", 400, 100, false, ""));
+ this.Controls.Add(controlLayoutTable);
+
+ base.CreateChildControls();
+ }
+
+ #region Utility Functions
+
+ //Create a TableRow that contains a label and a textbox.
+ private TableRow AddTableRowTextBox(String labelText, String controlID, int width, int maxLength, Boolean multiLine, String defaultValue)
+ {
+ TableRow row = new TableRow();
+ TableCell labelCell = new TableCell();
+ TableCell controlCell = new TableCell();
+ Label oLabel = new Label();
+ TextBox oText = new TextBox();
+
+ oLabel.Text = labelText;
+ oLabel.CssClass = base.LabelCssClass;
+ labelCell.Controls.Add(oLabel);
+ oText.ID = controlID;
+ oText.CssClass = base.TextBoxCssClass;
+ oText.Text = defaultValue;
+ oText.MaxLength = maxLength;
+ oText.Width = width;
+ if (multiLine)
+ {
+ oText.TextMode = TextBoxMode.MultiLine;
+ oText.Rows = System.Math.Min(6, (maxLength + 60) / 60);
+ oText.Wrap = true;
+ }
+ controlCell.Controls.Add(oText);
+ row.Cells.Add(labelCell);
+ row.Cells.Add(controlCell);
+ return row;
+ }
+
+ string GetText(string textBoxID)
+ {
+ TextBox textBox = (TextBox)this.FindControl(textBoxID);
+ return textBox.Text ?? String.Empty;
+ }
+ void SetText(string textBoxID, string text)
+ {
+ TextBox textBox = (TextBox)this.FindControl(textBoxID);
+ if (textBox != null)
+ textBox.Text = text;
+ else
+ textBox.Text = "";
+ }
+
+ //Set the text box to read mode or read/write mode
+ void SetTextBoxReadOnlyOption(string textBoxID, bool readOnly)
+ {
+ TextBox textBox = (TextBox)this.FindControl(textBoxID);
+ textBox.ReadOnly = readOnly;
+ }
+ #endregion
+
+ ///
+ /// Called when a user clicks the Save button in the Workflow Designer.
+ /// Returns an instance of the RequestLoggingActivity class that
+ /// has its properties set to the values entered into the text box controls
+ /// used in the UI of the activity.
+ ///
+ public override Activity GenerateActivityOnWorkflow(SequentialWorkflow workflow)
+ {
+ if (!this.ValidateInputs())
+ {
+ return null;
+ }
+ ClearSingleValuedAttributeActivity ThisActivity = new ClearSingleValuedAttributeActivity();
+ ThisActivity.Title = this.GetText("txtTitle");
+ ThisActivity.AttributeName = this.GetText("txtDestination");
+ return ThisActivity;
+ }
+
+ public override void LoadActivitySettings(Activity activity)
+ {
+ ClearSingleValuedAttributeActivity ThisActivity = activity as ClearSingleValuedAttributeActivity;
+ if (ThisActivity != null)
+ {
+ this.SetText("txtTitle", ThisActivity.Title);
+ this.SetText("txtDestination", ThisActivity.AttributeName);
+ }
+ }
+
+ ///
+ /// Saves the activity settings.
+ ///
+ public override ActivitySettingsPartData PersistSettings()
+ {
+ ActivitySettingsPartData data = new ActivitySettingsPartData();
+ data["Title"] = this.GetText("txtTitle");
+ data["Attribute"] = this.GetText("txtDestination");
+ return data;
+ }
+
+ ///
+ /// Restores the activity settings in the UI
+ ///
+ public override void RestoreSettings(ActivitySettingsPartData data)
+ {
+ if (null != data)
+ {
+ this.SetText("txtTitle", (string)data["Title"]);
+ this.SetText("txtDestination", (string)data["Attribute"]);
+ }
+ }
+
+ ///
+ /// Switches the activity between read only and read/write mode
+ ///
+ public override void SwitchMode(ActivitySettingsPartMode mode)
+ {
+ bool readOnly = (mode == ActivitySettingsPartMode.View);
+ this.SetTextBoxReadOnlyOption("txtTitle", readOnly);
+ this.SetTextBoxReadOnlyOption("txtDestination", readOnly);
+ }
+
+ ///
+ /// Returns the activity name.
+ ///
+ public override string Title
+ {
+ get
+ {
+ return string.Format("Clear single-valued attribute: {0}", this.GetText("txtTitle"));
+ }
+ }
+
+ ///
+ /// In general, this method should be used to validate information entered
+ /// by the user when the activity is added to a workflow in the Workflow
+ /// Designer.
+ /// We could add code to verify that the log file path already exists on
+ /// the server that is hosting the FIM Portal and check that the activity
+ /// has permission to write to that location. However, the code
+ /// would only check if the log file path exists when the
+ /// activity is added to a workflow in the workflow designer. This class
+ /// will not be used when the activity is actually run.
+ /// For this activity we will just return true.
+ ///
+ public override bool ValidateInputs()
+ {
+ return true;
+ }
+ }
+}
diff --git a/Granfeldt.FIM.ActivityLibrary/Activity.CodeRun/Activity.CodeRun.cs b/Granfeldt.FIM.ActivityLibrary/Activity.CodeRun/Activity.CodeRun.cs
index 6335e96..1469e0c 100644
--- a/Granfeldt.FIM.ActivityLibrary/Activity.CodeRun/Activity.CodeRun.cs
+++ b/Granfeldt.FIM.ActivityLibrary/Activity.CodeRun/Activity.CodeRun.cs
@@ -5,6 +5,8 @@
// due to clashes with built-in naming convention
// January 18, 2013 | Soren Granfeldt
// - changed update to use helper update activity
+// December 16, 2015 | soren granfeldt
+// - changed logging to tuse tracer
using System;
using System.CodeDom.Compiler;
@@ -41,7 +43,7 @@ namespace Granfeldt.FIM.ActivityLibrary
{
get
{
- return ((Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType)(base.GetValue(Granfeldt.FIM.ActivityLibrary.CodeRunActivity.TargetResourceProperty)));
+ return ((ResourceType)(base.GetValue(Granfeldt.FIM.ActivityLibrary.CodeRunActivity.TargetResourceProperty)));
}
set
{
@@ -187,19 +189,19 @@ namespace Granfeldt.FIM.ActivityLibrary
private void MoreParametersToResolve_Condition(object sender, ConditionalEventArgs e)
{
- Debugging.Log("Activity initialized");
+ Tracer.Enter("Activity initialized");
// we need to convert the string array to a list to
// be able to remove values
if (UnresolvedParameters == null)
{
UnresolvedParameters = this.Parameters.ToList();
- Debugging.Log("Resolving parameters");
+ Tracer.TraceInformation("Resolving parameters");
}
e.Result = false;
if (UnresolvedParameters.Count > 0)
{
this.ResolveParameterValue.GrammarExpression = UnresolvedParameters[0];
- Debugging.Log("Resolving", UnresolvedParameters[0]);
+ Tracer.TraceInformation("Resolving {0}", UnresolvedParameters[0]);
UnresolvedParameters.RemoveAt(0);
e.Result = true;
}
@@ -208,15 +210,15 @@ namespace Granfeldt.FIM.ActivityLibrary
private void SaveResolvedValue_ExecuteCode(object sender, EventArgs e)
{
ResolvedParameters.Add(HttpUtility.HtmlDecode(this.ResolveParameterValue.ResolvedExpression));
- Debugging.Log("Resolved to", HttpUtility.HtmlDecode(this.ResolveParameterValue.ResolvedExpression));
+ Tracer.TraceInformation("Resolved to {0}", HttpUtility.HtmlDecode(this.ResolveParameterValue.ResolvedExpression));
}
private void NonExistingGrammarException_ExecuteCode(object sender, EventArgs e)
{
- // if we get here, the resolve has failed. If the value that we're
- // trying to resolve doesn't exist, we also get here. We
- // assume that there is no value and set value to null
- Debugging.Log("Missing value or invalid XPath reference (returning [null])", this.ResolveParameterValue.GrammarExpression);
+ // if we get here, the resolve has failed. If the value that we're
+ // trying to resolve doesn't exist, we also get here. We
+ // assume that there is no value and set value to null
+ Tracer.TraceError("Missing value or invalid XPath reference (returning [null]) {0}", this.ResolveParameterValue.GrammarExpression);
ResolvedParameters.Add(null);
}
@@ -246,7 +248,7 @@ namespace Granfeldt.FIM.ActivityLibrary
{
compileErrors.AppendFormat("Compile Error: {0} in Ln {2} Col {3}-{1}\r\n", ce.ErrorNumber, ce.ErrorText, ce.Line, ce.Column);
}
- Debugging.Log(new Exception("Couldn't compile\r\n" + compileErrors));
+ Tracer.TraceError("Couldn't compile {0}\r\n" + compileErrors);
}
Assembly assembly = cr.CompiledAssembly;
compiled = assembly.CreateInstance("FIMDynamicClass");
@@ -256,18 +258,18 @@ namespace Granfeldt.FIM.ActivityLibrary
{
if (compiled == null)
{
- Debugging.Log(new NullReferenceException("Code must contain a class named FIMDynamicClass and that class must contain a method called FIMDynamicFunction"));
+ Tracer.TraceError("Code must contain a class named FIMDynamicClass and that class must contain a method called FIMDynamicFunction");
}
- Debugging.Log("Parameter count", ResolvedParameters.Count);
+ Tracer.TraceInformation("Parameter count {0}", ResolvedParameters.Count);
foreach (object param in ResolvedParameters)
{
- Debugging.Log("Adding parameter", param);
+ Tracer.TraceInformation("Adding parameter {0}", param);
}
MethodInfo mi = compiled.GetType().GetMethod("FIMDynamicFunction");
- Debugging.Log("Executing code");
+ Tracer.TraceInformation("Executing code");
codeReturnValue = mi.Invoke(compiled, ResolvedParameters.ToArray());
- Debugging.Log("Code executed");
- Debugging.Log("Code return value", codeReturnValue);
+ Tracer.TraceInformation("Code executed");
+ Tracer.TraceInformation("Code return value {0}", codeReturnValue);
}
private void ShouldUpdateTarget_Condition(object sender, ConditionalEventArgs e)
@@ -275,7 +277,9 @@ namespace Granfeldt.FIM.ActivityLibrary
// try to get parent workflow.
if (!SequentialWorkflow.TryGetContainingWorkflow(this, out containingWorkflow))
{
- throw new InvalidOperationException("Could not get parent workflow");
+ string errorMessage = "Could not get parent workflow";
+ Tracer.TraceError(errorMessage);
+ throw new InvalidOperationException(errorMessage);
}
StringUtilities.ExtractWorkflowExpression(this.Destination, out destinationObject, out destinationAttribute);
@@ -300,7 +304,7 @@ namespace Granfeldt.FIM.ActivityLibrary
}
else
{
- Debugging.Log(new Exception("Could not resolved destination. Please specify as [//Target/Attribute] or [//WorkflowData/Parameter]"));
+ Tracer.TraceError("Could not resolved destination. Please specify as [//Target/Attribute] or [//WorkflowData/Parameter]");
}
}
@@ -311,12 +315,12 @@ namespace Granfeldt.FIM.ActivityLibrary
// assume that there is no value and set source value to null
// which effectively results in a 'Delete' operation on
// the target attribute value (if present)
- Debugging.Log("Error: Argument Exception");
+ Tracer.TraceError("Error: Argument Exception");
}
private void ExitGracefully_ExecuteCode(object sender, EventArgs e)
{
- Debugging.Log("Activity exited");
+ Tracer.TraceInformation("Activity exited");
}
}
}
diff --git a/Granfeldt.FIM.ActivityLibrary/Base/Base.ActivitySettings/Base.ActivitySettings.cs b/Granfeldt.FIM.ActivityLibrary/Base/Base.ActivitySettings/Base.ActivitySettings.cs
index 489367c..eeb3d65 100644
--- a/Granfeldt.FIM.ActivityLibrary/Base/Base.ActivitySettings/Base.ActivitySettings.cs
+++ b/Granfeldt.FIM.ActivityLibrary/Base/Base.ActivitySettings/Base.ActivitySettings.cs
@@ -12,11 +12,6 @@ namespace Granfeldt.FIM.ActivityLibrary
class BaseActivitySettingsPart : ActivitySettingsPart
{
- #region Utility Functions
-
- ///
- /// Create a TableRow that contains a label and a textbox.
- ///
protected TableRow AddTableRowTextBox(String labelText, String controlID, int width, int maxLength, Boolean multiLine, String defaultValue)
{
TableRow row = new TableRow();
@@ -45,8 +40,60 @@ namespace Granfeldt.FIM.ActivityLibrary
return row;
}
- #region Lookup Action Dropdown
+ protected void SetDropdownSelectedValue(string dropDownListID, string value)
+ {
+ DropDownList ddl = (DropDownList)this.FindControl(dropDownListID);
+ if (ddl != null)
+ {
+ if (!string.IsNullOrEmpty(value))
+ ddl.SelectedValue = value;
+ }
+ else
+ Debugging.Log("Cannot find control with ID '" + dropDownListID + "'");
+ }
+ protected TableRow AddAddRemoveDropDownList(string labelText, string controlID, int width, string defaultValue)
+ {
+ TableRow row = new TableRow();
+ TableCell labelCell = new TableCell();
+ TableCell controlCell = new TableCell();
+
+ Label oLabel = new Label();
+ oLabel.Text = labelText;
+ oLabel.CssClass = base.LabelCssClass;
+ labelCell.Controls.Add(oLabel);
+
+ DropDownList ddl = new DropDownList();
+ ddl.ID = controlID;
+ ddl.Width = width;
+
+ ddl.Items.Add(new ListItem("Add", "Add"));
+ ddl.Items.Add(new ListItem("Remove", "Remove"));
+ ddl.SelectedValue = defaultValue;
+ controlCell.Controls.Add(ddl);
+
+ row.Cells.Add(labelCell);
+ row.Cells.Add(controlCell);
+
+ return row;
+ }
+ protected void SetAddRemoveDropDownList(string dropDownListID, string value)
+ {
+ SetDropdownSelectedValue(dropDownListID, value);
+ }
+ protected string GetAddRemoveDropDownList(string dropDownListID)
+ {
+ string g = "";
+ DropDownList ddl = (DropDownList)this.FindControl(dropDownListID);
+ if (ddl != null)
+ {
+ if (!string.IsNullOrEmpty(ddl.SelectedValue))
+ g = ddl.SelectedValue.ToString();
+ }
+ else
+ Debugging.Log("Cannot find control with ID '" + dropDownListID + "'");
+ return g;
+ }
protected TableRow AddLookupActionDropDownList(String labelText, String controlID, int width, String defaultValue)
{
TableRow row = new TableRow();
@@ -91,20 +138,9 @@ namespace Granfeldt.FIM.ActivityLibrary
protected void SetLookupActionDropDownList(string dropDownListID, string value)
{
- DropDownList ddl = (DropDownList)this.FindControl(dropDownListID);
- if (ddl != null)
- {
- if (!string.IsNullOrEmpty(value))
- ddl.SelectedValue = value;
- }
- else
- Debugging.Log("Cannot find control with ID '" + dropDownListID + "'");
+ SetDropdownSelectedValue(dropDownListID, value);
}
- #endregion
-
- #region Actor Dropdown
-
protected TableRow AddActorDropDownList(String labelText, String controlID, int width, String defaultValue)
{
TableRow row = new TableRow();
@@ -151,20 +187,11 @@ namespace Granfeldt.FIM.ActivityLibrary
return g;
}
- protected void SetActorDropDownList(string dropDownListID, object Guid)
+ protected void SetActorDropDownList(string dropDownListID, object value)
{
- DropDownList ddl = (DropDownList)this.FindControl(dropDownListID);
- if (ddl != null)
- {
- if (Guid != null)
- ddl.SelectedValue = Guid.ToString();
- }
- else
- Debugging.Log("Cannot find control with ID '" + dropDownListID + "'");
+ SetDropdownSelectedValue(dropDownListID, value.ToString());
}
- #endregion
-
protected TableRow AddCheckbox(String labelText, String controlID, bool defaultValue)
{
TableRow row = new TableRow();
@@ -266,7 +293,6 @@ namespace Granfeldt.FIM.ActivityLibrary
Debugging.Log("Cannot find control with ID '" + dropDownListID + "'");
}
- #endregion
///
/// Called when a user clicks the Save button in the Workflow Designer.
diff --git a/Granfeldt.FIM.ActivityLibrary/Base/Base.AttributeValue/Base.AttributeValue.cs b/Granfeldt.FIM.ActivityLibrary/Base/Base.AttributeValue/Base.AttributeValue.cs
index e4abb25..94a38f1 100644
--- a/Granfeldt.FIM.ActivityLibrary/Base/Base.AttributeValue/Base.AttributeValue.cs
+++ b/Granfeldt.FIM.ActivityLibrary/Base/Base.AttributeValue/Base.AttributeValue.cs
@@ -7,182 +7,180 @@ using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
namespace Granfeldt.FIM.ActivityLibrary
{
- public class AttributeValue
- {
- //Constructors
- ///
- /// Creates a new instance of the object type AttributeValue.
- ///
- public AttributeValue()
- {
- this.IsResolved = false;
- }
- ///
- /// Creates a new instance of the object type AttributeValue, and sets source and target attribute name.
- ///
- /// Name of the source attribute.
- /// Name of the target attribute.
- public AttributeValue(string sourceAttributeName, string targetAttributeName)
- {
- this.SourceAttributeName = sourceAttributeName;
- this.TargetAttributeName = targetAttributeName;
- this.IsResolved = false;
- }
- //Fields
- private object _sourceAttributeValue;
+ public class AttributeValue
+ {
+ //Constructors
+ ///
+ /// Creates a new instance of the object type AttributeValue.
+ ///
+ public AttributeValue()
+ {
+ this.IsResolved = false;
+ }
+ ///
+ /// Creates a new instance of the object type AttributeValue, and sets source and target attribute name.
+ ///
+ /// Name of the source attribute.
+ /// Name of the target attribute.
+ public AttributeValue(string sourceAttributeName, string targetAttributeName)
+ {
+ this.SourceAttributeName = sourceAttributeName;
+ this.TargetAttributeName = targetAttributeName;
+ this.IsResolved = false;
+ }
+ //Fields
+ private object _sourceAttributeValue;
- //Properties
- public string SourceAttributeName { get; set; }
- public object SourceAttributeValue
- {
- get
- {
- return this._sourceAttributeValue;
- }
- set
- {
- this._sourceAttributeValue = value;
- this.IsResolved = true;
- }
- }
- public string TargetAttributeName { get; set; }
- public object TargetAttributeValue { get; set; }
- public bool IsDelete { get; private set; }
- ///
- /// Indicates if the SourceAttributeName have been resolved.
- /// This is set when SourceAttributeValue is set.
- ///
- public bool IsResolved { get; private set; }
- ///
- /// Tells if the SourceAttributeValue should be resolved from SourceAttributeName.
- /// It is decided by testing if the SourceAttributeName contains a resolveable string.
- ///
- public bool ShouldResolve
- {
- get
- {
- if (this.IsResolved)
- {
- return false;
- }
- else
- {
- if (this.SourceAttributeName != null)
- return this.SourceAttributeName.Trim().Contains("[//");
- else
- return false;
- }
- }
- }
+ //Properties
+ public string SourceAttributeName { get; set; }
+ public object SourceAttributeValue
+ {
+ get
+ {
+ return this._sourceAttributeValue;
+ }
+ set
+ {
+ this._sourceAttributeValue = value;
+ this.IsResolved = true;
+ }
+ }
+ public string TargetAttributeName { get; set; }
+ public object TargetAttributeValue { get; set; }
+ public bool IsDelete { get; private set; }
+ ///
+ /// Indicates if the SourceAttributeName have been resolved.
+ /// This is set when SourceAttributeValue is set.
+ ///
+ public bool IsResolved { get; private set; }
+ ///
+ /// Tells if the SourceAttributeValue should be resolved from SourceAttributeName.
+ /// It is decided by testing if the SourceAttributeName contains a resolveable string.
+ ///
+ public bool ShouldResolve
+ {
+ get
+ {
+ if (this.IsResolved)
+ {
+ return false;
+ }
+ else
+ {
+ if (this.SourceAttributeName != null)
+ return this.SourceAttributeName.Trim().Contains("[//");
+ else
+ return false;
+ }
+ }
+ }
- #region Methods
- ///
- /// Returns this AttributeValue as an UpdateRequestParameter used for updating resources in FIM.
- ///
- /// ObjectID of the resource being updated.
- /// Tells the method what type of update to return.
- /// If isDelete is true a UpdateMode is set to: Remove.
- ///
- ///
- public UpdateRequestParameter ToUpdateRequestParameter(Guid objectId,bool isDelete)
- {
- if (!isDelete)
- return new UpdateRequestParameter(objectId, this.TargetAttributeName, UpdateMode.Modify, FIMAttributeUtilities.FormatValue(this.SourceAttributeValue), false);
- else
- {
- return new UpdateRequestParameter(objectId, this.TargetAttributeName, UpdateMode.Remove, this.TargetAttributeValue, false);
- }
- }
- ///
- /// Returns this AttributeValue as an UpdateRequestParameter used for updating resources in FIM, without specifying which object to update.
- ///
- /// Tells the method what type of update to return.
- /// If isDelete is true a UpdateMode is set to: Remove.
- ///
- public UpdateRequestParameter ToUpdateRequestParameter(bool isDelete)
- {
+ #region Methods
+ ///
+ /// Returns this AttributeValue as an UpdateRequestParameter used for updating resources in FIM.
+ ///
+ /// ObjectID of the resource being updated.
+ /// Tells the method what type of update to return.
+ /// If isDelete is true a UpdateMode is set to: Remove.
+ ///
+ ///
+ public UpdateRequestParameter ToUpdateRequestParameter(Guid objectId, bool isDelete)
+ {
+ if (!isDelete)
+ return new UpdateRequestParameter(objectId, this.TargetAttributeName, UpdateMode.Modify, FIMAttributeUtilities.FormatValue(this.SourceAttributeValue), false);
+ else
+ {
+ return new UpdateRequestParameter(objectId, this.TargetAttributeName, UpdateMode.Remove, this.TargetAttributeValue, false);
+ }
+ }
+ ///
+ /// Returns this AttributeValue as an UpdateRequestParameter used for updating resources in FIM, without specifying which object to update.
+ ///
+ /// Tells the method what type of update to return.
+ /// If isDelete is true a UpdateMode is set to: Remove.
+ ///
+ public UpdateRequestParameter ToUpdateRequestParameter(bool isDelete)
+ {
- if (!isDelete)
- return new UpdateRequestParameter(this.TargetAttributeName, UpdateMode.Modify, FIMAttributeUtilities.FormatValue(this.SourceAttributeValue), false);
- else
- {
- return new UpdateRequestParameter(this.TargetAttributeName, UpdateMode.Remove, this.TargetAttributeValue, false);
- }
-
- }
- ///
- /// Compares the source value with the supplied readValue parameter.
- /// Also sets IsDelete to true or false
- ///
- /// A value to compare with the SourceValue.
- ///
- public virtual bool ShouldUpdate(object readValue)
- {
-
+ if (!isDelete)
+ return new UpdateRequestParameter(this.TargetAttributeName, UpdateMode.Modify, FIMAttributeUtilities.FormatValue(this.SourceAttributeValue), false);
+ else
+ {
+ return new UpdateRequestParameter(this.TargetAttributeName, UpdateMode.Remove, this.TargetAttributeValue, false);
+ }
- // we need the original (non-converted) value if we are doing a removal as we must specify the original value (even a local date/time)
- // object originalTargetValue = this.TargetAttributeValue;
- object target = FIMAttributeUtilities.FormatValue(readValue);
- object source = FIMAttributeUtilities.FormatValue(this.SourceAttributeValue);
+ }
+ ///
+ /// Compares the source value with the supplied readValue parameter.
+ /// Also sets IsDelete to true or false
+ ///
+ /// A value to compare with the SourceValue.
+ ///
+ public virtual bool ShouldUpdate(object readValue)
+ {
+ // we need the original (non-converted) value if we are doing a removal as we must specify the original value (even a local date/time)
+ // object originalTargetValue = this.TargetAttributeValue;
+ object target = FIMAttributeUtilities.FormatValue(readValue);
+ object source = FIMAttributeUtilities.FormatValue(this.SourceAttributeValue);
- return getShouldUpdate(target, source);
- }
- ///
- /// Compares the Target attribute value with the existing source attribute value. If the source attribute value is not set,
- /// it will be compared on as a null value.
- ///
- /// Result of compare
- public virtual bool ShouldUpdate()
- {
- object target = FIMAttributeUtilities.FormatValue(this.TargetAttributeValue);
- object source = FIMAttributeUtilities.FormatValue(this.SourceAttributeValue);
+ return getShouldUpdate(target, source);
+ }
+ ///
+ /// Compares the Target attribute value with the existing source attribute value. If the source attribute value is not set,
+ /// it will be compared on as a null value.
+ ///
+ /// Result of compare
+ public virtual bool ShouldUpdate()
+ {
+ object target = FIMAttributeUtilities.FormatValue(this.TargetAttributeValue);
+ object source = FIMAttributeUtilities.FormatValue(this.SourceAttributeValue);
- Debugging.Log(String.Format("Comparing source: {0} and target: {1}, containing the values: {2} / {3}", this.SourceAttributeName, this.TargetAttributeName, this.SourceAttributeValue, this.TargetAttributeValue));
- bool result = getShouldUpdate(target, source);
- Debugging.Log(String.Format("Comparison resulted in: {0}",result));
- return result;
- }
- ///
- /// Private method for comparing Source and Target attributes
- ///
- /// Taget value
- /// Source value
- /// Whether or not the target attribute should be updated.
- private bool getShouldUpdate(object target, object source)
- {
- if (FIMAttributeUtilities.ValuesAreDifferent(source, target))
- {
- if (source == null)
- {
- // we are in a delete state
- Debugging.Log(string.Format("Deleting value '{1}' from {0}", this.TargetAttributeName, target == null ? "(null)" : target));
- this.IsDelete = true;
- }
- else
- {
- // we are in an update state
- Debugging.Log(string.Format("Updating {0} from '{1}' to '{2}'", this.TargetAttributeName, target == null ? "(null)" : target, source));
- this.IsDelete = false;
- }
- return true;
- }
- else
- {
- Debugging.Log(string.Format("No need to update {0}. Value is already {1}", this.TargetAttributeName, this.TargetAttributeValue == null ? "(null)" : this.TargetAttributeValue));
- this.IsDelete = false;
- return false;
- }
- }
- ///
- /// Sets the TargetAttributeValue on this AttributeValue based on the it's current TargetAttributeName.
- ///
- /// the ResourceType object to pull the attribute value from.
- internal virtual void SetValues(ResourceType resource)
- {
- TargetAttributeValue = resource[this.TargetAttributeName] != null ? resource[this.TargetAttributeName] : null;
- Debugging.Log(this.TargetAttributeName, this.TargetAttributeValue);
- }
- #endregion
- }
+ Debugging.Log(String.Format("Comparing source: {0} and target: {1}, containing the values: {2} / {3}", this.SourceAttributeName, this.TargetAttributeName, this.SourceAttributeValue, this.TargetAttributeValue));
+ bool result = getShouldUpdate(target, source);
+ Debugging.Log(String.Format("Comparison resulted in: {0}", result));
+ return result;
+ }
+ ///
+ /// Private method for comparing Source and Target attributes
+ ///
+ /// Taget value
+ /// Source value
+ /// Whether or not the target attribute should be updated.
+ private bool getShouldUpdate(object target, object source)
+ {
+ if (FIMAttributeUtilities.ValuesAreDifferent(source, target))
+ {
+ if (source == null)
+ {
+ // we are in a delete state
+ Debugging.Log(string.Format("Deleting value '{1}' from {0}", this.TargetAttributeName, target == null ? "(null)" : target));
+ this.IsDelete = true;
+ }
+ else
+ {
+ // we are in an update state
+ Debugging.Log(string.Format("Updating {0} from '{1}' to '{2}'", this.TargetAttributeName, target == null ? "(null)" : target, source));
+ this.IsDelete = false;
+ }
+ return true;
+ }
+ else
+ {
+ Debugging.Log(string.Format("No need to update {0}. Value is already {1}", this.TargetAttributeName, this.TargetAttributeValue == null ? "(null)" : this.TargetAttributeValue));
+ this.IsDelete = false;
+ return false;
+ }
+ }
+ ///
+ /// Sets the TargetAttributeValue on this AttributeValue based on the it's current TargetAttributeName.
+ ///
+ /// the ResourceType object to pull the attribute value from.
+ internal virtual void SetValues(ResourceType resource)
+ {
+ TargetAttributeValue = resource[this.TargetAttributeName] != null ? resource[this.TargetAttributeName] : null;
+ Debugging.Log(this.TargetAttributeName, this.TargetAttributeValue);
+ }
+ #endregion
+ }
}
diff --git a/Granfeldt.FIM.ActivityLibrary/Base/Base.Common/Base.Common.cs b/Granfeldt.FIM.ActivityLibrary/Base/Base.Common/Base.Common.cs
index c14e487..ad59b64 100644
--- a/Granfeldt.FIM.ActivityLibrary/Base/Base.Common/Base.Common.cs
+++ b/Granfeldt.FIM.ActivityLibrary/Base/Base.Common/Base.Common.cs
@@ -10,7 +10,6 @@ using Microsoft.Win32;
namespace Granfeldt.FIM.ActivityLibrary
{
-
public class WellKnownGuids
{
public static Guid BuiltInSynchronizationAccount = new Guid("fb89aefa-5ea1-47f1-8890-abe7797d6497");
diff --git a/Granfeldt.FIM.ActivityLibrary/Base/Helper.AddRemoveMultiValueAsNeededActivity.Designer.cs b/Granfeldt.FIM.ActivityLibrary/Base/Helper.AddRemoveMultiValueAsNeededActivity.Designer.cs
new file mode 100644
index 0000000..c1c9cf2
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Base/Helper.AddRemoveMultiValueAsNeededActivity.Designer.cs
@@ -0,0 +1,119 @@
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Collections;
+using System.Reflection;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Design;
+using System.Workflow.ComponentModel.Compiler;
+using System.Workflow.ComponentModel.Serialization;
+using System.Workflow.Runtime;
+using System.Workflow.Activities;
+using System.Workflow.Activities.Rules;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ public partial class AddRemoveMultiValueActivityAsNeeded
+ {
+ #region Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ [System.Diagnostics.DebuggerNonUserCode]
+ [System.CodeDom.Compiler.GeneratedCode("", "")]
+ private void InitializeComponent()
+ {
+ this.CanModifyActivities = true;
+ System.Workflow.Activities.CodeCondition codecondition1 = new System.Workflow.Activities.CodeCondition();
+ System.Workflow.ComponentModel.ActivityBind activitybind1 = new System.Workflow.ComponentModel.ActivityBind();
+ this.UpdateTarget = new Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity();
+ this.NothingToDo = new System.Workflow.Activities.IfElseBranchActivity();
+ this.DoUpdate = new System.Workflow.Activities.IfElseBranchActivity();
+ this.ShouldUpdate = new System.Workflow.Activities.IfElseActivity();
+ this.ReadTarget = new Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity();
+ this.PrepareReadResource = new System.Workflow.Activities.CodeActivity();
+ //
+ // UpdateTarget
+ //
+ this.UpdateTarget.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.UpdateTarget.ApplyAuthorizationPolicy = false;
+ this.UpdateTarget.Name = "UpdateTarget";
+ this.UpdateTarget.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.UpdateTarget.UpdateParameters = null;
+ //
+ // NothingToDo
+ //
+ this.NothingToDo.Name = "NothingToDo";
+ //
+ // DoUpdate
+ //
+ this.DoUpdate.Activities.Add(this.UpdateTarget);
+ codecondition1.Condition += new System.EventHandler(this.ShouldUpdate_Condition);
+ this.DoUpdate.Condition = codecondition1;
+ this.DoUpdate.Name = "DoUpdate";
+ //
+ // ShouldUpdate
+ //
+ this.ShouldUpdate.Activities.Add(this.DoUpdate);
+ this.ShouldUpdate.Activities.Add(this.NothingToDo);
+ this.ShouldUpdate.Name = "ShouldUpdate";
+ //
+ // ReadTarget
+ //
+ this.ReadTarget.ActorId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.ReadTarget.Name = "ReadTarget";
+ activitybind1.Name = "AddRemoveMultiValueActivityAsNeeded";
+ activitybind1.Path = "TargetResource";
+ this.ReadTarget.ResourceId = new System.Guid("00000000-0000-0000-0000-000000000000");
+ this.ReadTarget.SelectionAttributes = null;
+ this.ReadTarget.SetBinding(Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity.ResourceProperty, ((System.Workflow.ComponentModel.ActivityBind)(activitybind1)));
+ //
+ // PrepareReadResource
+ //
+ this.PrepareReadResource.Name = "PrepareReadResource";
+ this.PrepareReadResource.ExecuteCode += new System.EventHandler(this.PrepareReadResource_ExecuteCode);
+ //
+ // AddRemoveMultiValueActivityAsNeeded
+ //
+ this.Activities.Add(this.PrepareReadResource);
+ this.Activities.Add(this.ReadTarget);
+ this.Activities.Add(this.ShouldUpdate);
+ this.Name = "AddRemoveMultiValueActivityAsNeeded";
+ this.CanModifyActivities = false;
+
+ }
+
+ #endregion
+
+ private CodeActivity PrepareReadResource;
+
+ private Microsoft.ResourceManagement.Workflow.Activities.ReadResourceActivity ReadTarget;
+
+ private IfElseBranchActivity NothingToDo;
+
+ private IfElseBranchActivity DoUpdate;
+
+ private IfElseActivity ShouldUpdate;
+
+ private Microsoft.ResourceManagement.Workflow.Activities.UpdateResourceActivity UpdateTarget;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ }
+}
diff --git a/Granfeldt.FIM.ActivityLibrary/Base/Helper.AddRemoveMultiValueAsNeededActivity.cs b/Granfeldt.FIM.ActivityLibrary/Base/Helper.AddRemoveMultiValueAsNeededActivity.cs
new file mode 100644
index 0000000..09dbd4e
--- /dev/null
+++ b/Granfeldt.FIM.ActivityLibrary/Base/Helper.AddRemoveMultiValueAsNeededActivity.cs
@@ -0,0 +1,221 @@
+using System;
+using System.ComponentModel;
+using System.ComponentModel.Design;
+using System.Collections;
+using System.Collections.Generic;
+using System.Linq;
+using System.Workflow.ComponentModel;
+using System.Workflow.ComponentModel.Design;
+using System.Workflow.ComponentModel.Compiler;
+using System.Workflow.ComponentModel.Serialization;
+using System.Workflow.Runtime;
+using System.Workflow.Activities;
+using System.Workflow.Activities.Rules;
+using Microsoft.ResourceManagement.Workflow.Activities;
+using System.Collections.ObjectModel;
+using Microsoft.ResourceManagement.WebServices;
+using Microsoft.ResourceManagement.WebServices.WSResourceManagement;
+
+namespace Granfeldt.FIM.ActivityLibrary
+{
+ public partial class AddRemoveMultiValueActivityAsNeeded : SequenceActivity
+ {
+ public static DependencyProperty ActionProperty = DependencyProperty.Register("Action", typeof(System.String), typeof(AddRemoveMultiValueActivityAsNeeded));
+ public static DependencyProperty TargetResourceProperty = DependencyProperty.Register("TargetResource", typeof(Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType), typeof(AddRemoveMultiValueActivityAsNeeded));
+ public static DependencyProperty DestinationProperty = DependencyProperty.Register("Destination", typeof(string), typeof(AddRemoveMultiValueActivityAsNeeded));
+
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
+ [BrowsableAttribute(true)]
+ [CategoryAttribute("Misc")]
+ public String Action
+ {
+ get
+ {
+ return ((string)(base.GetValue(ActionProperty)));
+ }
+ set
+ {
+ base.SetValue(ActionProperty, value);
+ }
+ }
+
+ public static DependencyProperty TargetIdToUpdateProperty = DependencyProperty.Register("TargetIdToUpdate", typeof(Guid), typeof(AddRemoveMultiValueActivityAsNeeded));
+ [Description("TargetIdToUpdate")]
+ [Category("TargetIdToUpdate Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public Guid TargetIdToUpdate
+ {
+ get
+ {
+ return ((Guid)(base.GetValue(AddRemoveMultiValueActivityAsNeeded.TargetIdToUpdateProperty)));
+ }
+ set
+ {
+ base.SetValue(AddRemoveMultiValueActivityAsNeeded.TargetIdToUpdateProperty, value);
+ }
+ }
+
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ [Category("Properties")]
+ public string Destination
+ {
+ get
+ {
+ return (string)base.GetValue(DestinationProperty);
+ }
+ set
+ {
+ base.SetValue(DestinationProperty, value);
+ }
+ }
+
+ public static DependencyProperty ValueToAddOrRemoveProperty = DependencyProperty.Register("ValueToAddOrRemove", typeof(object), typeof(AddRemoveMultiValueActivityAsNeeded));
+ [Description("ValueToAddOrRemove")]
+ [Category("ValueToAddOrRemove Category")]
+ [Browsable(true)]
+ [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
+ public object ValueToAddOrRemove
+ {
+ get
+ {
+ return ((object)(base.GetValue(AddRemoveMultiValueActivityAsNeeded.ValueToAddOrRemoveProperty)));
+ }
+ set
+ {
+ base.SetValue(AddRemoveMultiValueActivityAsNeeded.ValueToAddOrRemoveProperty, value);
+ }
+ }
+
+ [DesignerSerializationVisibilityAttribute(DesignerSerializationVisibility.Visible)]
+ [BrowsableAttribute(true)]
+ [CategoryAttribute("Parameters")]
+ public Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType TargetResource
+ {
+ get
+ {
+ return ((Microsoft.ResourceManagement.WebServices.WSResourceManagement.ResourceType)(base.GetValue(TargetResourceProperty)));
+ }
+ set
+ {
+ base.SetValue(TargetResourceProperty, value);
+ }
+ }
+
+ SequentialWorkflow containingWorkflow;
+ List