We're updating the issue view to help you get more done. 

Problem com BDM with complex data

Description

I think there are problems in version 7.8.x community with BDM with complex data,
I imported the ExpenseReport 3.0 sample and it worked correctly,
when I try to replicate it doing zero, it gives error in the operation to write the information complex data (lines)

old function OK
import org.bonitasoft.engine.bpm.process.ProcessInstance;
import com.company.model.ExpenseReport;
import com.company.model.ExpenseReportLine;

ProcessInstance processInstance = apiAccessor.getProcessAPI (). GetProcessInstance (processInstanceId);

ExpenseReport newReport = new ExpenseReport ();
newReport.setIsApproved (false);
newReport.setSummary (reportContract.get ("summary"));
newReport.setCreationDate (new Date ());
newReport.setCreatedBy (processInstance.getStartedBy ());

List <Map <String, Object >> contractLines = reportContract.get ("lines");
List <ExpenseReportLine> lines = new ArrayList <ExpenseReportLine> ();
for (Map <String, Object> contractLine: contractLines)
{
ExpenseReportLine line = new ExpenseReportLine ();
line.setLabel (contractLine.get ("label"));
line.setCost (contractLine.get ("cost"));
lines.add (line);
}
newReport.setLines (lines);

return newReport;

new function with ERROR

expenseReportVar.summary = reportInput.summary
expenseReportVar.lines = {
def expenseReportLineList = []
// For each item collected in multiple input
reportInput.lines.each {
// Add aggregated ExpenseReportLine instance
expenseReportLineList.add ({currentExpenseReportLineInput ->
def expenseReportLineVar = expenseReportLineDAO.findByPersistenceId (currentExpenseReportLineInput.persistenceId.toLong ())
expenseReportLineVar.label = currentExpenseReportLineInput.label
expenseReportLineVar.cost = currentExpenseReportLineInput.cost
return expenseReportLineVar
} (it)
}
return expenseReportLineList} ()

Environment

windows 10

Steps to reproduce

Try replicate exemple ExpenseReport 3.0, but without import, create step by step

Workaround

None

External Link

None

Status

Assignee

Antoine Mottier

Reporter

Paulo Azevedo

Reference

None

Components

Affects versions

7.8.1
7.8.0
7.8.2