Package org.jbpm.process.core.context.exception

Examples of org.jbpm.process.core.context.exception.ExceptionScope


        compositeNode.setName("Composite");
        VariableScope variableScope = new VariableScope();
        compositeNode.addContext(variableScope);
        compositeNode.setDefaultContext(variableScope);
        variableScope.setVariables(variables);
        ExceptionScope exceptionScope = new ExceptionScope();
        compositeNode.addContext(exceptionScope);
        compositeNode.setDefaultContext(exceptionScope);
        exceptionHandler = new ActionExceptionHandler();
        exceptionHandler.setFaultVariable("faultVariable");
        action = new DroolsConsequenceAction("dialect", "consequence");
        exceptionHandler.setAction(action);
        exceptionScope.setExceptionHandler("MyFault", exceptionHandler);
        exceptionHandler = new ActionExceptionHandler();
        exceptionHandler.setFaultVariable("faultVariable2");
        action = new DroolsConsequenceAction("dialect2", "consequence2");
        exceptionHandler.setAction(action);
        exceptionScope.setExceptionHandler("MyFault2", exceptionHandler);
        subActionNode1 = new ActionNode();
        compositeNode.addNode(subActionNode1);
        subActionNode2 = new ActionNode();
        compositeNode.addNode(subActionNode2);
        new ConnectionImpl(subActionNode1, Node.CONNECTION_DEFAULT_TYPE, subActionNode2, Node.CONNECTION_DEFAULT_TYPE);
View Full Code Here


   
    if (faultVariable != null && faultVariable.length() > 0) {
      exceptionHandler.setFaultVariable(faultVariable);
    }
   
    ExceptionScope exceptionScope = (ExceptionScope)
      contextContainer.getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
    if (exceptionScope == null) {
      exceptionScope = new ExceptionScope();
          contextContainer.addContext(exceptionScope);
          contextContainer.setDefaultContext(exceptionScope);
    }
   
    exceptionScope.setExceptionHandler(faultName, exceptionHandler);

    return null;
  }
View Full Code Here

        ((CompositeContextNode) compositeNode).getDefaultContext(VariableScope.VARIABLE_SCOPE);
          if (variableScope != null) {
            List<Variable> variables = variableScope.getVariables();
            XmlWorkflowProcessDumper.visitVariables(variables, xmlDump);
          }
          ExceptionScope exceptionScope = (ExceptionScope)
        ((CompositeContextNode) compositeNode).getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
        if (exceptionScope != null) {
          XmlWorkflowProcessDumper.visitExceptionHandlers(
            exceptionScope.getExceptionHandlers(), xmlDump);
        }
        }
        List<Node> subNodes = getSubNodes(compositeNode);
        xmlDump.append("      <nodes>" + EOL);
        for (Node subNode: subNodes) {
View Full Code Here

        SwimlaneContext swimlaneContext = (SwimlaneContext)
          ((org.jbpm.process.core.Process) process).getDefaultContext(SwimlaneContext.SWIMLANE_SCOPE);
        if (swimlaneContext != null) {
            visitSwimlanes(swimlaneContext.getSwimlanes(), xmlDump);
        }
        ExceptionScope exceptionScope = (ExceptionScope)
          ((org.jbpm.process.core.Process) process).getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
        if (exceptionScope != null) {
            visitExceptionHandlers(exceptionScope.getExceptionHandlers(), xmlDump);
        }
        xmlDump.append("  </header>" + EOL + EOL);
    }
