2019/01/28

Enabling CORS in your jBPM Business Application

Currently when you generate your jBPM Business Application (online via start.jbpm.org, command-line via the jba-cli package, or in Visual Studio code via the jBPM extension) your app will have CORS (Cross-origin resource sharing) disabled by default.

With CORS disabled, if you have a consumer app (e.g. React frontend)  which does not live on the same domain as your business app, it will not be able to query its REST api.

CORS will be enabled by default with the next jBPM community release (7.18.0.Final), see Jira JBPM-8176, but if you would like to enable this on you own now, it is very easy to do:

In your generated business app service module edit the DefaultWebSecurityConfig.java file and replace it with the one in this Gist. That's it :)

With this change in place you will now be able to query your business apps REST api from any domain, for example if you are using jQuery.ajax and want to get your server information (/rest/server endpoint) you could do for example:

Sample ajax request to /rest/server

2019/01/23

Visual Studio Code extension for generating jBPM Business Apps


If you are developing your apps using Visual Studio Code you can now install a new jBPM Business Application extension. With this extension and the great tooling support of VSC you can now generate, develop, and launch your jBPM business apps without ever leaving your development environment.

Here is the youtube video showcasing how to install and use this extension:



The sources of the extension are on github. We are looking for contributions to make this extension better in the future.

2019/01/14

Generate jBPM Business Apps with Node.js Command-line interface (CLI)

In addition to start.jbpm.org there is now an command-line way to generate your jBPM Business Applications, namely with the jba-cli Node package.

jba-cli package on npmjs.com
Sample CLI usage

If you have Node installed locally you can install and run this package with:

npm install jba-cli -g
jba gen
This allows your to build your jBPM Business app zip file without having to go through the browser. 
To contribute to this little cool project feel free to clone it and create pull requests from its github repo.

Here is youtube video showing how to install and use the jba-cli command line interface to generate your app:



2019/01/11

Service task repository integrated into Business Central

Service tasks (aka work items) are of tremendous use in business processes. Users can build their custom logic into well defined tasks that can be reused across processes or even projects. jBPM comes with rather large set of service tasks out of the box, you can explore them in jbpm-work-items repository in GitHub.

jBPM also provides standalone service repo that could be used from jBPM designer to import service tasks. Though that was just intermediate step towards better integration with authoring tooling - Business Central.

Brand new integration between service task repository and business central is under development and I'd like to share a bit of news about this upcoming feature...

Service Task administration




First and foremost there is global administration of service tasks. This allows to select what service tasks (that the authoring environment comes with) are allowed to be installed in projects.




There are three configuration options
  • Install as Maven artefact - will upload the jar file of the handler if it does not exist in the local or Business Central's maven repo
  • Install service tasks artefact as maven dependency of project - will update pom.xml of project upon installation of the service task
  • Use version range - when adding service task artefact as project dependency it will use version range instead of fixed version e.g. [7.16,) instead of 7.16.0.Final

Service task installation - project settings

Once the service tasks are enabled they can be used within projects. Simply go into project settings page and install (or uninstall) service tasks of your desire. Note that this settings page will only list service tasks that are globally enabled.

Service tasks can then be installed into projects. During installation following will be done
  • dedicated wid (work definition) file is created for installed service task
  • custom icon for the service task is installed into project resources (if exists)
  • pom.xml of the project is updated to include dependencies (if it is enabled in the global settings)
  • deployment descriptor is updated to register work item handler for the service task
Similar steps are performed for uninstallation though to remove rather than add configuration.


Here is a short video (this time with audio.. not sure if that is good or bad ...) that illustrates the entire feature working together, including use of service task in business process.



This is part one of this feature so stay tuned for more updates in coming weeks...

Here is a complete video showing all features in action including


  • service repository administration
  • uploading new service tasks
  • default service tasks (REST, Email, Decision, etc)
  • installing service tasks into project with prompt for required parameters



This feature is planned for 7.17 so all the feedback is more than welcome.

2019/01/08

Using React as frontend for jBPM Business Apps

React is a very popular and powerful JavaScript framework and is currently one of the best frontend development frameworks out there.

In this demo we show how you can easily integrate React into your existing or new jBPM Business Application and consume data from the the out-of-the-box Rest services via React components.

React Demo 

As usual all the sources of this demo are on GitHub.
The demo integrates the React front-end app with the service module of your jBPM Business application via the frontend-maven-plugin and then bundles its resources in the generated business app jar. This way you can just start your business app with the provided launch scripts and both React frontend and your business app backend will be available and started together.

When building the demo the same plugin will also attempt to install node and npm (which are needed for React apps) if they are not available on your machine. It will also build the React frontend for you, so no need to build it separately.

Here is the youtube video for this demo:




Feel free to leave us any comments about this demo and ideas on how to improve it or what you would like to see next.

2019/01/04

Building jBPM Business Applications with Gradle

 



By default jBPM Business Applications generated via start.jbpm.org are build with Apache Maven. Your generated apps also include build scripts (for Unix, OSX, and Windows) which you can use out of the box to build all the apps modules, as well as launch your app in normal or dev modes.

Using Maven is fine however it excludes Gradle users from being able to build and launch jBPM Business Applications using their favorite build tool.

If you are using Gradle, take a look at this GitHub repo which includes Gradle build files as well as build scripts that call Gradle to build and launch your business application.



Follow the documentation there to set up your Gradle build environment for your generated jBPM business app.

Note that the out-of-the-box Maven build scripts are still the preferred choice when building your app. This is because the limitation of the Gradle scripts not being able to deploy your app on Docker and Openshift. We use the fabric8 plugin to help us do that and this plugin is not currently available for Gradle unfortunately (you can get more info on that here).

Also to note we are not Gradle experts and it would be really helpful if our jBPM community could help us with making the Gradle build for jBPM Business Applications better. If you are interested please clone https://github.com/tsurdilo/jbpm-business-apps-gradle and submit changes via git pull requests and share it to our community. We would really appreciate that!!

2019/01/02

jBPM Business Apps and Okta Single Sign-on (SSO)

Wanted to showcase a new jBPM Business Applications demo that includes easy
integration with the Okta identity management service.

The demo uses the developer.okta.com setup and the Okta Spring boot starter to quickly set up SSO for our jBPM Business App. It also shows how easy it is to restrict access to certain pages of your jBPM Business Application using the authentication info and identity setup in Okta.

Demo source code is on github.

The demo requires you to make an account on developer.okta.com (its free) and create an Okta application and set up two group called "Admin" and "Sales"

Okta group setup

Only other configuration is in the your apps application.properties file:

application.properties setup

All of this information you get for free once you create an account and an application on the Okta developer site.

Once you have completed this setup and start the Okta demo app, go to localhost:8090 and to authenticate and access your app. Note that since there is no logout feature in the demo app, in order to simulate the logout simply delete your recent browser cookies.

If you don't create and set up the "Sales" group in Okta for your application there accessing localhost:8090/sales will give you a "403" page:

Demo app 403 page

Otherwise you will be able to access it:

Demo sales page

The apps index page is authorized to users that are in the "Admin" group that you have set up in Okta.

Here is a youtube video which walks you through the Okta demo and shows how simple it is to set 
this all up: