460 likes | 858 Views
SmartForms for Banner Workflow. Presented by: Wallace Neikirk , Wright State University March 26, 2008. Introduction. This is a discussion of “ SmartForms ” SmartForms is the fusion of a web app to a workflow using web services.
E N D
SmartForms for Banner Workflow Presented by: Wallace Neikirk, Wright State University March 26, 2008
Introduction • This is a discussion of “SmartForms” • SmartForms is the fusion of a web app to a workflow using web services. • This idea was motivated by workflow’s static forms & factory floor approvals. • With SmartForms, we keep a large number of requestors at the web site & and a small number of admins in workflow doing business. • In addition, we will discuss “AjaxForms” • AjaxForms is the fusion of a web app to a workflow using the browser’s AJAX services. • This enables (out-of-the-box) “SimpleForms” to have dynamic Banner data in its HTML components.
Agenda • WSU Architecture • SmartForm Architecture • Development Environment • “FOAP Change” Request Form • SimpleForm Model • SmartForms • Design Details • AJAX Forms • Design Details • Future Plans • Questions
WSU Computing from 30,000 feet WSU Architecture
WSU Architecture • We are a Unified Digital Campus • We bought all the SCT products • WSU has been a Banner school since 2005.
WSU computing to implement SmartForms. SmartForm Architecture
SmartForm Architecture • This is the subset of the architecture to do SmartForms. • The only piece of architecture we added is the Tomcat App Server. • It houses the SmartForms. • Workflow communicates with Tomcat using Restful Web Services. • Workflow provides a “Web App” technology type to initiate the web services. • Tomcat communicates with Workflow using it’s SOAP services. • SCT Workflow is running an AXIS server to service SOAP request.
Tools to construct SmartForms. Development Environment
Development Environment • Development stations … • EasyEclipse 1.2.2 • Tomcat 4.1 • Import Workflow & Oracle jars into Eclipse • {Home}/lib/workflow • Clean compile • Production Deployment … • Publish SmartForm.war to Tomcat • Publish components, models, events, etc. to Workflow • Publish supporting tables to Oracle • Note, we are on Workflow 4.4
Let’s begin with the original request form. “FOAP Change” Request Form
“FOAP Change” Request Form • This is the current PDF Form • org_request_form.pdf • User can request new, revised, or terminated FOAP elements • Composed of FOAP content & approvals • User prints out, fills out, and sends through University mail
Document Processing • Document processing can be very straight forward … • User completes a request form • Approvals are collected • An Admin of the University does the task • The requestor is notified when complete
Document processing with SimpleForms, i.e., Workflow Custom Activity. SimpleForm Model
SimpleForm Model • Let’s implement “FOAP Change” solely with workflow • User signs onto Workflow • User fires off the workflow from “My Processes” • User fills out the request with SimpleForm • Static • Validation loop • Approvals are collected with SimpleRoute & SimpleApproval • Route is encoded into the model • Factory floor approvals
SimpleForm Demo • Let’s create a “FOAP Change” request • Note, all users that can make this request must be defined as Workflow users • Note, the request becomes an annoying guess & validate loop • Note, all possible approval paths must be encoded into the model
Document processing with SmartForms, i.e., Workflow web application business component. SmartForm Model
SmartForm Request • This is the “FOAP Change” Request implemented as a SmartForm • SvtSmartForm?action=Render&formTyp=OrgnReq • User navigates to the SmartForm from any University web site • SmartForm provides dynamic drop downs, search dialogs, and generated approvals • When the user submits the SmartForm, the corresponding workflow is initiated with the use of web services
SmartForm Model • The approval loop is driven by SmartForm’s generated route • The SmartForm & Workflow cooperate to collect approvals • Workflow posts to the SmartForm for the next approver • The SmartRoute task takes the next approver to the SmartForm for approval action
SmartForm Demo • Let’s create a “FOAP Change” request using a SmartForm • SvtSmartForm?action=Render&formTyp=OrgnReq • Note, requestors are NOT defined to workflow. We limit workflow users to a small set of University admins. • Note, Dynamic drop downs, Search dialogs, etc. • Note, generated route based upon content of form
SmartForms is a web application that uses Workflow web services. Design Details
Sequence Diagram • Create a SmartForm scenario … • User completes the SmartForm • Route is generated • Workflow is initiated • Approve a SmartForm scenario … • User approves the SmartForm • Set workflow context parms • Complete workitem task
SmartForm Design • SmartForms cooperate with Workflow using web services • The SmartForm class implements … • Initiate a workflow • Get/set context parameters • Release/complete a workitem • Workflow post request to a SmartForm • @BUILTIN_WORKITEM
Class Diagram • The Dispatch Servlet instantiates the proper model bean based upon the formTyp posted • The SmartForm Class handles all the web services • The SmartRoute Class handles all approvals, rejections, etc. • The OrgnReq Class inherits it’s “Smart” functionality
Database Diagram • These are the supporting data tables for SmartForms • The SmartAudit tables logs changes to the SmartForms
SmartForm code examples using Workflow web services. Code Details
WebAppTechnology Type • This is the SmartForm business component defined in workflow. • It uses the “Web App” technology type delivered with SCT Workflow. • This component will launch the SmartFormwebapp on Tomcat. • Simply fill in the Web Launch Parameters – host, action, etc. • Note, the special @ variables. These are either built-in system variables or context parameters. • The @BUILTIN_WORKITEM is a special variable.
Getting Userid & Role • select i.id, i.role_id, i.performer_id, • r.id, r.name, r.description, • u.id, u.logon • fromworkflow.vworkitemsi, • workflow.role r, • workflow.wfuser u • where i.id = wfWorkitem • andi.role_id = r.id • andi.performer_id = u.id • Workflow post to a SmartForm sending it @BUILTIN_WORKITEM • This piece of data can be used to obtain the user’s workflow userId and role • SmartForm needs to know who is performing the task • The @BUILTIN_WORKITEM is used to call SOAP services to get/set workflow context parms, complete/release workitems.
Initiate a Workflow • classpath: axis-ant.jar, axis.jar, jaxrpc.jar, saaj.jar, workflow.jar, xercesImpl.jar, xml-apis.jar • import com.sct.workflow.ws.v1_0.*; • import com.sct.workflow.ws.messages.v1_0.*; • Authentication authentication; • PrimaryKeyprimaryKey; • try { • String principal = new String("wfwebservices"); • String credential = new String(“u_pick_it"); • authentication = new Authentication(principal, credential); • NameParameterValuePairformIdParm = new NameParameterValuePair(); • formIdParm.setName("formId"); • formIdParm.setStringValue(formId); • PostExternalEventRequestpostReq = new PostExternalEventRequest(); • postReq.setAuthentication( authentication ); • postReq.setEventName( new String("eSmartOrgnReq") ); • postReq.setProductTypeName( new String("pSmartForm") ); • postReq.setExternalSource( new String("Wright State University") ); • postReq.setExternalID( new String("SmartOrgnReq") • + String.valueOf( System.currentTimeMillis() ) ); • postReq.setExternalDate( createDateTime( new Date() ) ); • postReq.setWorkflowName( new String("SmartOrgnReq") ); • postReq.setParameter( new NameParameterValuePair[] {formIdParm} ); • WorkflowWSLocator locator = new WorkflowWSLocator(); • locator.setWorkflowWSEndpointAddress( • "http://oas.wright.edu:8080/test/ws/services/WorkflowWS/v1_0"); • WorkflowWSPortTypews = locator.getWorkflowWS(); • PostExternalEventResponse response = ws.postExternalEvent( postReq ); • primaryKey = response.getExternalEventPK(); • This is the Java code to initiate a workflow • Class path should have the workflow jars • {Home}/lib/workflow • Import workflow packages • Authenticate, set parms, post request, post response • Define product type, business event, workflow model, etc.
Get/Set Context Parms • classpath: axis-ant.jar, axis.jar, jaxrpc.jar, saaj.jar, workflow.jar, xercesImpl.jar, xml-apis.jar • import com.sct.workflow.ws.v1_0.*; • import com.sct.workflow.ws.messages.v1_0.*; • Authentication authentication; • PrimaryKeyprimaryKey; • try { • String principal = new String("wfwebservices"); • String credential = new String(“u_pick_it"); • authentication = new Authentication(principal, credential); • primaryKey = new PrimaryKey(wfWorkitem); • NameParameterValuePairorgnParm = new NameParameterValuePair(); • orgnParm.setName( "orgn" ); • orgnParm.setStringValue( orgn); • SetWorkItemContextRequestsetReq = • new SetWorkItemContextRequest(authentication, primaryKey, • new NameParameterValuePair[] { orgnParm} ); • WorkflowWSLocator locator = new WorkflowWSLocator(); • locator.setWorkflowWSEndpointAddress( • "http://oas3.wright.edu:8080/workflow/ws/services/WorkflowWS/v1_0"); • WorkflowWSPortTypews = locator.getWorkflowWS(); • SetWorkItemContextResponse response = ws.setWorkItemContext( setReq ); • } catch (Exception e) {} • This is the Java code to set workflow context parameters • Import workflow packages • Authenticate, set parms, set request, set response • Used when update approve, etc. a SmartForm • Get workflow context parameter is similar
Release/Complete Workitem • classpath: axis-ant.jar, axis.jar, jaxrpc.jar, saaj.jar, workflow.jar, xercesImpl.jar, xml-apis.jar • import com.sct.workflow.ws.v1_0.*; • import com.sct.workflow.ws.messages.v1_0.*; • Authentication authentication; • PrimaryKeyprimaryKey; • try { • String principal = new String("wfwebservices"); • String credential = new String(“u_pick_it"); • authentication = new Authentication(principal, credential); • primaryKey = new PrimaryKey(wfWorkitem); • CompleteWorkItemRequestcompleteReq = • new CompleteWorkItemRequest(authentication, primaryKey); • WorkflowWSLocator locator = new WorkflowWSLocator(); • locator.setWorkflowWSEndpointAddress( • "http://oas3.wright.edu:8080/workflow/ws/services/WorkflowWS/v1_0"); • WorkflowWSPortTypews = locator.getWorkflowWS(); • CompleteWorkItemResponse response = ws.completeWorkItem( completeReq ); • } catch (Exception e) {} • This is the Java code to complete a workitem • Import workflow packages • Authenticate, complete request, complete response • Used when render, reject, etc. a SmartForm • Release a workitem is similar
Extending the functionality of SimpleForms with Browser's AJAX Services. AJAX Forms
AjaxForm Architecture • This is the subset of the architecture to do AjaxForms. • The only piece of the architecture we added is the AjaxForm Service. • It houses the Ajax components, e.g., Manager List, Fund List, Orgn List, etc. • These components had to be installed on the SCT Workflow Server – OC4J. • The components must come from the same ip domain as the Workflow SimpleForms. • Workflow communicates with these Ajax components using the browser’s XmlHttpRequest object. • This is done with some simple JavaScript functions. • The Ajax components communicate to Workflow by using those same SOAP services. • SCT Workflow is running an AXIS server to service SOAP request.
AjaxForm Model • This is a copy of the SimpleForm Model, except … • The AjaxForm replaces the SimpleForm task. • Actually, it is still a SimpleForm, but embedded into it are JavaScript calls to the Ajax components installed on the Workflow Server. • These components return live Banner data to the Browser. • So, we get dynamic data in our drop-down’s, list boxes, etc. • This technique eliminates that irritating validation loop
AjaxForm Demo • Let’s create a “FOAP Change” request using an AjaxForm • Note, Dynamic Banner data in the drop-downs, list boxes, etc. • The annoying guess & validate loop has been eliminated.
AjaxForms is a web application that uses Browser AJAX services. Design Details
AjaxForm Design • AjaxForms cooperate with Workflow through the Browser’s XmlHttpRequest Object. • The AjaxForm class implements … • Send/Receive Xml request • Get/set workflow context parameters • When the AjaxForm post to its components on the Workflow Server, it is passing that same @BUILTIN_WORKITEM variable. • This allows the components to determine the user performing the task, what role they are playing, etc. • It also allows the components to set/get workflow context parameters through the use of those same SOAP services.
Class Diagram • The Dispatch Servlet instantiates the proper model bean based upon the compTyp posted. • The AjaxForm Class handles all the Ajax and SOAP services. • The MgrList, FundList, OrgnList, and ProgList Class handle getting and setting up of the Banner data for the dynamic Html components. • The List classes inherit all their communication functionality.
AjaxForm code examples using Browser AJAX services. Code Details
Workflow Model Html • <script type="text/javascript" • src="/wsuwft/wf/ajax/finmgr/MgrList.js"> • </script> • <a href="#" • onclick="javascript:getMgrList(@workflowId);">Get • </a> • <span id="mgrlist_result"> • </span> • This small amount of Html goes into the AjaxForm task in the Workflow Model. • This is just a SimpleForm with some JavaScript dropped into it. • The imported JavaScript (MgrList.js) does the Ajax communications. • When the hyperlink is clicked, an Ajax call is made to the Workflow Server for dynamic Banner data. • Note, it passes the all important @BUILTIN_WORKITEM • The Workflow Server responds with a manager list drop-down which is placed into the <span id> tag.
Get Ajax Request Object • varreceiveReq = null; • function getXmlHttpRequestObject() { • if (window.XMLHttpRequest) { • return new XMLHttpRequest(); //Not IE • } else if(window.ActiveXObject) { • return new ActiveXObject("Microsoft.XMLHTTP"); //IE • } else { • alert("Your browser doesn't support the XmlHttpRequest object.”); • } • } • This is part of the imported JavaScript (MgrList.js) that handles Ajax communications. • First, we need to get a reference the the browser’s XmlHttpRequest object. • If the browser in no IE, then there is one way, • If the browser if IE, then you do it the MicroSoft way • Some browsers don’t support Ajax ???
Get Ajax Manager List • function getMgrList(wfWorkflowId) { • receiveReq = null; • receiveReq = getXmlHttpRequestObject(); • if (receiveReq.readyState == 4 || receiveReq.readyState == 0) { • receiveReq.open("GET", • "/wsuwft/SvtAjaxComp?compTyp=MgrList&action=GetMgrList&wfWorkflowId=" + • wfWorkflowId, true); • receiveReq.onreadystatechange = handleGetMgrList; • receiveReq.send(null); • } • } • function handleGetMgrList() { • if (receiveReq.readyState == 4) { • document.getElementById("mgrlist_result").innerHTML = receiveReq.responseText; • } • } • This is part of the imported JavaScript (MgrList.js) that handles Ajax communications. • The getMgrList function … • First, gets a reference to the XmlHttpRequest object • Then, it makes an asynchronous call to the Workflow Server for Banner data • It also registers the function to handle the response to the asynchronous call. • The handleGetMgrList function is called every time the request object changes state. • It receives the dynamic html component from the server • And, places in the <span id> tag on the AjaxForm page.
Get Java Manager List • // read mgr comp • datMgrList = new DatMgrList(wfMan, wfLog, wfEmail, wfDbPool); • datMgrList.setFmgrLastName(""); • datMgrList.readMgrList(); • // construct html view • StringBuffersb = new StringBuffer(); • sb.append("<select name='mgrList' onclick='javascript:setMgrList(this.value);'>"); • Enumeration e = datMgrList.getMgrList().elements(); • while ( e.hasMoreElements() ) { • DatMgrListdatMgrList = (DatMgrList) e.nextElement(); • sb.append("<option value='" + datMgrList.getFmgrCodePidm() + "," + • wfWorkflowId + "," + wfWorkitem + "'>" + datMgrList.getFmgrName() + "</option>"); • }; • sb.append("</select>"); • this.setHtmlVewMgrList(sb.toString()); • // return mgr list • PrintWriter pw = resp.getWriter(); • pw.print(cmdMgrList.getHtmlVewMgrList()); • pw.close(); • This is part of the CmdMgrList Java component installed on the Workflow Server. • This method does the get operation. • It responds to the asynchronous Ajax call from the Browser. • It reads the dynamic Banner data • Constructs an Html drop-down list • Returns that Html component to the browser.
Set Java Manager List • // read mgr comp • //datMgrList = new DatMgrList(wfMan, wfLog, wfEmail, wfDbPool); • datMgrList.setFmgrCodePidm(dFmgrCodePidm); • datMgrList.readMgrRow(); • // set the fmgrPidm & fmgrName for the manager selected !!! • Authentication authentication; • PrimaryKeyprimaryKey; • String principal = new String("wfwebservices"); • String credential = new String(""); • authentication = new Authentication(principal, credential); • primaryKey = new PrimaryKey(wfWorkitem); • NameParameterValuePaircompIdParm = new NameParameterValuePair(); • fmgrCodePidmParm.setName("fmgrCodePidm"); • fmgrCodePidmParm.setStringValue(datMgrList.getFmgrCodePidm().toString()); • NameParameterValuePairfmgrNameParm = new NameParameterValuePair(); • fmgrNameParm.setName("fmgrName"); • fmgrNameParm.setStringValue(datMgrList.getFmgrName()); • SetWorkItemContextRequestsetReq = new • SetWorkItemContextRequest(authentication, primaryKey, • new NameParameterValuePair[] {fmgrCodePidmParm, fmgrNameParm} ); • WorkflowWSLocator locator = new WorkflowWSLocator(); • locator.setWorkflowWSEndpointAddress( • "http://oas3.wright.edu:7778/wfTEST3/ws/services/WorkflowWS/v1_0"); • WorkflowWSPortTypews = locator.getWorkflowWS(); • SetWorkItemContextResponsesetResp = ws.setWorkItemContext( setReq ); • This is also part of the CmdMgrList Java component installed on the Workflow Server. • This method does the set operation. • It responds to the asynchronous Ajax call from the Browser. • When the user clicks on the drop-down, this method reads that particular Manger’s data from Banner. • Then, it uses Workflow’s SOAP services to set its context parameters.
Future Plans • Move more SmartForms into production • Can I add new forms quickly? • Try to make SmartForms into a framework • Make it quick & easy for new forms to enter the framework • Alter existing static Workflows with Ajax components.
Summary • We’ve taken a look at SmartForms • SmartForms cooperate with workflows through the use of web services • SmartForms have dynamic drop-downs, search dialogs, and generated approvals • They limit the number of workflow users to a small set of University admins • Also, we have taken a look at AjaxForms • AjaxForms cooperate with workflows using the browser’s AJAX services • AjaxForms produce dynamic drop-downs, list boxes, etc.
Thank You!Q & A Wallace Neikirk wallace.neikirk@wright.edu