private boolean isBusinessData(final SOperation operation) { return SLeftOperand.TYPE_BUSINESS_DATA.equals(operation.getLeftOperand().getType()); }
private boolean isBusinessData(final SOperation operation) { return SLeftOperand.TYPE_BUSINESS_DATA.equals(operation.getLeftOperand().getType()); }
Map<SLeftOperand, LeftOperandUpdateStatus> executeOperators(final List<SOperation> operations, final SExpressionContext expressionContext) throws SOperationExecutionException { final Map<SLeftOperand, LeftOperandUpdateStatus> leftOperandsToUpdate = new HashMap<>(); for (int i = 0; i < operations.size(); i++) { final SOperation currentOperation = operations.get(i); final boolean shouldPersistValue = persistRightOperandResolver.shouldPersistByPosition(i, operations); final LeftOperandUpdateStatus currentUpdateStatus = calculateRightOperandValue(currentOperation, expressionContext, shouldPersistValue); if (shouldUpdateLeftOperandContext(leftOperandsToUpdate, currentOperation.getLeftOperand(), currentUpdateStatus)) { leftOperandsToUpdate.put(currentOperation.getLeftOperand(), currentUpdateStatus); } } return leftOperandsToUpdate; }
Map<SLeftOperand, LeftOperandUpdateStatus> executeOperators(final List<SOperation> operations, final SExpressionContext expressionContext) throws SOperationExecutionException { final Map<SLeftOperand, LeftOperandUpdateStatus> leftOperandsToUpdate = new HashMap<>(); for (int i = 0; i < operations.size(); i++) { final SOperation currentOperation = operations.get(i); final boolean shouldPersistValue = persistRightOperandResolver.shouldPersistByPosition(i, operations); final LeftOperandUpdateStatus currentUpdateStatus = calculateRightOperandValue(currentOperation, expressionContext, shouldPersistValue); if (shouldUpdateLeftOperandContext(leftOperandsToUpdate, currentOperation.getLeftOperand(), currentUpdateStatus)) { leftOperandsToUpdate.put(currentOperation.getLeftOperand(), currentUpdateStatus); } } return leftOperandsToUpdate; }
SOperation getOperationToSetData(final String dataName, final List<SOperation> operations) { SOperation dataOperation = null; final Iterator<SOperation> iterator = operations.iterator(); boolean found = false; while (iterator.hasNext() && !found) { final SOperation operation = iterator.next(); if (SOperatorType.ASSIGNMENT.equals(operation.getType()) && SLeftOperand.TYPE_DATA.equals(operation.getLeftOperand().getType()) && dataName.equals(operation.getLeftOperand().getName())) { found = true; dataOperation = operation; } } return dataOperation; }
@Override public Object computeNewValueForLeftOperand(final SOperation operation, final Object value, final SExpressionContext expressionContext, final boolean shouldPersistValue) throws SOperationExecutionException { // do not check if value is external, see ENGINE-1739 if (operation.getLeftOperand().getType().equals(SLeftOperand.TYPE_DATA)) { checkReturnType(value, operation, expressionContext); } // no processing on the value, just return it return value; }
@Override public Object computeNewValueForLeftOperand(final SOperation operation, final Object value, final SExpressionContext expressionContext, final boolean shouldPersistValue) throws SOperationExecutionException { // do not check if value is external, see ENGINE-1739 if (operation.getLeftOperand().getType().equals(SLeftOperand.TYPE_DATA)) { checkReturnType(value, operation, expressionContext); } // no processing on the value, just return it return value; }
SOperation getOperationToSetData(final String dataName, final List<SOperation> operations) { SOperation dataOperation = null; final Iterator<SOperation> iterator = operations.iterator(); boolean found = false; while (iterator.hasNext() && !found) { final SOperation operation = iterator.next(); if (SOperatorType.ASSIGNMENT.equals(operation.getType()) && SLeftOperand.TYPE_DATA.equals(operation.getLeftOperand().getType()) && dataName.equals(operation.getLeftOperand().getName())) { found = true; dataOperation = operation; } } return dataOperation; }
protected Object extractObjectToInvokeFromContext(final SOperation operation, final SExpressionContext expressionContext) throws SOperationExecutionException { final Object objectToInvokeJavaMethodOn; final String dataToSet = operation.getLeftOperand().getName(); objectToInvokeJavaMethodOn = expressionContext.getInputValues().get(dataToSet); if (objectToInvokeJavaMethodOn == null) { throw new SOperationExecutionException("data " + dataToSet + " does not exist"); } return objectToInvokeJavaMethodOn; }
protected Object extractObjectToInvokeFromContext(final SOperation operation, final SExpressionContext expressionContext) throws SOperationExecutionException { final Object objectToInvokeJavaMethodOn; final String dataToSet = operation.getLeftOperand().getName(); objectToInvokeJavaMethodOn = expressionContext.getInputValues().get(dataToSet); if (objectToInvokeJavaMethodOn == null) { throw new SOperationExecutionException("data " + dataToSet + " does not exist"); } return objectToInvokeJavaMethodOn; }
protected String getStrategyKey(final SOperation operation) { String key = operation.getType().name(); String leftOperandType = operation.getLeftOperand().getType(); if (leftOperandType.equals(SLeftOperand.TYPE_BUSINESS_DATA) && key.equals(SOperatorType.ASSIGNMENT.name())) { key += "_" + leftOperandType; } return key; }
protected String getStrategyKey(final SOperation operation) { String key = operation.getType().name(); String leftOperandType = operation.getLeftOperand().getType(); if (leftOperandType.equals(SLeftOperand.TYPE_BUSINESS_DATA) && key.equals(SOperatorType.ASSIGNMENT.name())) { key += "_" + leftOperandType; } return key; }
private boolean matches(final String businessDataName, final SOperation operation, final SExpression expression) { if (expression == null) { return false; } boolean matches = SLeftOperand.TYPE_BUSINESS_DATA.equals(operation.getLeftOperand().getType()) && businessDataName.equals(expression.getContent()) && ExpressionType.TYPE_BUSINESS_DATA.name().equals(expression.getExpressionType()); if (!matches && expression.hasDependencies()) { Iterator<SExpression> iterator = expression.getDependencies().iterator(); while (iterator.hasNext() && !matches) { matches = matches(businessDataName, operation, iterator.next()); } } return matches; }
private boolean matches(final String businessDataName, final SOperation operation, final SExpression expression) { if (expression == null) { return false; } boolean matches = SLeftOperand.TYPE_BUSINESS_DATA.equals(operation.getLeftOperand().getType()) && businessDataName.equals(expression.getContent()) && ExpressionType.TYPE_BUSINESS_DATA.name().equals(expression.getExpressionType()); if (!matches && expression.hasDependencies()) { Iterator<SExpression> iterator = expression.getDependencies().iterator(); while (iterator.hasNext() && !matches) { matches = matches(businessDataName, operation, iterator.next()); } } return matches; }
protected Object evaluateRightOperandExpression(final SOperation operation, final SExpressionContext expressionContext, final SExpression sExpression) throws SOperationExecutionException { if (sExpression == null) { return null; } try { return expressionResolverService.evaluate(sExpression, expressionContext); } catch (final ClassCastException e) { throw new SOperationExecutionException("Unable to execute operation on " + operation.getLeftOperand().getName() + " with a new value which is not Serializable", e); } catch (final SBonitaException e) { throw new SOperationExecutionException(e); } }
private String buildLogMessage(final SOperation operation, final Object operationValue, final SExpressionContext expressionContext) { String stb = "Executed operation on container [id: '" + expressionContext.getContainerId() + "', type: '" + expressionContext.getContainerType() + "']. Operation: [left operand: '" + operation.getLeftOperand().getName() + "', operator: '" + operation.getOperator() + "', operation value: '" + operationValue + "']"; return stb; }
protected Object evaluateRightOperandExpression(final SOperation operation, final SExpressionContext expressionContext, final SExpression sExpression) throws SOperationExecutionException { if (sExpression == null) { return null; } try { return expressionResolverService.evaluate(sExpression, expressionContext); } catch (final ClassCastException e) { throw new SOperationExecutionException("Unable to execute operation on " + operation.getLeftOperand().getName() + " with a new value which is not Serializable", e); } catch (final SBonitaException e) { throw new SOperationExecutionException(e); } }
private String buildLogMessage(final SOperation operation, final Object operationValue, final SExpressionContext expressionContext) { String stb = "Executed operation on container [id: '" + expressionContext.getContainerId() + "', type: '" + expressionContext.getContainerType() + "']. Operation: [left operand: '" + operation.getLeftOperand().getName() + "', operator: '" + operation.getOperator() + "', operation value: '" + operationValue + "']"; return stb; }
public static Operation toOperation(final SOperation operation) { final OperationImpl operationImpl = new OperationImpl(); operationImpl.setRightOperand(toExpression(operation.getRightOperand())); operationImpl.setOperator(operation.getOperator()); operationImpl.setType(toOperatorType(operation.getType())); final LeftOperandImpl leftOperand = new LeftOperandImpl(); final SLeftOperand sLeftOperand = operation.getLeftOperand(); leftOperand.setName(sLeftOperand.getName()); leftOperand.setType(sLeftOperand.getType()); operationImpl.setLeftOperand(leftOperand); return operationImpl; }
public static Operation toOperation(final SOperation operation) { final OperationImpl operationImpl = new OperationImpl(); operationImpl.setRightOperand(toExpression(operation.getRightOperand())); operationImpl.setOperator(operation.getOperator()); operationImpl.setType(toOperatorType(operation.getType())); final LeftOperandImpl leftOperand = new LeftOperandImpl(); final SLeftOperand sLeftOperand = operation.getLeftOperand(); leftOperand.setName(sLeftOperand.getName()); leftOperand.setType(sLeftOperand.getType()); operationImpl.setLeftOperand(leftOperand); return operationImpl; }