16
www.sti-innsbruck.at © Copyright 2008 STI INNSBRUCK www.sti-innsbruck.at drupal.org/project/rules Zaenal Akbar Innsbruck, 02.10.2013

drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at © Copyright 2008 STI INNSBRUCK www.sti-innsbruck.at

drupal.org/project/rules

Zaenal Akbar Innsbruck, 02.10.2013

Page 2: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Outline

• Introduction

• Event Condition Action

• Features

• Example

• Integration

• Conclusion

2

Page 3: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

The Rules

• Rules is a module usually used to automate actions on Drupal site

• Allows site administrator to define conditionally executed actions based

on occurring events, known as reactive or Event-Condition-Action

(ECA) rules

• Rules is an engine for automating actions in Drupal

– Rules can react to events occurring on Drupal site, such as a user logging in or a node

being submitted

– it can perform customized follow-up actions such as redirecting to a certain page or

setting field values

• Rules is also a framework used by other modules

– allowing other modules to expose user-reconfigurable components with sets of actions

and conditions

3

Page 4: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Event Condition Action (1)

• Event

– specifies the signal that triggers the invocation of the rule

• Action

– consists of updates or invocation on the data

• Example:

– When “a user has logged in” “send an email to a user”

– When “content has been viewed” “unpublish content”

– When “content has been updated” “notify the content author”

4

Picture: https://drupal.org/files/drupal_EA.png

Page 5: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Event Condition Action (2)

• Condition

– a logical test that, if satisfied to true, causes the action to be carried out.

• Example:

– When “content has been updated”:

• If “content author different than the acting user” “notify the content author”

5

Picture: https://drupal.org/files/drupal_ECA.png

Page 6: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Features

• To react upon any event with custom conditions and actions

• Allow functionality to be re-used via components (sets of Rules

configuration)

• Scheduling system that allows scheduling any components/action

• Sharing Rules configuration by using the import/export feature

• Makes use of caching routines to speedup rule evaluation

• Rules 2.x:

– improved APIs

– a new admin GUI

– parameter configuration via simple data selection (i.e. “node:author” as argument)

– loops and lists (i.e loop over the list of tags)

– improved debug log

6

Page 7: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Example (1)

7

Page 8: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Example (2)

8

WHEN a New PD-Event (E) has been Saved

IF (E.field-location) is not Empty

Page 9: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Example (3)

9

THEN Create a New Entity News from (E)

WHEN a New PD-Event (E) has been Saved

IF (E.field-location) is not Empty

Page 10: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Example (4)

10

THEN Create a New Entity News from (E)

THEN Send a HTTP Request

WHEN a New PD-Event (E) has been Saved

IF (E.field-location) is not Empty

Page 11: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Integration (1)

• Web Service Client

– provides an interface to consume external web services.

• Rules HTTP Client

– adds an action wrapping of drupal_http_request to use Rules for making http requests.

11

Page 12: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Integration (2)

12

• Actions:

– Data

– Entities

– Node

– Path

– Rules Scheduler

– System

– User

– Web service

drupal.org/project/wsclient

drupal.org/project/rules_http_client

Page 13: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Integration (3)

13

• Event:

– Comment

– Node

– System

– Taxonomy

– User

Local Events Only

Page 14: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Integration (4)

14

• Use case: Distributed Editorial Workflow [Ref. vi]

• Separate editorial back-end site and front-ends serving the content to

the public.

– Use Rules web hooks (drupal.org/project/rules_web_hooks) on the editorial back-end

– the front-ends react on these hooks in order to locally create and publish the content

Picture from [Ref. vi]

Page 15: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

Conclusion

• Rules provides capability to react on events automatically

• The reaction could be toward the local data and to remote data (using

additional modules)

• Rules as a framework could be extended to add more functionality for

Action (i.e. request HTTP data, access a Web Service) and Event (i.e.

react to an Event on remote Drupal site)

• Current integration are mostly for the Action part, only few for the Event

part

15

Page 16: drupal.org/project/rules · 2013-10-02 · on occurring events, known as reactive or Event-Condition-Action (ECA) rules • Rules is an engine for automating actions in Drupal –

www.sti-innsbruck.at

References

i. Rules, https://drupal.org/project/rules

ii. Rules Documentation Handbook,

https://drupal.org/documentation/modules/rules

iii. Rules HTTP Client, https://drupal.org/project/rules_http_client

iv. Web service client, https://drupal.org/project/wsclient

v. Rules Web Hooks, https://drupal.org/project/rules_web_hooks

vi. Wolfgang Ziegler, “Event-Condition-Action rules for distributed content

management”, Master Thesis, TU Wien, 2010

16