void updateLeftOperands(final Map<SLeftOperand, LeftOperandUpdateStatus> leftOperandUpdates, final long leftOperandContainerId, final String leftOperandContainerType, final SExpressionContext expressionContext) throws SOperationExecutionException { for (final Entry<SLeftOperand, LeftOperandUpdateStatus> update : leftOperandUpdates.entrySet()) { final SLeftOperand leftOperand = update.getKey(); final LeftOperandHandler leftOperandHandler = getLeftOperandHandler(leftOperand.getType()); if (update.getValue().shouldUpdate()) { leftOperandHandler.update(leftOperand, expressionContext.getInputValues(), expressionContext.getInputValues().get(leftOperand.getName()), leftOperandContainerId, leftOperandContainerType); } else { leftOperandHandler.delete(leftOperand, leftOperandContainerId, leftOperandContainerType); } } }
public OperationServiceImpl(final OperationExecutorStrategyProvider operationExecutorStrategyProvider, final LeftOperandHandlerProvider leftOperandHandlerProvider, final ExpressionResolverService expressionResolverService, final PersistRightOperandResolver persistRightOperandResolver, final TechnicalLoggerService logger) { super(); this.operationExecutorStrategyProvider = operationExecutorStrategyProvider; this.expressionResolverService = expressionResolverService; this.persistRightOperandResolver = persistRightOperandResolver; this.logger = logger; final List<LeftOperandHandler> leftOperandHandlers = leftOperandHandlerProvider.getLeftOperandHandlers(); leftOperandHandlersMap = new HashMap<>(leftOperandHandlers.size()); for (final LeftOperandHandler leftOperandHandler : leftOperandHandlers) { leftOperandHandlersMap.put(leftOperandHandler.getType(), leftOperandHandler); } }
void retrieveLeftOperandsAndPutItInExpressionContextIfNotIn(final List<SOperation> operations, final long leftOperandContainerId, final String leftOperandContainerType, final SExpressionContext expressionContext) throws SOperationExecutionException { //if the container where we execute the operation is not the same than the container of the expression (call activity data mapping) we skip the loading of left operand final String containerType = expressionContext.getContainerType(); final Long containerId = expressionContext.getContainerId(); if (containerId == null || containerType == null) { return; } final HashMap<String, List<SLeftOperand>> leftOperandHashMap = new HashMap<>(); for (final SOperation operation : operations) { if (!operation.getType().equals(SOperatorType.ASSIGNMENT)) { // this operation will set a data, we retrieve it and put it in context final SLeftOperand leftOperand = operation.getLeftOperand(); if (!leftOperandHashMap.containsKey(leftOperand.getType())) { leftOperandHashMap.put(leftOperand.getType(), new ArrayList<>()); } leftOperandHashMap.get(leftOperand.getType()).add(leftOperand); } } for (final Entry<String, List<SLeftOperand>> leftOperandByType : leftOperandHashMap.entrySet()) { try { getLeftOperandHandler(leftOperandByType.getKey()) .loadLeftOperandInContext(leftOperandByType.getValue(), leftOperandContainerId, leftOperandContainerType, expressionContext); } catch (final SBonitaReadException e) { throw new SOperationExecutionException("Unable to retrieve value for operation " + leftOperandByType.getValue(), e); } } }
void retrieveLeftOperandsAndPutItInExpressionContextIfNotIn(final List<SOperation> operations, final long leftOperandContainerId, final String leftOperandContainerType, final SExpressionContext expressionContext) throws SOperationExecutionException { //if the container where we execute the operation is not the same than the container of the expression (call activity data mapping) we skip the loading of left operand final String containerType = expressionContext.getContainerType(); final Long containerId = expressionContext.getContainerId(); if (containerId == null || containerType == null) { return; } final HashMap<String, List<SLeftOperand>> leftOperandHashMap = new HashMap<>(); for (final SOperation operation : operations) { if (!operation.getType().equals(SOperatorType.ASSIGNMENT)) { // this operation will set a data, we retrieve it and put it in context final SLeftOperand leftOperand = operation.getLeftOperand(); if (!leftOperandHashMap.containsKey(leftOperand.getType())) { leftOperandHashMap.put(leftOperand.getType(), new ArrayList<>()); } leftOperandHashMap.get(leftOperand.getType()).add(leftOperand); } } for (final Entry<String, List<SLeftOperand>> leftOperandByType : leftOperandHashMap.entrySet()) { try { getLeftOperandHandler(leftOperandByType.getKey()) .loadLeftOperandInContext(leftOperandByType.getValue(), leftOperandContainerId, leftOperandContainerType, expressionContext); } catch (final SBonitaReadException e) { throw new SOperationExecutionException("Unable to retrieve value for operation " + leftOperandByType.getValue(), e); } } }
void updateLeftOperands(final Map<SLeftOperand, LeftOperandUpdateStatus> leftOperandUpdates, final long leftOperandContainerId, final String leftOperandContainerType, final SExpressionContext expressionContext) throws SOperationExecutionException { for (final Entry<SLeftOperand, LeftOperandUpdateStatus> update : leftOperandUpdates.entrySet()) { final SLeftOperand leftOperand = update.getKey(); final LeftOperandHandler leftOperandHandler = getLeftOperandHandler(leftOperand.getType()); if (update.getValue().shouldUpdate()) { leftOperandHandler.update(leftOperand, expressionContext.getInputValues(), expressionContext.getInputValues().get(leftOperand.getName()), leftOperandContainerId, leftOperandContainerType); } else { leftOperandHandler.delete(leftOperand, leftOperandContainerId, leftOperandContainerType); } } }
public OperationServiceImpl(final OperationExecutorStrategyProvider operationExecutorStrategyProvider, final LeftOperandHandlerProvider leftOperandHandlerProvider, final ExpressionResolverService expressionResolverService, final PersistRightOperandResolver persistRightOperandResolver, final TechnicalLoggerService logger) { super(); this.operationExecutorStrategyProvider = operationExecutorStrategyProvider; this.expressionResolverService = expressionResolverService; this.persistRightOperandResolver = persistRightOperandResolver; this.logger = logger; final List<LeftOperandHandler> leftOperandHandlers = leftOperandHandlerProvider.getLeftOperandHandlers(); leftOperandHandlersMap = new HashMap<>(leftOperandHandlers.size()); for (final LeftOperandHandler leftOperandHandler : leftOperandHandlers) { leftOperandHandlersMap.put(leftOperandHandler.getType(), leftOperandHandler); } }