Affect DocumentValue to a document

Description

In Bonita 7.10, it's impossible to assignate Document value to a Document in 'Operration' section.
When you try to assign DocumentValue to a Document in groovy script, you need to return a DocumentValue.
But, it's not working in Bonita 7.10 ( Bonita 7.6 work with it)

That a simple groovy code:

{{File newPdfFile = new File(filePath);
String contentType = new MimetypesFileTypeMap().getContentType(newPdfFile.getName());
FileInputValue pdf=new FileInputValue(FilenameUtils.getName(filePath), contentType, newPdfFile.getBytes())
return new DocumentValue(pdf.getContent(), pdf.getContentType(), pdf.getFileName());}}

When this script is executed, this error occured:

{{2020-03-11 10:51:28.161 +0100 GRAVE: org.bonitasoft.engine.execution.work.InSessionBonitaWork THREAD_ID=190 | HOSTNAME=SRV-DEV-DS7 | TENANT_ID=1 | The work [ExecuteFlowNodeWork: flowNodeInstanceId: 220422 (37, true, false, false)] failed. The failure will be handled.
2020-03-11 10:51:28.212 +0100 GRAVE: org.bonitasoft.engine.execution.work.InSessionBonitaWork THREAD_ID=190 | HOSTNAME=SRV-DEV-DS7 | TENANT_ID=1 | org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException : "PROCESS_DEFINITION_ID=5674093152343695238 | PROCESS_NAME=C-ProcessQuality | PROCESS_VERSION=1.3.7 | PROCESS_INSTANCE_ID=11026 | ROOT_PROCESS_INSTANCE_ID=11026 | FLOW_NODE_DEFINITION_ID=6710013963339028272 | FLOW_NODE_INSTANCE_ID=220422 | FLOW_NODE_NAME=Ajout des feuilles d'émargements | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: FLOW_NODE_INSTANCE_ID=220422 | Declared return type interface org.bonitasoft.engine.bpm.document.Document is not compatible with evaluated type class org.bonitasoft.engine.bpm.document.DocumentValue for expression pdfFinal"
org.bonitasoft.engine.core.process.instance.api.exceptions.SActivityStateExecutionException: PROCESS_DEFINITION_ID=5674093152343695238 | PROCESS_NAME=C-ProcessQuality | PROCESS_VERSION=1.3.7 | PROCESS_INSTANCE_ID=11026 | ROOT_PROCESS_INSTANCE_ID=11026 | FLOW_NODE_DEFINITION_ID=6710013963339028272 | FLOW_NODE_INSTANCE_ID=220422 | FLOW_NODE_NAME=Ajout des feuilles d'émargements | org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: FLOW_NODE_INSTANCE_ID=220422 | Declared return type interface org.bonitasoft.engine.bpm.document.Document is not compatible with evaluated type class org.bonitasoft.engine.bpm.document.DocumentValue for expression pdfFinal
at org.bonitasoft.engine.execution.StateBehaviors.executeOperations(StateBehaviors.java:582)
at org.bonitasoft.engine.execution.state.ExecutingAutomaticActivityStateImpl.onEnterToOnFinish(ExecutingAutomaticActivityStateImpl.java:48)
at org.bonitasoft.engine.execution.state.OnEnterAndFinishConnectorState.execute(OnEnterAndFinishConnectorState.java:67)
at org.bonitasoft.engine.execution.state.OnEnterAndFinishConnectorState.execute(OnEnterAndFinishConnectorState.java:34)
at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.executeState(FlowNodeExecutorImpl.java:115)
at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.updateState(FlowNodeExecutorImpl.java:163)
at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.stepForward(FlowNodeExecutorImpl.java:147)
at org.bonitasoft.engine.execution.FlowNodeExecutorImpl.executeFlowNode(FlowNodeExecutorImpl.java:301)
at org.bonitasoft.engine.execution.work.ExecuteFlowNodeWork.work(ExecuteFlowNodeWork.java:73)
at org.bonitasoft.engine.execution.work.TxBonitaWork.lambda$work$0(TxBonitaWork.java:42)
at org.bonitasoft.engine.transaction.JTATransactionServiceImpl.executeInTransaction(JTATransactionServiceImpl.java:274)
at org.bonitasoft.engine.execution.work.TxBonitaWork.work(TxBonitaWork.java:42)
at org.bonitasoft.engine.execution.work.LockProcessInstanceWork.work(LockProcessInstanceWork.java:63)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
at org.bonitasoft.engine.execution.work.failurewrapping.TxInHandleFailureWrappingWork.work(TxInHandleFailureWrappingWork.java:41)
at org.bonitasoft.engine.execution.work.InSessionBonitaWork.work(InSessionBonitaWork.java:59)
at org.bonitasoft.engine.work.BonitaThreadPoolExecutor.lambda$submit$1(BonitaThreadPoolExecutor.java:132)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.bonitasoft.engine.core.operation.exception.SOperationExecutionException: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: FLOW_NODE_INSTANCE_ID=220422 | Declared return type interface org.bonitasoft.engine.bpm.document.Document is not compatible with evaluated type class org.bonitasoft.engine.bpm.document.DocumentValue for expression pdfFinal
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:203)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.calculateRightOperandValue(OperationServiceImpl.java:121)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.executeOperators(OperationServiceImpl.java:106)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:95)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.execute(OperationServiceImpl.java:82)
at org.bonitasoft.engine.execution.StateBehaviors.executeOperations(StateBehaviors.java:579)
... 20 more
Caused by: org.bonitasoft.engine.expression.exception.SExpressionEvaluationException: FLOW_NODE_INSTANCE_ID=220422 | Declared return type interface org.bonitasoft.engine.bpm.document.Document is not compatible with evaluated type class org.bonitasoft.engine.bpm.document.DocumentValue for expression pdfFinal
at org.bonitasoft.engine.expression.impl.ReturnTypeChecker.checkReturnType(ReturnTypeChecker.java:81)
at org.bonitasoft.engine.expression.impl.ExpressionServiceImpl.evaluate(ExpressionServiceImpl.java:175)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsOfKind(ExpressionResolverServiceImpl.java:225)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateAllExpressionsWithNoDependencies(ExpressionResolverServiceImpl.java:182)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluateExpressionsFlatten(ExpressionResolverServiceImpl.java:115)
at org.bonitasoft.engine.core.expression.control.api.impl.ExpressionResolverServiceImpl.evaluate(ExpressionResolverServiceImpl.java:83)
at org.bonitasoft.engine.core.operation.impl.OperationServiceImpl.evaluateRightOperandExpression(OperationServiceImpl.java:198)
... 25 more}}

Environment

Windows 10
BonitaStudio 7.10

External Link

None

Workaround

None

Assignee

Delphine Coille

Reporter

Bastien Laurent

Affects versions

Reference

None

Fix versions

None
Configure