Package org.ofbiz.workflow

Examples of org.ofbiz.workflow.CannotStart


    public void start(String activityId) throws WfException, CannotStart, AlreadyRunning {
        if (state().equals("open.running"))
            throw new AlreadyRunning("Process is already running");

        if (activityId == null && getDefinitionObject().get("defaultStartActivityId") == null)
            throw new CannotStart("Initial activity is not defined.");

        changeState("open.running");

        // start the first activity (using the defaultStartActivityId)
        GenericValue start = null;

        try {
            if (activityId != null) {
                GenericValue processDef = getDefinitionObject();
                Map<String, Object> fields = UtilMisc.toMap("packageId", (Object) processDef.getString("packageId"), "packageVersion",
                        processDef.getString("packageVersion"), "processId", processDef.getString("processId"),
                        "processVersion", processDef.getString("processVersion"), "activityId", activityId);
                start = getDelegator().findByPrimaryKey("WorkflowActivity", fields);

                // here we must check and make sure this activity is defined to as a starting activity
                if (!start.getBoolean("canStart").booleanValue())
                    throw new CannotStart("The specified activity cannot initiate the workflow process");
            } else {
                // this is either the first activity defined or specified as an ExtendedAttribute
                // since this is defined in XPDL, we don't care if canStart is set.
                start = getDefinitionObject().getRelatedOne("DefaultStartWorkflowActivity");
            }
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e.getNested());
        }
        if (start == null)
            throw new CannotStart("No initial activity available");

        if (Debug.verboseOn())
            Debug.logVerbose("[WfProcess.start] : Started the workflow process.", module);

        // set the actualStartDate
