#6




Alfresco
Implementing Business Rules
                             Doc. v rc0.1 - 21/05/09




              Wildan ...
About Me
• Freelance Consultant - Software
  Developer – System Integrator
• Founder of OpenThink Labs
• Open Source Softw...
Overview
•   Automatically organize documents into specific spaces when you
    do a bulk upload of documents
•   Define t...
Using Business Rules on Spaces
• Organize Documents Automatically
• Run Rules in the Background to Improve Performance
• D...
Using Business Rules on Spaces
Organize Documents Automatically
•   Let us consider an example scenario. Let us say your finance
    department receives ...
Define Business Rule on Drop Zone
• In the Drop Zone space, click on More Actions |
  Manage Content Rules. You will see t...
Define Business Rule on Drop Zone #2
Define Business Rule on Drop Zone #3




Available actions :                             11. Increment Counter
1. Add aspe...
Define Business Rule on Drop Zone #4
Define Business Rule on Drop Zone #5
Define Business Rule on Drop Zone #6
• In the Step Three window, notice the business rule
  triggering options in the Type...
Define Business Rule on Drop Zone #6
Run Rules in the Background to Improve
                  Performance
•   Typically, business rules run in real time. Consi...
Dynamically Add Properties to a Document
 • Follow the steps provided below to add the Effectivity
   aspect to all the do...
Dynamically Add Properties to a Document #2
     6. In the Step Three window, select Inbound Type
        and provide appr...
Dynamically Add Properties to a Document #3
Automatic Versioning of Documents
• In Alfresco, version control is disabled by default
• Our case on Finance Department s...
Enable versioning for Contracts and Other Documents space
1. Make sure that you are in the Company Home | Intranet |
   Fi...
Send Notifications to Specified People
• Let us say that in your organization the Sales Group is
  responsible for followi...
Send Notifications to Specified People #2
 5. In the Step Two window, from the Select Actions drop-
    down list select S...
Send Notifications to Specified People #3
 6. In the Step Three window, select the Update Type, to
    send notification o...
Send Notifications to Specified People #2
 5. In the Step Two window, from the Select Actions drop-
    down list select S...
Chaining all the Business Rules




For example, consider the following sequence of operations when a document titled
Proj...
Built-In Business Rules
•   How these Business Rules Work
•   How the Conditions are Checked
•   What Actions are Executed...
How these Business Rules Work
•   Alfresco's underlying framework supports the latest technology,
    called Aspect-Orient...
The Alfresco Business Rule Wizard
1. The   condition to apply the rule
2. The   action to be performed as a result
3. The ...
How the Conditions are Checked
• The first step in the Rule Wizard is to select the content
  items to apply the rule. The...
What Actions are Executed
•   The second step in the Rule Wizard is to define the list of actions
    to be executed as a ...
What Actions are Executed #2
– Move item to a specific space: Cut document from the
  current space and move to specified ...
Add Aspect to Item Action Values
•   When you select the Add aspect to item action, you will have a
    list of built-in a...
Aspect Meaning
•   Classifiable: Enable Categorization so that categories can be linked
    to the document.
•   Complianc...
When are these Rules Triggered?
• The third step in the Rule Wizard is to define the
  triggering event types. The rules a...
Applying Business Rules to Individual
              Content
• Removing an Aspect from Content
Handling Content Transformations
• Transforming a Word Document to a
  PDF
• Resizing and Transforming Images
• OpenDocume...
Executing JavaScript as Business Rules
• Use Built-In JavaScript Files as
  Actions
• Extend Business Rules with Custom
  ...
Scheduled Actions
• Example to Publish Effective Content
  to Production
• XML Configuration File for Scheduled
  Actions
...
Summary
Reference
• Alfresco, Enterprise Content Management
     Implementation, Munwar Sharif, PACKT Publishing
Upcoming SlideShare
Loading in …5
×

Alfresco : Implementing Business Rules

8,417 views

Published on

Published in: Technology
1 Comment
3 Likes
Statistics
Notes
No Downloads
Views
Total views
8,417
On SlideShare
0
From Embeds
0
Number of Embeds
97
Actions
Shares
0
Downloads
318
Comments
1
Likes
3
Embeds 0
No embeds

