FlowImpl mainFlow = new FlowImpl(FLOW_TYPE_1);
String defaultAfterPage1 = "default-after-page-for-"+FLOW_TYPE_1;
String defaultPage1 = "page-of-"+FLOW_TYPE_1;
mainFlow.setPageName(defaultPage1);
mainFlow.setDefaultAfterPage(defaultAfterPage1);
FlowActivityImpl fa1 = new FlowActivityImpl().initInvisible(false);
FlowPropertyDefinitionImpl copiedBackProperty = new FlowPropertyDefinitionImpl("copiedBackProperty").initAccess(PropertyScope.flowLocal, PropertyUsage.io);
fa1.addPropertyDefinition(copiedBackProperty);
mainFlow.addActivity(fa1);
FlowImpl subFlow = new FlowImpl(FLOW_TYPE_2);
String defaultAfterPage2 = "default-after-page-for-"+FLOW_TYPE_2;
String defaultPage2 = "page-of-"+FLOW_TYPE_2;
subFlow.setPageName(defaultPage2);
subFlow.setDefaultAfterPage(defaultAfterPage2);
FlowActivityImpl fa2_1 = new FlowActivityImpl().initInvisible(false);
fa2_1.addPropertyDefinition(copiedBackProperty.clone());
subFlow.addActivity(fa2_1);
subFlow.addActivity(new TransitionFlowActivity());
FlowImpl continuedFlow = new FlowImpl(FLOW_TYPE_3);
String defaultAfterPage3 = "default-after-page-for-"+FLOW_TYPE_3;
String defaultPage3 = "page-of-"+FLOW_TYPE_3;
continuedFlow.setPageName(defaultPage3);
continuedFlow.setDefaultAfterPage(defaultAfterPage3);
FlowActivityImpl fa3_1 = new FlowActivityImpl().initInvisible(false);
continuedFlow.addActivity(fa3_1);
Object returnToFlowLookupKey = true;
FlowManagement baseFlowManagement = getFlowManagement(mainFlow, subFlow, continuedFlow);
FlowState flowState1 = baseFlowManagement.startFlowState(FLOW_TYPE_1, true, null, returnToFlowLookupKey);