Cleanup of the sellitem sample application.

This commit is contained in:
Erwin Vervaet
2007-02-17 20:21:33 +00:00
parent 56296c7ada
commit c5848bb3a7
5 changed files with 11 additions and 20 deletions

View File

@@ -21,8 +21,10 @@ public class InMemoryDatabaseCreator extends JdbcDaoSupport {
@Override
protected void initDao() throws Exception {
String createSales = "create table T_SALES (ID int not null identity primary key, ITEM_COUNT int not null, PRICE double NOT NULL, category VARCHAR(1) NOT NULL, SHIPPING_TYPE varchar(1))";
getJdbcTemplate().execute(createSales);
String createSalesSql =
"create table T_SALES (ID int not null identity primary key, ITEM_COUNT int not null, " +
"PRICE double NOT NULL, category VARCHAR(1) NOT NULL, SHIPPING_TYPE varchar(1))";
getJdbcTemplate().execute(createSalesSql);
}
}

View File

@@ -18,6 +18,7 @@ package org.springframework.webflow.samples.sellitem;
import org.springframework.jdbc.core.support.JdbcDaoSupport;
public class JdbcSaleProcessor extends JdbcDaoSupport implements SaleProcessor {
public void process(Sale sale) {
getJdbcTemplate().update("insert into T_SALES values (?, ?, ?, ?, ?)",
new Object[] { null, sale.getPrice(), sale.getItemCount(), sale.getCategory(), sale.getShippingType() });

View File

@@ -24,6 +24,10 @@ import org.springframework.webflow.execution.EnterStateVetoException;
import org.springframework.webflow.execution.FlowExecutionListenerAdapter;
import org.springframework.webflow.execution.RequestContext;
/**
* Flow execution listener that makes sure a user has the required role
* to enter a state.
*/
public class SellItemFlowExecutionListener extends FlowExecutionListenerAdapter {
public void stateEntering(RequestContext context, StateDefinition nextState) throws EnterStateVetoException {

View File

@@ -23,6 +23,7 @@
<property name="username" value="sa"/>
</bean>
<bean id="databaseCreator" class="org.springframework.webflow.samples.sellitem.InMemoryDatabaseCreator" autowire="byType"/>
<bean id="databaseCreator" class="org.springframework.webflow.samples.sellitem.InMemoryDatabaseCreator"
autowire="byType"/>
</beans>

View File

@@ -1,17 +0,0 @@
<%@ include file="includeTop.jsp" %>
<div id="content">
<div id="insert">
<img src="images/webflow-logo.jpg"/>
</div>
<p>
<span class="error">
Duplicate submit of the same transaction not allowed!
</span>
</p>
<p>
<A href="pos.htm?_flowId=sellitem">Sell a new item</A>
</p>
</div>
<%@ include file="includeBottom.jsp" %>