Skip to content

Commit

Permalink
Setup version 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-yves-monnet committed Jul 5, 2019
1 parent 67d14cf commit ea49a21
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 5 deletions.
33 changes: 32 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,33 @@
# BonitaCommandDeployment
Library to deploy automaticaly a command, when needed, and organize the communication between the source and the command
Library to deploy automaticaly a command, when needed, and organize the communication between the source and the command.



# Implement your command

A command must implement the method org.bonitasoft.engine.command.TenantCommand.TenantComand.execute().

This method has to concern:

1/ it pass as parameters a TenantServiceAccessor object. This object is not documented, and it's an internal class. Object you can access via this class are not stable, and can change on BonitaVersion. Any command you implement via this object can not work in a next release of Bonita

2/ BonitaEngine open for you a Database Transaction before the call. If you can access a public accessor, all method from the public accessor will not work (like a processAPI.getPendingTask() ): a connection is already opened.

To avoid this concern, BonitaCommandDeployment propose to extend a BonitaCommandApiAccessor class, method executeCommandApiAccessor().

public abstract ExecuteAnswer executeCommandApiAccessor(ExecuteParameters executeParameters, APIAccessor apiAccessor);

This command provide a APIAccessor, where you can get all the public API.

You are welcome to provide the method

public String getHelp(Map<String, Serializable> parameters, long tenantId, TenantServiceAccessor serviceAccessor)

to return information to the Administrator via the Custom Page Command.

# Deploy a command

Deploying a command via the API is complex.

To help the deployment, object BonitaCommandDeployment encapsulate all the work. So, a custom page who want to deploy automatically a command can just use this object.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.bonitasoft.command</groupId>
<artifactId>bonita-commanddeployment</artifactId>
<version>1.1.0</version>
<version>1.2</version>
<name>bonita-commanddeployment</name>
<dependencies>

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/bonitasoft/command/BonitaCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public static class ExecuteParameters {
* tenant Id
*/
public long tenantId;


public void setTenantId( Long tenantId) {
this.tenantId = tenantId ==null ? 1 : tenantId.longValue();}
}


Expand Down Expand Up @@ -175,7 +175,7 @@ private Serializable executeSingleton(Map<String, Serializable> parameters, Tena

executeParameters.parameters = parameters;
executeParameters.verb = (String) parameters.get(cstVerb);
executeParameters.tenantId = (Long) parameters.get(cstTenantId);
executeParameters.setTenantId( (Long) parameters.get(cstTenantId));
executeParameters.parametersCommand = (Map<String,Serializable>) parameters.get(BonitaCommand.cstParametersCommand);

logger.info(logHeader + "BonitaCommand Verb[" + (executeParameters.verb==null ? null : executeParameters.verb.toString()) + "] Tenant[" + executeParameters.tenantId + "]");
Expand Down

0 comments on commit ea49a21

Please sign in to comment.