No notes for slide

Alfresco : Implementing Business Rules

  1. 1. #6 Alfresco Implementing Business Rules Doc. v rc0.1 - 21/05/09 Wildan Maulana | wildan [at] tobethink.com
  2. 2. About Me • Freelance Consultant - Software Developer – System Integrator • Founder of OpenThink Labs • Open Source Software (OSS) Evangelist • Main Developer of OpenThink SAS • More Info : – Blog : http://wildanm.wordpress.com – Y! : hawking_123 – Gtalk : wildan.m – Mobile Phone : +6287884599249
  3. 3. Overview • Automatically organize documents into specific spaces when you do a bulk upload of documents • Define the sequence of business rules on a space • Run time-consuming business rules in the background • Automatically control document versions on specific documents in specific spaces • Automatically categorize documents based on names • Send notifications based on a specific event on a document • Transform documents from one format to another • Dynamically add custom properties to documents based on the location • Configure business rules as scheduled actions to run periodically • Extend business rules using customized JavaScript files
  4. 4. Using Business Rules on Spaces • Organize Documents Automatically • Run Rules in the Background to Improve Performance • Dynamically Add Properties to a Document • Automatic Versioning of Documents • Send Notifications to Specified People • Chaining All the Business Rules
  5. 5. Using Business Rules on Spaces
  6. 6. Organize Documents Automatically • Let us consider an example scenario. Let us say your finance department receives thousands of documents every day in electronic format from your customers, vendors, and internal departments. Your finance department receives checks from customers in the form of scanned images, invoices from vendors in the form of PDF documents, and contracts and other documents from various departments in the form of Microsoft Word documents. The department would like to upload them to the Alfresco repository and automatically organize them into various spaces, which are shown in the following figure.
  7. 7. Define Business Rule on Drop Zone • In the Drop Zone space, click on More Actions | Manage Content Rules. You will see the Content Rules pane as shown in the following figure: • Clicking on the Create Rule link (as shown in the figure) opens the Create Rule Wizard window
  8. 8. Define Business Rule on Drop Zone #2
  9. 9. Define Business Rule on Drop Zone #3 Available actions : 11. Increment Counter 1. Add aspect to item 12. Link item to category 2. Add simple workflow to item 13. Move item to a spesific space 3. Blog-post 14. Remove an aspect from an item 4. Check in content 15. Send an email to specified users 5. Check out content 16. Specialise the type of an item 6. Copy item to a folder in a web project 17. Transform and copy content to a 7.Copy item to a spesific space specific space 8.Execute a script 18. Transform and copy image to 9.Extract common metadata fields from content a spesific space 10. Import an Alfresco content package
  10. 10. Define Business Rule on Drop Zone #4
  11. 11. Define Business Rule on Drop Zone #5
  12. 12. Define Business Rule on Drop Zone #6 • In the Step Three window, notice the business rule triggering options in the Type drop-down list. – Inbound means this rule is triggered when a document is created (in the Web Client) or copied or moved (from some other space) or added (using the Web Services API) or dropped (using the drag-and- drop feature of CIFS, WebDAV, or FTP) in to the Drop Zone space. – Outbound means this rule is triggered when a document is deleted or cut (to move it to another space) from the Drop Zone space. – Update means this rule is triggered when a document in Drop Zone is updated. Again the update can happen by various means such as manual updating in the Web Client, updating through network drives (CIFS, FTP, or WebDAV), and updating through the Web Services API.
  13. 13. Define Business Rule on Drop Zone #6
  14. 14. Run Rules in the Background to Improve Performance • Typically, business rules run in real time. Consider having a business rule that transforms 25 megabytes of Microsoft Word document to a PDF. Consider that rule being applied to hundreds of such files. If you upload a big Word document in the web client, then you might have to wait for a while till the business rule is completely executed. Similarly, think about having a business rule that sends email notifications to thousands of people. All these rules take significant amounts of time and resources to execute. • To improve the performance of the system, the best practise is to execute such business rules in the background. Refer to the earlier figure (under the section describing Step Three) where the rule has been selected to run in the background. If this option is selected the rule will execute in the background, so the results may not appear immediately.
  15. 15. Dynamically Add Properties to a Document • Follow the steps provided below to add the Effectivity aspect to all the documents in the Finance Department space. 1. Make sure that you are in the Company Home | Intranet | Finance Department space. 2. In the Finance Department space click on More Actions | Manage Content Rules. 3. Click on the Create Rule link and you will see the Create Rules Wizard. 4. In the Step One window, Select Condition drop- down list, select All Items, and click on the Add to List button. Then click on the Next button. 5. In the Step Two window, Select Actions drop- down list, select Add aspect to item, and click on the Set Values and Add button. Select the Effectivity aspect and click OK. Then click on the Next button.
  16. 16. Dynamically Add Properties to a Document #2 6. In the Step Three window, select Inbound Type and provide appropriate Title and Description for this rule. Select the Apply rule to sub-spaces checkbox to apply this rule to all the documents within the sub-spaces as well. Now this rule will be applicable to all sub-spaces including Customer Checks, Vendor Invoices, and Contracts and Other Documents. 7.Finish the Rule
  17. 17. Dynamically Add Properties to a Document #3
  18. 18. Automatic Versioning of Documents • In Alfresco, version control is disabled by default • Our case on Finance Department space : 1. Drop Zone : without document versioning 2. Customer Checks : without document versioning 3. Vendor Invoices : without document versioning 4. Contracts and Other Documents : with document versioning
  19. 19. Enable versioning for Contracts and Other Documents space 1. Make sure that you are in the Company Home | Intranet | Finance Department | Contracts and Other documents space. 2. In the Contracts and Other documents space click on More Actions | Manage Content Rules. 3. Click on the Create Rule link and you will see the Create Rules Wizard. 4. In Step One, Select Condition drop-down list, select All Items and click on the Add to List button. Then, click on the Next button. 5. In Step Two, Select Actions drop-down list, select Add aspect to item and click on the Set Values and Add button. Select Versionable aspect and click OK. Then click on the Next button. 6. In Step Three, select Inbound Type and provide appropriate Title and Description for this rule. Select the Apply rule to sub-spaces checkbox to enable versioning for all the documents within sub-spaces as well. 7. Finish the Rule.
  20. 20. Send Notifications to Specified People • Let us say that in your organization the Sales Group is responsible for following up on contracts with customers. Follow the steps below to send email notifications to all the people in the Sales Group when a document in the Contracts and Other Documents space is updated. 1. Make sure that you are in the Company Home | Intranet | Finance Department | Contracts and Other documents space. 2. In the Contracts and Other Documents space click on More Actions | Manage Content Rules. 3. Click on the Create Rule link and you will see the Create Rules Wizard. 4. In the Step One window, from the Select Condition drop-down list select All Items and click on the Add to List button. Then click on the Next button.
  21. 21. Send Notifications to Specified People #2 5. In the Step Two window, from the Select Actions drop- down list select Send an email to specified users and click on the Set Values and Add button.
  22. 22. Send Notifications to Specified People #3 6. In the Step Three window, select the Update Type, to send notification on every document update. 7. Finish the Rule
  23. 23. Send Notifications to Specified People #2 5. In the Step Two window, from the Select Actions drop- down list select Send an email to specified users and click on the Set Values and Add button.
  24. 24. Chaining all the Business Rules For example, consider the following sequence of operations when a document titled ProjectXYZ_Contract.doc is dropped in Company Home | Intranet | Finance Department | Drop Zone. 1. Due to the business rules defined in Drop Zone, the document ProjectXYZ_Contract.doc is automatically moved to Finance Department | Contracts and Other Documents space 2. Due to Effectivity rule defined in the parent Finance Department space, two properties (Effective From and Effective To) are added to the ProjectXYZ_Contract.doc document. 3.Due to the Versioning aspect rule defined in the space, the document ProjectXYZ_Contract.doc is automatically versioned
  25. 25. Built-In Business Rules • How these Business Rules Work • How the Conditions are Checked • What Actions are Executed • When are these Rules Triggered?
  26. 26. How these Business Rules Work • Alfresco's underlying framework supports the latest technology, called Aspect-Oriented Programming, which is useful to change the behavior of the server dynamically without making changes to the code. Business rules leverage this technology so that you can define them at any space in Alfresco and change the behavior of the system. • Alfresco server follows a process to execute business rules: – Whenever a document is added to a space (Inbound) or removed from a space (Outbound) or updated within a space (Update), Alfresco server checks whether that space or the parent spaces have any business rule to execute based on the triggering event type (Inbound, Outbound, or Update). The server checks if the business rule condition is satisfied. For example the business rule can be applied to documents that have certain pattern in their names. – Then the server executes the action defined in the business rule.
  27. 27. The Alfresco Business Rule Wizard 1. The condition to apply the rule 2. The action to be performed as a result 3. The type of Event which triggers the action 4. The summary of the business rule to commit
  28. 28. How the Conditions are Checked • The first step in the Rule Wizard is to select the content items to apply the rule. The following can be checked against the content item. – Does it have a particular name pattern? – Is it in a particular category? – Is it of a specific type or format? – Does a property have a specific value?
  29. 29. What Actions are Executed • The second step in the Rule Wizard is to define the list of actions to be executed as a result. The following is the list of built-in actions to select from. – Add aspect to item: Add additional properties and behavior to document – Add simple workflow: Add approve and reject workflow – Check in content: Check in the document – Check out content: Check out the document to a space – Copy item to a specific space: Copy the document to a space – Execute a script: Execute a JavaScript as an action – Extract common metadata fields from content: Extract document metadata – Import Alfresco content package: Import as content package – Link item to category: Link document to a specific existing category
  30. 30. What Actions are Executed #2 – Move item to a specific space: Cut document from the current space and move to specified space – Remove an aspect from an item: Remove property or set of properties from the document – Send an email to specific users: Send email notifications to specific users or groups of users – Specialize the type of an item: Define content type for the document – Transform and copy content to a specific space: Transform content say from DOC to PDF and move the resultant file to the specified space – Transform and copy image to a specific space: Transform and resize image say from JPG to PNG format and move the resultant image to the specified space
  31. 31. Add Aspect to Item Action Values • When you select the Add aspect to item action, you will have a list of built-in aspects to choose from as shown in the following figure: – Classifiable – Complianceable – Dublin Core – Effectivity – Email Alias – Emailed – Summarizable – Taggable – Templatable – Versionable
  32. 32. Aspect Meaning • Classifiable: Enable Categorization so that categories can be linked to the document. • Complianceable: Add a compliance property called Remove after to the document. • Dublin Core: Add Dublin core metadata to the document. Dublin core metadata includes properties such as Publisher, Contributor, Subject, and Rights. • Effectivity: Add effectivity properties called Effective From and Effective To to the document. • Emailed: Add a set of properties called Email Data to the document. This is useful to capture the email information if the document is an attachment to email. • Localizable: Add a property called Locale to the document. • Summarizable: Add a property called Summary to the document. • Templatable: Enable template view. • Translatable: Add a property called Translations to the document. • Versionable: Enable versioning.
  33. 33. When are these Rules Triggered? • The third step in the Rule Wizard is to define the triggering event types. The rules are triggered by something happening and specified by the Type field as follows. – Inbound: content arriving into a space either new, copied, or moved – Outbound: content leaving a space either deleted or moved – Update: content updated either uploaded or saved
  34. 34. Applying Business Rules to Individual Content • Removing an Aspect from Content
  35. 35. Handling Content Transformations • Transforming a Word Document to a PDF • Resizing and Transforming Images • OpenDocument Format – Converting Microsoft Office Documents to ODF • Built-In Transformations
  36. 36. Executing JavaScript as Business Rules • Use Built-In JavaScript Files as Actions • Extend Business Rules with Custom JavaScript – Set up Website Space – Create Custom JavaScript – Execute Custom JavaScript as a Business Rule • JavaScript API
  37. 37. Scheduled Actions • Example to Publish Effective Content to Production • XML Configuration File for Scheduled Actions – The cron Expression
  38. 38. Summary
  39. 39. Reference • Alfresco, Enterprise Content Management Implementation, Munwar Sharif, PACKT Publishing

×