Examples of ProcessContext


Examples of org.drools.spi.ProcessContext

   
    if (handler instanceof ActionExceptionHandler) {
      Action action = (Action) ((ActionExceptionHandler) handler).getAction().getMetaData("Action");
      try {
          KnowledgeHelper knowledgeHelper = createKnowledgeHelper();
          ProcessContext context = new ProcessContext();
          ProcessInstance processInstance = getProcessInstance();
          ContextInstanceContainer contextInstanceContainer = getContextInstanceContainer();
          if (contextInstanceContainer instanceof NodeInstance) {
            context.setNodeInstance((NodeInstance) contextInstanceContainer);
          } else {
            context.setProcessInstance(processInstance);
          }
          String faultVariable = handler.getFaultVariable();
          if (faultVariable != null) {
            context.setVariable(faultVariable, params);
          }
            action.execute(knowledgeHelper, ((ProcessInstance) processInstance).getWorkingMemory(), context);
      } catch (Exception e) {
          throw new RuntimeException("unable to execute Action", e);
      }
View Full Code Here

Examples of org.drools.spi.ProcessContext

    return knowledgeHelper;
  }
 
  protected void executeAction(DroolsAction droolsAction, KnowledgeHelper knowledgeHelper) {
    Action action = (Action) droolsAction.getMetaData("Action");
    ProcessContext context = new ProcessContext();
    context.setNodeInstance(this);
    try {
      action.execute(knowledgeHelper, ((ProcessInstance) getProcessInstance()).getWorkingMemory(), context);
    } catch (Exception exception) {
      exception.printStackTrace();
      String exceptionName = exception.getClass().getName();
View Full Code Here

Examples of org.drools.spi.ProcessContext

    public boolean evaluate(SplitInstance instance,
                            Connection connection,
                            Constraint constraint) {
        Object value;
        try {
            ProcessContext context = new ProcessContext();
            context.setNodeInstance( instance );
            value = this.evaluator.evaluate( ((ProcessInstance) instance.getProcessInstance()).getWorkingMemory(),
                                             context );
        } catch ( Exception e ) {
            throw new RuntimeException( "unable to execute ReturnValueEvaluator",
                                        e );
View Full Code Here

Examples of org.openbravo.scheduling.ProcessContext

    final String windowId = vars.getStringParameter("inpwindowId");
    final String requestId = vars.getSessionValue(windowId + "|" + PROCESS_REQUEST_ID);

    String message;
    try {
      OBScheduler.getInstance().unschedule(requestId, new ProcessContext(vars));

    } catch (final SchedulerException e) {
      message = Utility.messageBD(this, "UNSCHED_ERROR", vars.getLanguage());
      advisePopUp(request, response, "ERROR", "Process Request", message + " " + e.getMessage());
    }
View Full Code Here

Examples of org.openbravo.scheduling.ProcessContext

   */
  private void processClient(VariablesSecureApp vars, ProcessBundle bundle) throws ServletException {
    final String processId = bundle.getProcessId();
    final String pinstanceId = bundle.getPinstanceId();

    final ProcessContext ctx = bundle.getContext();
    isDirect = bundle.getChannel() == Channel.DIRECT;

    if (log4j.isDebugEnabled()) {
      log4j.debug("Processing client: " + vars.getClient());
    }

    String adNoteId = "";
    if (isDirect) {
      addLog("@DL_STARTING@", false);
    } else {
      addLog("Starting background process.");
    }
    if (vars == null) {
      try {
        final AcctServerProcessData[] dataOrg = AcctServerProcessData.selectUserOrg(connection,
            processId);
        if (dataOrg == null || dataOrg.length == 0) {
          if (isDirect) {
            addLog("@DL_LOAD_FAILED@");
          } else {
            addLog("User and Organization loading failed.");
          }
          return;
        }
        vars = new VariablesSecureApp(dataOrg[0].adUserId, ctx.getClient(), dataOrg[0].adOrgId);
      } catch (final ServletException ex) {
        log4j.error(ex.getMessage());
        return;
      }
    }
    try {
      final AcctServerProcessData[] data = AcctServerProcessData.selectAcctTable(connection);
      final ArrayList<Object> vTableIds = new ArrayList<Object>();
      for (int i = 0; i < data.length; i++) {
        vTableIds.add(data[i].adTableId);
      }
      TableIds = new String[vTableIds.size()];
      vTableIds.toArray(TableIds);
    } catch (final ServletException ex) {
      log4j.error(ex.getMessage());
      return;
    }
    adNoteId = saveLog(adNoteId, vars.getClient());
    String[] tables = null;
    String strTable = "";
    // If it is the background process, we use 0
    String strOrg = "0";
    // if called by 'Posting by DB tables' get params from ad_pinstance
    if (isDirect) {
      strTable = AcctServerProcessData.selectTable(connection, pinstanceId);
      strOrg = AcctServerProcessData.selectOrg(connection, pinstanceId);
    }
    if (!strTable.equals("")) {
      tables = new String[1];
      tables[0] = new String(strTable);
    } else {
      tables = TableIds;
    }
    String strTableDesc;
    for (int i = 0; i < tables.length; i++) {
      final AcctServer acct = AcctServer.get(tables[i], vars.getClient(), strOrg, connection);
      acct.setBatchSize(BATCH_SIZE);
      strTableDesc = AcctServerProcessData.selectDescription(connection, ctx.getLanguage(),
          acct.AD_Table_ID);
      int total = 0;
      while (acct.checkDocuments()) {

        if (total == 0) {
          if (isDirect)
            addLog("@DL_ACCOUNTING@ - " + strTableDesc, false);
          else
            addLog("Accounting - " + strTableDesc, false);
        } else {
          if (isDirect)
            addLog("@DL_COUNTED@ " + total + " - " + strTableDesc, false);
          else
            addLog("Counted " + total + " - " + strTableDesc, false);
        }

        try {
          acct.run(vars);
        } catch (final Exception ex) {
          log4j.error(ex.getMessage(), ex);
          return;
        }

        total += Integer.valueOf(BATCH_SIZE).intValue();
      }
      if (isDirect) {
        addLog("@DL_TABLE@ = " + strTableDesc + " - " + acct.getInfo(ctx.getLanguage()), false);
      } else {
        addLog("Table = " + strTableDesc + " - " + acct.getInfo(ctx.getLanguage()));
      }
      adNoteId = saveLog(adNoteId, vars.getClient());
    }
  }
View Full Code Here

Examples of org.openbravo.scheduling.ProcessContext

    } else if (vars.commandIn("CANCELAR")) {
      String strTableId = vars.getStringParameter("inpadTableId", "");
      String strAdOrgId = vars.getStringParameter("inpadOrgId");
      if (data.length > 0 && data[0].status.equals(org.openbravo.scheduling.Process.SCHEDULED)) {
        try {
          OBScheduler.getInstance().unschedule(data[0].id, new ProcessContext(vars));
        } catch (SchedulerException e) {
          throw new ServletException(e.getMessage(), e);
        }
      }
      // acctServer.cancelDirectProcess();
View Full Code Here

Examples of org.openbravo.scheduling.ProcessContext

        if (requestList.size() == 0) { // Creating a process request
          pr = OBProvider.getInstance().get(ProcessRequest.class);
          pr.setProcess(HBProcess);
          pr.setActive(true);
          final ProcessContext context = new ProcessContext(vars);
          pr.setOpenbravoContext(context.toString());
        } else {
          pr = requestList.get(0);
        }

        // Schedule the next beat in 7 days
View Full Code Here

Examples of org.openbravo.scheduling.ProcessContext

   *
   * @param bundle
   *          provides the current user and other context information.
   */
  public void execute(ProcessBundle bundle) throws Exception {
    final ProcessContext processContext = bundle.getContext();

    boolean errorOccured = true;
    final OBContext currentOBContext = OBContext.getOBContext();
    try {
      String userId = processContext.getUser();
      String roleId = processContext.getRole();
      String clientId = processContext.getClient();
      String orgId = processContext.getOrganization();

      log.debug("Setting user context to user=" + userId + ",roleId=" + roleId + ",client="
          + clientId + ",org=" + orgId);

      OBContext.setOBContext(userId, roleId, clientId, orgId);
View Full Code Here

Examples of org.yaac.server.egql.processor.ProcessContext

            executeSimpleInsert(insertStmt)
          } else {
            // TODO supports other simple statements 
          }
        } else {
          ProcessContext context = new ProcessContext();
          context.setClientId(userService.getCurrentUser().getEmail());
          String pipelineId = pipeline.startNewPipeline(new ProcessorManager(), stmt.generateProcessors(), context);
         
          resp.add(pipelineId, stmt.getRawStatement());
          logger.info("started pipeline " + pipelineId + " for query: " + stmt.getRawStatement())
        }
View Full Code Here

Examples of org.yaac.server.egql.processor.ProcessContext

   
    // step 2 : parse statement
    SelectStatement stmt = parser(query).select_statement().stmt;
   
    // step 3 : run job
    ProcessContext context = new ProcessContext();
    context.setClientId("user@test.com");
   
    Processor loader = new DatastoreLoader(kind, EGQLConstant.DEFAULT_BATCH_SIZE);
    Processor selector = new SelectProccesor(stmt);

    return selector.process(context, loader.process(context, null));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.