removed start-state element in favor of attribute or no start-state at all.

This commit is contained in:
Keith Donald
2008-02-29 03:28:32 +00:00
parent eac0a2b47c
commit d371131d05
4 changed files with 2 additions and 59 deletions

View File

@@ -551,18 +551,9 @@ public class XmlFlowBuilder extends AbstractFlowBuilder implements ResourceHolde
private String getStartStateId(Element element) {
String startState = "start-state";
if (element.hasAttribute(startState)) {
Element startStateElement = DomUtils.getChildElementByTagName(element, startState);
Assert
.isNull(startStateElement,
"Define either a flow 'start-state' attribute or use the classic 'start-state' element. Do not use both.");
return element.getAttribute(startState);
} else {
Element startStateElement = DomUtils.getChildElementByTagName(element, startState);
if (startStateElement != null) {
return startStateElement.getAttribute("idref");
} else {
return null;
}
return null;
}
}

View File

@@ -292,20 +292,6 @@ For example:
<xsd:documentation>
<![CDATA[
Defines flow startup logic to execute. This logic will always execute when this flow is started.
]]>
</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:element ref="start-state" minOccurs="0">
<xsd:annotation>
<xsd:documentation>
<![CDATA[
Identifies the starting point of this flow. The start state is the point where flow execution begins.
This element is an alternative to the 'start-state' attribute. In general, the 'start-state' attribute
is performed when you wish to explictly denote the flow start-state.
If not specified, the default start state is the first state defined in the document.
]]>
</xsd:documentation>
</xsd:annotation>
@@ -488,20 +474,6 @@ If not specified, the default start state is the first state defined in the docu
</xsd:element>
<!-- Sub elements -->
<xsd:element name="start-state">
<xsd:complexType>
<xsd:attribute name="idref" type="xsd:IDREF" use="required">
<xsd:annotation>
<xsd:documentation>
<![CDATA[
The identifier of the start state of this flow. The start state is the point where flow execution begins.
]]>
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="input-mapper">
<xsd:complexType>
<xsd:sequence>
@@ -635,8 +607,7 @@ The value of this attribute; a short-cut alternative to an explicit child 'value
</xsd:complexType>
</xsd:element>
<xsd:element name="persistence-context">
</xsd:element>
<xsd:element name="persistence-context"/>
<xsd:element name="var">
<xsd:complexType>

View File

@@ -56,15 +56,6 @@ public class XmlFlowBuilderTests extends TestCase {
assertEquals("end", flow.getStartState().getId());
}
public void testBuildFlowWithStartStateElement() {
ClassPathResource resource = new ClassPathResource("flow-startstate-element.xml", getClass());
builder = new XmlFlowBuilder(resource);
FlowAssembler assembler = new FlowAssembler(builder, new MockFlowBuilderContext("flow"));
Flow flow = assembler.assembleFlow();
assertEquals("flow", flow.getId());
assertEquals("end", flow.getStartState().getId());
}
public void testCustomFlowAttribute() {
ClassPathResource resource = new ClassPathResource("flow-custom-attribute.xml", getClass());
builder = new XmlFlowBuilder(resource);

View File

@@ -1,10 +0,0 @@
<flow xmlns="http://www.springframework.org/schema/webflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd">
<start-state idref="end"/>
<end-state id="foo"/>
<end-state id="end"/>
</flow>