how do i use my custom connector inside the restApi

1
0
-1

hi guys
i have connector for create log inside of business data ( my connector start process for save new log)
i have restapi . the duty of this rest api is to assign and unassign task to specific user .
i want to use that connector inside of this rest api so i can have the assign logs .
i exported that connector and add as dependency inside of rest api dependencies

org.mycompany.connector
LogConnector-impl
1.0.0
provided

and i copy the jar file in side of this folder
.m2\repository\org\mycompany\connector\LogConnector-impl\1.0.0
then after deploy and execute rest api i have some errors that tell this
java.lang.ClassNotFoundException: groovy.lang.GroovyObject
i look inside the other dependency , bonita added there own dependency automatically ( the business data model are there ) but the connector class are not added there automatically .
i spent tree day on this problem without any result :(
what i am supposed to do ?

1 answer

1
0
-1

Hi,

The connector can be executed only by the process, either at the process level (start or end) or task level (start or end).

Trying to execute it using another way might most likely lead you into issues. That being said, here is an option to solve your issue.

You should externalize the logic used by your connector in a Java library that will be declared as a dependency of your connector. Then you can use this same dependency in your REST Api. As this dependency should be self-sufficient, that should work for both your connector and REST Api extension.

Cheers

Comments

Submitted by Meysam25 on Sat, 07/22/2017 - 07:02

hi dude
first of all you can use connector implementation any where in process event in grovvy code
something like this

 LogConnectorImpl tempLog = new LogConnectorImpl();
                Map<String,Object>  tempVar = new HashMap<String, Object>();
                tempVar.put("processDefinitionId",  task.processDefinitionId);
                tempVar.put("processInstanceId", task.rootContainerId);
                tempVar.put("activityInstanceId", task_id);

                tempVar.put("isBegin", false);
                tempLog.setAPIAccessor(processAPI);

trust me its working.
second of all i already did what you told me ( with netBean) i will get another error like
java.lang.ClassNotFoundException: com.bonitasoft.engine.api.APIClient

is there any other solution ?!

Notifications