Skip to content

marcelobfonseca/workflow-api

 
 

Repository files navigation

README

workflow-api

Building a BPMN workflow API for rails 5.1

Application in progress. This README will document all necessary steps to get the application up and running.

Dependencies:

  • Ruby 2.3.3
  • Ruby on Rails 5.1 +
  • MySQL 5.7
  • Yarn
  • Node 6.4.0 + How to Use:

1. Start localhost server

	$ git clone https://github.com/marcelobbfonseca/workflow-api.git
	$ cd workflow-api
	$ bundle install
	$ rails db:seed # add users admin, reporter and chief-editor
	$ yarn  # run yarn to compile webpacker
	$ rails server

Access server running on http://localhost:3000

Modeling a new BPD with bpmn-js. Access http://localhost:3000/bpmn/modeler Save file and image localy in yor computer

2.Create Business Process

Select Diagrams ("http://localhost:3000/admin/diagram") Create new diagram using the file and image saved, or just use one of the projects diagrams on bpmn folder. For this study case, upload the diagrama_multi.svg and ProducaoNoticiaWebMulti.bpmn located on workflow-api/bpmn directory.

The MySQL database is already setup. Uploading the diagram xml file("ex:ProducaoDaNoticia.bpmn") as paramater to the framework endpoint will create a business process for it on the relational database. Access the route below to create a Business Process for your diagram.bpmn:

GET http://localhost:3000/bpmn/create.json?name="bpmn_file_name"

For our example we will be using ProducaoDaNoticia.bpmn file, so it will be like this:

GET http://localhost:3000/bpmn/create.json?name=ProducaoDaNoticia

After that it should send a "Business Process Created." message. If you checkout your admin dashboard, there should be 1 new Business Process and all it's tasks and SequenceFlows created.

3.Assign user to a task

Still on admin dashboard click on Tasks ("http://localhost:3000/admin/task") Select the userTask pré-apura pauta to edit and assign user Aroldo, a reporter.

4. Upload Ontology

On admin dashboard, go to Ontologies and select create.("http://localhost:3000/admin/ontology/new") Create a new ontologies with:

The framework is now all setup.

5. Automatic role suggestion

Go to http://localhost:3000/ontologies view and select "show" on the ontology recently created. Just like in step 2. type the diagram name on the form to search the most suitable usertasks role for the diagram's task's. It will make a SparQL querie in the ontology for each usertask on the diagram and show the result in an array.

6. Endpoints

Get Busines Process and all lanes and tasks. 1 = BusinessProcess id

	GET http://localhost:3000/business_processes/1.json

Update Business Process current task to a next task with current_task id=22 and BusinessProcess id=1.

	PUT http://localhost:3000/business_processes/5.json
	

	{
		"business_process":{
			"current_task_id": 22
		}

	}

Get task information and existing nexts tasks

	GET localhost:3000/tasks/26.json

Creates a new Business with bpmn file name as params

	GET http://localhost:3000/bpmn/create.json?name=ProducaoNoticiaWebMulti

Get user with id = 1 data and all his tasks assigned to.

	GET http://localhost:3000/users/1.json

About

Building a BPMN workflow API for rails 5.1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 61.6%
  • CSS 32.9%
  • Ruby 4.7%
  • Other 0.8%