Skip to content

IAdmParameterOperatorValueCondition

The IAdmParameterOperatorValueCondition interface represents the If <parameter> <value> condition.

Inheritance: The IAdmParameterOperatorValueCondition interface inherits from the IAdmCondition interface.

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.


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:
  • Boolean
  • 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.

[Reflection.Assembly]::LoadWithPartialName("Softerra.Adaxes.Adsi")

# Parameter name with the "param" prefix
$parameterName = "param-MyParameter" # TODO modify me

# Connect to the Adaxes service
$admNS = New-Object "Softerra.Adaxes.Adsi.AdmNamespace"
$admService = $admNS.GetServiceDirectly("localhost")

# Bind to the Custom Command
$commandDN = "CN=My Command,CN=Custom Commands,CN=Configuration Objects,"+
    "CN=Adaxes Configuration,CN=Adaxes"
$command = $admService.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)
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 adsNS = new AdmNamespace();
        IAdmService admService = adsNS.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";
        IAdmCustomCommand2 command = (IAdmCustomCommand2)admService.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

See also