View Full Code Here


    // Starts or activates this automatic activity
    private void startActivity() throws WfException, CannotStart {
        try {
            changeState("open.running");
        } catch (InvalidState is) {
            throw new CannotStart(is.getMessage(), is);
        } catch (TransitionNotAllowed tna) {
            throw new CannotStart(tna.getMessage(), tna);
        }
        // check the limit service
        boolean limitAfterStart = getDefinitionObject().getBoolean("limitAfterStart").booleanValue();

        if (limitAfterStart
View Full Code Here

    // Starts or activates this automatic activity
    private void startActivity() throws WfException, CannotStart {
        try {
            changeState("open.running");
        } catch (InvalidState is) {
            throw new CannotStart(is.getMessage(), is);
        } catch (TransitionNotAllowed tna) {
            throw new CannotStart(tna.getMessage(), tna);
        }
        // check the limit service
        boolean limitAfterStart = getDefinitionObject().getBoolean("limitAfterStart").booleanValue();

        if (limitAfterStart
View Full Code Here

    public void start(String activityId) throws WfException, CannotStart, AlreadyRunning {
        if (state().equals("open.running"))
            throw new AlreadyRunning("Process is already running");

        if (activityId == null && getDefinitionObject().get("defaultStartActivityId") == null)
            throw new CannotStart("Initial activity is not defined.");

        changeState("open.running");

        // start the first activity (using the defaultStartActivityId)
        GenericValue start = null;

        try {
            if (activityId != null) {
                GenericValue processDef = getDefinitionObject();
                Map fields = UtilMisc.toMap("packageId", processDef.getString("packageId"), "packageVersion",
                        processDef.getString("packageVersion"), "processId", processDef.getString("processId"),
                        "processVersion", processDef.getString("processVersion"), "activityId", activityId);
                start = getDelegator().findByPrimaryKey("WorkflowActivity", fields);

                // here we must check and make sure this activity is defined to as a starting activity
                if (!start.getBoolean("canStart").booleanValue())
                    throw new CannotStart("The specified activity cannot initiate the workflow process");
            } else {
                // this is either the first activity defined or specified as an ExtendedAttribute
                // since this is defined in XPDL, we don't care if canStart is set.
                start = getDefinitionObject().getRelatedOne("DefaultStartWorkflowActivity");
            }
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e.getNested());
        }
        if (start == null)
            throw new CannotStart("No initial activity available");

        if (Debug.verboseOn())
            Debug.logVerbose("[WfProcess.start] : Started the workflow process.", module);

        // set the actualStartDate
View Full Code Here

    public void start(String activityId) throws WfException, CannotStart, AlreadyRunning {
        if (state().equals("open.running"))
            throw new AlreadyRunning("Process is already running");

        if (activityId == null && getDefinitionObject().get("defaultStartActivityId") == null)
            throw new CannotStart("Initial activity is not defined.");

        changeState("open.running");

        // start the first activity (using the defaultStartActivityId)
        GenericValue start = null;

        try {
            if (activityId != null) {
                GenericValue processDef = getDefinitionObject();
                Map<String, Object> fields = UtilMisc.toMap("packageId", (Object) processDef.getString("packageId"), "packageVersion",
                        processDef.getString("packageVersion"), "processId", processDef.getString("processId"),
                        "processVersion", processDef.getString("processVersion"), "activityId", activityId);
                start = getDelegator().findByPrimaryKey("WorkflowActivity", fields);

                // here we must check and make sure this activity is defined to as a starting activity
                if (!start.getBoolean("canStart").booleanValue())
                    throw new CannotStart("The specified activity cannot initiate the workflow process");
            } else {
                // this is either the first activity defined or specified as an ExtendedAttribute
                // since this is defined in XPDL, we don't care if canStart is set.
                start = getDefinitionObject().getRelatedOne("DefaultStartWorkflowActivity");
            }
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e.getNested());
        }
        if (start == null)
            throw new CannotStart("No initial activity available");

        if (Debug.verboseOn())
            Debug.logVerbose("[WfProcess.start] : Started the workflow process.", module);

        // set the actualStartDate
View Full Code Here

    // Starts or activates this automatic activity
    private void startActivity() throws WfException, CannotStart {
        try {
            changeState("open.running");
        } catch (InvalidState is) {
            throw new CannotStart(is.getMessage(), is);
        } catch (TransitionNotAllowed tna) {
            throw new CannotStart(tna.getMessage(), tna);
        }
        // check the limit service
        boolean limitAfterStart = getDefinitionObject().getBoolean("limitAfterStart").booleanValue();

        if (limitAfterStart
View Full Code Here

    public void start(String activityId) throws WfException, CannotStart, AlreadyRunning {
        if (state().equals("open.running"))
            throw new AlreadyRunning("Process is already running");

        if (activityId == null && getDefinitionObject().get("defaultStartActivityId") == null)
            throw new CannotStart("Initial activity is not defined.");

        changeState("open.running");

        // start the first activity (using the defaultStartActivityId)
        GenericValue start = null;

        try {
            if (activityId != null) {
                GenericValue processDef = getDefinitionObject();
                Map fields = UtilMisc.toMap("packageId", processDef.getString("packageId"), "packageVersion",
                        processDef.getString("packageVersion"), "processId", processDef.getString("processId"),
                        "processVersion", processDef.getString("processVersion"), "activityId", activityId);                        
                start = getDelegator().findByPrimaryKey("WorkflowActivity", fields);
               
                // here we must check and make sure this activity is defined to as a starting activity
                if (!start.getBoolean("canStart").booleanValue())
                    throw new CannotStart("The specified activity cannot initiate the workflow process");
            } else {
                // this is either the first activity defined or specified as an ExtendedAttribute
                // since this is defined in XPDL, we don't care if canStart is set.
                start = getDefinitionObject().getRelatedOne("DefaultStartWorkflowActivity");
            }
        } catch (GenericEntityException e) {
            throw new WfException(e.getMessage(), e.getNested());
        }
        if (start == null)
            throw new CannotStart("No initial activity available");

        if (Debug.verboseOn())
            Debug.logVerbose("[WfProcess.start] : Started the workflow process.", module);
           
        // set the actualStartDate
View Full Code Here

    // Starts or activates this automatic activity
    private void startActivity() throws WfException, CannotStart {
        try {
            changeState("open.running");
        } catch (InvalidState is) {
            throw new CannotStart(is.getMessage(), is);
        } catch (TransitionNotAllowed tna) {
            throw new CannotStart(tna.getMessage(), tna);
        }
        // check the limit service
        boolean limitAfterStart = getDefinitionObject().getBoolean("limitAfterStart").booleanValue();

        if (limitAfterStart
View Full Code Here

TOP

Related Classes of org.ofbiz.workflow.CannotStart

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.