Dears,
I got an issue when trying to add additional attributes to an existing groovy script. Basically, I got the script below that was working perfectly, the script is the resultset of a SQLServer connector.
Basically, the connector send a query to the database and then receive the result then save it in my BDM in the Business Variable Items.
Recently, I have tried to add a new attributes to the bdm: ratingPerf, than in future should be a value calculated based on some criterias that did not matter here.
I have then added the attributes, then updating the resultset script (below is the script, with the updated changes in bold, it was working perfectly before the update). For testing purpose, I just define the double variable with a constant so that should not cause any issue...
Now when I launch the script, I got the following error in the log:
2020-05-09 12:16:55.191 +0700 SEVERE: org.bonitasoft.engine.execution.work.InSessionBonitaWork THREAD_ID=442 | HOSTNAME=DESKTOP-CNGK13N | TENANT_ID=1 | The work [ExecuteConnectorOfActivity: flowNodeInstanceId = 60032, connectorDefinitionName = SAP-Item-Connector] failed. The failure will be handled.
2020-05-09 12:16:55.199 +0700 SEVERE: org.bonitasoft.engine.execution.work.InSessionBonitaWork THREAD_ID=442 | HOSTNAME=DESKTOP-CNGK13N | TENANT_ID=1 | org.bonitasoft.engine.core.connector.exception.SConnectorException : "PROCESS_DEFINITION_ID=8982342676288119146 | PROCESS_NAME=retrieveDataFromSAP | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=3039 | ROOT_PROCESS_INSTANCE_ID=3039 | FLOW_NODE_DEFINITION_ID=8166159322582162655 | FLOW_NODE_INSTANCE_ID=60032 | FLOW_NODE_NAME=Retrieve Data | CONNECTOR_IMPLEMENTATION_CLASS_NAME=SAP-Item-Connector | CONNECTOR_INSTANCE_ID=60038 | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: groovy.lang.MissingMethodException: No signature of method: ats.model.server.ItemDAOImpl.newInstance() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.String, java.lang.String, java.lang.Double, java.lang.Double) values: [004879, LEGRAND, Monoblock Modular Distribution Block 4P-160A, ...]
Possible solutions: newInstance(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.String, java.lang.String, java.lang.Double)"
org.bonitasoft.engine.core.connector.exception.SConnectorException: PROCESS_DEFINITION_ID=8982342676288119146 | PROCESS_NAME=retrieveDataFromSAP | PROCESS_VERSION=1.0 | PROCESS_INSTANCE_ID=3039 | ROOT_PROCESS_INSTANCE_ID=3039 | FLOW_NODE_DEFINITION_ID=8166159322582162655 | FLOW_NODE_INSTANCE_ID=60032 | FLOW_NODE_NAME=Retrieve Data | CONNECTOR_IMPLEMENTATION_CLASS_NAME=SAP-Item-Connector | CONNECTOR_INSTANCE_ID=60038 | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: groovy.lang.MissingMethodException: No signature of method: ats.model.server.ItemDAOImpl.newInstance() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.String, java.lang.String, java.lang.Double, java.lang.Double) values: [004879, LEGRAND, Monoblock Modular Distribution Block 4P-160A, ...]
[...]
Caused by: groovy.lang.MissingMethodException: No signature of method: ats.model.server.ItemDAOImpl.newInstance() is applicable for argument types: (java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Integer, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.String, java.lang.String, java.lang.Double, java.lang.Double) values: [004879, LEGRAND, Monoblock Modular Distribution Block 4P-160A, ...]
Possible solutions: newInstance(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.Double, java.lang.String, java.lang.String, java.lang.Double)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:71)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:48)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at BScript85.run(BScript85.groovy:43)
at org.bonitasoft.engine.expression.impl.GroovyScriptExpressionExecutorCacheStrategy.evaluate(GroovyScriptExpressionExecutorCacheStrategy.java:141)
... 22 more
Which seems to not like the newly added arguments and propose me a solution where I remove it...
I am a bit stuck here. Any help would be genuinely appreciated.
Thanks a lot in advance to all the community.
Best. Tim
------------ SCRIPT BELOW ----------------------------------------------------------------------------------------------
List itemsList = new ArrayList();
final String SOURCE = "SAP_OITM";
while(resultset.next()) {
String reference = resultset.getString("itemCode");
String brand = resultset.getString("FirmName");
String description = resultset.getString("itemName");
if(description == null) {
description = "NON";
}
String itemGroup = resultset.getString("ItmsGrpNam");
int onHand = resultset.getInt("OnHand");
double isCommited = resultset.getDouble("IsCommited");
double onOrder = resultset.getDouble("OnOrder");
double minStock = resultset.getDouble("MinStock");
double maxStock = resultset.getDouble("MaxStock");
double minOrder = resultset.getDouble("MinOrder");
double avgPrice = resultset.getDouble("AvgPrice");
String whsCode = resultset.getString("WhsCode");
double unitPrice = resultset.getDouble("price");
double ratingPerf = 1.21; // <--- What I have added
def myItem = itemDAO.newInstance(reference, brand, description, itemGroup, onHand, isCommited, onOrder, minStock, maxStock, minOrder, avgPrice, whsCode, SOURCE, unitPrice, ratingPerf); // ratingPerf (DOUBLE) seems to not be accepted here...
itemsList.add(myItem);
}
return itemsList;