Cleanup of the sellitem sample application.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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() });
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
@@ -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" %>
|
||||
Reference in New Issue
Block a user