put isMergeable before merge

removed unnecessary comments
This commit is contained in:
Keith Donald
2008-03-22 23:41:11 +00:00
parent 0debbf2770
commit 79f23bd495
17 changed files with 109 additions and 266 deletions

View File

@@ -22,14 +22,6 @@ 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
@@ -38,4 +30,12 @@ public abstract class AbstractActionModel extends AbstractModel {
return false;
}
/**
* Actions are not mergeable
* @param model the render action to merge into this render
*/
public void merge(Model model) {
// not mergeable
}
}

View File

@@ -21,10 +21,6 @@ import org.springframework.util.ObjectUtils;
/**
* Model support for action states.
* <p>
* A state where one or more actions are executed. This state type is typically used to invoke application code. An
* action state is a transitionable state. A transition out of this state is driven by the result of action execution.
*
* @author Scott Andrews
*/
public class ActionStateModel extends AbstractTransitionableStateModel {
@@ -38,10 +34,14 @@ public class ActionStateModel extends AbstractTransitionableStateModel {
setId(id);
}
/**
* Merge properties
* @param model the action state to merge into this state
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof ActionStateModel)) {
return false;
}
ActionStateModel state = (ActionStateModel) model;
return ObjectUtils.nullSafeEquals(getId(), state.getId());
}
public void merge(Model model) {
ActionStateModel state = (ActionStateModel) model;
setAttributes(merge(getAttributes(), state.getAttributes()));
@@ -53,18 +53,6 @@ public class ActionStateModel extends AbstractTransitionableStateModel {
setActions(merge(getActions(), state.getActions(), false));
}
/**
* Tests if the model is able to be merged with this action state
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof ActionStateModel)) {
return false;
}
ActionStateModel state = (ActionStateModel) model;
return ObjectUtils.nullSafeEquals(getId(), state.getId());
}
/**
* @return the actions
*/

View File

@@ -40,19 +40,6 @@ public class AttributeModel extends AbstractModel {
setValue(value);
}
/**
* Merge properties
* @param model the attribute to merge into this attribute
*/
public void merge(Model model) {
AttributeModel attribute = (AttributeModel) model;
setType(merge(getType(), attribute.getType()));
}
/**
* Tests if the model is able to be merged with this attribute
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof AttributeModel)) {
return false;
@@ -62,6 +49,11 @@ public class AttributeModel extends AbstractModel {
&& ObjectUtils.nullSafeEquals(getValue(), attribute.getValue());
}
public void merge(Model model) {
AttributeModel attribute = (AttributeModel) model;
setType(merge(getType(), attribute.getType()));
}
/**
* @return the name
*/

View File

@@ -36,20 +36,14 @@ public class BeanImportModel extends AbstractModel {
setResource(resource);
}
/**
* Bean imports are not mergeable
*/
public void merge(Model model) {
// not mergeable
}
/**
* Bean imports are not mergeable
*/
public boolean isMergeableWith(Model model) {
return false;
}
public void merge(Model model) {
}
/**
* @return the resource
*/

View File

@@ -21,13 +21,6 @@ import org.springframework.util.ObjectUtils;
/**
* Model support for decision states.
* <p>
* Evaluates one or more expressions to decide what state to transition to next. Intended to be used as an idempotent
* 'navigation' or 'routing' state.
* <p>
* A decision state is a transitionable state. A decision state transition can be triggered by evaluating a boolean
* expression against the flow execution request context. To define transition expressions, use the 'if' element.
*
* @author Scott Andrews
*/
public class DecisionStateModel extends AbstractStateModel {
@@ -42,10 +35,14 @@ public class DecisionStateModel extends AbstractStateModel {
setId(id);
}
/**
* Merge properties
* @param model the decision state to merge into this state
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof DecisionStateModel)) {
return false;
}
DecisionStateModel state = (DecisionStateModel) model;
return ObjectUtils.nullSafeEquals(getId(), state.getId());
}
public void merge(Model model) {
DecisionStateModel state = (DecisionStateModel) model;
setAttributes(merge(getAttributes(), state.getAttributes()));
@@ -56,18 +53,6 @@ public class DecisionStateModel extends AbstractStateModel {
setOnExitActions(merge(getOnExitActions(), state.getOnExitActions(), false));
}
/**
* Tests if the model is able to be merged with this decision state
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof DecisionStateModel)) {
return false;
}
DecisionStateModel state = (DecisionStateModel) model;
return ObjectUtils.nullSafeEquals(getId(), state.getId());
}
/**
* @return the ifs
*/

View File

@@ -22,15 +22,6 @@ import org.springframework.util.StringUtils;
/**
* Model support for end states.
* <p>
* A state that terminates this flow when entered. Defines a flow outcome.
* <p>
* An end state is not transitionable; there are never transitions out of an end state. When an end-state is entered, an
* instance of this flow is terminated.
* <p>
* When this flow terminates, if it was the "root" flow the entire execution is terminated. If this flow was a subflow,
* its parent flow resumes.
*
* @author Scott Andrews
*/
public class EndStateModel extends AbstractStateModel {
@@ -46,10 +37,14 @@ public class EndStateModel extends AbstractStateModel {
setId(id);
}
/**
* Merge properties
* @param model the end state to merge into this state
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof EndStateModel)) {
return false;
}
EndStateModel state = (EndStateModel) model;
return ObjectUtils.nullSafeEquals(getId(), state.getId());
}
public void merge(Model model) {
EndStateModel state = (EndStateModel) model;
setAttributes(merge(getAttributes(), state.getAttributes()));
@@ -61,18 +56,6 @@ public class EndStateModel extends AbstractStateModel {
setOutputs(merge(getOutputs(), state.getOutputs(), false));
}
/**
* Tests if the model is able to be merged with this end state
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof EndStateModel)) {
return false;
}
EndStateModel state = (EndStateModel) model;
return ObjectUtils.nullSafeEquals(getId(), state.getId());
}
/**
* @return the view
*/

View File

@@ -35,17 +35,13 @@ public class ExceptionHandlerModel extends AbstractModel {
setBeanName(beanName);
}
/**
* Exception handlers are not mergeable
*/
public void merge(Model model) {
// not mergable
}
public boolean isMergeableWith(Model model) {
return false;
}
public void merge(Model model) {
}
/**
* @return the bean name
*/

View File

@@ -67,10 +67,14 @@ public class FlowModel extends AbstractModel {
public FlowModel() {
}
/**
* Merge properties
* @param model the flow to merge into this flow
*/
public boolean isMergeableWith(Model model) {
if ((model instanceof FlowModel)) {
return true;
} else {
return false;
}
}
public void merge(Model model) {
FlowModel flow = (FlowModel) model;
setParent(null);
@@ -89,18 +93,6 @@ public class FlowModel extends AbstractModel {
setBeanImports(merge(getBeanImports(), flow.getBeanImports()));
}
/**
* Tests if the model is able to be merged with this flow
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if ((model instanceof FlowModel)) {
return true;
} else {
return false;
}
}
/**
* @return the parent
*/

View File

@@ -42,20 +42,6 @@ public class IfModel extends AbstractModel {
setThen(then);
}
/**
* Merge properties
* @param model the conditional to merge into this conditional
*/
public void merge(Model model) {
IfModel conditional = (IfModel) model;
setThen(merge(getThen(), conditional.getThen()));
setElse(merge(getElse(), conditional.getElse()));
}
/**
* Tests if the model is able to be merged with this if action
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof IfModel)) {
return false;
@@ -64,6 +50,12 @@ public class IfModel extends AbstractModel {
return ObjectUtils.nullSafeEquals(getTest(), conditional.getTest());
}
public void merge(Model model) {
IfModel conditional = (IfModel) model;
setThen(merge(getThen(), conditional.getThen()));
setElse(merge(getElse(), conditional.getElse()));
}
/**
* @return the test
*/

View File

@@ -36,21 +36,6 @@ public class InputModel extends AbstractMappingModel {
setValue(value);
}
/**
* Merge properties
* @param model the mapping to merge into this mapping
*/
public void merge(Model model) {
InputModel input = (InputModel) model;
setValue(merge(getValue(), input.getValue()));
setType(merge(getType(), input.getType()));
setRequired(merge(getRequired(), input.getRequired()));
}
/**
* Tests if the model is able to be merged with this input mapping
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof InputModel)) {
return false;
@@ -59,4 +44,11 @@ public class InputModel extends AbstractMappingModel {
return ObjectUtils.nullSafeEquals(getName(), input.getName());
}
public void merge(Model model) {
InputModel input = (InputModel) model;
setValue(merge(getValue(), input.getValue()));
setType(merge(getType(), input.getType()));
setRequired(merge(getRequired(), input.getRequired()));
}
}

View File

@@ -36,21 +36,6 @@ public class OutputModel extends AbstractMappingModel {
setValue(value);
}
/**
* Merge properties
* @param model the mapping to merge into this mapping
*/
public void merge(Model model) {
OutputModel output = (OutputModel) model;
setValue(merge(getValue(), output.getValue()));
setType(merge(getType(), output.getType()));
setRequired(merge(getRequired(), output.getRequired()));
}
/**
* Tests if the model is able to be merged with this output mapping
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof OutputModel)) {
return false;
@@ -59,4 +44,11 @@ public class OutputModel extends AbstractMappingModel {
return ObjectUtils.nullSafeEquals(getName(), output.getName());
}
public void merge(Model model) {
OutputModel output = (OutputModel) model;
setValue(merge(getValue(), output.getValue()));
setType(merge(getType(), output.getType()));
setRequired(merge(getRequired(), output.getRequired()));
}
}

View File

@@ -34,18 +34,12 @@ public class PersistenceContextModel extends AbstractModel {
public PersistenceContextModel() {
}
/**
* Persistence contexts are not mergeable
*/
public void merge(Model model) {
// not mergeable
}
/**
* Persistence contexts are not mergeable
*/
public boolean isMergeableWith(Model model) {
return false;
}
public void merge(Model model) {
}
}

View File

@@ -43,19 +43,6 @@ public class SecuredModel extends AbstractModel {
setAttributes(attributes);
}
/**
* Merge properties
* @param model the secured to merge into this secured
*/
public void merge(Model model) {
SecuredModel secured = (SecuredModel) model;
setMatch(merge(getMatch(), secured.getMatch()));
}
/**
* Tests if the model is able to be merged with this secured attribute
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof SecuredModel)) {
return false;
@@ -64,6 +51,11 @@ public class SecuredModel extends AbstractModel {
return ObjectUtils.nullSafeEquals(getAttributes(), secured.getAttributes());
}
public void merge(Model model) {
SecuredModel secured = (SecuredModel) model;
setMatch(merge(getMatch(), secured.getMatch()));
}
/**
* @return the attributes
*/

View File

@@ -22,12 +22,6 @@ import org.springframework.util.StringUtils;
/**
* Model support for subflow states.
* <p>
* Starts another flow as a subflow when entered. When the subflow ends, this state is expected to respond to its result
* by executing a transition.
* <p>
* A subflow state is a transitionable state. A transition is triggered by the subflow outcome that was reached.
*
* @author Scott Andrews
*/
public class SubflowStateModel extends AbstractTransitionableStateModel {
@@ -46,10 +40,14 @@ public class SubflowStateModel extends AbstractTransitionableStateModel {
setSubflow(subflow);
}
/**
* Merge properties
* @param model the subflow state to merge into this state
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof SubflowStateModel)) {
return false;
}
SubflowStateModel state = (SubflowStateModel) model;
return ObjectUtils.nullSafeEquals(getId(), state.getId());
}
public void merge(Model model) {
SubflowStateModel state = (SubflowStateModel) model;
setAttributes(merge(getAttributes(), state.getAttributes()));
@@ -64,18 +62,6 @@ public class SubflowStateModel extends AbstractTransitionableStateModel {
setOutputs(merge(getOutputs(), state.getOutputs()));
}
/**
* Tests if the model is able to be merged with this subflow state
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof SubflowStateModel)) {
return false;
}
SubflowStateModel state = (SubflowStateModel) model;
return ObjectUtils.nullSafeEquals(getId(), state.getId());
}
/**
* @return the subflow
*/

View File

@@ -44,10 +44,14 @@ public class TransitionModel extends AbstractModel {
public TransitionModel() {
}
/**
* Merge properties
* @param model the transition to merge into this transition
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof TransitionModel)) {
return false;
}
TransitionModel transition = (TransitionModel) model;
return ObjectUtils.nullSafeEquals(getOn(), transition.getOn());
}
public void merge(Model model) {
TransitionModel transition = (TransitionModel) model;
setOnException(merge(getOnException(), transition.getOnException()));
@@ -58,18 +62,6 @@ public class TransitionModel extends AbstractModel {
setActions(merge(getActions(), transition.getActions(), false));
}
/**
* Tests if the model is able to be merged with this transition
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof TransitionModel)) {
return false;
}
TransitionModel transition = (TransitionModel) model;
return ObjectUtils.nullSafeEquals(getOn(), transition.getOn());
}
/**
* @return the on
*/

View File

@@ -40,22 +40,14 @@ public class VarModel extends AbstractModel {
setClassName(className);
}
/**
* Vars are not mergeable
* @param model the render action to merge into this render
*/
public void merge(Model model) {
// not mergeable
}
/**
* Vars are not mergeable
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
return false;
}
public void merge(Model model) {
}
/**
* @return the name
*/

View File

@@ -22,17 +22,6 @@ import org.springframework.util.StringUtils;
/**
* Model support for view states.
* <p>
* A state where the user participates. When a view state is entered, this flow pauses and control goes to the user.
* After some think time, the user resumes this flow at the view-state by signaling an event.
* <p>
* Once paused, a view-state may be 'refreshed' by the user. A refresh causes the response to be reissued and then
* returns control back to the user.
* <p>
* A view state may be configured with one or more render-actions using the 'on-render' element. Render actions are
* executed immediately before the view is rendered.
* <p>
* A view state is a transitionable state. A view state transition is triggered by a user event.
*
* @author Scott Andrews
*/
@@ -52,10 +41,14 @@ public class ViewStateModel extends AbstractTransitionableStateModel {
setId(id);
}
/**
* Merge properties
* @param model the view state to merge into this state
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof ViewStateModel)) {
return false;
}
ViewStateModel state = (ViewStateModel) model;
return ObjectUtils.nullSafeEquals(getId(), state.getId());
}
public void merge(Model model) {
ViewStateModel state = (ViewStateModel) model;
setAttributes(merge(getAttributes(), state.getAttributes()));
@@ -72,18 +65,6 @@ public class ViewStateModel extends AbstractTransitionableStateModel {
setOnRenderActions(merge(getOnRenderActions(), state.getOnRenderActions(), false));
}
/**
* Tests if the model is able to be merged with this view state
* @param model the model to test
*/
public boolean isMergeableWith(Model model) {
if (!(model instanceof ViewStateModel)) {
return false;
}
ViewStateModel state = (ViewStateModel) model;
return ObjectUtils.nullSafeEquals(getId(), state.getId());
}
/**
* @return the view
*/