Difference between revisions of "Stardust/Knowledge Base/Reference Project"
(→UI Mashup) |
(→UI Mashup) |
||
Line 170: | Line 170: | ||
* a Javascript Main function in '''js/OrganizationRegistrationReviewPanelMainJQuery.js''' which binds Controller and Markup. | * a Javascript Main function in '''js/OrganizationRegistrationReviewPanelMainJQuery.js''' which binds Controller and Markup. | ||
− | all in charity-portal\resources\META-INF\webapp\public. | + | all in '''charity-portal\resources\META-INF\webapp\public'''. |
<pre> | <pre> |
Revision as of 12:53, 30 March 2013
Contents
Purpose
The Charity Reference Project is intended to explain to the Stardust community and beyond for the Eclipse SOA Project how BPM technology can be used to created a complete application with minimal programming effort and maximum involvement of domain experts.
Note, that the entire functionality of the Charity Reference Project is implemented without Java expertise.
Scenario
The Federal Charity Institution of the fictitious country Neverland provides an Internet platform for charity organizations to distribute their benefits to those in need. Charity institutions can register and describe their rules for accepting beneficiaries. Beneficiaries can apply for benefits such as vacation funding.
Main Elements
Processes, Events and Activities
- Charity Organization Registration and Approval
- Data Entry
- Address Verification
- Review
- Approval/Rejection
- Vacation Request
- Data Entry
- Address Verification
- Dispatching to Charity Organization
- Review
- Approval/Rejection
Participants
- Platform Operators from the roof organization running/operating the system
- Administrators of the charity organizations
- Applicants would only be implicit participants kicking of workflows via a little portal and receiving notifications
Services
- Address Validation Specifications managed in EasySOA, implementation prototyped in OW2 FraSCAti Studio
- HTML/JS UI Component for Organization Review
- Simplistic HTML5 web portal for Charity organization registration (kicking off first process) Application for vacation funding (kicking off second process)
Data Model
- XSD
- Charity Organization (Structure)
- Vacation Funding Request (Structure)
- Beneficiary (Structure)
- Address (Structure)
- Country (Structure)
- Used across tools (BPM, WS)
Running the Project
- Install Stardust for Helios or Kepler
- Create a Dynamic Web Project charity with Stardust Profile enabled following the concepts of the Stardust Rapid Application Development (for more details see the Support Case example in the documentation).
- Load the charity-portal Utility Project from Examples in Stardust Git into your workspace
- Copy the Process Model to a folder proces-models (or the like) in your Dynamic Web Project
- Add the charity-portal Utility Project to your Deployment Assembly of the charity project (Properties > Deployment Assembly > Add Project)
After these steps your Outline should look like this
After starting the server you should be able to open
- [http:/localhost:8080/charity http:/localhost:8080/charity] to access the Stardust Process Portal and
- [http:/localhost:8080/charity/plugins/charity-portal/public/homePage.htm http:/localhost:8080/charity/plugins/charity-portal/public/homePage.htm] to access the Neverland Charity Portal.
Selected Implementation Aspects
Charity Portal
The Charity Portal is a simple HTML/JS-based implementation which leverages
Architecture is
- a single HTML page (charity-portal/webapp/public/homePage.htm) containing all HTML markup,
- JavaScript controller classes (OrganizationRegistrationPanelController.js, VacactionFundingRequestPanelController.js) in charity-portal/webapp/public/js binding and modifying the HTML content
- a ServiceAdapter.js class in charity-portal/webapp/public/js to manage REST communication with the Stardust Server.
Processes are started via REST calls from the class ServiceAdapter
jQuery.ajax({type : "POST", beforeSend: function (request) { request.setRequestHeader("Authentication", self.getBasicAuthenticationHeader()); }, url : this.getProcessStartUrl("CharityOrganizationRegistration"), contentType : "application/xml", data : payload}).done(function() { deferred.resolve(); }).fail(function() { deferred.reject(); });
using a Deferred Pattern for synchronicity.
The XML payload to initialize the Process Data is assembled manually from the JSON objects used in the UI.
var payload = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; payload += "<ser:Args xmlns:ser=\"http://eclipse.org/stardust/models/generated/Charity\" " + "xmlns:cha=\"http://www.infinity.com/bpm/model/Charity/CharityOrganization\" " + "xmlns:add=\"http://www.infinity.com/bpm/model/Charity/Address\">\n"; payload += " <ser:CharityOrganization>\n"; payload += " <cha:CharityOrganization>\n"; payload += " <name>" + organization.name + "</name>\n"; payload += " <description>" + organization.description + "</description>\n"; payload += " <beneficiarySelectionRules>" + organization.beneficiarySelectionRules + "</beneficiarySelectionRules>\n"; payload += " <add:address>\n"; payload += " <street>" + organization.address.street + "</street>\n"; payload += " <city>" + organization.address.city + "</city>\n"; payload += " <postalCode>" + organization.address.postalCode + "</postalCode>\n"; payload += " <state>" + organization.address.state + "</state>\n"; payload += " <country>" + organization.address.country + "</country>\n"; payload += " </add:address>\n"; payload += " </cha:CharityOrganization>\n"; payload += " </ser:CharityOrganization>\n"; payload += "</ser:Args>\n";
This might be replaced by an automated conversion, e.g. with json2xml. Volunteers to help are welcome to submit via Gerrit.
Process Descriptors
Process Descriptors allow to display specific process data to search for Process Instances or sort lists of those. They can be easily defined in the Process Properties Pages of the Stardust Browser Modeler:
As a result of such a definition, e.g. Worklists will automatically provide corresponding information:
Department Concept
If Organizations are marked as supporting Departments and bound to Process Data like for Charity Organization below
Instances (Departments) of these Orgnizations and their respective Roles can be created at Runtime and users can be assigned to it.
Workitems are automatically dispatched as follows
UI Mashup
The Activity Review Organization Registration in the Organization Registration Process uses a UI Mashup for its implementation.
It is defined as follows in the Stardust Browser Modeler
with the following Input and Output Parameters
and can even be tested in th Browser Modeler
The implementation also follows established HTML/JavaScript patterns with
- an HTML file organizationRegistrationReviewPanelJQuery.htm,
- a JavaScript Controller js/OrganizationRegistrationReviewPanelControllerJQuery.js
- a Javascript Main function in js/OrganizationRegistrationReviewPanelMainJQuery.js which binds Controller and Markup.
all in charity-portal\resources\META-INF\webapp\public.
jQuery(document).ready(function() { var interaction = UiMashupInteraction.create(); interaction.bind().done(function() { var controller = OrganizationRegistrationReviewPanelController.create(); controller.setCharityOrganization(interaction.input.CharityOrganization); }).fail(function() { console.log("Failed to bind Interaction object."); }); });