SWF-94
Simplified model implementation
This commit is contained in:
@@ -457,6 +457,10 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder implements Resourc
|
||||
popup = ((Boolean) fromStringTo(Boolean.class).execute(state.getPopup())).booleanValue();
|
||||
}
|
||||
MutableAttributeMap attributes = convertMetaAttributes(state.getAttributes());
|
||||
if (state.getModel() != null) {
|
||||
attributes.put("model", getLocalContext().getExpressionParser().parseExpression(state.getModel(),
|
||||
new ParserContextImpl().eval(RequestContext.class)));
|
||||
}
|
||||
convertSecured(state.getSecured(), attributes);
|
||||
getLocalContext().getFlowArtifactFactory().createViewState(state.getId(), flow,
|
||||
convertViewVariables(state.getVars()), convertActions(state.getOnEntryActions()), viewFactory,
|
||||
@@ -677,6 +681,9 @@ public class FlowModelFlowBuilder extends AbstractFlowBuilder implements Resourc
|
||||
TransitionCriteria executionCriteria = TransitionCriteriaChain.criteriaChainFor(convertActions(transition
|
||||
.getActions()));
|
||||
MutableAttributeMap attributes = convertMetaAttributes(transition.getAttributes());
|
||||
if (transition.getBind() != null) {
|
||||
attributes.put("bind", transition.getBind());
|
||||
}
|
||||
convertSecured(transition.getSecured(), attributes);
|
||||
return getLocalContext().getFlowArtifactFactory().createTransition(targetStateResolver, matchingCriteria,
|
||||
executionCriteria, attributes);
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
|
||||
/**
|
||||
* Model support for actions.
|
||||
*
|
||||
@@ -23,4 +22,20 @@ package org.springframework.webflow.engine.model;
|
||||
*/
|
||||
public abstract class AbstractActionModel extends AbstractModel {
|
||||
|
||||
/**
|
||||
* Actions are not mergeable
|
||||
* @param model the render action to merge into this render
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
// not mergeable
|
||||
}
|
||||
|
||||
/**
|
||||
* Actions are not mergeable
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
|
||||
@@ -88,33 +89,35 @@ public abstract class AbstractModel implements Model {
|
||||
* @return the merged list
|
||||
*/
|
||||
protected LinkedList merge(LinkedList child, LinkedList parent, boolean addAtEnd) {
|
||||
if (parent == null) {
|
||||
return child;
|
||||
} else if (child == null) {
|
||||
if (child == null) {
|
||||
return parent;
|
||||
} else if (parent == null) {
|
||||
return child;
|
||||
} else {
|
||||
if (!addAtEnd) {
|
||||
parent = new LinkedList(parent);
|
||||
Collections.reverse(parent);
|
||||
}
|
||||
for (Iterator parentIt = parent.iterator(); parentIt.hasNext();) {
|
||||
Model parentElement = (Model) parentIt.next();
|
||||
if (!child.contains(parentElement)) {
|
||||
boolean matchFound = false;
|
||||
for (Iterator childIt = child.iterator(); !matchFound && childIt.hasNext();) {
|
||||
Model childElement = (Model) childIt.next();
|
||||
if (childElement.isMergeableWith(parentElement)) {
|
||||
matchFound = true;
|
||||
childElement.merge(parentElement);
|
||||
}
|
||||
boolean matchFound = false;
|
||||
for (Iterator childIt = child.iterator(); !matchFound && childIt.hasNext();) {
|
||||
Model childElement = (Model) childIt.next();
|
||||
if (childElement.isMergeableWith(parentElement)) {
|
||||
matchFound = true;
|
||||
childElement.merge(parentElement);
|
||||
}
|
||||
if (!matchFound) {
|
||||
if (addAtEnd) {
|
||||
child.addLast(parentElement);
|
||||
} else {
|
||||
child.addFirst(parentElement);
|
||||
}
|
||||
}
|
||||
if (!matchFound) {
|
||||
if (addAtEnd) {
|
||||
child.addLast(parentElement);
|
||||
} else {
|
||||
child.addFirst(parentElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
return child;
|
||||
}
|
||||
return child;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,44 +38,19 @@ public class ActionStateModel extends AbstractTransitionableStateModel {
|
||||
setId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an action state model
|
||||
* @param id the state identifier
|
||||
* @param attributes meta attributes for the state
|
||||
* @param secured security settings for the state
|
||||
* @param onEntryActions actions to execute upon entry
|
||||
* @param transitions transitions for the state
|
||||
* @param onExitActions actions to execute before leaving the state
|
||||
* @param actions actions to execute during the state
|
||||
* @param exceptionHandlers exception handlers for the state
|
||||
*/
|
||||
public ActionStateModel(String id, LinkedList attributes, SecuredModel secured, LinkedList onEntryActions,
|
||||
LinkedList transitions, LinkedList onExitActions, LinkedList actions, LinkedList exceptionHandlers) {
|
||||
setId(id);
|
||||
setAttributes(attributes);
|
||||
setSecured(secured);
|
||||
setOnEntryActions(onEntryActions);
|
||||
setTransitions(transitions);
|
||||
setOnExitActions(onExitActions);
|
||||
setActions(actions);
|
||||
setExceptionHandlers(exceptionHandlers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the action state to merge into this state
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
ActionStateModel state = (ActionStateModel) model;
|
||||
setAttributes(merge(getAttributes(), state.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), state.getSecured()));
|
||||
setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers()));
|
||||
setTransitions(merge(getTransitions(), state.getTransitions()));
|
||||
setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false));
|
||||
setActions(merge(getActions(), state.getActions(), false));
|
||||
}
|
||||
ActionStateModel state = (ActionStateModel) model;
|
||||
setAttributes(merge(getAttributes(), state.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), state.getSecured()));
|
||||
setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers()));
|
||||
setTransitions(merge(getTransitions(), state.getTransitions()));
|
||||
setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false));
|
||||
setActions(merge(getActions(), state.getActions(), false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,9 +58,6 @@ public class ActionStateModel extends AbstractTransitionableStateModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof ActionStateModel)) {
|
||||
return false;
|
||||
}
|
||||
@@ -93,45 +65,6 @@ public class ActionStateModel extends AbstractTransitionableStateModel {
|
||||
return ObjectUtils.nullSafeEquals(getId(), state.getId());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof ActionStateModel)) {
|
||||
return false;
|
||||
}
|
||||
ActionStateModel state = (ActionStateModel) obj;
|
||||
if (state == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getId(), state.getId())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getAttributes(), state.getAttributes())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getSecured(), state.getSecured())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnEntryActions(), state.getOnEntryActions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getExceptionHandlers(), state.getExceptionHandlers())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getTransitions(), state.getTransitions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnExitActions(), state.getOnExitActions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getActions(), state.getActions())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getId()) * 27 + ObjectUtils.nullSafeHashCode(getAttributes()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getSecured()) * 27 + ObjectUtils.nullSafeHashCode(getOnEntryActions())
|
||||
* 27 + ObjectUtils.nullSafeHashCode(getExceptionHandlers()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getTransitions()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getOnExitActions()) * 27 + ObjectUtils.nullSafeHashCode(getActions())
|
||||
* 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the actions
|
||||
*/
|
||||
|
||||
@@ -40,27 +40,13 @@ public class AttributeModel extends AbstractModel {
|
||||
setValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an attribute model
|
||||
* @param name the name of the attribute
|
||||
* @param value the value of the attribute
|
||||
* @param type the type of the value
|
||||
*/
|
||||
public AttributeModel(String name, String value, String type) {
|
||||
setName(name);
|
||||
setValue(value);
|
||||
setType(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the attribute to merge into this attribute
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
AttributeModel attribute = (AttributeModel) model;
|
||||
setType(merge(getType(), attribute.getType()));
|
||||
}
|
||||
AttributeModel attribute = (AttributeModel) model;
|
||||
setType(merge(getType(), attribute.getType()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,9 +54,6 @@ public class AttributeModel extends AbstractModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof AttributeModel)) {
|
||||
return false;
|
||||
}
|
||||
@@ -79,31 +62,6 @@ public class AttributeModel extends AbstractModel {
|
||||
&& ObjectUtils.nullSafeEquals(getValue(), attribute.getValue());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof AttributeModel)) {
|
||||
return false;
|
||||
}
|
||||
AttributeModel attribute = (AttributeModel) obj;
|
||||
if (attribute == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getName(), attribute.getName())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getType(), attribute.getType())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getValue(), attribute.getValue())) {
|
||||
return false;
|
||||
} else {
|
||||
return super.equals(attribute);
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getName()) * 27 + ObjectUtils.nullSafeHashCode(getType()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getValue()) * 27 + super.hashCode() * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -51,26 +50,6 @@ public class BeanImportModel extends AbstractModel {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof BeanImportModel)) {
|
||||
return false;
|
||||
}
|
||||
BeanImportModel beanImport = (BeanImportModel) obj;
|
||||
if (beanImport == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getResource(), beanImport.getResource())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getResource()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the resource
|
||||
*/
|
||||
|
||||
@@ -42,41 +42,18 @@ public class DecisionStateModel extends AbstractStateModel {
|
||||
setId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a decision state model
|
||||
* @param id the state identifier
|
||||
* @param ifs decision tests
|
||||
* @param onExitActions actions to execute before exiting this state
|
||||
* @param attributes meta attributes for this state
|
||||
* @param secured security settings for this state
|
||||
* @param onEntryActions actions to execute upon entering this state
|
||||
* @param exceptionHandlers exception handlers for this state
|
||||
*/
|
||||
public DecisionStateModel(String id, LinkedList ifs, LinkedList onExitActions, LinkedList attributes,
|
||||
SecuredModel secured, LinkedList onEntryActions, LinkedList exceptionHandlers) {
|
||||
setId(id);
|
||||
setIfs(ifs);
|
||||
setOnExitActions(onExitActions);
|
||||
setAttributes(attributes);
|
||||
setSecured(secured);
|
||||
setOnEntryActions(onEntryActions);
|
||||
setExceptionHandlers(exceptionHandlers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the decision state to merge into this state
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
DecisionStateModel state = (DecisionStateModel) model;
|
||||
setAttributes(merge(getAttributes(), state.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), state.getSecured()));
|
||||
setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers()));
|
||||
setIfs(merge(getIfs(), state.getIfs()));
|
||||
setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false));
|
||||
}
|
||||
DecisionStateModel state = (DecisionStateModel) model;
|
||||
setAttributes(merge(getAttributes(), state.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), state.getSecured()));
|
||||
setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers()));
|
||||
setIfs(merge(getIfs(), state.getIfs()));
|
||||
setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,9 +61,6 @@ public class DecisionStateModel extends AbstractStateModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof DecisionStateModel)) {
|
||||
return false;
|
||||
}
|
||||
@@ -94,41 +68,6 @@ public class DecisionStateModel extends AbstractStateModel {
|
||||
return ObjectUtils.nullSafeEquals(getId(), state.getId());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof DecisionStateModel)) {
|
||||
return false;
|
||||
}
|
||||
DecisionStateModel state = (DecisionStateModel) obj;
|
||||
if (state == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getId(), state.getId())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getAttributes(), state.getAttributes())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getSecured(), state.getSecured())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnEntryActions(), state.getOnEntryActions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getExceptionHandlers(), state.getExceptionHandlers())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getIfs(), state.getIfs())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnExitActions(), state.getOnExitActions())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getId()) * 27 + ObjectUtils.nullSafeHashCode(getAttributes()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getSecured()) * 27 + ObjectUtils.nullSafeHashCode(getOnEntryActions())
|
||||
* 27 + ObjectUtils.nullSafeHashCode(getExceptionHandlers()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getIfs()) * 27 + ObjectUtils.nullSafeHashCode(getOnExitActions()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the ifs
|
||||
*/
|
||||
|
||||
@@ -46,44 +46,19 @@ public class EndStateModel extends AbstractStateModel {
|
||||
setId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an end state model
|
||||
* @param id the state identifier
|
||||
* @param view the view to render
|
||||
* @param commit indicate if the persistence context should be committed
|
||||
* @param outputs output mappings
|
||||
* @param attributes meta attributes for the state
|
||||
* @param secured security settings for the state
|
||||
* @param onEntryActions actions to execute when entering the state
|
||||
* @param exceptionHandlers exception handlers for the state
|
||||
*/
|
||||
public EndStateModel(String id, String view, String commit, LinkedList outputs, LinkedList attributes,
|
||||
SecuredModel secured, LinkedList onEntryActions, LinkedList exceptionHandlers) {
|
||||
setId(id);
|
||||
setView(view);
|
||||
setCommit(commit);
|
||||
setOutputs(outputs);
|
||||
setAttributes(attributes);
|
||||
setSecured(secured);
|
||||
setOnEntryActions(onEntryActions);
|
||||
setExceptionHandlers(exceptionHandlers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the end state to merge into this state
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
EndStateModel state = (EndStateModel) model;
|
||||
setAttributes(merge(getAttributes(), state.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), state.getSecured()));
|
||||
setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers()));
|
||||
setView(merge(getView(), state.getView()));
|
||||
setCommit(merge(getCommit(), state.getCommit()));
|
||||
setOutputs(merge(getOutputs(), state.getOutputs(), false));
|
||||
}
|
||||
EndStateModel state = (EndStateModel) model;
|
||||
setAttributes(merge(getAttributes(), state.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), state.getSecured()));
|
||||
setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers()));
|
||||
setView(merge(getView(), state.getView()));
|
||||
setCommit(merge(getCommit(), state.getCommit()));
|
||||
setOutputs(merge(getOutputs(), state.getOutputs(), false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -91,9 +66,6 @@ public class EndStateModel extends AbstractStateModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof EndStateModel)) {
|
||||
return false;
|
||||
}
|
||||
@@ -101,44 +73,6 @@ public class EndStateModel extends AbstractStateModel {
|
||||
return ObjectUtils.nullSafeEquals(getId(), state.getId());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof EndStateModel)) {
|
||||
return false;
|
||||
}
|
||||
EndStateModel state = (EndStateModel) obj;
|
||||
if (state == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getId(), state.getId())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getAttributes(), state.getAttributes())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getSecured(), state.getSecured())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnEntryActions(), state.getOnEntryActions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getExceptionHandlers(), state.getExceptionHandlers())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getView(), state.getView())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getCommit(), state.getCommit())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOutputs(), state.getOutputs())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hasCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getId()) * 27 + ObjectUtils.nullSafeHashCode(getAttributes()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getSecured()) * 27 + ObjectUtils.nullSafeHashCode(getOnEntryActions())
|
||||
* 27 + ObjectUtils.nullSafeHashCode(getExceptionHandlers()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getView()) * 27 + ObjectUtils.nullSafeHashCode(getCommit()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getOutputs()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the view
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -38,80 +37,6 @@ public class EvaluateModel extends AbstractActionModel {
|
||||
setExpression(expression);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an evaluate action model
|
||||
* @param expression the expression to evaluate
|
||||
* @param result where to store the result of the expressions
|
||||
*/
|
||||
public EvaluateModel(String expression, String result) {
|
||||
setExpression(expression);
|
||||
setResult(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an evaluate action model
|
||||
* @param expression the expression to evaluate
|
||||
* @param result where to store the result of the expressions
|
||||
* @param resultType the type of the result
|
||||
*/
|
||||
public EvaluateModel(String expression, String result, String resultType) {
|
||||
setExpression(expression);
|
||||
setResult(result);
|
||||
setResultType(resultType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the evaluate action to merge into this evaluate
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
EvaluateModel evaluate = (EvaluateModel) model;
|
||||
setResult(merge(getResult(), evaluate.getResult()));
|
||||
setResultType(merge(getResultType(), evaluate.getResultType()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the model is able to be merged with this evaluate action
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof EvaluateModel)) {
|
||||
return false;
|
||||
}
|
||||
EvaluateModel evaluate = (EvaluateModel) model;
|
||||
return ObjectUtils.nullSafeEquals(getExpression(), evaluate.getExpression());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof EvaluateModel)) {
|
||||
return false;
|
||||
}
|
||||
EvaluateModel evaluate = (EvaluateModel) obj;
|
||||
if (evaluate == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getExpression(), evaluate.getExpression())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getResult(), evaluate.getResult())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getResultType(), evaluate.getResultType())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getExpression()) * 27 + ObjectUtils.nullSafeHashCode(getResult()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getResultType()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the expression
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -47,26 +46,6 @@ public class ExceptionHandlerModel extends AbstractModel {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof ExceptionHandlerModel)) {
|
||||
return false;
|
||||
}
|
||||
ExceptionHandlerModel exceptionHandler = (ExceptionHandlerModel) obj;
|
||||
if (exceptionHandler == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getBeanName(), exceptionHandler.getBeanName())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getBeanName()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the bean name
|
||||
*/
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.springframework.webflow.engine.model;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -73,23 +72,21 @@ public class FlowModel extends AbstractModel {
|
||||
* @param model the flow to merge into this flow
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
FlowModel flow = (FlowModel) model;
|
||||
setParent(null);
|
||||
setStartStateId(merge(getStartStateId(), flow.getStartStateId()));
|
||||
setAttributes(merge(getAttributes(), flow.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), flow.getSecured()));
|
||||
setPersistenceContext((PersistenceContextModel) merge(getPersistenceContext(), flow.getPersistenceContext()));
|
||||
setVars(merge(getVars(), flow.getVars(), false));
|
||||
setInputs(merge(getInputs(), flow.getInputs()));
|
||||
setOutputs(merge(getOutputs(), flow.getOutputs()));
|
||||
setOnStartActions(merge(getOnStartActions(), flow.getOnStartActions(), false));
|
||||
setStates(merge(getStates(), flow.getStates()));
|
||||
setGlobalTransitions(merge(getGlobalTransitions(), flow.getGlobalTransitions()));
|
||||
setOnEndActions(merge(getOnEndActions(), flow.getOnEndActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), flow.getExceptionHandlers()));
|
||||
setBeanImports(merge(getBeanImports(), flow.getBeanImports()));
|
||||
}
|
||||
FlowModel flow = (FlowModel) model;
|
||||
setParent(null);
|
||||
setStartStateId(merge(getStartStateId(), flow.getStartStateId()));
|
||||
setAttributes(merge(getAttributes(), flow.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), flow.getSecured()));
|
||||
setPersistenceContext((PersistenceContextModel) merge(getPersistenceContext(), flow.getPersistenceContext()));
|
||||
setVars(merge(getVars(), flow.getVars(), false));
|
||||
setInputs(merge(getInputs(), flow.getInputs()));
|
||||
setOutputs(merge(getOutputs(), flow.getOutputs()));
|
||||
setOnStartActions(merge(getOnStartActions(), flow.getOnStartActions(), false));
|
||||
setStates(merge(getStates(), flow.getStates()));
|
||||
setGlobalTransitions(merge(getGlobalTransitions(), flow.getGlobalTransitions()));
|
||||
setOnEndActions(merge(getOnEndActions(), flow.getOnEndActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), flow.getExceptionHandlers()));
|
||||
setBeanImports(merge(getBeanImports(), flow.getBeanImports()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -97,9 +94,6 @@ public class FlowModel extends AbstractModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if ((model instanceof FlowModel)) {
|
||||
return true;
|
||||
} else {
|
||||
@@ -107,60 +101,6 @@ public class FlowModel extends AbstractModel {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof FlowModel)) {
|
||||
return false;
|
||||
}
|
||||
FlowModel flow = (FlowModel) obj;
|
||||
if (flow == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getParent(), flow.getParent())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getStartStateId(), flow.getStartStateId())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getAttributes(), flow.getAttributes())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getSecured(), flow.getSecured())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getPersistenceContext(), flow.getPersistenceContext())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getVars(), flow.getVars())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getInputs(), flow.getInputs())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOutputs(), flow.getOutputs())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnStartActions(), flow.getOnStartActions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getStates(), flow.getStates())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getGlobalTransitions(), flow.getGlobalTransitions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnEndActions(), flow.getOnEndActions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getExceptionHandlers(), flow.getExceptionHandlers())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getBeanImports(), flow.getBeanImports())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getParent()) * 27 + ObjectUtils.nullSafeHashCode(getStartStateId()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getAttributes()) * 27 + ObjectUtils.nullSafeHashCode(getSecured()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getPersistenceContext()) * 27 + ObjectUtils.nullSafeHashCode(getVars())
|
||||
* 27 + ObjectUtils.nullSafeHashCode(getInputs()) * 27 + ObjectUtils.nullSafeHashCode(getOutputs()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getOnStartActions()) * 27 + ObjectUtils.nullSafeHashCode(getStates())
|
||||
* 27 + ObjectUtils.nullSafeHashCode(getGlobalTransitions()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getOnEndActions()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getExceptionHandlers()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getBeanImports()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the parent
|
||||
*/
|
||||
|
||||
@@ -42,28 +42,14 @@ public class IfModel extends AbstractModel {
|
||||
setThen(then);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an if model
|
||||
* @param test the boolean condition to test
|
||||
* @param then the state to transition to if the boolean expression evaluates to true
|
||||
* @param elze the state to transition to if the boolean expression evaluates to false
|
||||
*/
|
||||
public IfModel(String test, String then, String elze) {
|
||||
setTest(test);
|
||||
setThen(then);
|
||||
setElse(elze);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the conditional to merge into this conditional
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
IfModel conditional = (IfModel) model;
|
||||
setThen(merge(getThen(), conditional.getThen()));
|
||||
setElse(merge(getElse(), conditional.getElse()));
|
||||
}
|
||||
IfModel conditional = (IfModel) model;
|
||||
setThen(merge(getThen(), conditional.getThen()));
|
||||
setElse(merge(getElse(), conditional.getElse()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,9 +57,6 @@ public class IfModel extends AbstractModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof IfModel)) {
|
||||
return false;
|
||||
}
|
||||
@@ -81,31 +64,6 @@ public class IfModel extends AbstractModel {
|
||||
return ObjectUtils.nullSafeEquals(getTest(), conditional.getTest());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof IfModel)) {
|
||||
return false;
|
||||
}
|
||||
IfModel conditional = (IfModel) obj;
|
||||
if (conditional == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getTest(), conditional.getTest())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getThen(), conditional.getThen())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getElse(), conditional.getElse())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getTest()) * 27 + ObjectUtils.nullSafeHashCode(getThen()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getElse()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the test
|
||||
*/
|
||||
|
||||
@@ -36,31 +36,15 @@ public class InputModel extends AbstractMappingModel {
|
||||
setValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an input mapping model
|
||||
* @param name the name of the mapping variable
|
||||
* @param value the value to map
|
||||
* @param type the type of the value
|
||||
* @param required indicates if this mapping is required
|
||||
*/
|
||||
public InputModel(String name, String value, String type, String required) {
|
||||
setName(name);
|
||||
setValue(value);
|
||||
setType(type);
|
||||
setRequired(required);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the mapping to merge into this mapping
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
InputModel input = (InputModel) model;
|
||||
setValue(merge(getValue(), input.getValue()));
|
||||
setType(merge(getType(), input.getType()));
|
||||
setRequired(merge(getRequired(), input.getRequired()));
|
||||
}
|
||||
InputModel input = (InputModel) model;
|
||||
setValue(merge(getValue(), input.getValue()));
|
||||
setType(merge(getType(), input.getType()));
|
||||
setRequired(merge(getRequired(), input.getRequired()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,9 +52,6 @@ public class InputModel extends AbstractMappingModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof InputModel)) {
|
||||
return false;
|
||||
}
|
||||
@@ -78,31 +59,4 @@ public class InputModel extends AbstractMappingModel {
|
||||
return ObjectUtils.nullSafeEquals(getName(), input.getName());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof InputModel)) {
|
||||
return false;
|
||||
}
|
||||
InputModel input = (InputModel) obj;
|
||||
if (input == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getName(), input.getName())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getValue(), input.getValue())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getType(), input.getType())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getRequired(), input.getRequired())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getName()) * 27 + ObjectUtils.nullSafeHashCode(getValue()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getType()) * 27 + ObjectUtils.nullSafeHashCode(getRequired()) * 27;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,31 +36,15 @@ public class OutputModel extends AbstractMappingModel {
|
||||
setValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create an output mapping model
|
||||
* @param name the name of the mapping variable
|
||||
* @param value the value to map
|
||||
* @param type the type of the value
|
||||
* @param required indicates if this mapping is required
|
||||
*/
|
||||
public OutputModel(String name, String value, String type, String required) {
|
||||
setName(name);
|
||||
setValue(value);
|
||||
setType(type);
|
||||
setRequired(required);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the mapping to merge into this mapping
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
OutputModel output = (OutputModel) model;
|
||||
setValue(merge(getValue(), output.getValue()));
|
||||
setType(merge(getType(), output.getType()));
|
||||
setRequired(merge(getRequired(), output.getRequired()));
|
||||
}
|
||||
OutputModel output = (OutputModel) model;
|
||||
setValue(merge(getValue(), output.getValue()));
|
||||
setType(merge(getType(), output.getType()));
|
||||
setRequired(merge(getRequired(), output.getRequired()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,9 +52,6 @@ public class OutputModel extends AbstractMappingModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof OutputModel)) {
|
||||
return false;
|
||||
}
|
||||
@@ -78,31 +59,4 @@ public class OutputModel extends AbstractMappingModel {
|
||||
return ObjectUtils.nullSafeEquals(getName(), output.getName());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof InputModel)) {
|
||||
return false;
|
||||
}
|
||||
OutputModel output = (OutputModel) obj;
|
||||
if (output == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getName(), output.getName())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getValue(), output.getValue())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getType(), output.getType())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getRequired(), output.getRequired())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getName()) * 27 + ObjectUtils.nullSafeHashCode(getValue()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getType()) * 27 + ObjectUtils.nullSafeHashCode(getRequired()) * 27;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -37,42 +36,6 @@ public class RenderModel extends AbstractActionModel {
|
||||
setFragments(fragments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Render action models are not mergeable
|
||||
* @param model the render action to merge into this render
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
// not mergeable
|
||||
}
|
||||
|
||||
/**
|
||||
* Render action models are not mergeable
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof RenderModel)) {
|
||||
return false;
|
||||
}
|
||||
RenderModel render = (RenderModel) obj;
|
||||
if (render == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getFragments(), render.getFragments())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getFragments()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the fragments
|
||||
*/
|
||||
|
||||
@@ -43,25 +43,13 @@ public class SecuredModel extends AbstractModel {
|
||||
setAttributes(attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a security settings model
|
||||
* @param attributes the security attributes
|
||||
* @param match the type of matching for the attributes
|
||||
*/
|
||||
public SecuredModel(String attributes, String match) {
|
||||
setAttributes(attributes);
|
||||
setMatch(match);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the secured to merge into this secured
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
SecuredModel secured = (SecuredModel) model;
|
||||
setMatch(merge(getMatch(), secured.getMatch()));
|
||||
}
|
||||
SecuredModel secured = (SecuredModel) model;
|
||||
setMatch(merge(getMatch(), secured.getMatch()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -69,9 +57,6 @@ public class SecuredModel extends AbstractModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof SecuredModel)) {
|
||||
return false;
|
||||
}
|
||||
@@ -79,28 +64,6 @@ public class SecuredModel extends AbstractModel {
|
||||
return ObjectUtils.nullSafeEquals(getAttributes(), secured.getAttributes());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof SecuredModel)) {
|
||||
return false;
|
||||
}
|
||||
SecuredModel secured = (SecuredModel) obj;
|
||||
if (secured == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getAttributes(), secured.getAttributes())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getMatch(), secured.getMatch())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getAttributes()) * 27 + ObjectUtils.nullSafeHashCode(getMatch()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the attributes
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -40,71 +39,6 @@ public class SetModel extends AbstractActionModel {
|
||||
setValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a set action model
|
||||
* @param name the name of the property to set
|
||||
* @param value the value to set
|
||||
* @param type the type of the property
|
||||
*/
|
||||
public SetModel(String name, String value, String type) {
|
||||
setName(name);
|
||||
setValue(value);
|
||||
setType(type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the set action to merge into this set
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
SetModel set = (SetModel) model;
|
||||
setValue(merge(getValue(), set.getValue()));
|
||||
setType(merge(getType(), set.getType()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the model is able to be merged with this set action
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof SetModel)) {
|
||||
return false;
|
||||
}
|
||||
SetModel set = (SetModel) model;
|
||||
return ObjectUtils.nullSafeEquals(getName(), set.getName());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof SetModel)) {
|
||||
return false;
|
||||
}
|
||||
SetModel set = (SetModel) obj;
|
||||
if (set == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getName(), set.getName())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getValue(), set.getValue())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getType(), set.getType())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getName()) * 27 + ObjectUtils.nullSafeHashCode(getValue()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getType()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
|
||||
@@ -46,54 +46,22 @@ public class SubflowStateModel extends AbstractTransitionableStateModel {
|
||||
setSubflow(subflow);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a subflow state model
|
||||
* @param id the identifier of the state
|
||||
* @param subflow the identifier of the flow to launch as a subflow
|
||||
* @param subflowAttributeMapper bean name of the attribute mapping
|
||||
* @param inputs input mappings
|
||||
* @param outputs output mappings
|
||||
* @param attributes meta attributes for the state
|
||||
* @param secured security settings for the state
|
||||
* @param onEntryActions actions to be executed when entering the state
|
||||
* @param exceptionHandlers exception handlers for the state
|
||||
* @param transitions transitions for the state
|
||||
* @param onExitActions actions to be executed before leaving the state.
|
||||
*/
|
||||
public SubflowStateModel(String id, String subflow, String subflowAttributeMapper, LinkedList inputs,
|
||||
LinkedList outputs, LinkedList attributes, SecuredModel secured, LinkedList onEntryActions,
|
||||
LinkedList exceptionHandlers, LinkedList transitions, LinkedList onExitActions) {
|
||||
setId(id);
|
||||
setSubflow(subflow);
|
||||
setSubflowAttributeMapper(subflowAttributeMapper);
|
||||
setInputs(inputs);
|
||||
setOutputs(outputs);
|
||||
setAttributes(attributes);
|
||||
setSecured(secured);
|
||||
setOnEntryActions(onEntryActions);
|
||||
setExceptionHandlers(exceptionHandlers);
|
||||
setTransitions(transitions);
|
||||
setOnExitActions(onExitActions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the subflow state to merge into this state
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
SubflowStateModel state = (SubflowStateModel) model;
|
||||
setAttributes(merge(getAttributes(), state.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), state.getSecured()));
|
||||
setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers()));
|
||||
setTransitions(merge(getTransitions(), state.getTransitions()));
|
||||
setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false));
|
||||
setSubflow(merge(getSubflow(), state.getSubflow()));
|
||||
setSubflowAttributeMapper(merge(getSubflowAttributeMapper(), state.getSubflowAttributeMapper()));
|
||||
setInputs(merge(getInputs(), state.getInputs()));
|
||||
setOutputs(merge(getOutputs(), state.getOutputs()));
|
||||
}
|
||||
SubflowStateModel state = (SubflowStateModel) model;
|
||||
setAttributes(merge(getAttributes(), state.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), state.getSecured()));
|
||||
setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers()));
|
||||
setTransitions(merge(getTransitions(), state.getTransitions()));
|
||||
setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false));
|
||||
setSubflow(merge(getSubflow(), state.getSubflow()));
|
||||
setSubflowAttributeMapper(merge(getSubflowAttributeMapper(), state.getSubflowAttributeMapper()));
|
||||
setInputs(merge(getInputs(), state.getInputs()));
|
||||
setOutputs(merge(getOutputs(), state.getOutputs()));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,9 +69,6 @@ public class SubflowStateModel extends AbstractTransitionableStateModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof SubflowStateModel)) {
|
||||
return false;
|
||||
}
|
||||
@@ -111,52 +76,6 @@ public class SubflowStateModel extends AbstractTransitionableStateModel {
|
||||
return ObjectUtils.nullSafeEquals(getId(), state.getId());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof SubflowStateModel)) {
|
||||
return false;
|
||||
}
|
||||
SubflowStateModel state = (SubflowStateModel) obj;
|
||||
if (state == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getId(), state.getId())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getAttributes(), state.getAttributes())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getSecured(), state.getSecured())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnEntryActions(), state.getOnEntryActions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getExceptionHandlers(), state.getExceptionHandlers())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getTransitions(), state.getTransitions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnExitActions(), state.getOnExitActions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getSubflow(), state.getSubflow())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getSubflowAttributeMapper(), state.getSubflowAttributeMapper())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getInputs(), state.getInputs())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOutputs(), state.getOutputs())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getId()) * 27 + ObjectUtils.nullSafeHashCode(getAttributes()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getSecured()) * 27 + ObjectUtils.nullSafeHashCode(getOnEntryActions())
|
||||
* 27 + ObjectUtils.nullSafeHashCode(getExceptionHandlers()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getTransitions()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getOnExitActions()) * 27 + ObjectUtils.nullSafeHashCode(getSubflow())
|
||||
* 27 + ObjectUtils.nullSafeHashCode(getSubflowAttributeMapper()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getInputs()) * 27 + ObjectUtils.nullSafeHashCode(getOutputs()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the subflow
|
||||
*/
|
||||
|
||||
@@ -40,41 +40,8 @@ public class TransitionModel extends AbstractModel {
|
||||
|
||||
/**
|
||||
* Create a transition model
|
||||
* @param on the matching criteria
|
||||
*/
|
||||
public TransitionModel(String on) {
|
||||
setOn(on);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a transition model
|
||||
* @param on the matching criteria
|
||||
* @param to the identifier of the state to target
|
||||
*/
|
||||
public TransitionModel(String on, String to) {
|
||||
setOn(on);
|
||||
setTo(to);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a transition model
|
||||
* @param on the matching criteria
|
||||
* @param to the identifier of the state to target
|
||||
* @param onException class name of the exception to handle
|
||||
* @param bind if the transition should bind to the defined model. Valid only for view state transitions
|
||||
* @param attributes meta attributes for the transition
|
||||
* @param secured security settings for the transition
|
||||
* @param actions actions to be executed after matching the transition
|
||||
*/
|
||||
public TransitionModel(String on, String to, String onException, String bind, LinkedList attributes,
|
||||
SecuredModel secured, LinkedList actions) {
|
||||
setOn(on);
|
||||
setTo(to);
|
||||
setOnException(onException);
|
||||
setBind(bind);
|
||||
setAttributes(attributes);
|
||||
setSecured(secured);
|
||||
setActions(actions);
|
||||
public TransitionModel() {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -82,15 +49,13 @@ public class TransitionModel extends AbstractModel {
|
||||
* @param model the transition to merge into this transition
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
TransitionModel transition = (TransitionModel) model;
|
||||
setOnException(merge(getOnException(), transition.getOnException()));
|
||||
setTo(merge(getTo(), transition.getTo()));
|
||||
setBind(merge(getBind(), transition.getBind()));
|
||||
setAttributes(merge(getAttributes(), transition.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), transition.getSecured()));
|
||||
setActions(merge(getActions(), transition.getActions(), false));
|
||||
}
|
||||
TransitionModel transition = (TransitionModel) model;
|
||||
setOnException(merge(getOnException(), transition.getOnException()));
|
||||
setTo(merge(getTo(), transition.getTo()));
|
||||
setBind(merge(getBind(), transition.getBind()));
|
||||
setAttributes(merge(getAttributes(), transition.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), transition.getSecured()));
|
||||
setActions(merge(getActions(), transition.getActions(), false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -98,9 +63,6 @@ public class TransitionModel extends AbstractModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof TransitionModel)) {
|
||||
return false;
|
||||
}
|
||||
@@ -108,41 +70,6 @@ public class TransitionModel extends AbstractModel {
|
||||
return ObjectUtils.nullSafeEquals(getOn(), transition.getOn());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof TransitionModel)) {
|
||||
return false;
|
||||
}
|
||||
TransitionModel transition = (TransitionModel) obj;
|
||||
if (transition == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOn(), transition.getOn())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnException(), transition.getOnException())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getTo(), transition.getTo())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getBind(), transition.getBind())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getAttributes(), transition.getAttributes())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getSecured(), transition.getSecured())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getActions(), transition.getActions())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getOn()) * 27 + ObjectUtils.nullSafeHashCode(getOnException()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getTo()) * 27 + ObjectUtils.nullSafeHashCode(getBind()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getAttributes()) * 27 + ObjectUtils.nullSafeHashCode(getSecured()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getActions()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the on
|
||||
*/
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -42,67 +41,19 @@ public class VarModel extends AbstractModel {
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a variable model
|
||||
* @param name the name of the variable
|
||||
* @param className the class type of the variable
|
||||
* @param scope the scope to store the variable
|
||||
*/
|
||||
public VarModel(String name, String className, String scope) {
|
||||
setName(name);
|
||||
setClassName(className);
|
||||
setScope(scope);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the var to merge into this var
|
||||
* Vars are not mergeable
|
||||
* @param model the render action to merge into this render
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
VarModel var = (VarModel) model;
|
||||
setClassName(merge(getClassName(), var.getClassName()));
|
||||
setScope(merge(getScope(), var.getScope()));
|
||||
}
|
||||
// not mergeable
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the model is able to be merged with this var
|
||||
* Vars are not mergeable
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof VarModel)) {
|
||||
return false;
|
||||
}
|
||||
VarModel var = (VarModel) model;
|
||||
return ObjectUtils.nullSafeEquals(getName(), var.getName());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof VarModel)) {
|
||||
return false;
|
||||
}
|
||||
VarModel var = (VarModel) obj;
|
||||
if (var == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getName(), var.getName())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getClassName(), var.getClassName())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getScope(), var.getScope())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getName()) * 27 + ObjectUtils.nullSafeHashCode(getClassName()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getScope()) * 27;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,70 +52,24 @@ public class ViewStateModel extends AbstractTransitionableStateModel {
|
||||
setId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a view state model
|
||||
* @param id the identifier of the state
|
||||
* @param view the view to render
|
||||
*/
|
||||
public ViewStateModel(String id, String view) {
|
||||
setId(id);
|
||||
setView(view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a view state model
|
||||
* @param id the identifier of the state
|
||||
* @param view the view to render
|
||||
* @param redirect request a flow execution redirect before render
|
||||
* @param popup view should render in a popup dialog
|
||||
* @param model the model object to bind for this view
|
||||
* @param vars variables for this state
|
||||
* @param onRenderActions actions to be executed before rendering
|
||||
* @param attributes meta attributes for this state
|
||||
* @param secured the security settings for this state
|
||||
* @param onEntryActions actions to be executed on entry
|
||||
* @param exceptionHandlers exception handlers for this state
|
||||
* @param transitions transitions for this state
|
||||
* @param onExitActions actions to be executed before exiting
|
||||
*/
|
||||
public ViewStateModel(String id, String view, String redirect, String popup, String model, LinkedList vars,
|
||||
LinkedList onRenderActions, LinkedList attributes, SecuredModel secured, LinkedList onEntryActions,
|
||||
LinkedList exceptionHandlers, LinkedList transitions, LinkedList onExitActions) {
|
||||
setId(id);
|
||||
setView(view);
|
||||
setRedirect(redirect);
|
||||
setPopup(popup);
|
||||
setModel(model);
|
||||
setVars(vars);
|
||||
setOnRenderActions(onRenderActions);
|
||||
setAttributes(attributes);
|
||||
setSecured(secured);
|
||||
setOnEntryActions(onEntryActions);
|
||||
setExceptionHandlers(exceptionHandlers);
|
||||
setTransitions(transitions);
|
||||
setOnExitActions(onExitActions);
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge properties
|
||||
* @param model the view state to merge into this state
|
||||
*/
|
||||
public void merge(Model model) {
|
||||
if (isMergeableWith(model)) {
|
||||
ViewStateModel state = (ViewStateModel) model;
|
||||
setAttributes(merge(getAttributes(), state.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), state.getSecured()));
|
||||
setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers()));
|
||||
setTransitions(merge(getTransitions(), state.getTransitions()));
|
||||
setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false));
|
||||
setView(merge(getView(), state.getView()));
|
||||
setRedirect(merge(getRedirect(), state.getRedirect()));
|
||||
setPopup(merge(getPopup(), state.getPopup()));
|
||||
setModel(merge(getModel(), state.getModel()));
|
||||
setVars(merge(getVars(), state.getVars(), false));
|
||||
setOnRenderActions(merge(getOnRenderActions(), state.getOnRenderActions(), false));
|
||||
}
|
||||
ViewStateModel state = (ViewStateModel) model;
|
||||
setAttributes(merge(getAttributes(), state.getAttributes()));
|
||||
setSecured((SecuredModel) merge(getSecured(), state.getSecured()));
|
||||
setOnEntryActions(merge(getOnEntryActions(), state.getOnEntryActions(), false));
|
||||
setExceptionHandlers(merge(getExceptionHandlers(), state.getExceptionHandlers()));
|
||||
setTransitions(merge(getTransitions(), state.getTransitions()));
|
||||
setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false));
|
||||
setView(merge(getView(), state.getView()));
|
||||
setRedirect(merge(getRedirect(), state.getRedirect()));
|
||||
setPopup(merge(getPopup(), state.getPopup()));
|
||||
setModel(merge(getModel(), state.getModel()));
|
||||
setVars(merge(getVars(), state.getVars(), false));
|
||||
setOnRenderActions(merge(getOnRenderActions(), state.getOnRenderActions(), false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,9 +77,6 @@ public class ViewStateModel extends AbstractTransitionableStateModel {
|
||||
* @param model the model to test
|
||||
*/
|
||||
public boolean isMergeableWith(Model model) {
|
||||
if (model == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(model instanceof ViewStateModel)) {
|
||||
return false;
|
||||
}
|
||||
@@ -133,57 +84,6 @@ public class ViewStateModel extends AbstractTransitionableStateModel {
|
||||
return ObjectUtils.nullSafeEquals(getId(), state.getId());
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
} else if (!(obj instanceof ViewStateModel)) {
|
||||
return false;
|
||||
}
|
||||
ViewStateModel state = (ViewStateModel) obj;
|
||||
if (state == null) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getId(), state.getId())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getAttributes(), state.getAttributes())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getSecured(), state.getSecured())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnEntryActions(), state.getOnEntryActions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getExceptionHandlers(), state.getExceptionHandlers())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getTransitions(), state.getTransitions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnExitActions(), state.getOnExitActions())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getView(), state.getView())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getRedirect(), state.getRedirect())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getPopup(), state.getPopup())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getModel(), state.getModel())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getVars(), state.getVars())) {
|
||||
return false;
|
||||
} else if (!ObjectUtils.nullSafeEquals(getOnRenderActions(), state.getOnRenderActions())) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return ObjectUtils.nullSafeHashCode(getId()) * 27 + ObjectUtils.nullSafeHashCode(getAttributes()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getSecured()) * 27 + ObjectUtils.nullSafeHashCode(getOnEntryActions())
|
||||
* 27 + ObjectUtils.nullSafeHashCode(getExceptionHandlers()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getTransitions()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getOnExitActions()) * 27 + ObjectUtils.nullSafeHashCode(getView()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getRedirect()) * 27 + ObjectUtils.nullSafeHashCode(getPopup()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getModel()) * 27 + ObjectUtils.nullSafeHashCode(getVars()) * 27
|
||||
+ ObjectUtils.nullSafeHashCode(getOnRenderActions()) * 27;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the view
|
||||
*/
|
||||
|
||||
@@ -175,7 +175,7 @@ public class XmlFlowModelBuilder implements FlowModelBuilder, ResourceHolder {
|
||||
.hasNext();) {
|
||||
attributes.add(parseAttribute((Element) attributeIt.next()));
|
||||
}
|
||||
return attributes;
|
||||
return !attributes.isEmpty() ? attributes : null;
|
||||
}
|
||||
|
||||
protected LinkedList parseVars(Element ele) {
|
||||
@@ -183,7 +183,7 @@ public class XmlFlowModelBuilder implements FlowModelBuilder, ResourceHolder {
|
||||
for (Iterator varIt = DomUtils.getChildElementsByTagName(ele, "var").iterator(); varIt.hasNext();) {
|
||||
vars.add(parseVar((Element) varIt.next()));
|
||||
}
|
||||
return vars;
|
||||
return !vars.isEmpty() ? vars : null;
|
||||
}
|
||||
|
||||
protected LinkedList parseInputs(Element ele) {
|
||||
@@ -191,7 +191,7 @@ public class XmlFlowModelBuilder implements FlowModelBuilder, ResourceHolder {
|
||||
for (Iterator inputIt = DomUtils.getChildElementsByTagName(ele, "input").iterator(); inputIt.hasNext();) {
|
||||
inputs.add(parseInput((Element) inputIt.next()));
|
||||
}
|
||||
return inputs;
|
||||
return !inputs.isEmpty() ? inputs : null;
|
||||
}
|
||||
|
||||
protected LinkedList parseOutputs(Element ele) {
|
||||
@@ -199,16 +199,19 @@ public class XmlFlowModelBuilder implements FlowModelBuilder, ResourceHolder {
|
||||
for (Iterator outputIt = DomUtils.getChildElementsByTagName(ele, "output").iterator(); outputIt.hasNext();) {
|
||||
outputs.add(parseOutput((Element) outputIt.next()));
|
||||
}
|
||||
return outputs;
|
||||
return !outputs.isEmpty() ? outputs : null;
|
||||
}
|
||||
|
||||
protected LinkedList parseActions(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
}
|
||||
LinkedList actions = new LinkedList();
|
||||
for (Iterator actionIt = getChildElementsByTagNames(ele, new String[] { "evaluate", "render", "set" })
|
||||
.iterator(); actionIt.hasNext();) {
|
||||
actions.add(parseAction((Element) actionIt.next()));
|
||||
}
|
||||
return actions;
|
||||
return !actions.isEmpty() ? actions : null;
|
||||
}
|
||||
|
||||
protected LinkedList parseStates(Element ele) {
|
||||
@@ -218,7 +221,7 @@ public class XmlFlowModelBuilder implements FlowModelBuilder, ResourceHolder {
|
||||
.iterator(); stateIt.hasNext();) {
|
||||
states.add(parseState((Element) stateIt.next()));
|
||||
}
|
||||
return states;
|
||||
return !states.isEmpty() ? states : null;
|
||||
}
|
||||
|
||||
protected LinkedList parseTransitions(Element ele) {
|
||||
@@ -227,8 +230,7 @@ public class XmlFlowModelBuilder implements FlowModelBuilder, ResourceHolder {
|
||||
.hasNext();) {
|
||||
transitions.add(parseTransition((Element) transitionIt.next()));
|
||||
}
|
||||
return transitions;
|
||||
|
||||
return !transitions.isEmpty() ? transitions : null;
|
||||
}
|
||||
|
||||
protected LinkedList parseExceptionHandlers(Element ele) {
|
||||
@@ -237,7 +239,7 @@ public class XmlFlowModelBuilder implements FlowModelBuilder, ResourceHolder {
|
||||
.hasNext();) {
|
||||
exceptionHandlers.add(parseExceptionHandler((Element) exceptionHandlerIt.next()));
|
||||
}
|
||||
return exceptionHandlers;
|
||||
return !exceptionHandlers.isEmpty() ? exceptionHandlers : null;
|
||||
}
|
||||
|
||||
protected LinkedList parseBeanImports(Element ele) {
|
||||
@@ -246,7 +248,7 @@ public class XmlFlowModelBuilder implements FlowModelBuilder, ResourceHolder {
|
||||
.hasNext();) {
|
||||
beanImports.add(parseBeanImport((Element) beanImportIt.next()));
|
||||
}
|
||||
return beanImports;
|
||||
return !beanImports.isEmpty() ? beanImports : null;
|
||||
}
|
||||
|
||||
protected LinkedList parseIfs(Element ele) {
|
||||
@@ -254,7 +256,7 @@ public class XmlFlowModelBuilder implements FlowModelBuilder, ResourceHolder {
|
||||
for (Iterator ifIt = DomUtils.getChildElementsByTagName(ele, "if").iterator(); ifIt.hasNext();) {
|
||||
ifs.add(parseIf((Element) ifIt.next()));
|
||||
}
|
||||
return ifs;
|
||||
return !ifs.isEmpty() ? ifs : null;
|
||||
}
|
||||
|
||||
protected AbstractActionModel parseAction(Element ele) {
|
||||
@@ -286,23 +288,18 @@ public class XmlFlowModelBuilder implements FlowModelBuilder, ResourceHolder {
|
||||
}
|
||||
|
||||
protected LinkedList parseGlobalTransitions(Element ele) {
|
||||
ele = DomUtils.getChildElementByTagName(ele, "global-transitions");
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "global-transitions")) {
|
||||
return parseGlobalTransitions(DomUtils.getChildElementByTagName(ele, "global-transitions"));
|
||||
} else {
|
||||
return parseTransitions(ele);
|
||||
}
|
||||
}
|
||||
|
||||
protected AttributeModel parseAttribute(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "attribute")) {
|
||||
return parseAttribute(DomUtils.getChildElementByTagName(ele, "attribute"));
|
||||
} else {
|
||||
return new AttributeModel(ele.getAttribute("name"), parseValue(ele), ele.getAttribute("type"));
|
||||
}
|
||||
AttributeModel attribute = new AttributeModel(ele.getAttribute("name"), parseValue(ele));
|
||||
attribute.setType(ele.getAttribute("type"));
|
||||
return attribute;
|
||||
}
|
||||
|
||||
protected String parseValue(Element ele) {
|
||||
@@ -315,239 +312,172 @@ public class XmlFlowModelBuilder implements FlowModelBuilder, ResourceHolder {
|
||||
}
|
||||
|
||||
protected SecuredModel parseSecured(Element ele) {
|
||||
ele = DomUtils.getChildElementByTagName(ele, "secured");
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "secured")) {
|
||||
return parseSecured(DomUtils.getChildElementByTagName(ele, "secured"));
|
||||
} else {
|
||||
return new SecuredModel(ele.getAttribute("attributes"), ele.getAttribute("match"));
|
||||
SecuredModel secured = new SecuredModel(ele.getAttribute("attributes"));
|
||||
secured.setMatch(ele.getAttribute("match"));
|
||||
return secured;
|
||||
}
|
||||
}
|
||||
|
||||
protected PersistenceContextModel parsePersistenceContext(Element ele) {
|
||||
ele = DomUtils.getChildElementByTagName(ele, "persistence-context");
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "persistence-context")) {
|
||||
return parsePersistenceContext(DomUtils.getChildElementByTagName(ele, "persistence-context"));
|
||||
} else {
|
||||
return new PersistenceContextModel();
|
||||
}
|
||||
}
|
||||
|
||||
protected VarModel parseVar(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "var")) {
|
||||
return parseVar(DomUtils.getChildElementByTagName(ele, "var"));
|
||||
} else {
|
||||
return new VarModel(ele.getAttribute("name"), ele.getAttribute("class"), ele.getAttribute("scope"));
|
||||
}
|
||||
VarModel var = new VarModel(ele.getAttribute("name"), ele.getAttribute("class"));
|
||||
var.setScope(ele.getAttribute("scope"));
|
||||
return var;
|
||||
}
|
||||
|
||||
protected InputModel parseInput(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "input")) {
|
||||
return parseInput(DomUtils.getChildElementByTagName(ele, "input"));
|
||||
} else {
|
||||
return new InputModel(ele.getAttribute("name"), ele.getAttribute("value"), ele.getAttribute("type"), ele
|
||||
.getAttribute("required"));
|
||||
}
|
||||
InputModel input = new InputModel(ele.getAttribute("name"), ele.getAttribute("value"));
|
||||
input.setType(ele.getAttribute("type"));
|
||||
input.setRequired(ele.getAttribute("required"));
|
||||
return input;
|
||||
}
|
||||
|
||||
protected OutputModel parseOutput(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "output")) {
|
||||
return parseOutput(DomUtils.getChildElementByTagName(ele, "output"));
|
||||
} else {
|
||||
return new OutputModel(ele.getAttribute("name"), ele.getAttribute("value"), ele.getAttribute("type"), ele
|
||||
.getAttribute("required"));
|
||||
}
|
||||
OutputModel output = new OutputModel(ele.getAttribute("name"), ele.getAttribute("value"));
|
||||
output.setType(ele.getAttribute("type"));
|
||||
output.setRequired(ele.getAttribute("required"));
|
||||
return output;
|
||||
}
|
||||
|
||||
protected TransitionModel parseTransition(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "transition")) {
|
||||
return parseTransition(DomUtils.getChildElementByTagName(ele, "transition"));
|
||||
} else {
|
||||
return new TransitionModel(ele.getAttribute("on"), ele.getAttribute("to"),
|
||||
ele.getAttribute("on-exception"), ele.getAttribute("bind"), parseAttributes(ele),
|
||||
parseSecured(ele), parseActions(ele));
|
||||
}
|
||||
TransitionModel transition = new TransitionModel();
|
||||
transition.setOn(ele.getAttribute("on"));
|
||||
transition.setTo(ele.getAttribute("to"));
|
||||
transition.setOnException(ele.getAttribute("on-exception"));
|
||||
transition.setBind(ele.getAttribute("bind"));
|
||||
transition.setAttributes(parseAttributes(ele));
|
||||
transition.setSecured(parseSecured(ele));
|
||||
transition.setActions(parseActions(ele));
|
||||
return transition;
|
||||
}
|
||||
|
||||
protected ExceptionHandlerModel parseExceptionHandler(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "exception-handler")) {
|
||||
return parseExceptionHandler(DomUtils.getChildElementByTagName(ele, "exception-handler"));
|
||||
} else {
|
||||
return new ExceptionHandlerModel(ele.getAttribute("bean-name"));
|
||||
}
|
||||
return new ExceptionHandlerModel(ele.getAttribute("bean-name"));
|
||||
}
|
||||
|
||||
protected BeanImportModel parseBeanImport(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "bean-import")) {
|
||||
return parseBeanImport(DomUtils.getChildElementByTagName(ele, "bean-import"));
|
||||
} else {
|
||||
return new BeanImportModel(ele.getAttribute("resource"));
|
||||
}
|
||||
return new BeanImportModel(ele.getAttribute("resource"));
|
||||
}
|
||||
|
||||
protected IfModel parseIf(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "if")) {
|
||||
return parseIf(DomUtils.getChildElementByTagName(ele, "if"));
|
||||
} else {
|
||||
return new IfModel(ele.getAttribute("test"), ele.getAttribute("then"), ele.getAttribute("else"));
|
||||
}
|
||||
IfModel conditional = new IfModel(ele.getAttribute("test"), ele.getAttribute("then"));
|
||||
conditional.setElse(ele.getAttribute("else"));
|
||||
return conditional;
|
||||
}
|
||||
|
||||
protected LinkedList parseOnStartActions(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "on-start")) {
|
||||
return parseOnStartActions(DomUtils.getChildElementByTagName(ele, "on-start"));
|
||||
} else {
|
||||
return parseActions(ele);
|
||||
}
|
||||
return parseActions(DomUtils.getChildElementByTagName(ele, "on-start"));
|
||||
}
|
||||
|
||||
protected LinkedList parseOnEntryActions(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "on-entry")) {
|
||||
return parseOnEntryActions(DomUtils.getChildElementByTagName(ele, "on-entry"));
|
||||
} else {
|
||||
return parseActions(ele);
|
||||
}
|
||||
}
|
||||
|
||||
protected LinkedList parseOnExitActions(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "on-exit")) {
|
||||
return parseOnExitActions(DomUtils.getChildElementByTagName(ele, "on-exit"));
|
||||
} else {
|
||||
return parseActions(ele);
|
||||
}
|
||||
return parseActions(DomUtils.getChildElementByTagName(ele, "on-entry"));
|
||||
}
|
||||
|
||||
protected LinkedList parseOnRenderActions(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "on-render")) {
|
||||
return parseOnRenderActions(DomUtils.getChildElementByTagName(ele, "on-render"));
|
||||
} else {
|
||||
return parseActions(ele);
|
||||
}
|
||||
return parseActions(DomUtils.getChildElementByTagName(ele, "on-render"));
|
||||
}
|
||||
|
||||
protected LinkedList parseOnExitActions(Element ele) {
|
||||
return parseActions(DomUtils.getChildElementByTagName(ele, "on-exit"));
|
||||
}
|
||||
|
||||
protected LinkedList parseOnEndActions(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "on-end")) {
|
||||
return parseOnEndActions(DomUtils.getChildElementByTagName(ele, "on-end"));
|
||||
} else {
|
||||
return parseActions(ele);
|
||||
}
|
||||
return parseActions(DomUtils.getChildElementByTagName(ele, "on-end"));
|
||||
}
|
||||
|
||||
protected EvaluateModel parseEvaluate(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "evaluate")) {
|
||||
return parseEvaluate(DomUtils.getChildElementByTagName(ele, "evaluate"));
|
||||
} else {
|
||||
return new EvaluateModel(ele.getAttribute("expression"), ele.getAttribute("result"), ele
|
||||
.getAttribute("result-type"));
|
||||
}
|
||||
EvaluateModel evaluate = new EvaluateModel(ele.getAttribute("expression"));
|
||||
evaluate.setResult(ele.getAttribute("result"));
|
||||
evaluate.setResultType(ele.getAttribute("result-type"));
|
||||
return evaluate;
|
||||
}
|
||||
|
||||
protected RenderModel parseRender(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "render")) {
|
||||
return parseRender(DomUtils.getChildElementByTagName(ele, "render"));
|
||||
} else {
|
||||
return new RenderModel(ele.getAttribute("fragments"));
|
||||
}
|
||||
return new RenderModel(ele.getAttribute("fragments"));
|
||||
}
|
||||
|
||||
protected SetModel parseSet(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "set")) {
|
||||
return parseSet(DomUtils.getChildElementByTagName(ele, "set"));
|
||||
} else {
|
||||
return new SetModel(ele.getAttribute("name"), ele.getAttribute("value"), ele.getAttribute("type"));
|
||||
}
|
||||
SetModel set = new SetModel(ele.getAttribute("name"), ele.getAttribute("value"));
|
||||
set.setType(ele.getAttribute("type"));
|
||||
return set;
|
||||
}
|
||||
|
||||
protected ActionStateModel parseActionState(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "action-state")) {
|
||||
return parseActionState(DomUtils.getChildElementByTagName(ele, "action-state"));
|
||||
} else {
|
||||
return new ActionStateModel(ele.getAttribute("id"), parseAttributes(ele), parseSecured(ele),
|
||||
parseOnEntryActions(ele), parseTransitions(ele), parseOnExitActions(ele), parseActions(ele),
|
||||
parseExceptionHandlers(ele));
|
||||
}
|
||||
ActionStateModel state = new ActionStateModel(ele.getAttribute("id"));
|
||||
state.setAttributes(parseAttributes(ele));
|
||||
state.setSecured(parseSecured(ele));
|
||||
state.setOnEntryActions(parseOnEntryActions(ele));
|
||||
state.setTransitions(parseTransitions(ele));
|
||||
state.setOnExitActions(parseOnExitActions(ele));
|
||||
state.setActions(parseActions(ele));
|
||||
state.setExceptionHandlers(parseExceptionHandlers(ele));
|
||||
return state;
|
||||
}
|
||||
|
||||
protected ViewStateModel parseViewState(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "view-state")) {
|
||||
return parseViewState(DomUtils.getChildElementByTagName(ele, "view-state"));
|
||||
} else {
|
||||
return new ViewStateModel(ele.getAttribute("id"), ele.getAttribute("view"), ele.getAttribute("redirect"),
|
||||
ele.getAttribute("popup"), ele.getAttribute("model"), parseVars(ele), parseOnRenderActions(ele),
|
||||
parseAttributes(ele), parseSecured(ele), parseOnEntryActions(ele), parseExceptionHandlers(ele),
|
||||
parseTransitions(ele), parseOnExitActions(ele));
|
||||
}
|
||||
ViewStateModel state = new ViewStateModel(ele.getAttribute("id"));
|
||||
state.setView(ele.getAttribute("view"));
|
||||
state.setRedirect(ele.getAttribute("redirect"));
|
||||
state.setPopup(ele.getAttribute("popup"));
|
||||
state.setModel(ele.getAttribute("model"));
|
||||
state.setVars(parseVars(ele));
|
||||
state.setOnRenderActions(parseOnRenderActions(ele));
|
||||
state.setAttributes(parseAttributes(ele));
|
||||
state.setSecured(parseSecured(ele));
|
||||
state.setOnEntryActions(parseOnEntryActions(ele));
|
||||
state.setExceptionHandlers(parseExceptionHandlers(ele));
|
||||
state.setTransitions(parseTransitions(ele));
|
||||
state.setOnExitActions(parseOnExitActions(ele));
|
||||
return state;
|
||||
}
|
||||
|
||||
protected DecisionStateModel parseDecisionState(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "decision-state")) {
|
||||
return parseDecisionState(DomUtils.getChildElementByTagName(ele, "decision-state"));
|
||||
} else {
|
||||
return new DecisionStateModel(ele.getAttribute("id"), parseIfs(ele), parseOnExitActions(ele),
|
||||
parseAttributes(ele), parseSecured(ele), parseOnEntryActions(ele), parseExceptionHandlers(ele));
|
||||
}
|
||||
DecisionStateModel state = new DecisionStateModel(ele.getAttribute("id"));
|
||||
state.setIfs(parseIfs(ele));
|
||||
state.setOnExitActions(parseOnExitActions(ele));
|
||||
state.setAttributes(parseAttributes(ele));
|
||||
state.setSecured(parseSecured(ele));
|
||||
state.setOnEntryActions(parseOnEntryActions(ele));
|
||||
state.setExceptionHandlers(parseExceptionHandlers(ele));
|
||||
return state;
|
||||
}
|
||||
|
||||
protected SubflowStateModel parseSubflowState(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "subflow-state")) {
|
||||
return parseSubflowState(DomUtils.getChildElementByTagName(ele, "subflow-state"));
|
||||
} else {
|
||||
return new SubflowStateModel(ele.getAttribute("id"), ele.getAttribute("subflow"), ele
|
||||
.getAttribute("subflow-attribute-mapper"), parseInputs(ele), parseOutputs(ele),
|
||||
parseAttributes(ele), parseSecured(ele), parseOnEntryActions(ele), parseExceptionHandlers(ele),
|
||||
parseTransitions(ele), parseOnExitActions(ele));
|
||||
}
|
||||
SubflowStateModel state = new SubflowStateModel(ele.getAttribute("id"), ele.getAttribute("subflow"));
|
||||
state.setSubflowAttributeMapper(ele.getAttribute("subflow-attribute-mapper"));
|
||||
state.setInputs(parseInputs(ele));
|
||||
state.setOutputs(parseOutputs(ele));
|
||||
state.setAttributes(parseAttributes(ele));
|
||||
state.setSecured(parseSecured(ele));
|
||||
state.setOnEntryActions(parseOnEntryActions(ele));
|
||||
state.setExceptionHandlers(parseExceptionHandlers(ele));
|
||||
state.setTransitions(parseTransitions(ele));
|
||||
state.setOnExitActions(parseOnExitActions(ele));
|
||||
return state;
|
||||
}
|
||||
|
||||
protected EndStateModel parseEndState(Element ele) {
|
||||
if (ele == null) {
|
||||
return null;
|
||||
} else if (!DomUtils.nodeNameEquals(ele, "end-state")) {
|
||||
return parseEndState(DomUtils.getChildElementByTagName(ele, "end-state"));
|
||||
} else {
|
||||
return new EndStateModel(ele.getAttribute("id"), ele.getAttribute("view-factory"), ele
|
||||
.getAttribute("commit"), parseOutputs(ele), parseAttributes(ele), parseSecured(ele),
|
||||
parseOnEntryActions(ele), parseExceptionHandlers(ele));
|
||||
}
|
||||
EndStateModel state = new EndStateModel(ele.getAttribute("id"));
|
||||
state.setView(ele.getAttribute("view"));
|
||||
state.setCommit(ele.getAttribute("commit"));
|
||||
state.setOutputs(parseOutputs(ele));
|
||||
state.setAttributes(parseAttributes(ele));
|
||||
state.setSecured(parseSecured(ele));
|
||||
state.setOnEntryActions(parseOnEntryActions(ele));
|
||||
state.setExceptionHandlers(parseExceptionHandlers(ele));
|
||||
return state;
|
||||
}
|
||||
|
||||
// TODO: submit this to DomUtils
|
||||
|
||||
@@ -78,7 +78,9 @@ public class FlowModelFlowBuilderTests extends TestCase {
|
||||
|
||||
public void testCustomFlowAttribute() {
|
||||
model.addAttribute(new AttributeModel("foo", "bar"));
|
||||
model.addAttribute(new AttributeModel("number", "1", "integer"));
|
||||
AttributeModel attribute = new AttributeModel("number", "1");
|
||||
attribute.setType("integer");
|
||||
model.addAttribute(attribute);
|
||||
model.addEndState(new EndStateModel("end"));
|
||||
Flow flow = getFlow(model);
|
||||
assertEquals("bar", flow.getAttributes().get("foo"));
|
||||
@@ -94,10 +96,16 @@ public class FlowModelFlowBuilderTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testFlowInputOutputMapping() {
|
||||
InputModel input;
|
||||
OutputModel output;
|
||||
model.addInput(new InputModel("foo", "flowScope.foo"));
|
||||
model.addInput(new InputModel("foo", "flowScope.bar"));
|
||||
model.addInput(new InputModel("number", "flowScope.baz", "integer", null));
|
||||
model.addInput(new InputModel("required", "flowScope.boop", null, "true"));
|
||||
input = new InputModel("number", "flowScope.baz");
|
||||
input.setType("integer");
|
||||
model.addInput(input);
|
||||
input = new InputModel("required", "flowScope.boop");
|
||||
input.setRequired("true");
|
||||
model.addInput(input);
|
||||
EndStateModel end = new EndStateModel("end");
|
||||
end.addOutput(new OutputModel("foo", "flowScope.foo"));
|
||||
model.addEndState(end);
|
||||
@@ -105,18 +113,23 @@ public class FlowModelFlowBuilderTests extends TestCase {
|
||||
notReached.addOutput(new OutputModel("notReached", "flowScope.foo"));
|
||||
model.addEndState(notReached);
|
||||
model.addOutput(new OutputModel("differentName", "flowScope.bar"));
|
||||
model.addOutput(new OutputModel("number", "flowScope.baz", "integer", null));
|
||||
model.addOutput(new OutputModel("required", "flowScope.baz", "integer", "true"));
|
||||
output = new OutputModel("number", "flowScope.baz");
|
||||
output.setType("integer");
|
||||
model.addOutput(output);
|
||||
output = new OutputModel("required", "flowScope.baz");
|
||||
output.setType("integer");
|
||||
output.setRequired("true");
|
||||
model.addOutput(output);
|
||||
model.addOutput(new OutputModel("literal", "'a literal'"));
|
||||
Flow flow = getFlow(model);
|
||||
FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
|
||||
FlowExecution execution = factory.createFlowExecution(flow);
|
||||
MockExternalContext context = new MockExternalContext();
|
||||
MutableAttributeMap input = new LocalAttributeMap();
|
||||
input.put("foo", "bar");
|
||||
input.put("number", "3");
|
||||
input.put("required", "9");
|
||||
execution.start(input, context);
|
||||
MutableAttributeMap map = new LocalAttributeMap();
|
||||
map.put("foo", "bar");
|
||||
map.put("number", "3");
|
||||
map.put("required", "9");
|
||||
execution.start(map, context);
|
||||
Event outcome = execution.getOutcome();
|
||||
assertEquals("end", outcome.getId());
|
||||
assertEquals("bar", outcome.getAttributes().get("foo"));
|
||||
@@ -128,10 +141,16 @@ public class FlowModelFlowBuilderTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testFlowRequiredInputMapping() {
|
||||
InputModel input;
|
||||
OutputModel output;
|
||||
model.addInput(new InputModel("foo", "flowScope.foo"));
|
||||
model.addInput(new InputModel("foo", "flowScope.bar"));
|
||||
model.addInput(new InputModel("number", "flowScope.baz", "integer", null));
|
||||
model.addInput(new InputModel("required", "flowScope.boop", null, "true"));
|
||||
input = new InputModel("number", "flowScope.baz");
|
||||
input.setType("integer");
|
||||
model.addInput(input);
|
||||
input = new InputModel("required", "flowScope.boop");
|
||||
input.setRequired("true");
|
||||
model.addInput(input);
|
||||
EndStateModel end = new EndStateModel("end");
|
||||
end.addOutput(new OutputModel("foo", "flowScope.foo"));
|
||||
model.addEndState(end);
|
||||
@@ -139,26 +158,37 @@ public class FlowModelFlowBuilderTests extends TestCase {
|
||||
notReached.addOutput(new OutputModel("notReached", "flowScope.foo"));
|
||||
model.addEndState(notReached);
|
||||
model.addOutput(new OutputModel("differentName", "flowScope.bar"));
|
||||
model.addOutput(new OutputModel("number", "flowScope.baz", "integer", null));
|
||||
model.addOutput(new OutputModel("required", "flowScope.baz", "integer", "true"));
|
||||
output = new OutputModel("number", "flowScope.baz");
|
||||
output.setType("integer");
|
||||
model.addOutput(output);
|
||||
output = new OutputModel("required", "flowScope.baz");
|
||||
output.setType("integer");
|
||||
output.setRequired("true");
|
||||
model.addOutput(output);
|
||||
model.addOutput(new OutputModel("literal", "'a literal'"));
|
||||
Flow flow = getFlow(model);
|
||||
FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
|
||||
FlowExecution execution = factory.createFlowExecution(flow);
|
||||
MockExternalContext context = new MockExternalContext();
|
||||
MutableAttributeMap input = new LocalAttributeMap();
|
||||
MutableAttributeMap map = new LocalAttributeMap();
|
||||
try {
|
||||
execution.start(input, context);
|
||||
execution.start(map, context);
|
||||
fail("Should have failed");
|
||||
} catch (FlowInputMappingException e) {
|
||||
}
|
||||
}
|
||||
|
||||
public void testFlowRequiredOutputMapping() {
|
||||
InputModel input;
|
||||
OutputModel output;
|
||||
model.addInput(new InputModel("foo", "flowScope.foo"));
|
||||
model.addInput(new InputModel("foo", "flowScope.bar"));
|
||||
model.addInput(new InputModel("number", "flowScope.baz", "integer", null));
|
||||
model.addInput(new InputModel("required", "flowScope.boop", null, "true"));
|
||||
input = new InputModel("number", "flowScope.baz");
|
||||
input.setType("integer");
|
||||
model.addInput(input);
|
||||
input = new InputModel("required", "flowScope.boop");
|
||||
input.setRequired("true");
|
||||
model.addInput(input);
|
||||
EndStateModel end = new EndStateModel("end");
|
||||
end.addOutput(new OutputModel("foo", "flowScope.foo"));
|
||||
model.addEndState(end);
|
||||
@@ -166,17 +196,22 @@ public class FlowModelFlowBuilderTests extends TestCase {
|
||||
notReached.addOutput(new OutputModel("notReached", "flowScope.foo"));
|
||||
model.addEndState(notReached);
|
||||
model.addOutput(new OutputModel("differentName", "flowScope.bar"));
|
||||
model.addOutput(new OutputModel("number", "flowScope.baz", "integer", null));
|
||||
model.addOutput(new OutputModel("required", "flowScope.baz", "integer", "true"));
|
||||
output = new OutputModel("number", "flowScope.baz");
|
||||
output.setType("integer");
|
||||
model.addOutput(output);
|
||||
output = new OutputModel("required", "flowScope.baz");
|
||||
output.setType("integer");
|
||||
output.setRequired("true");
|
||||
model.addOutput(output);
|
||||
model.addOutput(new OutputModel("literal", "'a literal'"));
|
||||
Flow flow = getFlow(model);
|
||||
FlowExecutionImplFactory factory = new FlowExecutionImplFactory();
|
||||
FlowExecution execution = factory.createFlowExecution(flow);
|
||||
MockExternalContext context = new MockExternalContext();
|
||||
MutableAttributeMap input = new LocalAttributeMap();
|
||||
input.put("required", "yo");
|
||||
MutableAttributeMap map = new LocalAttributeMap();
|
||||
map.put("required", "yo");
|
||||
try {
|
||||
execution.start(input, context);
|
||||
execution.start(map, context);
|
||||
fail("Should have failed");
|
||||
} catch (FlowOutputMappingException e) {
|
||||
}
|
||||
@@ -208,7 +243,8 @@ public class FlowModelFlowBuilderTests extends TestCase {
|
||||
|
||||
public void testFlowSecuredTransition() {
|
||||
model.addEndState(new EndStateModel("end"));
|
||||
TransitionModel transition = new TransitionModel(null, "end");
|
||||
TransitionModel transition = new TransitionModel();
|
||||
transition.setTo("end");
|
||||
transition.setSecured(new SecuredModel("ROLE_USER"));
|
||||
model.addGlobalTransition(transition);
|
||||
Flow flow = getFlow(model);
|
||||
@@ -222,7 +258,9 @@ public class FlowModelFlowBuilderTests extends TestCase {
|
||||
|
||||
public void testFlowVariable() {
|
||||
model.addVar(new VarModel("flow-foo", "org.springframework.webflow.TestBean"));
|
||||
model.addVar(new VarModel("conversation-foo", "org.springframework.webflow.TestBean", "conversation"));
|
||||
VarModel var = new VarModel("conversation-foo", "org.springframework.webflow.TestBean");
|
||||
var.setScope("conversation");
|
||||
model.addVar(var);
|
||||
model.addEndState(new EndStateModel("end"));
|
||||
Flow flow = getFlow(model);
|
||||
assertEquals("flow-foo", flow.getVariable("flow-foo").getName());
|
||||
@@ -256,7 +294,9 @@ public class FlowModelFlowBuilderTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testViewStateFlowRedirect() {
|
||||
model.addViewState(new ViewStateModel("view", "flowRedirect:myFlow?input=#{flowScope.foo}"));
|
||||
ViewStateModel state = new ViewStateModel("view");
|
||||
state.setView("flowRedirect:myFlow?input=#{flowScope.foo}");
|
||||
model.addViewState(state);
|
||||
Flow flow = getFlow(model);
|
||||
ViewFactory vf = ((ViewState) flow.getStateInstance("view")).getViewFactory();
|
||||
assertTrue(vf instanceof ActionExecutingViewFactory);
|
||||
@@ -265,8 +305,9 @@ public class FlowModelFlowBuilderTests extends TestCase {
|
||||
}
|
||||
|
||||
public void testViewStateExternalRedirect() {
|
||||
model.addViewState(new ViewStateModel("view",
|
||||
"externalRedirect:http://www.paypal.com?_callbackUrl=#{flowExecutionUri}"));
|
||||
ViewStateModel state = new ViewStateModel("view");
|
||||
state.setView("externalRedirect:http://www.paypal.com?_callbackUrl=#{flowExecutionUri}");
|
||||
model.addViewState(state);
|
||||
Flow flow = getFlow(model);
|
||||
ViewFactory vf = ((ViewState) flow.getStateInstance("view")).getViewFactory();
|
||||
assertTrue(vf instanceof ActionExecutingViewFactory);
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.ActionStateModel;
|
||||
import org.springframework.webflow.engine.model.EvaluateModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -25,34 +22,28 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class ActionStateModelTests extends TestCase {
|
||||
|
||||
public void testMergeable() {
|
||||
ActionStateModel child = new ActionStateModel("child");
|
||||
assertTrue(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
public void testNotMergeable() {
|
||||
ActionStateModel child = new ActionStateModel("child");
|
||||
ActionStateModel parent = new ActionStateModel("parent");
|
||||
assertFalse(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testNotMergeableWithNull() {
|
||||
ActionStateModel child = new ActionStateModel("child");
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testMerge() {
|
||||
ActionStateModel child = new ActionStateModel("child");
|
||||
ActionStateModel parent = new ActionStateModel("parent");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getId());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
ActionStateModel child = new ActionStateModel("child");
|
||||
ActionStateModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getId());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
ActionStateModel child = new ActionStateModel("child");
|
||||
ActionStateModel parent = new ActionStateModel("child");
|
||||
parent.addAction(new EvaluateModel("eval1"));
|
||||
parent.setSecured(new SecuredModel("secured"));
|
||||
child.merge(parent);
|
||||
assertEquals(1, child.getActions().size());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
ActionStateModel child = new ActionStateModel("child");
|
||||
ActionStateModel parent = new ActionStateModel("parent");
|
||||
parent.addAction(new EvaluateModel("eval1"));
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getActions());
|
||||
assertNotNull(child.getSecured());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.AttributeModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,32 +22,28 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class AttributeModelTests extends TestCase {
|
||||
|
||||
public void testMergeable() {
|
||||
AttributeModel child = new AttributeModel("child", "value");
|
||||
assertTrue(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
public void testNotMergeable() {
|
||||
AttributeModel child = new AttributeModel("child", "value");
|
||||
AttributeModel parent = new AttributeModel("parent", "value");
|
||||
assertFalse(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testNotMergeableWithNull() {
|
||||
AttributeModel child = new AttributeModel("child", "value");
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testMerge() {
|
||||
AttributeModel child = new AttributeModel("child", "childvalue");
|
||||
AttributeModel parent = new AttributeModel("parent", "parentvalue");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getName());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
AttributeModel child = new AttributeModel("child", "childvalue");
|
||||
AttributeModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getName());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
AttributeModel child = new AttributeModel("child", "childvalue");
|
||||
AttributeModel parent = new AttributeModel("child", "childvalue", "string");
|
||||
AttributeModel parent = new AttributeModel("child", "childvalue");
|
||||
parent.setType("string");
|
||||
child.merge(parent);
|
||||
assertEquals("string", child.getType());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
AttributeModel child = new AttributeModel("child", "childvalue");
|
||||
AttributeModel parent = new AttributeModel("parent", "parentvalue", "string");
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.BeanImportModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,26 +22,9 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class BeanImportModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
public void testNotMergeable() {
|
||||
BeanImportModel child = new BeanImportModel("child");
|
||||
BeanImportModel parent = new BeanImportModel("parent");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getResource());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
BeanImportModel child = new BeanImportModel("child");
|
||||
BeanImportModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getResource());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
// bean import will never merge
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
// bean import will never merge
|
||||
assertFalse(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,9 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.DecisionStateModel;
|
||||
import org.springframework.webflow.engine.model.IfModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -25,34 +22,28 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class DecisionStateModelTests extends TestCase {
|
||||
|
||||
public void testMergeable() {
|
||||
DecisionStateModel child = new DecisionStateModel("child");
|
||||
assertTrue(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
public void testNotMergeable() {
|
||||
DecisionStateModel child = new DecisionStateModel("child");
|
||||
DecisionStateModel parent = new DecisionStateModel("parent");
|
||||
assertFalse(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testNotMergeableWithNull() {
|
||||
DecisionStateModel child = new DecisionStateModel("child");
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testMerge() {
|
||||
DecisionStateModel child = new DecisionStateModel("child");
|
||||
DecisionStateModel parent = new DecisionStateModel("parent");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getId());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
DecisionStateModel child = new DecisionStateModel("child");
|
||||
DecisionStateModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getId());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
DecisionStateModel child = new DecisionStateModel("child");
|
||||
DecisionStateModel parent = new DecisionStateModel("child");
|
||||
parent.addIf(new IfModel("test", "then"));
|
||||
parent.setSecured(new SecuredModel("secured"));
|
||||
child.merge(parent);
|
||||
assertEquals(1, child.getIfs().size());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
DecisionStateModel child = new DecisionStateModel("child");
|
||||
DecisionStateModel parent = new DecisionStateModel("parent");
|
||||
parent.addIf(new IfModel("test", "then"));
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getIfs());
|
||||
assertNotNull(child.getSecured());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.EndStateModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,21 +22,23 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class EndStateModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
public void testMergeable() {
|
||||
EndStateModel child = new EndStateModel("child");
|
||||
assertTrue(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
public void testNotMergeable() {
|
||||
EndStateModel child = new EndStateModel("child");
|
||||
EndStateModel parent = new EndStateModel("parent");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getId());
|
||||
assertFalse(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
public void testNotMergeableWithNull() {
|
||||
EndStateModel child = new EndStateModel("child");
|
||||
EndStateModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getId());
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
public void testMerge() {
|
||||
EndStateModel child = new EndStateModel("child");
|
||||
EndStateModel parent = new EndStateModel("child");
|
||||
parent.setCommit("true");
|
||||
@@ -46,12 +46,4 @@ public class EndStateModelTests extends TestCase {
|
||||
assertEquals("true", child.getCommit());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
EndStateModel child = new EndStateModel("child");
|
||||
EndStateModel parent = new EndStateModel("parent");
|
||||
parent.setCommit("true");
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getCommit());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.EvaluateModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,32 +22,9 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class EvaluateModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
EvaluateModel child = new EvaluateModel("child");
|
||||
EvaluateModel parent = new EvaluateModel("parent");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getExpression());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
EvaluateModel child = new EvaluateModel("child");
|
||||
EvaluateModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getExpression());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
EvaluateModel child = new EvaluateModel("child");
|
||||
EvaluateModel parent = new EvaluateModel("child", "end");
|
||||
child.merge(parent);
|
||||
assertEquals("end", child.getResult());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
EvaluateModel child = new EvaluateModel("child");
|
||||
EvaluateModel parent = new EvaluateModel("parent", "end");
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getResult());
|
||||
public void testNotMergeable() {
|
||||
EvaluateModel child = new EvaluateModel("name");
|
||||
assertFalse(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.ExceptionHandlerModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,26 +22,9 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class ExceptionHandlerModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
public void testNotMergeable() {
|
||||
ExceptionHandlerModel child = new ExceptionHandlerModel("child");
|
||||
ExceptionHandlerModel parent = new ExceptionHandlerModel("parent");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getBeanName());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
ExceptionHandlerModel child = new ExceptionHandlerModel("child");
|
||||
ExceptionHandlerModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getBeanName());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
// exception handler will never merge
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
// exception handler will never merge
|
||||
assertFalse(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,46 +22,28 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class FlowModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
FlowModel child = new FlowModel();
|
||||
child.setStartStateId("child");
|
||||
FlowModel parent = new FlowModel();
|
||||
parent.setStartStateId("parent");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getStartStateId());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
FlowModel child = new FlowModel();
|
||||
child.setStartStateId("child");
|
||||
FlowModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getStartStateId());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
public void testMergeable() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
parent.addViewState(new ViewStateModel("view"));
|
||||
child.merge(parent);
|
||||
assertEquals(1, child.getStates().size());
|
||||
assertTrue(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
public void testNotMergeableWithNull() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
parent.addViewState(new ViewStateModel("view"));
|
||||
child.merge(parent);
|
||||
// flows will always merge, regardless of likeness
|
||||
assertEquals(1, child.getStates().size());
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testIntegrationAttributes() {
|
||||
public void testMergeAttributes() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
AttributeModel attribute;
|
||||
child.addAttribute(new AttributeModel("name", "value"));
|
||||
parent.addAttribute(new AttributeModel("name", "value", "type"));
|
||||
parent.addAttribute(new AttributeModel("name2", "value2", "type2"));
|
||||
attribute = new AttributeModel("name", "value");
|
||||
attribute.setType("type");
|
||||
parent.addAttribute(attribute);
|
||||
attribute = new AttributeModel("name2", "value2");
|
||||
attribute.setType("type2");
|
||||
parent.addAttribute(attribute);
|
||||
child.merge(parent);
|
||||
assertEquals(2, child.getAttributes().size());
|
||||
assertEquals("name", ((AttributeModel) child.getAttributes().get(0)).getName());
|
||||
@@ -70,16 +52,18 @@ public class FlowModelTests extends TestCase {
|
||||
assertEquals("type2", ((AttributeModel) child.getAttributes().get(1)).getType());
|
||||
}
|
||||
|
||||
public void testIntegrationSecured() {
|
||||
public void testMergeSecured() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
child.setSecured(new SecuredModel("secured"));
|
||||
parent.setSecured(new SecuredModel("secured", "all"));
|
||||
SecuredModel secured = new SecuredModel("secured");
|
||||
secured.setMatch("all");
|
||||
parent.setSecured(secured);
|
||||
child.merge(parent);
|
||||
assertEquals("all", child.getSecured().getMatch());
|
||||
}
|
||||
|
||||
public void testIntegrationPersistenceContext() {
|
||||
public void testMergePersistenceContext() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
parent.setPersistenceContext(new PersistenceContextModel());
|
||||
@@ -87,49 +71,70 @@ public class FlowModelTests extends TestCase {
|
||||
assertNotNull(child.getPersistenceContext());
|
||||
}
|
||||
|
||||
public void testIntegrationVars() {
|
||||
public void testMergeVars() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
child.addVar(new VarModel("name", "value"));
|
||||
parent.addVar(new VarModel("name", "", "scope"));
|
||||
parent.addVar(new VarModel("name2", "value2"));
|
||||
VarModel var = new VarModel("name", "value");
|
||||
child.addVar(var);
|
||||
parent.addVar(var);
|
||||
var = new VarModel("name", "value");
|
||||
var.setScope("scope");
|
||||
parent.addVar(var);
|
||||
child.merge(parent);
|
||||
assertEquals(2, child.getVars().size());
|
||||
assertEquals(3, child.getVars().size());
|
||||
assertEquals("scope", ((VarModel) child.getVars().get(1)).getScope());
|
||||
assertEquals("scope", ((VarModel) parent.getVars().get(1)).getScope());
|
||||
}
|
||||
|
||||
public void testIntegrationMappings() {
|
||||
public void testMergeMappings() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
InputModel input;
|
||||
child.addInput(new InputModel("name", "value"));
|
||||
child.addInput(new InputModel("name2", "value2", "type2", "required2"));
|
||||
child.addInput(new InputModel("name3", "value3", "type3", "required3"));
|
||||
parent.addInput(new InputModel("name", "value", "type", "required"));
|
||||
parent.addInput(new InputModel("name3", "value3", "type3", "required3"));
|
||||
input = new InputModel("name2", "value2");
|
||||
input.setType("type2");
|
||||
input.setRequired("required2");
|
||||
child.addInput(input);
|
||||
input = new InputModel("name3", "value3");
|
||||
input.setType("type3");
|
||||
input.setRequired("required3");
|
||||
child.addInput(input);
|
||||
input = new InputModel("name", "value");
|
||||
input.setType("type");
|
||||
input.setRequired("required");
|
||||
parent.addInput(input);
|
||||
input = new InputModel("name3", "value3");
|
||||
input.setType("type3");
|
||||
input.setRequired("required3");
|
||||
parent.addInput(input);
|
||||
child.merge(parent);
|
||||
assertEquals(3, child.getInputs().size());
|
||||
}
|
||||
|
||||
public void testIntegrationOnStart() {
|
||||
public void testMergeOnStart() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
child.addOnStartAction(new EvaluateModel("expression"));
|
||||
child.addOnStartAction(new RenderModel("expression"));
|
||||
child.addOnStartAction(new SetModel("expression", "value"));
|
||||
parent.addOnStartAction(new EvaluateModel("expression", "result"));
|
||||
EvaluateModel eval = new EvaluateModel("expression");
|
||||
eval.setResult("result");
|
||||
parent.addOnStartAction(eval);
|
||||
parent.addOnStartAction(new RenderModel("expression"));
|
||||
parent.addOnStartAction(new SetModel("expression", "value"));
|
||||
child.merge(parent);
|
||||
assertEquals(3, child.getOnStartActions().size());
|
||||
assertEquals("result", ((EvaluateModel) child.getOnStartActions().get(0)).getResult());
|
||||
assertEquals(6, child.getOnStartActions().size());
|
||||
assertNotNull(((EvaluateModel) child.getOnStartActions().get(0)).getResult());
|
||||
}
|
||||
|
||||
public void testIntegrationStates() {
|
||||
public void testMergeStates() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
child.addViewState(new ViewStateModel("view"));
|
||||
child.addEndState(new EndStateModel("end"));
|
||||
parent.addViewState(new ViewStateModel("view", "jsp"));
|
||||
ViewStateModel view = new ViewStateModel("view");
|
||||
view.setView("jsp");
|
||||
parent.addViewState(view);
|
||||
parent.addState(new DecisionStateModel("decider"));
|
||||
parent.addActionState(new ActionStateModel("end"));
|
||||
child.merge(parent);
|
||||
@@ -137,33 +142,45 @@ public class FlowModelTests extends TestCase {
|
||||
assertEquals("jsp", ((ViewStateModel) child.getStates().get(0)).getView());
|
||||
}
|
||||
|
||||
public void testIntegrationGlobalTransitions() {
|
||||
public void testMergeGlobalTransitions() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
child.addGlobalTransition(new TransitionModel("end"));
|
||||
child.addGlobalTransition(new TransitionModel("start"));
|
||||
parent.addGlobalTransition(new TransitionModel("search"));
|
||||
parent.addGlobalTransition(new TransitionModel("end", "theend"));
|
||||
TransitionModel transition;
|
||||
transition = new TransitionModel();
|
||||
transition.setOn("end");
|
||||
child.addGlobalTransition(transition);
|
||||
transition = new TransitionModel();
|
||||
transition.setOn("start");
|
||||
child.addGlobalTransition(transition);
|
||||
transition = new TransitionModel();
|
||||
transition.setOn("search");
|
||||
parent.addGlobalTransition(transition);
|
||||
transition = new TransitionModel();
|
||||
transition.setOn("end");
|
||||
transition.setTo("theend");
|
||||
parent.addGlobalTransition(transition);
|
||||
child.merge(parent);
|
||||
assertEquals(3, child.getGlobalTransitions().size());
|
||||
assertEquals("theend", ((TransitionModel) child.getGlobalTransitions().get(0)).getTo());
|
||||
}
|
||||
|
||||
public void testIntegrationOnEnd() {
|
||||
public void testMergeOnEnd() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
child.addOnEndAction(new EvaluateModel("expression"));
|
||||
child.addOnEndAction(new RenderModel("expression"));
|
||||
child.addOnEndAction(new SetModel("expression", "value"));
|
||||
parent.addOnEndAction(new EvaluateModel("expression", "result"));
|
||||
EvaluateModel eval = new EvaluateModel("expression");
|
||||
eval.setResult("result");
|
||||
parent.addOnEndAction(eval);
|
||||
parent.addOnEndAction(new RenderModel("expression"));
|
||||
parent.addOnEndAction(new SetModel("expression", "value"));
|
||||
child.merge(parent);
|
||||
assertEquals(3, child.getOnEndActions().size());
|
||||
assertEquals("result", ((EvaluateModel) child.getOnEndActions().get(0)).getResult());
|
||||
assertEquals(6, child.getOnEndActions().size());
|
||||
assertNotNull(((EvaluateModel) child.getOnEndActions().get(0)).getResult());
|
||||
}
|
||||
|
||||
public void testIntegrationExceptionHandlers() {
|
||||
public void testMergeExceptionHandlers() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
child.addExceptionHandler(new ExceptionHandlerModel("bean1"));
|
||||
@@ -171,10 +188,10 @@ public class FlowModelTests extends TestCase {
|
||||
parent.addExceptionHandler(new ExceptionHandlerModel("bean2"));
|
||||
parent.addExceptionHandler(new ExceptionHandlerModel("bean3"));
|
||||
child.merge(parent);
|
||||
assertEquals(3, child.getExceptionHandlers().size());
|
||||
assertEquals(4, child.getExceptionHandlers().size());
|
||||
}
|
||||
|
||||
public void testIntegrationBeanImports() {
|
||||
public void testMergeBeanImports() {
|
||||
FlowModel child = new FlowModel();
|
||||
FlowModel parent = new FlowModel();
|
||||
child.addBeanImport(new BeanImportModel("path1"));
|
||||
@@ -182,7 +199,7 @@ public class FlowModelTests extends TestCase {
|
||||
parent.addBeanImport(new BeanImportModel("path2"));
|
||||
parent.addBeanImport(new BeanImportModel("path3"));
|
||||
child.merge(parent);
|
||||
assertEquals(3, child.getBeanImports().size());
|
||||
assertEquals(4, child.getBeanImports().size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.IfModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,32 +22,28 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class IfModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
public void testMergeable() {
|
||||
IfModel child = new IfModel("child", "childthen");
|
||||
assertTrue(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
public void testNotMergeable() {
|
||||
IfModel child = new IfModel("child", "childthen");
|
||||
IfModel parent = new IfModel("parent", "parentthen");
|
||||
child.merge(parent);
|
||||
assertEquals("childthen", child.getThen());
|
||||
assertFalse(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
public void testNotMergeableWithNull() {
|
||||
IfModel child = new IfModel("child", "childthen");
|
||||
IfModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("childthen", child.getThen());
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
public void testMerge() {
|
||||
IfModel child = new IfModel("child", "childthen");
|
||||
IfModel parent = new IfModel("child", "childthen", "childelse");
|
||||
IfModel parent = new IfModel("child", "parentthen");
|
||||
parent.setElse("parentelse");
|
||||
child.merge(parent);
|
||||
assertEquals("childelse", child.getElse());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
IfModel child = new IfModel("child", "childthen");
|
||||
IfModel parent = new IfModel("parent", "parentthen", "parentelse");
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getElse());
|
||||
assertEquals("parentelse", child.getElse());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.InputModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,34 +22,28 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class InputModelTests extends TestCase {
|
||||
|
||||
public void testMergeable() {
|
||||
InputModel child = new InputModel("child", "childvalue");
|
||||
assertTrue(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
public void testNotMergeable() {
|
||||
InputModel child = new InputModel("child", "childvalue");
|
||||
InputModel parent = new InputModel("parent", "parentvalue");
|
||||
assertFalse(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testNotMergeableWithNull() {
|
||||
InputModel child = new InputModel("child", "childvalue");
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testMerge() {
|
||||
InputModel child = new InputModel("child", "childvalue");
|
||||
InputModel parent = new InputModel("parent", "parentvalue");
|
||||
InputModel parent = new InputModel("child", "parentvalue");
|
||||
parent.setType("parenttype");
|
||||
child.merge(parent);
|
||||
assertEquals("childvalue", child.getValue());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
InputModel child = new InputModel("child", "childvalue");
|
||||
InputModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("childvalue", child.getValue());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
InputModel child = new InputModel("child", "childvalue");
|
||||
InputModel parent = new InputModel("child", "childvalue");
|
||||
parent.setType("long");
|
||||
child.merge(parent);
|
||||
assertEquals("long", child.getType());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
InputModel child = new InputModel("child", "childvalue");
|
||||
InputModel parent = new InputModel("parent", "parentvalue");
|
||||
parent.setType("long");
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getType());
|
||||
assertEquals("parenttype", child.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.OutputModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,34 +22,28 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class OutputModelTests extends TestCase {
|
||||
|
||||
public void testMergeable() {
|
||||
OutputModel child = new OutputModel("child", "childvalue");
|
||||
assertTrue(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
public void testNotMergeable() {
|
||||
OutputModel child = new OutputModel("child", "childvalue");
|
||||
OutputModel parent = new OutputModel("parent", "parentvalue");
|
||||
assertFalse(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testNotMergeableWithNull() {
|
||||
OutputModel child = new OutputModel("child", "childvalue");
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testMerge() {
|
||||
OutputModel child = new OutputModel("child", "childvalue");
|
||||
OutputModel parent = new OutputModel("parent", "parentvalue");
|
||||
OutputModel parent = new OutputModel("child", "parentvalue");
|
||||
parent.setType("parenttype");
|
||||
child.merge(parent);
|
||||
assertEquals("childvalue", child.getValue());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
OutputModel child = new OutputModel("child", "childvalue");
|
||||
OutputModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("childvalue", child.getValue());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
OutputModel child = new OutputModel("child", "childvalue");
|
||||
OutputModel parent = new OutputModel("child", "childvalue");
|
||||
parent.setType("long");
|
||||
child.merge(parent);
|
||||
assertEquals("long", child.getType());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
OutputModel child = new OutputModel("child", "childvalue");
|
||||
OutputModel parent = new OutputModel("parent", "parentvalue");
|
||||
parent.setType("long");
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getType());
|
||||
assertEquals("parenttype", child.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.PersistenceContextModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,8 +22,9 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class PersistenceContextModelTests extends TestCase {
|
||||
|
||||
public void test() {
|
||||
// no op
|
||||
public void testNotMergeable() {
|
||||
PersistenceContextModel child = new PersistenceContextModel();
|
||||
assertFalse(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.RenderModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,26 +22,9 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class RenderModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
public void testNotMergeable() {
|
||||
RenderModel child = new RenderModel("child");
|
||||
RenderModel parent = new RenderModel("parent");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getFragments());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
RenderModel child = new RenderModel("child");
|
||||
RenderModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getFragments());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
// render will never merge
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
// render will never merge
|
||||
assertFalse(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.SecuredModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,32 +22,28 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class SecuredModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
public void testMergeable() {
|
||||
SecuredModel child = new SecuredModel("child");
|
||||
assertTrue(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
public void testNotMergeable() {
|
||||
SecuredModel child = new SecuredModel("child");
|
||||
SecuredModel parent = new SecuredModel("parent");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getAttributes());
|
||||
assertFalse(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
public void testNotMergeableWithNull() {
|
||||
SecuredModel child = new SecuredModel("child");
|
||||
SecuredModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getAttributes());
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
public void testMerge() {
|
||||
SecuredModel child = new SecuredModel("child");
|
||||
SecuredModel parent = new SecuredModel("child", "all");
|
||||
SecuredModel parent = new SecuredModel("child");
|
||||
parent.setMatch("all");
|
||||
child.merge(parent);
|
||||
assertEquals("all", child.getMatch());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
SecuredModel child = new SecuredModel("child");
|
||||
SecuredModel parent = new SecuredModel("parent", "all");
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getMatch());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.SetModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,32 +22,9 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class SetModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
SetModel child = new SetModel("child", "childvalue");
|
||||
SetModel parent = new SetModel("parent", "parentvalue");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getName());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
SetModel child = new SetModel("child", "childvalue");
|
||||
SetModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getName());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
SetModel child = new SetModel("child", "childvalue");
|
||||
SetModel parent = new SetModel("child", "childvalue", "childtype");
|
||||
child.merge(parent);
|
||||
assertEquals("childtype", child.getType());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
SetModel child = new SetModel("child", "childvalue");
|
||||
SetModel parent = new SetModel("parent", "parentvalue", "parenttype");
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getType());
|
||||
public void testNotMergeable() {
|
||||
SetModel child = new SetModel("name", "value");
|
||||
assertFalse(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,34 +22,28 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class SubflowStateModelTests extends TestCase {
|
||||
|
||||
public void testMergeable() {
|
||||
SubflowStateModel child = new SubflowStateModel("child", "flow");
|
||||
assertTrue(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
public void testNotMergeable() {
|
||||
SubflowStateModel child = new SubflowStateModel("child", "flow");
|
||||
SubflowStateModel parent = new SubflowStateModel("parent", "flow");
|
||||
assertFalse(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testNotMergeableWithNull() {
|
||||
SubflowStateModel child = new SubflowStateModel("child", "flow");
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testMerge() {
|
||||
SubflowStateModel child = new SubflowStateModel("child", "childflow");
|
||||
SubflowStateModel parent = new SubflowStateModel("parent", "parentflow");
|
||||
SubflowStateModel child = new SubflowStateModel("child", "flow");
|
||||
SubflowStateModel parent = new SubflowStateModel("child", "flow");
|
||||
parent.setSecured(new SecuredModel("secured"));
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getId());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
SubflowStateModel child = new SubflowStateModel("child", "childflow");
|
||||
SubflowStateModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getId());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
SubflowStateModel child = new SubflowStateModel("child", "childflow");
|
||||
SubflowStateModel parent = new SubflowStateModel("child", "parentflow");
|
||||
parent.addInput(new InputModel("inname", "invalue"));
|
||||
child.merge(parent);
|
||||
assertEquals(1, child.getInputs().size());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
SubflowStateModel child = new SubflowStateModel("child", "childflow");
|
||||
SubflowStateModel parent = new SubflowStateModel("parent", "parentflow");
|
||||
parent.addInput(new InputModel("inname", "invalue"));
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getInputs());
|
||||
assertNotNull(child.getSecured());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.TransitionModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,32 +22,33 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class TransitionModelTests extends TestCase {
|
||||
|
||||
public void testMergeable() {
|
||||
TransitionModel child = new TransitionModel();
|
||||
child.setOn("child");
|
||||
assertTrue(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
public void testNotMergeable() {
|
||||
TransitionModel child = new TransitionModel();
|
||||
child.setOn("child");
|
||||
TransitionModel parent = new TransitionModel();
|
||||
parent.setOn("parent");
|
||||
assertFalse(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testNotMergeableWithNull() {
|
||||
TransitionModel child = new TransitionModel();
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testMerge() {
|
||||
TransitionModel child = new TransitionModel("child");
|
||||
TransitionModel parent = new TransitionModel("parent");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getOn());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
TransitionModel child = new TransitionModel("child");
|
||||
TransitionModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getOn());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
TransitionModel child = new TransitionModel("child");
|
||||
TransitionModel parent = new TransitionModel("child", "end");
|
||||
TransitionModel child = new TransitionModel();
|
||||
child.setOn("child");
|
||||
TransitionModel parent = new TransitionModel();
|
||||
parent.setOn("child");
|
||||
parent.setTo("end");
|
||||
child.merge(parent);
|
||||
assertEquals("end", child.getTo());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
TransitionModel child = new TransitionModel("child");
|
||||
TransitionModel parent = new TransitionModel("parent", "end");
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getTo());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.VarModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,32 +22,9 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class VarModelTests extends TestCase {
|
||||
|
||||
public void testMerge() {
|
||||
VarModel child = new VarModel("child", "childclass");
|
||||
VarModel parent = new VarModel("parent", "parentclass");
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getName());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
VarModel child = new VarModel("child", "childclass");
|
||||
VarModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("child", child.getName());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
VarModel child = new VarModel("child", "childclass");
|
||||
VarModel parent = new VarModel("child", "childclass", "childscope");
|
||||
child.merge(parent);
|
||||
assertEquals("childscope", child.getScope());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
VarModel child = new VarModel("child", "childclass");
|
||||
VarModel parent = new VarModel("parent", "parentclass", "parentscope");
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getScope());
|
||||
public void testNotMergeable() {
|
||||
VarModel child = new VarModel("name", "value");
|
||||
assertFalse(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
*/
|
||||
package org.springframework.webflow.engine.model;
|
||||
|
||||
import org.springframework.webflow.engine.model.ViewStateModel;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
/**
|
||||
@@ -24,32 +22,28 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class ViewStateModelTests extends TestCase {
|
||||
|
||||
public void testMergeable() {
|
||||
ViewStateModel child = new ViewStateModel("child");
|
||||
assertTrue(child.isMergeableWith(child));
|
||||
}
|
||||
|
||||
public void testNotMergeable() {
|
||||
ViewStateModel child = new ViewStateModel("child");
|
||||
ViewStateModel parent = new ViewStateModel("parent");
|
||||
assertFalse(child.isMergeableWith(parent));
|
||||
}
|
||||
|
||||
public void testNotMergeableWithNull() {
|
||||
ViewStateModel child = new ViewStateModel("child");
|
||||
assertFalse(child.isMergeableWith(null));
|
||||
}
|
||||
|
||||
public void testMerge() {
|
||||
ViewStateModel child = new ViewStateModel("child", "childview");
|
||||
ViewStateModel parent = new ViewStateModel("parent", "parentview");
|
||||
child.merge(parent);
|
||||
assertEquals("childview", child.getView());
|
||||
}
|
||||
|
||||
public void testMergeNullParent() {
|
||||
ViewStateModel child = new ViewStateModel("child", "childview");
|
||||
ViewStateModel parent = null;
|
||||
child.merge(parent);
|
||||
assertEquals("childview", child.getView());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatch() {
|
||||
ViewStateModel child = new ViewStateModel("child");
|
||||
ViewStateModel parent = new ViewStateModel("child", "parentview");
|
||||
ViewStateModel parent = new ViewStateModel("child");
|
||||
parent.setSecured(new SecuredModel("secured"));
|
||||
child.merge(parent);
|
||||
assertEquals("parentview", child.getView());
|
||||
}
|
||||
|
||||
public void testMergeOverrideMatchFailed() {
|
||||
ViewStateModel child = new ViewStateModel("child");
|
||||
ViewStateModel parent = new ViewStateModel("parent", "parentview");
|
||||
child.merge(parent);
|
||||
assertEquals(null, child.getView());
|
||||
assertNotNull(child.getSecured());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user