• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
PowerPoint Presentation [PPT]
 

PowerPoint Presentation [PPT]

on

  • 2,289 views

 

Statistics

Views

Total Views
2,289
Views on SlideShare
2,288
Embed Views
1

Actions

Likes
0
Downloads
25
Comments
0

1 Embed 1

http://www.slideshare.net 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Let's talk about where we should be using Custom Workflow Event Handlers. Custom Workflow Event Handlers are going to be best used where decision logic is required. We expect that in 80% of all scenarios, business logic can be handled by the commonHandlers' methods, which were introduced to you in the last presentation given by Janaki Ramaswamy. For instance, the executeSQL method is useful for easily crafting custom sql expressions and then executing the sql code. However, if you need the functionality of an "If... Then... Else" clause then you need a custom Workflow Event Handler
  • Creating and Altering Web Views ARCHIBUS/FM Business Partner Training
  • 04/29/10 Creating and Altering Web Views ARCHIBUS/FM Business Partner Training
  • OK. We are now at the point where we are saying, "The commonHandlers class is great, but it doesn't meet this one use-case I have". When you find yourself in this situation, you are going to have to write a custom Workflow Rule Event Handler. What we now need to discuss is the framework that we have provided you. First, let's cover the directory structure, and the templates that we have provided to you to help you write Custom Workflow Rule Event Handlers. So, let's talk about the ADN Product-Activity structure. Within the ..tomcatarchibusschema directory, you are going to see a new folder called adn-products. What we want you to do is to put all of your ADN Products and Activities inside of the ad-products folder. The reason for this framework is to help avoid naming conflicts between ADN Products and Activities, and also to provide a unique name for the library (or jar file) that will be deployed to Web Central's library (or lib) folder in a production environment. So, as you can see in this slide I have created a new Product called my-adn-product, and I have also created two Activities beneath my new product called activity-01 and activity-02. Creating and Altering Web Views ARCHIBUS/FM Business Partner Training
  • 04/29/10 Creating and Altering Web Views ARCHIBUS/FM Business Partner Training
  • This slide shows what my new Activities look like when they are deployed to a production environment. Notice how a jar file is built for each activity that you had created beneath the adn-productsmy-adn-product folder. And in fact, the jar file is assigned a unique name based upon its product name and its activity name. So, 'archibus' is concatenated with the product name you have created and the activity name you have created. All of your custom Workflow Event Handlers will be compiled and compressed into the jar, and then the jar is copied to the .. omcatWEB-INFlib folder. Why do we jar your custom Workflow Event Handlers? Putting all of your Workflow Event Handlers into jar format allows for significantly easier deployment of your Product and Activities at client sites. Go to Windows Explorer and show the directory structure: So, we are looking at my adn-products folder. In it you will see 2 ADN Products. The first, sample-adn-product, is a sample ADN product that we ship as an example, as well as a template for how you should create your own products and Activities. The sample-adn-product product contains 6 Activities: Echo, Hello-World, Help-Desk, Next-View, Notify, and Work-Order. For demonstration purposes I put together a Product called webc15-webinar. I have two Activities underneath my new Product. The first is approve-reject, and the second is excel-transform. Let's take a look at the directory structure. Within my adn-products folder notice I have a number of files like build.properties, build.xml, etc. Now also notice within my webc15-webinar folder I have a large number of build scripts and a build.properties. I did not create these files myself. Instead, I copied them from one of my sample activities beneath my sample-adn-product folder. We will go into more detail regarding what these tools do in just a moment. Creating and Altering Web Views ARCHIBUS/FM Business Partner Training
  • 04/29/10 Creating and Altering Web Views ARCHIBUS/FM Business Partner Training
  • 04/29/10 Creating and Altering Web Views ARCHIBUS/FM Business Partner Training
  • 04/29/10 Creating and Altering Web Views ARCHIBUS/FM Business Partner Training
  • 04/29/10 Creating and Altering Web Views ARCHIBUS/FM Business Partner Training
  • 04/29/10 Creating and Altering Web Views ARCHIBUS/FM Business Partner Training
  • 04/29/10 Creating and Altering Web Views ARCHIBUS/FM Business Partner Training
  • 04/29/10 Creating and Altering Web Views ARCHIBUS/FM Business Partner Training

