polish swf-1094

This commit is contained in:
Keith Donald
2009-04-14 20:23:27 +00:00
parent 828cf2835b
commit 3bc28ccab3
9 changed files with 41 additions and 29 deletions

View File

@@ -38,8 +38,11 @@ public abstract class AbstractStateModel extends AbstractModel {
private LinkedList exceptionHandlers;
public AbstractStateModel(String id) {
setId(id);
}
protected void fillCopy(AbstractStateModel copy) {
copy.setId(id);
copy.setParent(parent);
copy.setAttributes(copyList(attributes));
copy.setSecured((SecuredModel) copy(secured));

View File

@@ -28,6 +28,10 @@ public abstract class AbstractTransitionableStateModel extends AbstractStateMode
private LinkedList onExitActions;
public AbstractTransitionableStateModel(String id) {
super(id);
}
protected void fillCopy(final AbstractTransitionableStateModel copy) {
super.fillCopy(copy);
copy.setTransitions(copyList(transitions));

View File

@@ -32,7 +32,7 @@ public class ActionStateModel extends AbstractTransitionableStateModel {
* @param id the state identifier
*/
public ActionStateModel(String id) {
setId(id);
super(id);
}
public boolean isMergeableWith(Model model) {

View File

@@ -34,7 +34,7 @@ public class DecisionStateModel extends AbstractStateModel {
* @param id the state identifier
*/
public DecisionStateModel(String id) {
setId(id);
super(id);
}
public boolean isMergeableWith(Model model) {

View File

@@ -37,7 +37,7 @@ public class EndStateModel extends AbstractStateModel {
* @param id the state identifier
*/
public EndStateModel(String id) {
setId(id);
super(id);
}
public boolean isMergeableWith(Model model) {

View File

@@ -115,12 +115,7 @@ public class FlowModel extends AbstractModel {
copy.setStartStateId(startStateId);
copy.setAttributes(copyList(attributes));
copy.setSecured((SecuredModel) copy(secured));
if (secured != null) {
copy.setSecured((SecuredModel) secured.createCopy());
}
if (persistenceContext != null) {
copy.setPersistenceContext((PersistenceContextModel) persistenceContext.createCopy());
}
copy.setPersistenceContext((PersistenceContextModel) copy(persistenceContext));
copy.setVars(copyList(vars));
copy.setInputs(copyList(inputs));
copy.setOutputs(copyList(outputs));

View File

@@ -15,11 +15,11 @@
*/
package org.springframework.webflow.engine.model;
import java.util.LinkedList;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.LinkedList;
/**
* Model support for subflow states.
* @author Scott Andrews
@@ -40,7 +40,7 @@ public class SubflowStateModel extends AbstractTransitionableStateModel {
* @param subflow the identifier of the flow to launch as a subflow
*/
public SubflowStateModel(String id, String subflow) {
setId(id);
super(id);
setSubflow(subflow);
}
@@ -67,14 +67,14 @@ public class SubflowStateModel extends AbstractTransitionableStateModel {
setOutputs(merge(getOutputs(), state.getOutputs()));
}
public Model createCopy() {
final SubflowStateModel copy = new SubflowStateModel(getId(), subflow);
super.fillCopy(copy);
copy.setSubflowAttributeMapper(subflowAttributeMapper);
copy.setInputs(copyList(inputs));
copy.setOutputs(copyList(outputs));
return copy;
}
public Model createCopy() {
final SubflowStateModel copy = new SubflowStateModel(getId(), subflow);
super.fillCopy(copy);
copy.setSubflowAttributeMapper(subflowAttributeMapper);
copy.setInputs(copyList(inputs));
copy.setOutputs(copyList(outputs));
return copy;
}
/**
* @return the subflow

View File

@@ -15,11 +15,11 @@
*/
package org.springframework.webflow.engine.model;
import java.util.LinkedList;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.LinkedList;
/**
* Model support for transitions.
* <p>
@@ -76,6 +76,20 @@ public class TransitionModel extends AbstractModel {
setActions(merge(getActions(), transition.getActions(), false));
}
public Model createCopy() {
TransitionModel copy = new TransitionModel();
copy.setOn(on);
copy.setOnException(onException);
copy.setTo(to);
copy.setBind(bind);
copy.setValidate(validate);
copy.setHistory(history);
copy.setAttributes(copyList(attributes));
copy.setSecured((SecuredModel) copy(secured));
copy.setActions(copyList(actions));
return copy;
}
/**
* @return the on
*/

View File

@@ -46,7 +46,7 @@ public class ViewStateModel extends AbstractTransitionableStateModel {
* @param id the identifier of the state
*/
public ViewStateModel(String id) {
setId(id);
super(id);
}
public boolean isMergeableWith(Model model) {
@@ -83,11 +83,7 @@ public class ViewStateModel extends AbstractTransitionableStateModel {
copy.setPopup(popup);
copy.setModel(model);
copy.setVars(copyList(vars));
if (binder != null) {
copy.setBinder((BinderModel) binder.createCopy());
} else {
copy.setBinder(null);
}
copy.setBinder((BinderModel) copy(binder));
copy.setOnRenderActions(copyList(onRenderActions));
return copy;
}