Commit 24a7a971 authored by Romain Bioteau's avatar Romain Bioteau
Browse files

BS-14537

Export document list instead of simple document
parent eddb1dd6
......@@ -33,6 +33,7 @@ import org.bonitasoft.studio.model.process.Data;
import org.bonitasoft.studio.model.process.Document;
import org.bonitasoft.studio.model.process.ProcessFactory;
import org.bonitasoft.studio.model.process.builders.BusinessObjectDataBuilder;
import org.bonitasoft.studio.model.process.builders.DocumentBuilder;
import org.eclipse.emf.ecore.EObject;
import org.junit.Test;
......@@ -66,6 +67,24 @@ public class EngineExpressionUtilTest {
.hasExpressionType(ExpressionType.TYPE_DOCUMENT.name());
}
@Test
public void should_createExpression_document_list() throws Exception {
//given
final Expression studioExpression = createStudioExpression("document1", "document1", List.class.getName(),
ExpressionConstants.DOCUMENT_TYPE);
studioExpression.getReferencedElements().add(DocumentBuilder.aDocument().multiple().build());
//when
final org.bonitasoft.engine.expression.Expression engineExpression = EngineExpressionUtil.createExpression(studioExpression);
//then
EngineExpressionAssert.assertThat(engineExpression)
.hasName("document1")
.hasContent("document1")
.hasReturnType(List.class.getName())
.hasExpressionType(ExpressionType.TYPE_DOCUMENT_LIST.name());
}
@Test
public void should_createExpression_constant() throws Exception {
//given
......
......@@ -407,6 +407,13 @@ public class EngineExpressionUtil {
return createPatternExpression(expressionBuilder, expression);
}
if (ExpressionConstants.DOCUMENT_TYPE.equals(type)) {
final EList<EObject> referencedElements = expression.getReferencedElements();
if (!referencedElements.isEmpty()) {
final Document document = (Document) referencedElements.get(0);
if (document.isMultiple()) {
return createDocumentListExpression(expressionBuilder, expression);
}
}
return createDocumentExpression(expressionBuilder, expression);
}
if (ExpressionConstants.DOCUMENT_LIST_TYPE.equals(type)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment