public void AddStep(ICrmEntity plugin, CrmPluginStep step) { if (step == null) { throw new ArgumentNullException("step"); } if (plugin == null) { throw new ArgumentNullException("plugin"); } if (plugin is CrmPlugin crmPlugin) { if (!crmPlugin.Steps.ContainsKey(step.StepId)) { crmPlugin.AddStep(step); return; } } //if (plugin is CrmServiceEndpoint crmServiceEndpoint) //{ // if (!crmServiceEndpoint.Steps.ContainsKey(step.StepId)) // { // crmServiceEndpoint.AddStep(step); // return; // } //} ValidateEntity(step); m_stepList.Add(step.StepId, step); }
public void ClearSteps(Guid pluginId) { CrmPluginStep[] stepList; if (pluginId == Guid.Empty) { m_imageList.Clear(); //Copy the list of steps. Can't use the enumerator because we are changing the underlying data stepList = new CrmPluginStep[m_stepList.Count]; m_stepList.Values.CopyTo(stepList, 0); } else if (m_pluginList.ContainsKey(pluginId)) { //Copy the list of steps. Can't use the enumerator because we are changing the underlying data stepList = m_pluginList[pluginId].Steps.ToArray(); } else { throw new ArgumentException("Invalid Entity Id", "pluginId"); } //Loop through the step id's foreach (CrmPluginStep step in stepList) { RemoveStep(step.PluginId, step.StepId); } }
private void ValidateEntity(CrmPluginStep step) { if (step == null) { throw new ArgumentNullException(); } else if (m_stepList.ContainsKey(step.StepId)) { throw new ArgumentException("Step is already in the list"); } else if (step.Organization != this) { throw new ArgumentException("Organization must match"); } else if (step.AssemblyId == Guid.Empty) { throw new ArgumentException("AssemblyId must be set to valid Guid"); } else if (step.PluginId == Guid.Empty) { throw new ArgumentException("PluginId must be set to valid Guid"); } else if (step.StepId == Guid.Empty) { throw new ArgumentException("StepId must be set to valid Guid"); } }
public void RemoveStep(CrmPlugin plugin, Guid stepId) { if (plugin == null) { throw new ArgumentNullException("plugin"); } else if (plugin.Steps.ContainsKey(stepId)) { plugin.RemoveStep(stepId); } else if (m_stepList.ContainsKey(stepId)) { CrmPluginStep step = m_stepList[stepId]; //Copy the list of images. Can't use the enumerator because we are changing the underlying data Guid[] imageIdList = new Guid[step.Images.Count]; step.Images.Keys.CopyTo(imageIdList, 0); //Loop through the image id's foreach (Guid imageId in imageIdList) { RemoveImage(step, imageId); } m_stepList.Remove(stepId); } else { throw new ArgumentException("Step is not in list", "stepId"); } }
public Dictionary<string, object> GenerateCrmEntities() { if (Organization != null) { CrmPluginStep step = Organization[AssemblyId][PluginId][StepId]; return GenerateCrmEntities(step.MessageId, step.MessageEntityId); } return GenerateCrmEntities(Guid.Empty, Guid.Empty); }
public CrmPluginStep Clone(bool includeOrganization) { CrmPluginStep newStep; if (includeOrganization) { newStep = new CrmPluginStep(m_org); } else { newStep = new CrmPluginStep(null); } newStep.m_assemblyId = m_assemblyId; newStep.UnsecureConfiguration = UnsecureConfiguration; newStep.m_createdOn = m_createdOn; newStep.m_customizationLevel = m_customizationLevel; newStep.Deployment = Deployment; newStep.Name = Name; newStep.Enabled = Enabled; newStep.MessageEntityId = MessageEntityId; newStep.m_filteringAttributes = m_filteringAttributes; newStep.ImpersonatingUserId = ImpersonatingUserId; newStep.InvocationSource = InvocationSource; newStep.MessageId = MessageId; newStep.Mode = Mode; newStep.m_modifiedOn = m_modifiedOn; newStep.m_pluginId = m_pluginId; newStep.Rank = Rank; newStep.SecureConfiguration = SecureConfiguration; newStep.SecureConfigurationId = SecureConfigurationId; newStep.Stage = Stage; newStep.StepId = StepId; newStep.m_serviceBusConfigurationId = m_serviceBusConfigurationId; //Create a new image list Dictionary <Guid, CrmPluginImage> newImageList = new Dictionary <Guid, CrmPluginImage>(); foreach (CrmPluginImage image in m_imageList.Values) { //Clone the image CrmPluginImage clonedImage = image.Clone(includeOrganization); //Add the image to the new list newImageList.Add(clonedImage.ImageId, clonedImage); } //Assign the list to the new object newStep.m_imageList = newImageList; return(newStep); }
public void AddStep(CrmPluginStep step) { if (step == null) { throw new ArgumentNullException("step"); } m_stepList.Add(step.StepId, step); if (Organization != null) { Organization.AddStep(this, step); } }
public void RemoveImage(CrmPluginStep step, Guid imageId) { if (step == null) { throw new ArgumentNullException("step"); } else if (step.Images.ContainsKey(imageId)) { step.RemoveImage(imageId); } else if (m_imageList.ContainsKey(imageId)) { m_imageList.Remove(imageId); } else { throw new ArgumentException("Image is not in list", "step"); } }
public CrmPlugin Clone(bool includeOrganization) { CrmPlugin newPlugin; if (includeOrganization) { newPlugin = new CrmPlugin(m_org); } else { newPlugin = new CrmPlugin(null); } newPlugin.m_assemblyName = m_assemblyName; newPlugin.m_createdOn = m_createdOn; newPlugin.m_customizationLevel = m_customizationLevel; newPlugin.m_friendlyName = m_friendlyName; newPlugin.m_friendlyNameIgnore = m_friendlyNameIgnore; newPlugin.m_isolatable = m_isolatable; newPlugin.m_modifiedOn = m_modifiedOn; newPlugin.m_pluginAssemblyId = m_pluginAssemblyId; newPlugin.m_pluginId = m_pluginId; newPlugin.m_plugType = m_plugType; newPlugin.m_typeName = m_typeName; //Create a new step list Dictionary <Guid, CrmPluginStep> newStepList = new Dictionary <Guid, CrmPluginStep>(); foreach (CrmPluginStep step in m_stepList.Values) { //Clone the step CrmPluginStep clonedStep = step.Clone(includeOrganization); //Add the step to the new list newStepList.Add(clonedStep.StepId, clonedStep); } //Assign the list to the new object newPlugin.m_stepList = newStepList; return(newPlugin); }
public void AddImage(CrmPluginStep step, CrmPluginImage image) { if (image == null) { throw new ArgumentNullException("image"); } else if (step == null) { throw new ArgumentNullException("step"); } else if (!step.Images.ContainsKey(image.ImageId)) { step.AddImage(image); return; } else { ValidateEntity(image); } m_imageList.Add(image.ImageId, image); }
public void AddStep(CrmPlugin plugin, CrmPluginStep step) { if (step == null) { throw new ArgumentNullException("step"); } else if (plugin == null) { throw new ArgumentNullException("plugin"); } else if (!plugin.Steps.ContainsKey(step.StepId)) { plugin.AddStep(step); return; } else { ValidateEntity(step); } m_stepList.Add(step.StepId, step); }