A "rule" consists of a "condition" and an "action" part, each represented by TCL code. The condition is evaluated every time that an object modified or viewed by a user, or once per day. The action part is executed if the condition evaluated to "1" (representing a true value). The action part consists of a TCL command or optionally an email to be sent.
For details on how to use rules please see the Rule Engine package.
Structure of the im_rules database table:
create table im_rules (
-- The object_id: references acs_objects.object_id.
-- So we can lookup object metadata such as creation_date,
-- object_type etc in acs_objects.
rule_id integer
constraint im_rule_id_pk
primary key
constraint im_rule_id_fk
references acs_objects,
-- Short name of rule
rule_object_type varchar(100)
constraint im_rule_object_type_nn
not null
constraint im_rule_object_type_fk
references acs_object_types,
-- Every ]po[ object should have a "status_id" to control
-- its lifecycle. Status_id reference im_categories, where
-- you can define the list of stati for this object type.
rule_status_id integer
constraint im_rule_status_nn
not null
constraint im_rule_status_fk
references im_categories,
-- Every ]po[ object should have a "type_id" to allow creating
-- sub-types of the object. Type_id references im_categories
-- where you can define the list of subtypes per object type.
rule_type_id integer
constraint im_rule_type_nn
not null
constraint im_rule_type_fk
references im_categories,
-- Short name of rule
rule_name text
constraint im_rule_rule_nn
not null,
rule_sort_order integer
default(0),
-- Description for rule
rule_description text,
-- Condition = Left Hand Side of the rule - a TCL expression returning 0 or 1
rule_condition_tcl text
constraint im_rule_rule_nn
not null,
-- TCL expression for action = right hand side
rule_action_tcl text,
-- TCL expression returning a list of email addresses
rule_action_email_to_tcl text,
-- Text with %varname% substitution
rule_action_email_subject text,
-- Text with %varname% substitution
rule_action_email_body text
-- There may be additional fields for actions to be performed on rule firing
);
Calle Aprestadora 19, 12o-2a
08902 Hospitalet de Llobregat (Barcelona)
Spain
Tel Europe: +34 609 953 751
Tel US: +1 415 200 2465
Mail: info@project-open.com