PowerPoint Presentation [PPT] PowerPoint Presentation [PPT] Presentation Transcript

  • C16: Workflow Rules Nick Stefanidakis, ARCHIBUS, Inc. 2008 International ARCHIBUS Users’ Conference Wednesday, 16 April, 2008
  • Topics
    • Web Central System Integrators Learning Path
      • Roles
      • Skills
      • Techniques
    • Creating Command & Control Web Views
      • Introducing Panels
      • The Mini-Console
      • Edit Forms
      • Multiple Frame Form Patterns and Tabbed Views
      • Using Restriction Consoles
    • Enhancing Views with JavaScript
    • Creating and Working with Workflow Rules
  • System Administration Roles
    • Application Administrator
      • Installation (Configuration, Projects, Logging)
      • A/FM Security
    • Database Administrator
      • SQL-level Security
    • Domain Administrator (FIM)
      • A/FM personalization (forms, reports, processes)
      • Review Activity Concepts in Learning Path doc
    • Database Manager
      • Customize SQL schema using A/FM data-dictionary
  • System Integrator Role
    • System Integrator Capabilities
      • Create custom Web Central forms/reports
      • Add Actions or calculated fields
      • Create Tabbed/Wizard forms
      • Interact with Workflow Rules
      • Use inline .css to customize formatting
      • Use JavaScript to enhance functionality
    • Skills required:
      • SQL, XML, JavaScript
      • Simple .css (optional)
  • Business Logic Integrator Role
    • Business Logic Integrator
      • Write new Workflow Rule (event) handlers
      • Create Unit Tests
      • Invoke handlers using XML or JavaScript
    • Required Skills
      • SQL
      • Simple Java (as a scripting language)
      • Understanding of the build environment
  • Software Engineer Role
    • Embed advanced controls using JavaScript and Java
    • Create Ajax-enabled controls
      • Timeline control (Room Reservations)
      • Custom/3 rd party controls/charts
      • Others
    • Beyond the scope of this session!
  • View Handling Data- base axvw JAVA Web Server XML Response XSL Transform XML Request XSL Style- sheet Web Client HTML JS AJAX css
  • What is AJAX?
    • “ AJAX isn't a technology, or a language, and there's no recipe to implement it; it's just a combination of various components to achieve something you otherwise couldn't: asynchronous http requests…
    • AJAX is short for Asynchronous JavaScript and XML . It uses the JavaScript XMLHttpRequest function to create a tunnel from the client's browser to the server and transmit information back and forth without having to refresh the page. The data travels in XML format because it transmits complex data types over clear text. ”
    • Coldfusion Developer’s Journal
  • Working with Workflow Rules
  • System Integrator vs. Business Logic Integrator
    • Workflow Roles: For larger projects, project teams often divide the responsibilities:
      • the system integrator takes care of the forms and presentation layer and invoking the business rules
      • the business logic integrator defines the workflow rules and any new event handlers that must be scripted
    • You may be both!
  • What are Workflow Rules?
    • Complex Business functions require database manipulation using JAVA event handlers
    • Instead of calling event handlers directly, a workflow rule “pointer” is created inside the database.
    • Since workflow rules include a security group field, users can be restricted from implementing event handlers they are not authorized to use
    • System Integrators only need to know the rule name
    • Schedule rules can also be configured to run at specified intervals, without users clicking a button
  • 3 Ways to Call your WF Rule from an AXVW
    • <afmAction> - Original Style (works with all views)
    • <command> - C&C style (must have a panel section)
    <afmAction type=&quot;messageRule&quot; eventName=&quot;AbSolutionsWorkflow-helpDeskPlanRequest“ responseType=&quot;ab-ex-helpdesk-request-step2.axvw&quot;> <title translatable=&quot;false&quot;>Submit</title> </afmAction> <field controlType=&quot;button&quot;> <title translatable=&quot;true&quot;>Approve</title> <command type=&quot;workflowRule&quot; ruleId=&quot;AbSolutionsViewExamples-approveProject&quot;/> </field> <afmAction id=&quot;approve&quot;> <title translatable=&quot;true&quot;>Approve</title> <command type=&quot;workflowRule&quot; ruleId=&quot;AbSolutionsViewExamples-approveProject&quot;/> </afmAction>
  • Define Workflow Rules
    • Define Rule Name
    • Specify Java Class and Method to call
  • A Word on WFR <Inputs>
    • Many of the new Command and Control Workflow Rule invocations do not require inputs to be supplied with the rule definition.
    • By default, the new commands will pass the form values to the rule without specifying.
      • Forms will pass all field values
      • Reports will pass the primary key(s) for the selected record(s)
  • Business Logic Integrator Skills
    • Using Java, you’ll:
      • Learn how to compile small Java extensions to Web Central
      • Know how to call and define Java functions, extend an existing Java class, access predefined class methods and properties.
      • Work with Java data types, conditional statements, and looping statements.
    • You do not need to know how to:
      • Code a large Java program.
      • Use object-oriented design techniques.
      • Use the J2EE libraries, write servlets, interface with EJB’s.
  • Workflow Rule Examples
    • Invoking a Rule from a Panel Button ( source )
    • Edit axvw to call correct workflow rule!
    • Invoking Rules from Per-Row Buttons ( source )
    • Invoking Rules on Multiply Selected Rows ( source )
    <!-- call to WFR to invoke Hello World rule --> <command type=&quot;workflowRule&quot; ruleId=&quot; AbSolutionsMyAdn-helloWorld &quot;/>
  • Enabling SQL & Workflow Rule Logging
    • Logging SQL Statements
      • Aside from seeing when the query is invoked, the SQL logging shows the query in the final form: with all SQL dialect considerations evaluated and all macros expanded.
    • Logging Workflow Rule Invocations
    • Logging View-Analysis Query Operations
  • Web Central Help and Java API Reference
    • Event Handler Interface
      • Web Central expects that each event handler that is called from a workflow rule will implement the EventHandler interface.
      • Essentially, this amounts to implementing at least a single “handle()” method that Web Central knows to call.
  • When to Use Custom Workflow
    • Customized business workflow requiring complex decision logic
    • Complex reporting requiring multiple custom queries and invoked via AJAX
    • Use results of a SQL query to execute another SQL query(ies)
  • Components of a Workflow Rule
    • Workflow Rule
      • A database record describing…
        • Function – ‘Approve Project’
        • Parameters – ‘Project ID’
        • Security – Who may execute, e.g.: ‘Project Approvers’
    • Event Handler
      • A compiled Java class file defining… Business logic
    • Note: Each Workflow Rule must call an Event Handler that implements the rule
  • Custom Workflow Rule Development Process
    • Create event handler Java class
    • Compile event handler Java class into JAR file
    • Create workflow rule definition in an XML file
    • Import the workflow rule XML definition into the database
    • Write event handler unit test and verify that it works
    • Test the workflow rule from Web Central UI
  • ADN Product/Activity Structure
    • Workflow rules and event handlers are a part of ADN product/activity structure:
  • Working with Web Central’s API
    • Web Central API provides over 100 methods
      • More than double in size from 16.2
    • Functionality including:
      • Create/retrieve/update/delete database records
      • Format and localize data values
      • Invoke other workflow rules
      • Render views and generate reports
      • Send email notifications
  • Moving Event Handlers to Production
    • Event handlers are compressed to JAR format
    • Product and Activity name are used as a part of the JAR file name
  • Rules for Handling Exceptions
    • Stop… Don’t do it!
    • All exceptions thrown from event handlers are handled by Web Central:
      • The database transaction is rolled back
      • An error message is displayed and logged to archibus.log file
  • Rules for Handling Exceptions
    • You may handle exceptions if…
      • You use custom transaction management, or…
      • To provide custom error message to the user
  • WebCentral as Development platform
    • Built in Development Platform
    • Activity’s root directories contain build scripts
        • For example: ..adn-productsmy-productmy-activity
      • compileJar.bat Compiles Java classes, creates JAR file and copies it to WEB-INF/lib
      • importWorkflowRules.bat Imports workflow rules from an XML file into database
      • exportWorkflowRules.bat Exports workflow rules from the database into an XML file
      • testEventHandler.bat Executes an event handler’s unit test and generates a report
  • Multiple methods in Event Handler
    • Event handler class can have many methods:
    • public class HelpDeskHandler
    • extends EventHandlerBase {
    • public void approve (EventHandlerContext context){
    • // your code here
    • }
    • public void reject (EventHandlerContext context){
    • // your code here
    • }
    • This event handler Java class implements two different workflow rules
  • Working with Input Parameters
    • All input parameters are passed to the event handler via EventHandlerContext object:
    • public void handle(EventHandlerContext context) {
    • Double cost_estimated = (Double)
    • context.getParameter(&quot; cost_estimated &quot;);
    • Web Central converts HTTP request string parameters into Java objects of a correct type – numeric, date, time
    • String parameters are literalized to protect from SQL injection attack
    • If parameter is not supplied, the exception is thrown
  • Working with Input Parameter Groups
    • Use input parameter groups to handle all values submitted from the form – regardless of their number or names:
    • Map fieldValues = new HashMap(
    • context.getParameters(&quot; fields &quot;));
    • fieldValues .put(&quot;project.status&quot;, &quot;Approved&quot;);
    • executeDbSave(
    • context, &quot;project&quot;, stripPrefix( fieldValues ));
  • Returning Results from Event Handlers
    • Use EventHandlerContext to add any number of response parameters:
    • String message = localizeString (context, &quot;Hello!&quot;);
    • context. addResponseParameter (&quot;message&quot;, message);
    • All response parameters are added to the response-for-XSL document:
      • String parameters as attributes of actionIn XML element;
      • XML parameters as children of actionIn XML element;
    • Access the workflow rule response parameters in custom view XSL:
    • <xsl:variable name=&quot;message&quot; select=&quot; //actionIn/result/@message &quot;/>
  • Tools for Writing Your Own Handlers
    • Folder structure
    • Command Utilities
    • The Eclipse IDE (WebCentralEclipseGuide.doc)
    • Unit Tests
    • JS Eclipse
    • XML Buddy
    • Firefox
    • FireBug
  • Putting it all Together
    • Helpdesk Request Example
    • afm_activity_params table
  • Questions?