/** * Gets an input (all) list. * @param message the message * @param operation the operation * @param runtime the runtime engine * @return the input (all) list */ public static List<Object> getInputList(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { return getInputList(message, operation.getInputExpressionMappings(), runtime); }
/** * Sets the faults. * @param message the message * @param operation the operation * @param contextOverrides the context overrides */ public static void setFaults(Message message, KnowledgeOperation operation, Map<String, Object> contextOverrides) { setOutputsOrFaults(message, operation.getFaultExpressionMappings(), contextOverrides, FAULT); }
/** * Contains the globals. * * @param message * the message * @param operation * the operation * @param runtime * the runtime engine * @return containsGlobal */ public static boolean containsGlobals(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { Map<String, Object> expressionMap = getMap(message, operation.getGlobalExpressionMappings(), null); return expressionMap != null && expressionMap.size() > 0; }
Map<String, Object> expressionVariables = new HashMap<String, Object>(); TransactionHelper txh = new TransactionHelper(_persistent); BPMOperationType operationType = (BPMOperationType)operation.getType(); switch (operationType) { case START_PROCESS: { String eventId = operation.getEventId(); if (BPMOperationType.SIGNAL_EVENT.equals(operationType)) { processInstanceId = getProcessInstanceId(exchange, inputMessage, runtime);
type = defaultOperation.getType(); eventId = defaultOperation.getEventId(); KnowledgeOperation operation = new KnowledgeOperation(type, eventId); mapExpressions(operationModel, operation); if (operations.containsKey(name)) {
Map<String, List<Object>> inputMap = getListMap( inputMessage, operation.getInputExpressionMappings(), true, undefinedVariable); if (inputMap.size() > 0) { if (undefinedVariable.equals(key)) { String eventId = Strings.trimToNull(operation .getEventId()); if (eventId != null) { key = eventId;
private static void mapExpressions(OperationModel operationModel, KnowledgeOperation operation) { GlobalsModel globalsModel = operationModel.getGlobals(); if (globalsModel != null) { for (GlobalModel globalModel : globalsModel.getGlobals()) { operation.getGlobalExpressionMappings().add(new ExpressionMapping(globalModel)); } } InputsModel inputsModel = operationModel.getInputs(); if (inputsModel != null) { for (InputModel inputModel : inputsModel.getInputs()) { operation.getInputExpressionMappings().add(new ExpressionMapping(inputModel)); } } OutputsModel outputsModel = operationModel.getOutputs(); if (outputsModel != null) { for (OutputModel outputModel : outputsModel.getOutputs()) { operation.getOutputExpressionMappings().add(new ExpressionMapping(outputModel)); } } FaultsModel faultsModel = operationModel.getFaults(); if (faultsModel != null) { for (FaultModel faultModel : faultsModel.getFaults()) { operation.getFaultExpressionMappings().add(new ExpressionMapping(faultModel)); } } }
private int fireAllRules(Message inputMessage, KnowledgeOperation operation) { KnowledgeRuntimeEngine runtime = getSingletonRuntimeEngine(); RulesOperationType operationType = (RulesOperationType) operation .getType(); // sessionIdentifier = runtime.getSessionIdentifier(); setGlobals(inputMessage, operation, runtime, true); KieSession session = runtime.getKieSession(); List<Object> facts = getInputList(inputMessage, operation, runtime); for (Object fact : facts) { session.insert(fact); } if (RulesOperationType.FIRE_ALL_RULES.equals(operationType)) { return session.fireAllRules(); } return 0; }
/** * Gets an input-only list. * @param message the message * @param operation the operation * @param runtime the runtime engine * @return the input-only list */ public static List<Object> getInputOnlyList(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { return getInputList(message, operation.getInputOnlyExpressionMappings(), runtime); }
Map<String, Object> expressionVariables = new HashMap<String, Object>(); TransactionHelper txh = new TransactionHelper(_persistent); BPMOperationType operationType = (BPMOperationType)operation.getType(); switch (operationType) { case START_PROCESS: { String eventId = operation.getEventId(); if (BPMOperationType.SIGNAL_EVENT.equals(operationType)) { processInstanceId = getProcessInstanceId(exchange, inputMessage, runtime);
type = defaultOperation.getType(); eventId = defaultOperation.getEventId(); KnowledgeOperation operation = new KnowledgeOperation(type, eventId); mapExpressions(operationModel, operation); if (operations.containsKey(name)) {
private static void mapExpressions(OperationModel operationModel, KnowledgeOperation operation) { GlobalsModel globalsModel = operationModel.getGlobals(); if (globalsModel != null) { for (GlobalModel globalModel : globalsModel.getGlobals()) { operation.getGlobalExpressionMappings().add(new ExpressionMapping(globalModel)); } } InputsModel inputsModel = operationModel.getInputs(); if (inputsModel != null) { for (InputModel inputModel : inputsModel.getInputs()) { operation.getInputExpressionMappings().add(new ExpressionMapping(inputModel)); } } OutputsModel outputsModel = operationModel.getOutputs(); if (outputsModel != null) { for (OutputModel outputModel : outputsModel.getOutputs()) { operation.getOutputExpressionMappings().add(new ExpressionMapping(outputModel)); } } FaultsModel faultsModel = operationModel.getFaults(); if (faultsModel != null) { for (FaultModel faultModel : faultsModel.getFaults()) { operation.getFaultExpressionMappings().add(new ExpressionMapping(faultModel)); } } }
ExchangePattern exchangePattern = exchange.getContract().getProviderOperation().getExchangePattern(); Map<String, Object> expressionVariables = new HashMap<String, Object>(); RulesOperationType operationType = (RulesOperationType)operation.getType(); switch (operationType) { case EXECUTE: {
/** * Gets an input-only list. * @param message the message * @param operation the operation * @param runtime the runtime engine * @return the input-only list */ public static List<Object> getInputOnlyList(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { return getInputList(message, operation.getInputOnlyExpressionMappings(), runtime); }
Map<String, Object> expressionVariables = new HashMap<String, Object>(); TransactionHelper txh = new TransactionHelper(_persistent); BPMOperationType operationType = (BPMOperationType)operation.getType(); switch (operationType) { case START_PROCESS: { String eventId = operation.getEventId(); if (BPMOperationType.SIGNAL_EVENT.equals(operationType)) { processInstanceId = getProcessInstanceId(exchange, inputMessage, runtime);
/** * Gets an input (all) list. * @param message the message * @param operation the operation * @param runtime the runtime engine * @return the input (all) list */ public static List<Object> getInputList(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { return getInputList(message, operation.getInputExpressionMappings(), runtime); }
/** * Contains the globals. * * @param message * the message * @param operation * the operation * @param runtime * the runtime engine * @return containsGlobal */ public static boolean containsGlobals(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { Map<String, Object> expressionMap = getMap(message, operation.getGlobalExpressionMappings(), null); return expressionMap != null && expressionMap.size() > 0; }
/** * Sets the faults. * @param message the message * @param operation the operation * @param contextOverrides the context overrides */ public static void setFaults(Message message, KnowledgeOperation operation, Map<String, Object> contextOverrides) { setOutputsOrFaults(message, operation.getFaultExpressionMappings(), contextOverrides, FAULT); }
/** * Gets an input map. * @param message the message * @param operation the operation * @param runtime the runtime engine * @return the input map */ public static Map<String, Object> getInputMap(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime) { Map<String, Object> map = new HashMap<String, Object>(); List<ExpressionMapping> inputs = operation.getInputExpressionMappings(); if (inputs.size() > 0) { map.putAll(getMap(message, inputs, null)); } else { Object content = filterRemoteDefaultInputContent(message.getContent(), runtime); if (content != null) { map.put(PARAMETER, content); } } return map; }
/** * Sets the globals. * @param message the message * @param operation the operation * @param runtime the runtime engine * @param singleton singleton */ public static void setGlobals(Message message, KnowledgeOperation operation, KnowledgeRuntimeEngine runtime, boolean singleton) { Globals globals = runtime.getSessionGlobals(); if (globals != null) { Map<String, Object> globalsMap = new HashMap<String, Object>(); globalsMap.put(GLOBALS, new ConcurrentHashMap<String, Object>()); Map<String, Object> expressionMap = getMap(message, operation.getGlobalExpressionMappings(), null); if (expressionMap != null) { globalsMap.putAll(expressionMap); } for (Entry<String, Object> globalsEntry : globalsMap.entrySet()) { if (!singleton) { globals.set(globalsEntry.getKey(), globalsEntry.getValue()); } else { if (globals.get(globalsEntry.getKey()) == null || (globalsEntry.getValue() != null && (globalsEntry .getValue() instanceof Map && !((Map) globalsEntry .getValue()).isEmpty()))) { globals.set(globalsEntry.getKey(), globalsEntry.getValue()); } } } } }