Eric D. Schabell: How To Duplicate Artifacts In JBoss BPM Suite in 3 Easy Steps

Monday, October 13, 2014

How To Duplicate Artifacts In JBoss BPM Suite in 3 Easy Steps

Earlier we have shown you how to access your business users project within the JBoss BPM Suite, by cloning over an SSH connection.

The following example is using the JBoss BPM HR Employee Rewards process project as the starting off point, giving us a completed process project.

Now we assume that we want to extend our existing process with a new BPMN2 concept, but we don't want to create a new process parallel from scratch. We have the desire to copy the existing artifact and start modifying from there.

Looking into the JBoss BPM Suite we can't find a way to do this in the dashboard, not even when we are managing the artifacts as an admin user.

Project Authoring duplicate of process artifact.
This is fine, as the developer setting up a project has more control options as the underlying repository is GIT which they can approach with all the normal tooling they use to develop their applications.

In the following 3 easy steps we use the command line in a console to show the GIT interaction to copy and insert a new process that gets you started working on the new modifications you want to make.

1. Clone process project

As stated, this has been covered in a previous article. Here is the short version to clone the rewards process project over SSH.

$ git clone ssh://erics@localhost:8001/rewards-demo

Cloning into 'rewards-demo'...
The authenticity of host '[localhost]:8001 ([127.0.0.1]:8001)' can't be established.
DSA key fingerprint is ef:48:43:b3:ef:c4:ac:c7:d3:2a:3f:52:63:52:8c:e8.
Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added '[localhost]:8001' (DSA) to the list of known hosts.
Password authentication
Password: bpmsuite1!

remote: Counting objects: 1277, done
remote: Finding sources: 100% (1277/1277)
remote: Getting sizes: 100% (1142/1142)
remote: Compressing objects: 100% (1076486/1076486)
Receiving objects: 100% (1277/1277), 135.97 KiB | 0 bytes/s, done.
remote: Total 1277 (delta 41), reused 0 (delta 0)
Resolving deltas: 100% (706/706), done.
Checking connectivity... done.

This gives you a local copy of the rewards process project and all artifacts.

2. Copy existing artifact

Now we want to create a copy of the existing rewards process to start extending with new functionality.

$ cd rewards-demo

$ cp rewards/src/main/resources/com/redhat/jboss/hr/rewards/rewards-approval.bpmn2 \
     rewards/src/main/resources/com/redhat/jboss/hr/rewards/rewards-multi-approval.bpmn2

$ git add rewards/src/main/resources/com/redhat/jboss/hr/rewards/rewards-multi-approval.bpmn2

$ git co -m "Added new process to extend with multi-instance approval."

Administration perspective with duplicate added.
Now we have duplicated the artifact we want to extend, but it only exists locally in our project, we need to push it back to the business users.

3. Push back into project

We push the changes back into our central repository over SSH.

$ git push

Password authentication
Password: bpmsuite1!

Counting objects: 21, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (11/11), 787 bytes | 0 bytes/s, done.
Total 11 (delta 4), reused 0 (delta 0)
remote: Resolving deltas: 100% (4/4)
remote: Updating references: 100% (1/1)
To ssh://erics@localhost:8001/rewards-demo
   87e23d9..c772080  master -> master

Now we can see that it appears in business-central both in the Administration Perspective and the Project Authoring perspectives. This can be done in the same exact fashion using JBoss BRMS.
Pushed back into the central repository.

We hope this helps speed up your development by easily duplicating existing artifacts in your JBoss BRMS & BPM Suite projects.