IAdmParameterOperatorValueCondition
The IAdmParameterOperatorValueCondition interface represents the If <parameter> <value> condition.
Inheritance: IAdmCondition
Properties
-
Property
-
Description
-
HolderId
-
Gets or sets the unique identifier of the object that contains the condition (e.g. custom command or Report).
-
ParameterId
-
Gets or sets the identifier of the parameter that is checked in the condition.
-
ComparisonOperator
-
Gets or sets a comparison operator for the condition.
-
Value
-
Gets or sets the parameter value that will be checked in the condition.
-
CaseSensitive
-
Gets or sets a value indicating whether the parameter value will be treated as case sensitive for the condition.
-
Mask
-
Gets or sets a mask that determines the part of the parameter value that will be checked in the condition.
Details
HolderId
Gets or sets the unique identifier of the object that contains the condition (e.g. custom command or Report).
- Type:
- string
- Access:
- Read/Write
ParameterId
Gets or sets the identifier of the parameter that is checked in the condition. To get the identifier, use the IAdmParameter::ID property.
- Type:
- string
- Access:
- Read/Write
ComparisonOperator
Gets or sets a comparison operator for the condition.
- Type:
- ADM_COMPARISONOPERATOR_ENUM
- Access:
- Read/Write
Value
Gets or sets the parameter value that will be checked in the condition.
- Type:
- Object
- Access:
- Read/Write
CaseSensitive
Gets or sets a value indicating whether the parameter value will be treated as case sensitive for the condition.
- Type:
- bool
- Access:
- Read/Write
Mask
Gets or sets a mask that determines the part of the parameter value that will be checked in the condition.
- Type:
- Object
- Access:
- Read/Write
Remarks
For parameters that represent a list of items, the mask specifies the identifier of the parameter item that will be checked in the condition. To get the identifier, use the IAdmParameter::ID property. For other parameters, this property is currently ignored.
Examples
The following code sample creates a set of actions and conditions for a custom command that deletes an object if the first item of a parameter is set to true
.
- PowerShell
-
[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi") # Parameter name with the "param" prefix $parameterName = "param-MyParameter" # TODO modify me # Connect to the Adaxes service $ns = New-Object "Softerra.Adaxes.Adsi.AdmNamespace" $service = $ns.GetServiceDirectly("localhost") # Bind to the custom command $commandDN = "CN=My Command,CN=Custom Commands,CN=Configuration Objects,"+ "CN=Adaxes Configuration,CN=Adaxes" $command = $service.OpenObject("Adaxes://$commandDN", $null, $null, 0) # Create a new set of actions and conditions $actionsAndConditions = $command.ConditionedActions.Create() $actionsAndConditions.ConditionsLogicalOperation = "ADM_LOGICALOPERATION_AND" $actionsAndConditions.SetInfo() # If the 'Item 1' option of parameter 'MyParameter' equals 'Yes' $condition = $actionsAndConditions.Conditions.CreateEx("adm-ParameterOperatorValueCondition") $parameterCondition = $condition.GetCondition() $parameterCondition.HolderId = $command.CommandID $parameter = $command.Parameters | Where-Object {$_.Name -ieq $parameterName} $parameterCondition.ParameterId = $parameter.ID $parameterCondition.Mask = $parameter.Items[0].ID # identifier of the first item $parameterCondition.Value = 1 # is checked $condition.SetCondition($parameterCondition) $condition.SetInfo() $actionsAndConditions.Conditions.Add($condition) # Delete the object $action = $actionsAndConditions.Actions.CreateEx("adm-DeleteObjectAction") $action.ExecutionOptions = "ADM_ACTIONEXECUTIONOPTIONS_SYNC" $deleteAction = $action.GetAction() $deleteAction.DeleteSubtree = $true $action.SetAction($deleteAction) $action.SetInfo() $actionsAndConditions.Actions.Add($action) # Add the set to the custom command $command.ConditionedActions.Add($actionsAndConditions)
- C#
-
using System; using System.Collections.Generic; using System.Linq; using Softerra.Adaxes.Adsi; using Softerra.Adaxes.Interop.Adsi; using Softerra.Adaxes.Interop.Adsi.BusinessRules; using Softerra.Adaxes.Interop.Adsi.CustomCommands; using Softerra.Adaxes.Interop.Adsi.Parameters; using Softerra.Adaxes.Interop.Adsi.PersistentObjects; class Program { static void Main(string[] args) { // Parameter name with the "param" prefix const string parameterName = "param-MyParameter"; // Connect to the Adaxes service AdmNamespace ns = new AdmNamespace(); IAdmService service = ns.GetServiceDirectly("localhost"); // Bind to the custom command const string commandPath = "Adaxes://CN=My Command,CN=Custom Commands," + "CN=Configuration Objects,CN=Adaxes Configuration,CN=Adaxes"; IAdmCustomCommand command = (IAdmCustomCommand)service.OpenObject( commandPath, null, null, 0); // Create a new set of actions and conditions IAdmBusinessRuleConditionedActions actionsAndConditions = (IAdmBusinessRuleConditionedActions)command.ConditionedActions.Create(); actionsAndConditions.ConditionsLogicalOperation = ADM_LOGICALOPERATION_ENUM.ADM_LOGICALOPERATION_AND; actionsAndConditions.SetInfo(); // If the 'Item 1' option of parameter 'MyParameter' equals 'Yes' IAdmBusinessRuleCondition condition = (IAdmBusinessRuleCondition)actionsAndConditions.Conditions.CreateEx( "adm-ParameterOperatorValueCondition"); IAdmParameterOperatorValueCondition parameterCondition = (IAdmParameterOperatorValueCondition)condition.GetCondition(); parameterCondition.HolderId = command.CommandID; List<IAdmParameter> parameters = command.Parameters.ToList(); IAdmParameterCheckList parameter = (IAdmParameterCheckList)parameters.Find(param => string.Equals( param.Name, parameterName, StringComparison.CurrentCultureIgnoreCase)); parameterCondition.ParameterId = parameter.ID; parameterCondition.Mask = parameter.Items[0].ID; // identifier of the first item parameterCondition.Value = 1; // is checked condition.SetCondition(parameterCondition); condition.SetInfo(); actionsAndConditions.Conditions.Add(condition); // Delete the object IAdmBusinessRuleAction action = (IAdmBusinessRuleAction)actionsAndConditions.Actions.CreateEx("adm-DeleteObjectAction"); action.ExecutionOptions = ADM_ACTIONEXECUTIONOPTIONS_ENUM.ADM_ACTIONEXECUTIONOPTIONS_SYNC; IAdmDeleteObjectAction deleteAction = (IAdmDeleteObjectAction)action.GetAction(); deleteAction.DeleteSubtree = true; action.SetAction(deleteAction); action.SetInfo(); actionsAndConditions.Actions.Add(action); // Add the set to the custom command command.ConditionedActions.Add(actionsAndConditions); } }
Requirements
Minimum required version: 2018.2