reorg
This commit is contained in:
@@ -576,22 +576,6 @@ public class XmlFlowBuilder extends AbstractFlowBuilder implements ResourceHolde
|
||||
parseAttributes(element));
|
||||
}
|
||||
|
||||
private ViewVariable[] parseViewVariables(Element viewStateElement) {
|
||||
List varElements = DomUtils.getChildElementsByTagName(viewStateElement, VAR_ELEMENT);
|
||||
List variables = new ArrayList(varElements.size());
|
||||
for (Iterator it = varElements.iterator(); it.hasNext();) {
|
||||
variables.add(parseViewVariable((Element) it.next()));
|
||||
}
|
||||
return (ViewVariable[]) variables.toArray(new ViewVariable[variables.size()]);
|
||||
}
|
||||
|
||||
private ViewVariable parseViewVariable(Element element) {
|
||||
Class clazz = (Class) fromStringTo(Class.class).execute(element.getAttribute(CLASS_ATTRIBUTE));
|
||||
VariableValueFactory valueFactory = new BeanFactoryVariableValueFactory(clazz,
|
||||
(AutowireCapableBeanFactory) getFlow().getBeanFactory());
|
||||
return new ViewVariable(element.getAttribute("name"), valueFactory);
|
||||
}
|
||||
|
||||
private void parseAndAddDecisionState(Element element, Flow flow) {
|
||||
getFlowArtifactFactory()
|
||||
.createDecisionState(parseId(element), flow, parseEntryActions(element), parseIfs(element),
|
||||
@@ -614,6 +598,22 @@ public class XmlFlowBuilder extends AbstractFlowBuilder implements ResourceHolde
|
||||
return element.getAttribute(ID_ATTRIBUTE);
|
||||
}
|
||||
|
||||
private ViewVariable[] parseViewVariables(Element viewStateElement) {
|
||||
List varElements = DomUtils.getChildElementsByTagName(viewStateElement, VAR_ELEMENT);
|
||||
List variables = new ArrayList(varElements.size());
|
||||
for (Iterator it = varElements.iterator(); it.hasNext();) {
|
||||
variables.add(parseViewVariable((Element) it.next()));
|
||||
}
|
||||
return (ViewVariable[]) variables.toArray(new ViewVariable[variables.size()]);
|
||||
}
|
||||
|
||||
private ViewVariable parseViewVariable(Element element) {
|
||||
Class clazz = (Class) fromStringTo(Class.class).execute(element.getAttribute(CLASS_ATTRIBUTE));
|
||||
VariableValueFactory valueFactory = new BeanFactoryVariableValueFactory(clazz,
|
||||
(AutowireCapableBeanFactory) getFlow().getBeanFactory());
|
||||
return new ViewVariable(element.getAttribute("name"), valueFactory);
|
||||
}
|
||||
|
||||
private Action[] parseEntryActions(Element element) {
|
||||
Element entryActionsElement = DomUtils.getChildElementByTagName(element, ENTRY_ACTIONS_ELEMENT);
|
||||
if (entryActionsElement != null) {
|
||||
@@ -655,30 +655,6 @@ public class XmlFlowBuilder extends AbstractFlowBuilder implements ResourceHolde
|
||||
return viewStateId + ".html";
|
||||
}
|
||||
|
||||
private Action parseFinalResponseAction(Element element) {
|
||||
String encodedView = element.getAttribute(VIEW_ATTRIBUTE);
|
||||
if (encodedView == null || encodedView.length() == 0) {
|
||||
// null final responses are allowed
|
||||
return null;
|
||||
} else if (encodedView.startsWith(EXTERNAL_REDIRECT_PREFIX)) {
|
||||
String encodedUrl = encodedView.substring(EXTERNAL_REDIRECT_PREFIX.length());
|
||||
Expression externalUrl = getExpressionParser().parseExpression(encodedUrl,
|
||||
new ParserContextImpl().eval(RequestContext.class).expect(String.class));
|
||||
return new ExternalRedirectAction(externalUrl);
|
||||
} else if (encodedView.startsWith(FLOW_DEFINITION_REDIRECT_PREFIX)) {
|
||||
String flowRedirect = encodedView.substring(FLOW_DEFINITION_REDIRECT_PREFIX.length());
|
||||
return FlowDefinitionRedirectAction.create(flowRedirect);
|
||||
} else if (encodedView.startsWith(BEAN_PREFIX)) {
|
||||
return (Action) getLocalContext().getBeanFactory().getBean(encodedView.substring(BEAN_PREFIX.length()),
|
||||
Action.class);
|
||||
} else {
|
||||
Expression viewName = getExpressionParser().parseExpression(encodedView,
|
||||
new ParserContextImpl().eval(RequestContext.class).expect(String.class));
|
||||
return new ViewFactoryActionAdapter(getLocalContext().getViewFactoryCreator().createViewFactory(viewName,
|
||||
getLocalContext().getResourceLoader()));
|
||||
}
|
||||
}
|
||||
|
||||
private Action[] parseRenderActions(Element element) {
|
||||
Element renderActionsElement = DomUtils.getChildElementByTagName(element, RENDER_ACTIONS_ELEMENT);
|
||||
if (renderActionsElement != null) {
|
||||
@@ -1075,6 +1051,30 @@ public class XmlFlowBuilder extends AbstractFlowBuilder implements ResourceHolde
|
||||
return null;
|
||||
}
|
||||
|
||||
private Action parseFinalResponseAction(Element element) {
|
||||
String encodedView = element.getAttribute(VIEW_ATTRIBUTE);
|
||||
if (encodedView == null || encodedView.length() == 0) {
|
||||
// null final responses are allowed
|
||||
return null;
|
||||
} else if (encodedView.startsWith(EXTERNAL_REDIRECT_PREFIX)) {
|
||||
String encodedUrl = encodedView.substring(EXTERNAL_REDIRECT_PREFIX.length());
|
||||
Expression externalUrl = getExpressionParser().parseExpression(encodedUrl,
|
||||
new ParserContextImpl().eval(RequestContext.class).expect(String.class));
|
||||
return new ExternalRedirectAction(externalUrl);
|
||||
} else if (encodedView.startsWith(FLOW_DEFINITION_REDIRECT_PREFIX)) {
|
||||
String flowRedirect = encodedView.substring(FLOW_DEFINITION_REDIRECT_PREFIX.length());
|
||||
return FlowDefinitionRedirectAction.create(flowRedirect);
|
||||
} else if (encodedView.startsWith(BEAN_PREFIX)) {
|
||||
return (Action) getLocalContext().getBeanFactory().getBean(encodedView.substring(BEAN_PREFIX.length()),
|
||||
Action.class);
|
||||
} else {
|
||||
Expression viewName = getExpressionParser().parseExpression(encodedView,
|
||||
new ParserContextImpl().eval(RequestContext.class).expect(String.class));
|
||||
return new ViewFactoryActionAdapter(getLocalContext().getViewFactoryCreator().createViewFactory(viewName,
|
||||
getLocalContext().getResourceLoader()));
|
||||
}
|
||||
}
|
||||
|
||||
private FlowExecutionExceptionHandler[] parseExceptionHandlers(Element element) {
|
||||
FlowExecutionExceptionHandler[] transitionExecutingHandlers = parseTransitionExecutingExceptionHandlers(element);
|
||||
FlowExecutionExceptionHandler[] customHandlers = parseCustomExceptionHandlers(element);
|
||||
@@ -1137,20 +1137,6 @@ public class XmlFlowBuilder extends AbstractFlowBuilder implements ResourceHolde
|
||||
return getLocalContext().getConversionService().getConversionExecutor(String.class, targetType);
|
||||
}
|
||||
|
||||
private static class ViewInfo {
|
||||
|
||||
private ViewFactory viewFactory;
|
||||
|
||||
public ViewInfo(ViewFactory viewFactory) {
|
||||
this.viewFactory = viewFactory;
|
||||
}
|
||||
|
||||
public ViewFactory getViewFactory() {
|
||||
return viewFactory;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class FlowRelativeResourceLoader implements ResourceLoader {
|
||||
private Resource resource;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user