public FlowState transitionToFlowState(FlowState flowState, String key) {
FlowState nextFlowState = null;
Map<String, FlowTransition> transitions = flowState.getProperty(key, Map.class);
String finishKey = flowState.getFinishKey();
if ( isNotEmpty(transitions) && isNotBlank(finishKey)) {
FlowTransition flowTransition = transitions.get(finishKey);
if ( flowTransition != null ) {
FlowActivityImplementor currentActivity = flowState.getCurrentActivity();
String flowType = currentActivity.resolveIndirectReference(flowTransition.getNextFlowType());
if (isNotBlank(flowType)) {
nextFlowState = this.createFlowState(flowType, flowState.getExportedValuesMap(), false);
FlowUtils.INSTANCE.copyMapToFlowState(nextFlowState, flowTransition.getInitialValues());
}
}
}
return nextFlowState;
}