Rules & Mappers	using rules engine
34 Questions
1 Views

Rules & Mappers using rules engine

Created by
@SupportedAstatine4145

Podcast Beta

Play an AI-generated podcast conversation about this lesson

Questions and Answers

What does the Validate method in the RulesEngine return to indicate the success of a rule?

  • True if the rule fails
  • False if the rule is invalid
  • The input object associated with the RuleManager
  • True if the rule passes (correct)
  • What happens if a RuleManager is null when calling the Execute method in the RulesEngine?

  • An exception is thrown
  • The execution returns false
  • The execution returns true (correct)
  • The rules are executed normally
  • How does the ValidateRule method determine the appropriate ICriteriaType object?

  • By using the CriteriaTyepFactory (correct)
  • By creating a new RuleManager instance
  • By querying the list of context objects
  • By calling the execute method of the RulesEngine
  • What is the primary purpose of the RulesEngine class?

    <p>To execute and validate rule clauses</p> Signup and view all the answers

    What does the RuleClauses property of the RuleManager help with?

    <p>Iterating through and processing rule groups</p> Signup and view all the answers

    What is the purpose of the text box labeled 'Value' in the context of Comparison Operators?

    <p>To hold a value for comparison by the operator.</p> Signup and view all the answers

    Which of the following options specifies the manner in which a rule resolves in comparison to other rules?

    <p>And/Or Option</p> Signup and view all the answers

    What does the 'Within/Outside' selector determine in relation to geographic rules?

    <p>If the defined distance relates to being inside or outside a particular area.</p> Signup and view all the answers

    When defining a geographical rule, what do the text boxes for Latitude and Longitude specify?

    <p>The geographical location from which the rule originates.</p> Signup and view all the answers

    What type of criteria can be selected from the drop-down for Custom Property Name?

    <p>Multiple customer custom properties for comparison.</p> Signup and view all the answers

    What component must be chosen to define which characteristics are used in a persona rule?

    <p>Rule Type Drop Down</p> Signup and view all the answers

    Which operator is NOT included in the list of comparison criteria options?

    <p>Performs</p> Signup and view all the answers

    What determines if a rule resolves in conjunction or alternatively with other rules?

    <p>And/Or Option</p> Signup and view all the answers

    Which function does the Value Text Box serve in a persona rule?

    <p>Holds a value for comparison</p> Signup and view all the answers

    In a persona rule setup, which of the following is primarily influenced by the selected Rule Type?

    <p>Display of Available Comparison Operators</p> Signup and view all the answers

    Which type of rule is concerned with the customer's characteristics rather than the user's?

    <p>Persona Rule</p> Signup and view all the answers

    What does the 'Criteria Property' dropdown allow the user to do?

    <p>Determine the Comparison Criteria</p> Signup and view all the answers

    Which characteristic can be used to build a persona rule aside from those in the Admin Console?

    <p>Location of the Shopper</p> Signup and view all the answers

    What does the 'RequiresCriteriaObject' field indicate?

    <p>It signifies if the UI must prompt for the criteria object.</p> Signup and view all the answers

    Which of the following statements is true about 'CriteriaObject'?

    <p>It defines a specific entity to be used in rule evaluation.</p> Signup and view all the answers

    What is the purpose of the 'ValidRuleClause' field?

    <p>To specify valid comparison values for the UI.</p> Signup and view all the answers

    Which of the following statements captures the essence of 'LookupObject'?

    <p>It finds and embeds a single instance's Guid into rules.</p> Signup and view all the answers

    What does the 'RequiresValueType' Boolean determine?

    <p>Whether a data type is necessary for defining CriteriaValue.</p> Signup and view all the answers

    What is indicated by the 'DependencyName' field in the class?

    <p>It represents an attribute for identifying the class in rules.</p> Signup and view all the answers

    When is 'CriteriaValueLabel' considered obsolete?

    <p>When the Custom Properties are fully defined.</p> Signup and view all the answers

    What does 'RequiresGeoCode' signify?

    <p>It identifies if distance-related criteria are required.</p> Signup and view all the answers

    What is the function of the RuleClauseComparisonOperator.Equals?

    <p>It verifies if two parameter values are equal.</p> Signup and view all the answers

    What does the CriteriaTypeParameter Label define?

    <p>The name displayed for a specific criterion.</p> Signup and view all the answers

    What does the ValueMaximum parameter represent in a rule clause?

    <p>The maximum limit that parameter values can reach.</p> Signup and view all the answers

    In the context of CriteriaObject, what is the significance of RequiresCriteriaProperty?

    <p>It determines if a specific property must be defined.</p> Signup and view all the answers

    Which of the following accurately describes RuleTypeOption?

    <p>It links to the CriteriaClass plugin using DependencyName.</p> Signup and view all the answers

    What does the PossibleValues array for CriteriaValue imply?

    <p>The potential values that can be assigned to a criterion.</p> Signup and view all the answers

    How does CriteriaType affect the functionality of a rule clause?

    <p>It determines the required fields based on the type.</p> Signup and view all the answers

    In which situation is the CriteriaObject field necessary?

    <p>When an object property is required for criteria application.</p> Signup and view all the answers

    Study Notes

    Persona Rule Types

    • Persona rules are built on user and customer characteristics, which can be selected from data fields on the Customer screen or outside the Admin Console, such as shopper's location.
    • Rule Types are grouped in the Rule Tab's drop-down field.
    • Depending on rule types, the Rule Tab updates to display only the fields needed for completion.
    • The tables list each Rule Type and the data fields required to create a persona rule.

    User Custom Property

    • This text box allows you to determine the User Custom Property that the rule will compare using the Comparison Operator and Value.
    • The Comparison Operator drop-down offers options like "Equals," "Not Equals," "Less Than," "Less Than or Equals," "Greater Than," "Greater Than or Equals," "Matches," "Range," and "List."
    • The Value text box holds the value against which the Comparison Operator will resolve.
    • The Condition option determines if the rule will resolve in addition to other rules (And) or if it should resolve true in an either/or scenario (Or).

    Customer Fields

    • The Criteria Property drop-down determines the Criteria Property the rule will compare using the Comparison Operator and Value.
    • Similar to User Custom Property, the Comparison Operator drop-down offers various options for comparison.
    • The Value text box holds the value against which the Comparison Operator will resolve.
    • The Condition option determines whether the rule will resolve in addition to other rules (And) or in an either/or scenario (Or).

    Distance from a Point

    • The Location Phrase text box accepts an address that Google Maps translates into specific Latitude and Longitude coordinates.
    • The Latitude text box determines the Latitude for the origination point of the rule.
    • The Longitude text box determines the Longitude for the origination point of the rule.
    • The Within/Outside selector determines whether the distance is within or outside the area originating from the geographic location.
    • The Distance text box and selector determine the numerical distance from the origination point for which the rule will resolve as true, and whether that distance is in Kilometers or Miles.
    • The Condition option determines if the rule will resolve in addition to other rules (And) or in an either/or scenario (Or).

    Customer Custom Properties

    • The Custom Property Name text box allows you to determine the Customer Custom Property that the rule will compare using the Comparison Operator and Value.
    • The Comparison Operator drop-down offers options like "Equals," "Not Equals," "Less Than," "Less Than or Equals," "Greater Than," "Greater Than or Equals," "Matches," "Range," and "List."
    • The Value text box holds the value against which the Comparison Operator will resolve.
    • The Condition option determines if the rule will resolve in addition to other rules (And) or in an either/or scenario (Or).

    ### Rule Types by Context

    • Rule Types are classes responsible for implementing the rules engine logic and validating rules.
    • The Validate method, when called, returns True if the rule passes and False if it fails.

    Rule Types for Entity Properties

    • These rules allow you to check values of entity properties.
    • An instance of the entity being checked must be provided to the rules engine's list of context objects.

    RulesEngine

    • This class acts as the concrete implementation and generic rules engine for Configured Commerce.
    • The Execute and ValidateRule methods are virtual, enabling derivation from the RulesEngine base class for new RulesEngine instances.

    Execute Method

    • Executes rules and returns a Boolean (True for pass, False for fail).
    • Requires an input object with an associated RuleManager object.
    • If RuleManager is null, a result of True is returned, as default objects may not have associated rules.
    • If RuleManager is available, the RuleClauses property of the RuleManager is iterated through for processing conditions.

    ValidateRule Method

    • Validates a RuleClause by calling the appropriate CriteriaType's implementation of the validate method.
    • Retrieves the valid ICriteriaType object using the CriteriaTypeFactory.
    • Interrogates the enumerable context for a context object with a type matching the object type required for the current RuleClause.
    • If no context is found, the RuleClause is validated without any context.

    IRulesEngine

    • The RulesEngine.Execute method receives the entity containing the RuleManager and a list of objects with context information (like CustomerOrder, UserProfile) to validate against.

    Field-Level Data

    • The following fields, not readily apparent in the database, are essential for understanding the data perspective.

    Table/Field or Property

    • CriteriaType: This field is not stored in the database.
    • DependencyName: This attribute of the class identifies the class in RuleTypeOption and RuleTypeClause.
    • LookupObject: Identifies a specific entity to find a single instance and embed its Guid (ID) into RulesClause.SimpleValue.
    • CriteriaObject: Represents the fixed object that must be passed into the rule for evaluating logic. Crucial for customer order-specific rules in shipping and promotion engines.
    • DisplayName: This is what displays as the criteria in the UI.
    • RequiresCriteriaObject: A Boolean flag that determines if the UI should prompt for the criteria object itself. Currently, this is only set to True for Object and CustomProperty criteria.
    • RequiresCriteriaProperty: A Boolean flag defining if the UI should prompt for the CriteriaPriority in the RuleTypeOption.
    • RequiresCriteriaValue: A Boolean flag defining if the UI should prompt for the CriteriaValue in the RuleTypeOption.
    • CriteriaValueLabel: This is a parameter description.
    • RequiresValueType: Boolean, defines if a data type needs to be defined for the CriteriaValue. This is mostly obsolete as Custom Properties are now type-aware.
    • RequiresGeoCode: Boolean, defines if this is a distance-related rule.
    • ValidRuleClauseComparisonOperators: Defines the specific comparison values valid in the UI. If none are specified, all comparisons are available.
    • ParameterDescriptions: Explicitly defines parameter values that can be acquired through the UI, overriding default values.

    RuleTypeOption

    • Description: Used in the rule clause dropdown to select a rule to configure.
    • CriteriaType: A pointer back to the CriteriaClass plugin using the DependencyName from the class.
    • CriteriaObject: An optional field defining the object to apply the criteria to.
    • CriteriaProperty: If the criteria type is Object, this defines a specific property of the CriteriaObject or "All Properties" for selecting from any property.
    • ValueType: Allows selecting the type of data for the rule clause.

    Studying That Suits You

    Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

    Quiz Team

    Related Documents

    Description

    This quiz delves into the intricacies of persona rules and their various types. It covers user custom properties, comparison operators, and how to effectively utilize these elements to create meaningful rules. Test your understanding of how persona rules are structured and applied.

    More Like This

    Taxation Rules for Various Income Categories
    57 questions
    Investment Rules and Conflicts Quiz
    29 questions
    Internet Safety Rules Video
    6 questions
    Use Quizgecko on...
    Browser
    Browser