Step I¶
Create Driving Licence Project¶
To create a smile Driving Licence project, go to the command line and do the following steps
~/temp $ smile new DrivingLicence
~/temp $ cd drivingLicence
~/temp/drivingLicence
~/temp/drivingLicence $ sbt
$[drivingLicence] smile
- For flow we need to add ‘prism’ component, which is built on smile specificallyfor flow.
$[drivingLicence] add-component prism-release-0.7
info] downloading prism-release-0.4-smile-3.3.3.zip from https://bitbucket.org/sanjibkg/smile-repo/downloads ...
######################################################################## 100.0%
[info] prism-release-0.4 is installed in local repository
[error] add the following dependent components and try again : valey-api_release-0.11,gompa-release-0.12,buter-release-0.14,bread-release-0.4
- prism depends on valey-api, gompa, buter, bread, and these dependency inclusion is guided by smile.
$[drivingLicence] add-component bread-release-0.4
$[error] add the following dependent libs and try again : common-0.1
$[DrivingLicence] $ add-lib common-0.1
$[info] common-0.1 is added to the project
$[info] add the import-lib 'import-lib common-0.1' to /Users/trishna/i3/drivinglicence/k/DrivingLicence.ksmile and smile.
$[DrivingLicence] $ add-component bread-release-0.4
$[info] bread-release-0.4 is added to the project
$[info] refresh eclipse project
$[info] add the import 'import-component bread-release-0.4(BreadData,BreadDomain,NotifierProcess)' to /Users/trishna/i3/drivinglicence/k/DrivingLicence.ksmile and smile.
$[DrivingLicence] $ add-component buter-release-0.14
$[info] buter-release-0.14 is added to the project
$[info] refresh eclipse project
$[info] add the import 'import-component buter-release-0.14(ButerVue)' to /Users/trishna/i3/drivinglicence/k/DrivingLicence.ksmile and smile.
$[DrivingLicence] $ add-component gompa-release-0.12
$[info] gompa-release-0.12 is added to the project
$[info] refresh eclipse project
$[info] add the import 'import-component gompa-release-0.12(GompaApi,GompaApiDomain,GompaApp,GompaData,GompaDomain,GompaMongo,GompaScript,LoginApp)' to /Users/trishna/i3/drivinglicence/k/DrivingLicence.ksmile and smile.
$[DrivingLicence] $ add-component valey-api_release-0.12
$[info] valey-api_release-0.11 is added to the project
$[info] refresh eclipse project
$[info] add the import 'import-component valey-api_release-0.11(ResourceConnector,ResourceConnectorData,ValeyApi,ValeyData,ValeyDomain,ValeyMongo,ValeyStream)' to /Users/trishna/i3/drivinglicence/k/DrivingLicence.ksmile and smile.
- Open DrivingLicence.ksmile in Eclipse.
- Edit DrivingLicence.ksmile and insert the below content to create a DlProcess module
import-lib common-0.1
import-component bread-release-0.4(BreadData,BreadDomain,NotifierProcess)
import-component buter-release-0.14(ButerVue)
import-component gompa-release-0.12(GompaApi,GompaApiDomain,GompaApp,GompaData,GompaDomain,GompaMongo,GompaScript,LoginApp)
import-component valey-api_release-0.12(ResourceConnector,ResourceConnectorData,ValeyApi,ValeyData,ValeyDomain,ValeyMongo,ValeyStream)
import-component prism-release-0.7(BrowserApi,BrowserApp,BrowserData,BrowserMongo,BrowserQuery,MonitorApi,MonitorApp,MonitorData,MonitorMongo,MonitorProcess,MonitorQuery,PrismData,PrismDomain,ReportApi,ReportApp,ReportData,WorkerApi,WorkerApp,WorkerData)
section dl{
process-module DlProcess at com.metastay.dlprocess
}
- import all the components(bread,butter,gompa,valey) in eclipse, they are in <install dir>/smile/component
- $smile
- In Eclipse refresh to see the DlProcess.kprocess
Review Application Task¶
- Edit DlProcess.kprocess and insert the below content to create a DrivingLicense flow
role-ref RTO("rto"), Applicant("applicant")
flow DrivingLicense {
document(firstName:String,lastName:String, age:Int, reviewOkay:Boolean = `false`)
task ReviewApplication {
input(firstName, lastName, age) display-id("${document.firstName} ${document.lastName}")
output(reviewOkay)
realizer manual(RTO) distribution(system)
}
net DL {
init-document(firstName,lastName, age)
START out (ReviewApplication)
END in (ReviewApplication)
}
}
- We needed to create two roles, RTO and Applicant, document holds the data to be filled up by the flow.
- ReviewApplication task is the definition of the task. realizer manual means a person with RTO role should be able to do the task
- display-id defines the task name in UI, here we need to see whose application(First Name and Last name) we are looking at.
- Net DL chains the tasks and reveals the sequence they will be created and completed.
- DrivingLicense flow is ready to run with the single task.
- Now it could be a good time to load DrivingLicense in IntelliJ(build.sbt)
- Before running,you might have to include the following part in drivinglicence/conf/smile.conf
bbq-pinned-dispatcher {
executor = "thread-pool-executor"
type = PinnedDispatcher
}
* to run the project go to command line
$[drivingLicence] run
Gompa Setup¶
We included gompa component to the project at the begining. Gompa enables us to set up user, team, usergroup for the flow. Here in gompa we also set up user to the role. We will be setting up RTO and Applicant role which we defined in DlProcess.kprocess
- Go to the browser, and localhost:9000/gompa
- enter username and password gompa/gompa
- click on user tab and Add User button and create rto user, userName/password rto/rtorto
- Add another User johndoe , userName/password johndoe/johndoe
- Click on tab App -> MonitorApp -> Add User Role, select User from Role dropdown, and rto from Username select
- Click on Add User Role and now select canCreateFlow from Role dropdown,and rto from Username select
- Click on Add User Role and now select User from Role dropdown,and johndoe from Username select
- Click on tab App -> WorkerApp -> Add User Role select User from Role dropdown, and rto from Username select
- Click on Add User Role select User from Role dropdown, and johndoe from Username select
- Click on tab Team -> Create Team Select DlProcess::DrivingLicence from the dropdown and enter Team Code ad “dlteam” , submit
- After submitting click on Add User Role then select Supervisor from Role dropdown,and rto from UserName select
- Again Add User Role and select Rto from Role dropdown,and rto from UserName select
- Gompa set up is done, we created two user rto and johndoe, and one team for the flow. Then user named rto got rto role, and johndoe got an applicant role. And user rto also got the permission to create flow, and has become a supervisor too. Though WorkerApp rto and johndoe both became worker app user to use the app to see their assigned task.
Execute Flow¶
Now we are ready to create driving licence flow and execute the task
- Go to the browser, and localhost:9000/monitor
- enter username and password rto/rtorto (rto user can create the flow)
- Go to Team tab and click on + button next to the team name
- In Create Flow page select the net DL, and First name as Jim ,Last name as Harrison and age as 50
- Submit will create the flow, and a review Application task (notice the task is allocated to rto)
- Go to localhost:9000/executive to see the task allocated to rto.
- Click on the task display as Jim Harrison(display-id as Firstname and Last name mentioned in the spec)
- Start the task by clicking on START button, check output Review Okay as true
- Click on COMPLETE Button
- Go to localhost:9000/report, and select Flow name Driving Licence, and search
- Click on the search result, and see the complete report of the flow just completed
That concludes the step one which has a flow with single task and complete user set up to execute the flow.