Welcome Guest, you are in: Login

Aumen Business - Rule Manager Wiki

RSS RSS

Navigation (Installation)




Search the wiki
»

Tags

Create Rules Release history Rule Editing
Rule conditions cannot always be expressed with only using the basic compares with numbers, boolean and string. Sometimes Business formula's or functions have to be called to transform basic data. So instead of

If Person's Age > 12 Then ...

We might have to wright something like

If Compute Age (Person's Birthday ) > 12 Then ...

Or we might have to call a webservice to find the local weather forecast.

For this we allow a user to define his own business functions and import these functions into the Vocabulary.

Vocabulary

 Custom Business Functions

The Schema Adapter import wizard can import static methods that have been decorated with the AcumenBusiness.IModel.FunctionAttribute.

The function will only be imported if the FunctionAttribute is placed on a public static method. Similar to the FunctionAttribute, we also provide a Concept- and a Term-Attribute. All attributes define a business friendly name and a description of the item.


//Only valid on a class
[ConceptAttribute("Name of the concept", "Description of the concept")]

//Only valid on a property
[TermAttribute("Name of the term" , "Description of the term")]

//Only valid on a static method
[FunctionAttribute("Name of the function", "Description of the function")]

For the function attribute the following attributes must also be set: Category = "Logical group where the function belongs to" ReturnType = AcumenBusiness.IModel.Type enum value ArgumentTypes = AcumenBusiness.IModel.Type[]

Below is an example that shows the usage:


using AcumenBusiness.IModel;
namespace TestDotNetSchema {
  [Concept("A Hospital", "Place where the patients are located")]
  public class Hospital {
    //..
    [Term("Insurance provided", "does the insurance cover for a stay at this hospital")]
    public bool InsuranceProvided
    {
       get { return insuranceProvided; }
       set { insuranceProvided = value; }
    }

    [Function("Calculate free beds", "Calculate how many beds are available.", Category = "My Functions", ReturnType=Type.integer, 
         ArgumentTypes = new Type[]{Type.integer, Type.integer})]
    public static int CalculateNumberOfFreeBeds(int bedOccupied, int totalBeds)
    {
       return totalBeds - bedOccupied;
    }
   
    //...
  }
Once you have decorated your classes, properties and methods (and you have included the AcumenBusiness.IModel assembly) you can compile the project and import the assembly with the Schema Adapter.

Now there is a little trick to get hold of the AcumenBusiness.IModel assembly (and .xml documentation). Just create a dummy policy and export the solution to WWF rules. The solution will deploy the AcumenBusiness.IModel assembly. This is the assembly that contains the attribute definitions.

File Options dialog

In order to execute the rules by the interactive rule map or by the rule verification, make sure that you put a reference to the imported file into the File Reference option settings:

File Options dialog

These assemblies will dynamically be loaded by our internal rules engine and will invoke the method. 

ScrewTurn Wiki version 3.0.4.560. Some of the icons created by FamFamFam.