@Override public void loadLeftOperandInContext(final SLeftOperand sLeftOperand, final long leftOperandContainerId, final String leftOperandContainerType, final SExpressionContext expressionContext) throws SBonitaReadException { final Map<String, Object> inputValues = expressionContext.getInputValues(); final String businessDataName = sLeftOperand.getName(); if (!inputValues.containsKey(businessDataName)) { inputValues.put(businessDataName, getBusinessData(businessDataName, leftOperandContainerId, leftOperandContainerType)); } }
@Override public void loadLeftOperandInContext(final SLeftOperand sLeftOperand, final long leftOperandContainerId, final String leftOperandContainerType, final SExpressionContext expressionContext) throws SBonitaReadException { final Map<String, Object> inputValues = expressionContext.getInputValues(); final String businessDataName = sLeftOperand.getName(); if (!inputValues.containsKey(businessDataName)) { inputValues.put(businessDataName, getBusinessData(businessDataName, leftOperandContainerId, leftOperandContainerType)); } }
@Override public void loadLeftOperandInContext(final SLeftOperand sLeftOperand,final long leftOperandContainerId, final String leftOperandContainerType, final SExpressionContext expressionContext) { String name = sLeftOperand.getName(); if(!expressionContext.getInputValues().containsKey(name)) { expressionContext.getInputValues().put(name, expressionContext.getInputValues().get(name)); } }
@Override public void loadLeftOperandInContext(final SLeftOperand sLeftOperand,final long leftOperandContainerId, final String leftOperandContainerType, final SExpressionContext expressionContext) { String name = sLeftOperand.getName(); if(!expressionContext.getInputValues().containsKey(name)) { expressionContext.getInputValues().put(name, expressionContext.getInputValues().get(name)); } }
private SDataInstance retrieve(final SLeftOperand sLeftOperand, final Long containerId, final String containerType) throws SBonitaReadException { try { return transientDataService.getDataInstance(sLeftOperand.getName(), containerId, containerType); } catch (final SDataInstanceException e) { throw new SBonitaReadException("Unable to read the transient data", e); } }
private SDataInstance retrieve(final SLeftOperand sLeftOperand, final Long containerId, final String containerType) throws SBonitaReadException { try { return transientDataService.getDataInstance(sLeftOperand.getName(), containerId, containerType); } catch (final SDataInstanceException e) { throw new SBonitaReadException("Unable to read the transient data", e); } }
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; }
@Override public void loadLeftOperandInContext(final SLeftOperand sLeftOperand,final long leftOperandContainerId, final String leftOperandContainerType, final SExpressionContext expressionContext) throws SBonitaReadException { String name = sLeftOperand.getName(); SDataInstance dataInstance = retrieve(sLeftOperand, leftOperandContainerId, leftOperandContainerType); expressionContext.getInputValues().put(TRANSIENT_DATA + name, dataInstance); if (!expressionContext.getInputValues().containsKey(name)) { expressionContext.getInputValues().put(name, dataInstance.getValue()); } }
@Override public void loadLeftOperandInContext(final SLeftOperand sLeftOperand,final long leftOperandContainerId, final String leftOperandContainerType, final SExpressionContext expressionContext) throws SBonitaReadException { String name = sLeftOperand.getName(); SDataInstance dataInstance = retrieve(sLeftOperand, leftOperandContainerId, leftOperandContainerType); expressionContext.getInputValues().put(TRANSIENT_DATA + name, dataInstance); if (!expressionContext.getInputValues().containsKey(name)) { expressionContext.getInputValues().put(name, dataInstance.getValue()); } }
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); } } }
private void putInContext(SLeftOperand sLeftOperand,final long leftOperandContainerId, final String leftOperandContainerType, SExpressionContext expressionContext) throws SDataInstanceException { SDataInstance dataInstance = getDataInstance(sLeftOperand.getName(), leftOperandContainerId, leftOperandContainerType); putDataInContext(expressionContext.getInputValues(), dataInstance); }
private void putInContext(SLeftOperand sLeftOperand,final long leftOperandContainerId, final String leftOperandContainerType, SExpressionContext expressionContext) throws SDataInstanceException { SDataInstance dataInstance = getDataInstance(sLeftOperand.getName(), leftOperandContainerId, leftOperandContainerType); putDataInContext(expressionContext.getInputValues(), dataInstance); }
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); } } }
@Override public Object update(final SLeftOperand sLeftOperand, Map<String, Object> inputValues, final Object newValue, final long containerId, final String containerType) throws SOperationExecutionException { try { return entitiesActionsExecutor.executeAction(newValue, new BusinessDataContext(sLeftOperand.getName(), new Container(containerId, containerType)), updateDataRefAction); } catch (SEntityActionExecutionException e) { throw new SOperationExecutionException(e); } }
@Override public Object update(final SLeftOperand sLeftOperand, Map<String, Object> inputValues, final Object newValue, final long containerId, final String containerType) throws SOperationExecutionException { try { return entitiesActionsExecutor.executeAction(newValue, new BusinessDataContext(sLeftOperand.getName(), new Container(containerId, containerType)), updateDataRefAction); } catch (SEntityActionExecutionException e) { throw new SOperationExecutionException(e); } }
@Override public void delete(final SLeftOperand sLeftOperand, final long containerId, final String containerType) throws SOperationExecutionException { try { final SRefBusinessDataInstance refBusinessDataInstance = refBusinessDataRetriever.getRefBusinessDataInstance(new BusinessDataContext(sLeftOperand .getName(), new Container(containerId, containerType))); removeBusinessData(refBusinessDataInstance); dereferenceBusinessData(refBusinessDataInstance); } catch (final Exception e) { throw new SOperationExecutionException(e); } }
@Override public void delete(final SLeftOperand sLeftOperand, final long containerId, final String containerType) throws SOperationExecutionException { try { final SRefBusinessDataInstance refBusinessDataInstance = refBusinessDataRetriever.getRefBusinessDataInstance(new BusinessDataContext(sLeftOperand .getName(), new Container(containerId, containerType))); removeBusinessData(refBusinessDataInstance); dereferenceBusinessData(refBusinessDataInstance); } catch (final Exception e) { throw new SOperationExecutionException(e); } }
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; }