Package org.amplafi.flow

Examples of org.amplafi.flow.FlowState


    public void selectActivity() {
        if (getForm().getDelegate().getHasErrors()) {
            return;
        }

        FlowState currentFlow = getAttachedFlowState();
        int activityToGo = getActivityToGo();
        try {
            FlowActivity next = currentFlow.selectVisibleActivity(activityToGo);
            String page = next.getPageName();
            if (page!=null) {
                getPage().getRequestCycle().activate(page);
            } else {
                updateComponents(findComponentsToUpdate(getUpdateComponents()));
View Full Code Here


    /**
     * @return Returns the activeActivity.
     */
    public int getActiveActivityIndex() {
        FlowState currentFlow = getAttachedFlowState();
        return currentFlow.getCurrentActivityIndex();
    }
View Full Code Here

    /**
     * @return the submitted page's flowId
     */
    public String getSubmittedFlowId() {
        FlowState currentFlow = getAttachedFlowState();
        // to be returned as part of form submit (see selectActivity)
        return currentFlow.getLookupKey();
    }
View Full Code Here

        FlowTestingUtils flowTestingUtils = new FlowTestingUtils();
        TransitionFlowActivity obj = new TransitionFlowActivity();
        String flowTypeName = "foo";
        flowTestingUtils.addFlowDefinition(flowTypeName, obj);
        Map<String, String> initialFlowState = null;
        FlowState flowState = flowTestingUtils.getFlowManagement().startFlowState(flowTypeName, false, initialFlowState, returnToFlowLookupKey);
        assertTrue(flowState.isCompleted());
    }
View Full Code Here

        transitionFlowActivity.setNextFlowType(nextFlowType);
        String flowTypeName = flowTestingUtils.addFlowDefinition(newFlowActivity(), transitionFlowActivity);
        FlowManagement flowManagement = flowTestingUtils.getFlowManager().getFlowManagement();
        FlowStateImplementor flowState = flowManagement.startFlowState(flowTypeName, true, null, returnToFlowLookupKey);
        flowTestingUtils.advanceToEnd(flowState);
        FlowState nextFlowState = flowManagement.getCurrentFlowState();
        // the alternate condition was not met.
        assertNull(nextFlowState);

        flowState = flowManagement.startFlowState(flowTypeName, true, null, returnToFlowLookupKey);
        flowState.setFinishKey(TransitionType.alternate.toString());
        // make sure cache can't help 'cheat'
        flowState.clearCache();
        flowTestingUtils.advanceToEnd(flowState);
        nextFlowState = flowManagement.getCurrentFlowState();
        assertNotNull(nextFlowState);
        assertEquals(nextFlowState.getFlowTypeName(), nextFlowType);
        assertNull(nextFlowState.getFinishKey(), "nextFlowState="+nextFlowState);
    }
View Full Code Here

        String nextFlowType = flowTestingUtils.addFlowDefinition(newFlowActivity());
        TransitionFlowActivity transitionFlowActivity = new TransitionFlowActivity();
        transitionFlowActivity.setNextFlowType(nextFlowType);
        String flowTypeName = flowTestingUtils.addFlowDefinition(newFlowActivity(), transitionFlowActivity);
        FlowManagement flowManagement = flowTestingUtils.getFlowManager().getFlowManagement();
        FlowState flowState = flowManagement.startFlowState(flowTypeName, true, null, returnToFlowLookupKey);
        flowTestingUtils.advanceToEnd(flowState);
        FlowState nextFlowState = flowManagement.getCurrentFlowState();
        assertNotNull(nextFlowState);
        assertEquals(nextFlowState.getFlowTypeName(), nextFlowType);

    }
View Full Code Here

        TransitionFlowActivity transitionFlowActivity2 = new TransitionFlowActivity();
        transitionFlowActivity2.setNextFlowType(nextFlowType2);

        String flowTypeName = flowTestingUtils.addFlowDefinition(newFlowActivity(), transitionFlowActivity0, transitionFlowActivity1, transitionFlowActivity2);
        FlowManagement flowManagement = flowTestingUtils.getFlowManager().getFlowManagement();
        FlowState flowState = flowManagement.startFlowState(flowTypeName, true, null, returnToFlowLookupKey);
        flowTestingUtils.advanceToEnd(flowState);
        FlowState nextFlowState = flowManagement.getCurrentFlowState();
        // the alternate condition was not met.
        assertNotNull(nextFlowState);
        assertEquals(nextFlowState.getFlowTypeName(), nextFlowType2);

        flowState = flowManagement.startFlowState(flowTypeName, true, null, returnToFlowLookupKey);
        flowState.setFinishKey(TransitionType.alternate.toString());
        flowTestingUtils.advanceToEnd(flowState);
        nextFlowState = flowManagement.getCurrentFlowState();
        assertNotNull(nextFlowState);
        assertEquals(nextFlowState.getFlowTypeName(), nextFlowType0);

        flowState = flowManagement.startFlowState(flowTypeName, true, null, returnToFlowLookupKey);
        flowState.setFinishKey("foo1");
        flowTestingUtils.advanceToEnd(flowState);
        nextFlowState = flowManagement.getCurrentFlowState();
        assertNotNull(nextFlowState);
        assertEquals(nextFlowState.getFlowTypeName(), nextFlowType1);
    }
View Full Code Here

    public abstract void setCurrentFlowState(FlowState state);

    @Override
    protected void prepareForRender(IRequestCycle cycle) {
        super.prepareForRender(cycle);
        FlowState state = getAttachedFlowState();
        if (state == null) {
            FlowBorder border = FlowBorder.get(cycle);
            if (border!=null) {
                state = border.getAttachedFlowState();
            }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public <T> T get(FlowPropertyProviderImplementor flowPropertyProvider, FlowPropertyDefinition flowPropertyDefinition) {
        FlowStateImplementor flowStateImplementor = flowPropertyProvider.getFlowState();
        String lookupKey = flowStateImplementor.getRawProperty(flowPropertyProvider, flowPropertyDefinition);
        FlowState flowState = flowStateImplementor.getFlowManagement().getFlowState(lookupKey);
        return (T) flowState;
    }
View Full Code Here

        check(flowPropertyDefinition);
        String label = "message:flow.label-cancel";
        String lookupKey =flowPropertyProvider.getProperty(FSRETURN_TO_FLOW);
        if ( lookupKey != null ) {
            FlowManagement flowManagement = flowPropertyProvider.getFlowState().getFlowManagement();
            FlowState flowState = flowManagement.getFlowState(lookupKey);
            if ( flowState != null) {
                label = flowState.getCurrentActivity().getProperty(FSRETURN_TO_TEXT);
                if (isBlank(label)) {
                    // TODO -- how to internationalize?
                    label = "Return to "+flowState.getFlowTitle();
                }
            }
        }
        return (T) label;
    }
View Full Code Here

TOP

Related Classes of org.amplafi.flow.FlowState

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.