Added Spring Java Conventions to all of the spring sub-projects and formatted them to meet the guidelines.

This commit is contained in:
Ben Hale
2007-08-13 16:16:51 +00:00
parent 2e4ed776c1
commit 67a05c196d
50 changed files with 119 additions and 139 deletions

View File

@@ -1,4 +1,4 @@
#Thu Aug 09 13:12:30 EDT 2007
#Mon Aug 13 12:11:40 EDT 2007
eclipse.preferences.version=1
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
@@ -77,7 +77,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.indentation.size=8
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
@@ -257,7 +257,7 @@ org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=mixed
org.eclipse.jdt.core.formatter.tabulation.size=8
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true

View File

@@ -1,4 +1,4 @@
#Thu Aug 09 13:12:30 EDT 2007
#Mon Aug 13 12:10:46 EDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Spring Java Conventions

View File

@@ -21,9 +21,8 @@ public class InMemoryDatabaseCreator extends JdbcDaoSupport {
@Override
protected void initDao() throws Exception {
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))";
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

@@ -100,8 +100,7 @@ public class Sale implements Serializable {
if (itemCount >= 100) {
discount = 0.1;
}
}
else if ("B".equals(category)) {
} else if ("B".equals(category)) {
if (itemCount >= 200) {
discount = 0.2;
}
@@ -123,8 +122,7 @@ public class Sale implements Serializable {
double delCost = 0.0;
if ("S".equals(shippingType)) {
delCost = 10.0;
}
else if ("E".equals(shippingType)) {
} else if ("E".equals(shippingType)) {
delCost = 20.0;
}
return delCost;

View File

@@ -25,10 +25,10 @@ public class SaleValidator implements Validator {
}
public void validate(Object obj, Errors errors) {
Sale sale = (Sale)obj;
Sale sale = (Sale) obj;
validatePriceAndItemCount(sale, errors);
}
public void validatePriceAndItemCount(Sale sale, Errors errors) {
if (sale.getItemCount() <= 0) {
errors.rejectValue("itemCount", "tooLittle", "Item count must be greater than 0");

View File

@@ -25,15 +25,14 @@ 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.
* 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 {
String role = nextState.getAttributes().getString("role");
if (StringUtils.hasText(role)) {
HttpServletRequest request = ((ServletExternalContext)context.getExternalContext()).getRequest();
HttpServletRequest request = ((ServletExternalContext) context.getExternalContext()).getRequest();
if (!request.isUserInRole(role)) {
throw new EnterStateVetoException(context.getActiveFlow().getId(), context.getCurrentState().getId(),
nextState.getId(), "State requires role '" + role

View File

@@ -69,9 +69,9 @@ public class SellItemFlowExecutionTests extends AbstractXmlFlowExecutionTests {
public void testSubmitShippingDetailsForm() {
testSubmitCategoryFormWithShipping();
saleProcessor.process((Sale)getRequiredFlowAttribute("sale", Sale.class));
saleProcessor.process((Sale) getRequiredFlowAttribute("sale", Sale.class));
EasyMock.replay(saleProcessor);
MockParameterMap parameters = new MockParameterMap();
parameters.put("shippingType", "E");
parameters.put("shipDate", "12/06/2007");