Commit 62b446ee authored by Romain Bioteau's avatar Romain Bioteau

Merge branch 'master' of git@github.com:bonitasoft/bonita-studio-sp.git

parents 9d2c01ba a3387ee5
......@@ -130,7 +130,7 @@ selectIndexFieldsMessages=\u3053\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306e
warningTextIndex=\u30c6\u30ad\u30b9\u30c8\u578b\u3067\u5c5e\u6027\u306e\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u306f\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3002\u5fc5\u8981\u306a\u3089\u6587\u5b57\u5217\u578b\u306b\u5207\u308a\u66ff\u3048\u307e\u3059\u3002
businessObjectDAO=\u30d3\u30b8\u30cd\u30b9 \u30aa\u30d6\u30b8\u30a7\u30af\u30c8 DAO
mandatoryColumnTooltip=\u300c\u8907\u6570\u300d\u3068\u300c\u5fc5\u9808\u300d\u3092\u30c1\u30a7\u30c3\u30af\u3059\u308b\u5834\u5408\u306f\u3001\u5c11\u306a\u304f\u3068\u3082 1 \u3064\u306e\u5024\u306f\u5fc5\u9808\u3067\u3059\u3002
stringLengthTooltip=\u4e00\u610f\u5236\u7d04\u307e\u305f\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u3001\u6587\u5b57\u5217\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u305d\u306e\u6700\u5927\u9577\u306f\u3001\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4f9d\u5b58\u3057\u307e\u3059\u3002\u3088\u308a\u9577\u3044\u6587\u5b57\u5217\u306b\u306f\u3001\u30c6\u30ad\u30b9\u30c8\u578b\u3092\u9078\u629e\u3057\u307e\u3059\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u540c\u7b49\u578b\uff1a varchar
stringLengthTooltip=\u4e00\u610f\u5236\u7d04\u307e\u305f\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u5fc5\u8981\u306a\u5834\u5408\u306f\u3001STRING\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u305d\u306e\u6700\u5927\u9577\u306f\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u4f9d\u5b58\u3057\u307e\u3059\u3002 \u3088\u308a\u9577\u3044\u6587\u5b57\u5217\u306b\u306f\u3001TEXT\u3092\u9078\u629e\u3057\u307e\u3059\u3002\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u540c\u7b49\u578b\uff1a varchar
lengthCannotBeEmpty=\u9577\u3055\u3092\u6709\u52b9\u306a\u6b63\u306e\u6574\u6570\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059
noDetailsAvailable=\u8a73\u7d30\u304c\u3042\u308a\u307e\u305b\u3093
details=\u8a73\u7d30\u60c5\u5831
......@@ -158,7 +158,7 @@ bdmDeployedTitle=\u30d3\u30b8\u30cd\u30b9 \u30c7\u30fc\u30bf \u30e2\u30c7\u30eb\
bdmDeployedMessage=\u30d3\u30b8\u30cd\u30b9 \u30c7\u30fc\u30bf \u30e2\u30c7\u30eb\u306f\u6b63\u5e38\u306b\u30c7\u30d7\u30ed\u30a4\u3055\u308c\u307e\u3057\u305f\u3002\n\u26a0 \u958b\u3044\u3066\u3044\u308b\u30bb\u30c3\u30b7\u30e7\u30f3\uff08\u30dd\u30fc\u30bf\u30eb\u3001\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3...\uff09\u306f\u30af\u30ed\u30fc\u30ba\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u518d\u5ea6\u30ed\u30b0\u30a4\u30f3\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002
doNotShowMeAgain=\u4eca\u5f8c\u3053\u306e\u901a\u77e5\u3092\u8868\u793a\u3057\u306a\u3044\u3002
bdmDeployDetails=\u30d3\u30b8\u30cd\u30b9 \u30c7\u30fc\u30bf \u30e2\u30c7\u30eb\u306e\u30c7\u30d7\u30ed\u30a4\u624b\u9806\uff1a\n\t\u23f8 BPM \u30b5\u30fc\u30d3\u30b9\u3092\u4e00\u6642\u505c\u6b62 \uff08\u2192 \u958b\u3044\u3066\u3044\u308b\u3059\u3079\u3066\u306e\u30bb\u30c3\u30b7\u30e7\u30f3\u3092\u9589\u3058\u308b\uff09\n\t\u26a1 \u30e2\u30c7\u30eb\u304b\u3089 Java \u306e\u30a8\u30f3\u30c6\u30a3\u30c6\u30a3\u3068 DAO \u3092\u751f\u6210\u3059\u308b \n\t\u26a1 \u30c7\u30fc\u30bf\u30d9\u30fc\u30b9 \u30b9\u30ad\u30fc\u30de\u3092\u4f5c\u6210/\u66f4\u65b0\n\t\u25b6 BPM \u30b5\u30fc\u30d3\u30b9\u3092\u518d\u958b
textDetails=\u6587\u5b57\u5217\u306e\u9577\u3055\u304c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u6587\u5b57\u5217\u306e\u6700\u5927\u9577\u3092\u8d85\u3048\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u5834\u5408\uff08\u4f8b\u3048\u3070\u30c6\u30ad\u30b9\u30c8\u9818\u57df\uff09\u306f\u3001\u30c6\u30ad\u30b9\u30c8\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u9577\u3055\u3092\u8d85\u3048\u308b\u3068\u4e00\u610f\u5236\u7d04\u307e\u305f\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u3067\u304d\u306a\u304f\u306a\u308b\u305f\u3081\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u540c\u7b49\u578b\uff1a Clob
textDetails=\u6587\u5b57\u5217\u306e\u9577\u3055\u304c\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u6587\u5b57\u5217\u306e\u6700\u5927\u9577\u3092\u8d85\u3048\u308b\u53ef\u80fd\u6027\u304c\u3042\u308b\u5834\u5408\uff08\u305f\u3068\u3048\u3070\u3001TEXTAREA\uff09\u306f\u3001TEXT\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002\u9577\u3055\u3092\u8d85\u3048\u308b\u3068\u4e00\u610f\u5236\u7d04\u307e\u305f\u306f\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u304c\u3067\u304d\u306a\u304f\u306a\u308b\u305f\u3081\u6ce8\u610f\u3057\u3066\u304f\u3060\u3055\u3044\u3002\n\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306e\u540c\u7b49\u578b\uff1a Clob
lengthIsNotAPositiveNumber=\u9577\u3055\u306f\u6b63\u306e\u6574\u6570\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059
lengthIsNotANumber=\u9577\u3055\u306f\u6574\u6570\u306b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059
dateDetails=DATE\u578b\u306f\u3001LONG\u306e\u9577\u6574\u6570\u578b\uff081970/01/01 00\u6642 00\u5206\: 00 (UTC) \u3092\u8d77\u70b9\u3068\u3057\u305f\u30df\u30ea\u79d2\u5358\u4f4d\u306e\u7d4c\u904e\u6642\u9593\uff09\u3092\u4f7f\u7528\u3057\u3066\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u65e5\u4ed8\u3068\u6642\u523b\u3092\u683c\u7d0d\u3057\u3001Java \u578b\u3068\u3057\u3066\u306f\u3001java.util.Date \u3092 \u4f7f\u7528\u3057\u307e\u3059\u3002\nUI \u30c7\u30b6\u30a4\u30ca\u30fc\u3001Groovy \u30b9\u30af\u30ea\u30d7\u30c8\u3001\u304a\u3088\u3073 REST API \u306e\u8907\u96d1\u306a\u64cd\u4f5c\u306f\u3001DATE \u578b\u3068\u4e00\u90e8\u4e0d\u4e00\u81f4\u3092\u8d77\u3053\u3057\u3066\u3044\u307e\u3057\u305f\u3002\n\u3057\u305f\u304c\u3063\u3066\u3001DATE\u578b\u306f\u3001\u4ee5\u524d\u306e\u958b\u767a\u3092\u30b5\u30dd\u30fc\u30c8\u3059\u308b\u305f\u3081\u5b58\u7d9a\u3057\u307e\u3059\u304c\u3001\u65b0\u3057\u3044\u958b\u767a\u3067\u306f\u3001\u4f7f\u7528\u76ee\u7684\u306b\u5fdc\u3058\u300c\u65e5\u4ed8\u306e\u307f\u300d\u3001\u300c\u65e5\u6642 (\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u306a\u3057)\u300d\u3001\u307e\u305f\u306f\u300c\u65e5\u6642 (\u30bf\u30a4\u30e0\u30be\u30fc\u30f3\u3042\u308a)\u300d\u306e\uff13\u3064\u306e\u578b\u3092\u4f7f\u3044\u5206\u3051\u307e\u3059\u3002
......
......@@ -17,7 +17,9 @@ package org.bonitasoft.studio.expression.editor.operation;
import static org.bonitasoft.studio.assertions.StatusAssert.assertThat;
import static org.bonitasoft.studio.model.expression.builders.ExpressionBuilder.anExpression;
import static org.bonitasoft.studio.model.process.builders.ContractInputBuilder.aContractInput;
import static org.bonitasoft.studio.model.process.builders.DataBuilder.aData;
import static org.bonitasoft.studio.model.process.builders.JavaObjectDataBuilder.aJavaObjectData;
import static org.bonitasoft.studio.model.process.builders.LongDataTypeBuilder.aLongDataType;
import java.util.ArrayList;
import java.util.List;
......@@ -111,14 +113,16 @@ public class OperationReturnTypesValidatorTest {
final IStatus status = validator.validate(expr);
Assertions.assertThat(status.isOK()).isFalse();
Assertions.assertThat(status.getMessage()).isEqualTo(Messages.incompatibleType + " " + Messages.messageOperationWithDocumentInForm);
Assertions.assertThat(status.getMessage())
.isEqualTo(Messages.incompatibleType + " " + Messages.messageOperationWithDocumentInForm);
final Task task = ProcessFactory.eINSTANCE.createTask();
task.getOperations().add(operation);
final IStatus taskStatus = validator.validate(expr);
Assertions.assertThat(taskStatus.isOK()).isFalse();
Assertions.assertThat(taskStatus.getMessage()).isEqualTo(Messages.incompatibleType + " " + Messages.messageOperationWithDocumentInTask);
Assertions.assertThat(taskStatus.getMessage())
.isEqualTo(Messages.incompatibleType + " " + Messages.messageOperationWithDocumentInTask);
}
......@@ -126,7 +130,8 @@ public class OperationReturnTypesValidatorTest {
public void should_not_fail_for_SetDocument_Operation_with_DocumentValue() {
final Expression leftOperand = ExpressionHelper.createDocumentExpressionWithDependency("doc");
final Expression rightOperand = ExpressionHelper.createGroovyScriptExpression("myDocumentValue", DocumentValue.class.getName());
final Expression rightOperand = ExpressionHelper.createGroovyScriptExpression("myDocumentValue",
DocumentValue.class.getName());
rightOperand.setContent("new DocumentValue()");
createOperation(leftOperand, rightOperand, ExpressionConstants.SET_DOCUMENT_OPERATOR);
......@@ -139,8 +144,9 @@ public class OperationReturnTypesValidatorTest {
@Test
public void should_not_fail_for_SetDocument_Operation_with_FileInputValue() {
final Expression leftOperand = ExpressionHelper.createDocumentExpressionWithDependency("doc");
final Expression rightOperand = ExpressionHelper.createContractInputExpression(aContractInput().withType(ContractInputType.FILE).withName("myFile")
.build());
final Expression rightOperand = ExpressionHelper
.createContractInputExpression(aContractInput().withType(ContractInputType.FILE).withName("myFile")
.build());
createOperation(leftOperand, rightOperand, ExpressionConstants.SET_DOCUMENT_OPERATOR);
final IStatus status = new OperationReturnTypesValidator().validate(rightOperand);
......@@ -179,10 +185,12 @@ public class OperationReturnTypesValidatorTest {
}
@Test
public void shouldValidateSetDocumentListOperation_add_error_message_when_right_operand_is_String_in_Operation_of_Task_Or_Form() throws Exception {
public void shouldValidateSetDocumentListOperation_add_error_message_when_right_operand_is_String_in_Operation_of_Task_Or_Form()
throws Exception {
final Expression leftOperand = ExpressionHelper.createListDocumentExpressionWithDependency("doc");
final Expression rightOperand = ExpressionHelper.createConstantExpression("toto", "toto", String.class.getName());
final Operation operation = createOperation(leftOperand, rightOperand, ExpressionConstants.SET_LIST_DOCUMENT_OPERATOR);
final Operation operation = createOperation(leftOperand, rightOperand,
ExpressionConstants.SET_LIST_DOCUMENT_OPERATOR);
final OperationReturnTypesValidator validator = new OperationReturnTypesValidator();
// test in a task operation
......@@ -191,14 +199,17 @@ public class OperationReturnTypesValidatorTest {
final IStatus status = validator.validate(rightOperand);
Assertions.assertThat(status.isOK()).isFalse();
Assertions.assertThat(status.getMessage()).isEqualTo(Messages.incompatibleType + " " + Messages.messageOperationWithListDocumentInTask);
Assertions.assertThat(status.getMessage())
.isEqualTo(Messages.incompatibleType + " " + Messages.messageOperationWithListDocumentInTask);
}
@Test
public void shouldValidateSetListDocumentOperation_add_info_message_when_expression_is_empty_in_Operation_of_Task_Or_Form() throws Exception {
public void shouldValidateSetListDocumentOperation_add_info_message_when_expression_is_empty_in_Operation_of_Task_Or_Form()
throws Exception {
final Expression leftOperand = ExpressionHelper.createListDocumentExpressionWithDependency("doc");
final Expression rightOperand = ExpressionHelper.createConstantExpression("", "", String.class.getName());
final Operation operation = createOperation(leftOperand, rightOperand, ExpressionConstants.SET_LIST_DOCUMENT_OPERATOR);
final Operation operation = createOperation(leftOperand, rightOperand,
ExpressionConstants.SET_LIST_DOCUMENT_OPERATOR);
final OperationReturnTypesValidator validator = new OperationReturnTypesValidator();
// Test task Action
......@@ -220,7 +231,8 @@ public class OperationReturnTypesValidatorTest {
}
@Test
public void shouldValidateSetDocumentOperation_add_info_message_when_rightOperandExpression_is_empty_in_Operation_of_Task_Or_Form() throws Exception {
public void shouldValidateSetDocumentOperation_add_info_message_when_rightOperandExpression_is_empty_in_Operation_of_Task_Or_Form()
throws Exception {
// set left operand
final Expression leftOperand = ExpressionHelper.createDocumentExpressionWithDependency("doc");
// set right operand
......@@ -249,9 +261,11 @@ public class OperationReturnTypesValidatorTest {
@Test
public void should_fail_when_assigning_a_business_object_in_a_process_data() throws Exception {
final Expression leftOperand = ExpressionHelper.createVariableExpression(aJavaObjectData().withName("employee").withClassname("org.test.Employee")
.build());
final Expression rightOperand = anExpression().withExpressionType(ExpressionConstants.QUERY_TYPE).withName("Employee.findById")
final Expression leftOperand = ExpressionHelper
.createVariableExpression(aJavaObjectData().withName("employee").withClassname("org.test.Employee")
.build());
final Expression rightOperand = anExpression().withExpressionType(ExpressionConstants.QUERY_TYPE)
.withName("Employee.findById")
.withContent("SELECT AN EMPLOYEE").withReturnType("org.test.Employee").build();
final Operation operation = createOperation(leftOperand, rightOperand, ExpressionConstants.ASSIGNMENT_OPERATOR);
......@@ -262,10 +276,13 @@ public class OperationReturnTypesValidatorTest {
}
@Test
public void should_fail_when_assigning_a_business_object_in_a_process_data_using_java_method_operator() throws Exception {
final Expression leftOperand = ExpressionHelper.createVariableExpression(aJavaObjectData().withName("employee").withClassname("org.test.Employee")
.build());
final Expression rightOperand = anExpression().withExpressionType(ExpressionConstants.QUERY_TYPE).withName("Employee.findById")
public void should_fail_when_assigning_a_business_object_in_a_process_data_using_java_method_operator()
throws Exception {
final Expression leftOperand = ExpressionHelper
.createVariableExpression(aJavaObjectData().withName("employee").withClassname("org.test.Employee")
.build());
final Expression rightOperand = anExpression().withExpressionType(ExpressionConstants.QUERY_TYPE)
.withName("Employee.findById")
.withContent("SELECT AN EMPLOYEE").withReturnType("org.test.Employee").build();
final Operation operation = createOperation(leftOperand, rightOperand, ExpressionConstants.JAVA_METHOD_OPERATOR);
......@@ -274,4 +291,19 @@ public class OperationReturnTypesValidatorTest {
StatusAssert.assertThat(status).isNotOK().hasMessage(Messages.cannotStoreBusinessObjectInProcessVariable);
}
@Test
public void should_not_fail_when_assigning_a_primitive_query_result_in_a_process_data() throws Exception {
final Expression leftOperand = ExpressionHelper
.createVariableExpression(aData().havingDataType(aLongDataType()).withName("nbEmployee").build());
final Expression rightOperand = anExpression().withExpressionType(ExpressionConstants.QUERY_TYPE)
.withName("Employee.countForfind")
.withContent("SELECT AN EMPLOYEE").withReturnType(Long.class.getName()).build();
final Operation operation = createOperation(leftOperand, rightOperand, ExpressionConstants.ASSIGNMENT_OPERATOR);
final OperationReturnTypesValidator validator = new OperationReturnTypesValidator();
final IStatus status = validator.validate(operation.getRightOperand());
StatusAssert.assertThat(status).isOK();
}
}
......@@ -16,6 +16,9 @@ package org.bonitasoft.studio.expression.editor.operation;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.bonitasoft.engine.bpm.contract.FileInputValue;
import org.bonitasoft.engine.bpm.document.DocumentValue;
......@@ -49,6 +52,12 @@ public class OperationReturnTypesValidator implements IExpressionValidator {
private Expression dataExpression;
private static Set<String> primitiveTypes = Stream.of(Long.class.getName(),
Integer.class.getName(),
Float.class.getName(),
Double.class.getName())
.collect(Collectors.toSet());
/*
* (non-Javadoc)
* @see org.eclipse.core.databinding.validation.IValidator#validate(java.lang.Object)
......@@ -104,7 +113,8 @@ public class OperationReturnTypesValidator implements IExpressionValidator {
}
if (ExpressionConstants.DOCUMENT_REF_TYPE.equals(dataExpression.getType())) {
return ValidationStatus.error(Messages.bind(Messages.incompatibleExpressionTypeForOperator,
typeLabelProvider.getText(dataExpression.getType()), operatorLabelProvider.getText(operation.getOperator())));
typeLabelProvider.getText(dataExpression.getType()),
operatorLabelProvider.getText(operation.getOperator())));
}
}
if (ExpressionConstants.MESSAGE_ID_TYPE.equals(operation.getRightOperand().getType())) {
......@@ -139,29 +149,33 @@ public class OperationReturnTypesValidator implements IExpressionValidator {
try {
Integer.valueOf(expressionContent);
} catch (final NumberFormatException e) {
return ValidationStatus.warning(Messages.bind(Messages.expressionValueNotCompatibleWithReturnType, expressionContent,
returnType));
return ValidationStatus.warning(
Messages.bind(Messages.expressionValueNotCompatibleWithReturnType, expressionContent,
returnType));
}
} else if (Double.class.getName().equals(returnType)) {
try {
Double.valueOf(expressionContent);
} catch (final NumberFormatException e) {
return ValidationStatus.warning(Messages.bind(Messages.expressionValueNotCompatibleWithReturnType, expressionContent,
returnType));
return ValidationStatus.warning(
Messages.bind(Messages.expressionValueNotCompatibleWithReturnType, expressionContent,
returnType));
}
} else if (Float.class.getName().equals(returnType)) {
try {
Float.valueOf(expressionContent);
} catch (final NumberFormatException e) {
return ValidationStatus.warning(Messages.bind(Messages.expressionValueNotCompatibleWithReturnType, expressionContent,
returnType));
return ValidationStatus.warning(
Messages.bind(Messages.expressionValueNotCompatibleWithReturnType, expressionContent,
returnType));
}
} else if (Long.class.getName().equals(returnType)) {
try {
Long.valueOf(expressionContent);
} catch (final NumberFormatException e) {
return ValidationStatus.warning(Messages.bind(Messages.expressionValueNotCompatibleWithReturnType, expressionContent,
returnType));
return ValidationStatus.warning(
Messages.bind(Messages.expressionValueNotCompatibleWithReturnType, expressionContent,
returnType));
}
}
}
......@@ -176,18 +190,27 @@ public class OperationReturnTypesValidator implements IExpressionValidator {
private boolean isInvalidQueryExpression(final Operation operation) {
if (leftOperandHasReferencedElement(operation)) {
final EObject data = operation.getLeftOperand().getReferencedElements().get(0);
return !(data instanceof BusinessObjectData) && Objects.equals(operation.getRightOperand().getType(), ExpressionConstants.QUERY_TYPE);
return !(data instanceof BusinessObjectData)
&& Objects.equals(operation.getRightOperand().getType(), ExpressionConstants.QUERY_TYPE)
&& !isPrimitive(operation.getRightOperand().getReturnType());
}
return false;
}
private boolean isPrimitive(String returnType) {
return primitiveTypes.contains(returnType);
}
private boolean leftOperandHasReferencedElement(final Operation operation) {
return !operation.getLeftOperand().getReferencedElements().isEmpty();
}
protected IStatus validateDeletionOperation(final Expression expression, final String expressionName, final Operation operation) {
if (!dataExpression.getReferencedElements().isEmpty() && !(dataExpression.getReferencedElements().get(0) instanceof BusinessObjectData)) {
return ValidationStatus.error(Messages.bind(Messages.incompatibleExpressionTypeForOperator, typeLabelProvider.getText(dataExpression.getType()),
protected IStatus validateDeletionOperation(final Expression expression, final String expressionName,
final Operation operation) {
if (!dataExpression.getReferencedElements().isEmpty()
&& !(dataExpression.getReferencedElements().get(0) instanceof BusinessObjectData)) {
return ValidationStatus.error(Messages.bind(Messages.incompatibleExpressionTypeForOperator,
typeLabelProvider.getText(dataExpression.getType()),
operatorLabelProvider.getText(operation.getOperator())));
}
return null;
......@@ -206,16 +229,20 @@ public class OperationReturnTypesValidator implements IExpressionValidator {
final String dataReturnType = storageExpression.getReturnType();
final String returnType = expression.getReturnType();
try {
final boolean isListType = listClass.equals(returnType) || List.class.isAssignableFrom(Class.forName(returnType));
final boolean isListType = listClass.equals(returnType)
|| List.class.isAssignableFrom(Class.forName(returnType));
if (!isListType && listClass.equals(dataReturnType)) {
if (isTask) {
return ValidationStatus.warning(Messages.incompatibleType + " " + Messages.messageOperationWithListDocumentInTask);
return ValidationStatus
.warning(Messages.incompatibleType + " " + Messages.messageOperationWithListDocumentInTask);
} else {
if (PlatformUtil.isACommunityBonitaProduct()) {
return ValidationStatus.warning(Messages.incompatibleType + " " + Messages.messageOperationWithListDocumentInFormInCommunity);
return ValidationStatus.warning(Messages.incompatibleType + " "
+ Messages.messageOperationWithListDocumentInFormInCommunity);
} else {
return ValidationStatus.warning(Messages.incompatibleType + " " + Messages.messageOperationWithListDocumentInForm);
return ValidationStatus.warning(
Messages.incompatibleType + " " + Messages.messageOperationWithListDocumentInForm);
}
}
} else {
......@@ -240,7 +267,8 @@ public class OperationReturnTypesValidator implements IExpressionValidator {
final String expressionName, final Operation operation) {
if (!ExpressionConstants.VARIABLE_TYPE.equals(dataExpression.getType())
&& !(dataExpression.getReferencedElements().get(0) instanceof BusinessObjectData)) {
return ValidationStatus.error(Messages.bind(Messages.incompatibleExpressionTypeForOperator, typeLabelProvider.getText(dataExpression.getType()),
return ValidationStatus.error(Messages.bind(Messages.incompatibleExpressionTypeForOperator,
typeLabelProvider.getText(dataExpression.getType()),
operatorLabelProvider.getText(operation.getOperator())));
}
return null;
......@@ -294,10 +322,14 @@ public class OperationReturnTypesValidator implements IExpressionValidator {
if (expression != null && expression.getContent() != null && !expression.getContent().isEmpty()) {
final String typeName = storageExpression.getReturnType();
final String actionExpressionReturnType = expression.getReturnType();
if (!((DocumentValue.class.getName().equals(actionExpressionReturnType) || FileInputValue.class.getName().equals(actionExpressionReturnType))
&& typeName.equals(String.class.getName()))) {
return isTask ? ValidationStatus.warning(Messages.incompatibleType + " " + Messages.messageOperationWithDocumentInTask) : ValidationStatus
.warning(Messages.incompatibleType + " " + Messages.messageOperationWithDocumentInForm);
if (!((DocumentValue.class.getName().equals(actionExpressionReturnType)
|| FileInputValue.class.getName().equals(actionExpressionReturnType))
&& typeName.equals(String.class.getName()))) {
return isTask
? ValidationStatus
.warning(Messages.incompatibleType + " " + Messages.messageOperationWithDocumentInTask)
: ValidationStatus
.warning(Messages.incompatibleType + " " + Messages.messageOperationWithDocumentInForm);
} else {
return ValidationStatus.ok();
}
......@@ -310,7 +342,8 @@ public class OperationReturnTypesValidator implements IExpressionValidator {
protected IStatus validateXPathOperation(final Expression expression,
final String expressionName, final Operation operation) {
if (!ExpressionConstants.VARIABLE_TYPE.equals(dataExpression.getType())) {
return ValidationStatus.error(Messages.bind(Messages.incompatibleExpressionTypeForOperator, typeLabelProvider.getText(dataExpression.getType()),
return ValidationStatus.error(Messages.bind(Messages.incompatibleExpressionTypeForOperator,
typeLabelProvider.getText(dataExpression.getType()),
operatorLabelProvider.getText(operation.getOperator())));
}
if (dataExpression != null && dataExpression.getContent() != null && !dataExpression.getContent().isEmpty()) {
......@@ -339,8 +372,10 @@ public class OperationReturnTypesValidator implements IExpressionValidator {
protected IStatus validateJavaMethodOperation(final Expression expression,
final String expressionName, final Operation operation) {
if (!ExpressionConstants.VARIABLE_TYPE.equals(dataExpression.getType())
|| !(!dataExpression.getReferencedElements().isEmpty() && dataExpression.getReferencedElements().get(0) instanceof JavaObjectData)) {
return ValidationStatus.error(Messages.bind(Messages.incompatibleExpressionTypeForOperator, typeLabelProvider.getText(dataExpression.getType()),
|| !(!dataExpression.getReferencedElements().isEmpty()
&& dataExpression.getReferencedElements().get(0) instanceof JavaObjectData)) {
return ValidationStatus.error(Messages.bind(Messages.incompatibleExpressionTypeForOperator,
typeLabelProvider.getText(dataExpression.getType()),
operatorLabelProvider.getText(operation.getOperator())));
}
if (!operation.getOperator().getInputTypes().isEmpty()) {
......
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