View Full Code Here

                        }
                    }
                    if (type.startsWith("Escalation-")) {
                        boolean cancelActivity = (Boolean) node.getMetaData().get("CancelActivity");
                        CompositeContextNode compositeNode = (CompositeContextNode) attachedNode;
                        ExceptionScope exceptionScope = (ExceptionScope)
                            compositeNode.getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
                        if (exceptionScope == null) {
                            exceptionScope = new ExceptionScope();
                            compositeNode.addContext(exceptionScope);
                            compositeNode.setDefaultContext(exceptionScope);
                        }
                        String escalationCode = (String) node.getMetaData().get("EscalationEvent");
                        ActionExceptionHandler exceptionHandler = new ActionExceptionHandler();
                        exceptionHandler.setAction(new DroolsConsequenceAction("java",
                            (cancelActivity ? "((org.jbpm.workflow.instance.NodeInstance) kcontext.getNodeInstance()).cancel();" : "") +
                            "kcontext.getProcessInstance().signalEvent(\"Escalation-" + attachedTo + "-" + escalationCode + "\", null);"));
                        exceptionScope.setExceptionHandler(escalationCode, exceptionHandler);
                    } else if (type.startsWith("Error-")) {
                        CompositeContextNode compositeNode = (CompositeContextNode) attachedNode;
                        ExceptionScope exceptionScope = (ExceptionScope)
                            compositeNode.getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
                        if (exceptionScope == null) {
                            exceptionScope = new ExceptionScope();
                            compositeNode.addContext(exceptionScope);
                            compositeNode.setDefaultContext(exceptionScope);
                        }
                        String errorCode = (String) node.getMetaData().get("ErrorEvent");
                        ActionExceptionHandler exceptionHandler = new ActionExceptionHandler();
                        exceptionHandler.setAction(new DroolsConsequenceAction("java",
                            "((org.jbpm.workflow.instance.NodeInstance) kcontext.getNodeInstance()).cancel();" +
                            "kcontext.getProcessInstance().signalEvent(\"Error-" + attachedTo + "-" + errorCode + "\", null);"));
                        exceptionScope.setExceptionHandler(errorCode, exceptionHandler);
                    } else if (type.startsWith("Timer-")) {
                        boolean cancelActivity = (Boolean) node.getMetaData().get("CancelActivity");
                        CompositeContextNode compositeNode = (CompositeContextNode) attachedNode;
                        String timeDuration = (String) node.getMetaData().get("TimeDuration");
                        String timeCycle = (String) node.getMetaData().get("TimeCycle");
View Full Code Here

    public void buildContexts(ContextContainer contextContainer, ProcessBuildContext buildContext) {
      List<Context> exceptionScopes = contextContainer.getContexts(ExceptionScope.EXCEPTION_SCOPE);
      if (exceptionScopes != null) {
        for (Context context: exceptionScopes) {
          ExceptionScope exceptionScope = (ExceptionScope) context;
          for (ExceptionHandler exceptionHandler: exceptionScope.getExceptionHandlers().values()) {
            if (exceptionHandler instanceof ActionExceptionHandler) {
              DroolsConsequenceAction action = (DroolsConsequenceAction)
                ((ActionExceptionHandler) exceptionHandler).getAction();
              ActionDescr actionDescr = new ActionDescr();
                  actionDescr.setText( action.getConsequence() );  
View Full Code Here

    variableScope.getVariables().add(variable);
        return this;
    }
   
    public CompositeNodeFactory exceptionHandler(String exception, ExceptionHandler exceptionHandler) {
      ExceptionScope exceptionScope = (ExceptionScope)
      getCompositeNode().getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
    if (exceptionScope == null) {
      exceptionScope = new ExceptionScope();
      getCompositeNode().addContext(exceptionScope);
      getCompositeNode().setDefaultContext(exceptionScope);
    }
    exceptionScope.setExceptionHandler(exception, exceptionHandler);
      return this;
    }
View Full Code Here

        addContext(variableScope);
        setDefaultContext(variableScope);
        SwimlaneContext swimLaneContext = new SwimlaneContext();
        addContext(swimLaneContext);
        setDefaultContext(swimLaneContext);
        ExceptionScope exceptionScope = new ExceptionScope();
        addContext(exceptionScope);
        setDefaultContext(exceptionScope);
    }
View Full Code Here

        if (END_NODE.equals(id)) {
            CompositeNode.NodeAndType link = getCompositeNode().getLinkedOutgoingNode(Node.CONNECTION_DEFAULT_TYPE);
            return link == null ? "" : link.getNodeId() + "";
        }
        if (EXCEPTION_HANDLERS.equals(id)) {
            ExceptionScope exceptionScope = (ExceptionScope)
                getCompositeContextNode().getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
            if (exceptionScope == null) {
                return new HashMap<String, ExceptionHandler>();
            }
            return exceptionScope.getExceptionHandlers();
        }
        return super.getPropertyValue(id);
    }
View Full Code Here

        } else if (START_NODE.equals(id)) {
            getCompositeNode().linkIncomingConnections(Node.CONNECTION_DEFAULT_TYPE, null);
        } else if (END_NODE.equals(id)) {
            getCompositeNode().linkOutgoingConnections(null, Node.CONNECTION_DEFAULT_TYPE);
        } else if (EXCEPTION_HANDLERS.equals(id)) {
            ExceptionScope exceptionScope = (ExceptionScope)
                getCompositeContextNode().getDefaultContext(ExceptionScope.EXCEPTION_SCOPE);
            if (exceptionScope != null) {
                exceptionScope.setExceptionHandlers(new HashMap<String, ExceptionHandler>());
            }
        } else {
            super.resetPropertyValue(id);
        }
    }
View Full Code Here

TOP

Related Classes of org.jbpm.process.core.context.exception.ExceptionScope

Copyright © 2018 www.massapicom. 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.