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 @@
#Tue Jul 31 15:11:23 EDT 2007
#Mon Aug 13 12:11:13 EDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -76,7 +76,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
@@ -256,7 +256,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,9 +1,8 @@
#Tue Jul 31 15:07:56 EDT 2007
#Mon Aug 13 12:11:13 EDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Spring Java Conventions
formatter_settings_version=11
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true

View File

@@ -54,7 +54,7 @@ public class BirthDateFormAction extends FormAction {
*/
public Event calculateAge(RequestContext context) throws Exception {
// pull the date from the model
BirthDate birthDate = (BirthDate)getFormObject(context);
BirthDate birthDate = (BirthDate) getFormObject(context);
// calculate the age (quick & dirty)
// in a real application you would delegate to the business layer for

View File

@@ -28,7 +28,7 @@ public class BirthDateValidator implements Validator {
}
public void validate(Object obj, Errors errors) {
BirthDate birthDate = (BirthDate)obj;
BirthDate birthDate = (BirthDate) obj;
validateBirthdateForm(birthDate, errors);
validateCardForm(birthDate, errors);
}
@@ -44,8 +44,7 @@ public class BirthDateValidator implements Validator {
cal.setTime(birthDate.getDate());
if (cal.get(Calendar.MONTH) == 11) {
errors.reject("tooGoodForCards", "You're born in December--you're too good for a silly card!");
}
else {
} else {
ValidationUtils.rejectIfEmptyOrWhitespace(errors, "emailAddress", "noEmail",
"Please specify your email address.");
}

View File

@@ -1,4 +1,4 @@
#Tue Jul 31 15:11:23 EDT 2007
#Mon Aug 13 12:11:18 EDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -76,7 +76,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
@@ -256,7 +256,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 @@
#Tue Jul 31 15:08:06 EDT 2007
#Mon Aug 13 12:11:18 EDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Spring Java Conventions

View File

@@ -28,8 +28,7 @@ public class FileUploadAction extends AbstractAction {
// data was uploaded
context.getFlashScope().put("file", new String(file.getBytes()));
return success();
}
else {
} else {
return error();
}
}

View File

@@ -1,4 +1,4 @@
#Tue Jul 31 15:11:23 EDT 2007
#Mon Aug 13 12:11:22 EDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -76,7 +76,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
@@ -256,7 +256,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,9 +1,8 @@
#Tue Jul 31 15:08:18 EDT 2007
#Mon Aug 13 12:11:22 EDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Spring Java Conventions
formatter_settings_version=11
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true

View File

@@ -1,4 +1,4 @@
#Tue Jul 31 15:11:23 EDT 2007
#Mon Aug 13 12:11:25 EDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -76,7 +76,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
@@ -256,7 +256,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 @@
#Tue Jul 31 15:08:30 EDT 2007
#Mon Aug 13 12:11:25 EDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Spring Java Conventions

View File

@@ -33,8 +33,7 @@ public class AddItemAction extends AbstractAction {
try {
// add a bit of artificial think time
Thread.sleep(2000);
}
catch (InterruptedException e) {
} catch (InterruptedException e) {
}
return success();

View File

@@ -1,4 +1,4 @@
#Tue Jul 31 15:11:23 EDT 2007
#Mon Aug 13 12:11:28 EDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -76,7 +76,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
@@ -256,7 +256,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,9 +1,8 @@
#Tue Jul 31 15:08:39 EDT 2007
#Mon Aug 13 12:11:28 EDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Spring Java Conventions
formatter_settings_version=11
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true

View File

@@ -20,8 +20,8 @@ import java.util.Calendar;
import java.util.Random;
/**
* Action that encapsulates logic for the number guess sample flow. Note that
* this is a stateful action: it holds modifiable state in instance members!
* Action that encapsulates logic for the number guess sample flow. Note that this is a stateful action: it holds
* modifiable state in instance members!
*
* @author Erwin Vervaet
* @author Keith Donald
@@ -63,16 +63,13 @@ public class HigherLowerGame implements Serializable {
public GuessResult makeGuess(int guess) {
if (guess < 0 || guess > 100) {
setResult(GuessResult.INVALID);
}
else {
} else {
guesses++;
if (answer < guess) {
setResult(GuessResult.TOO_HIGH);
}
else if (answer > guess) {
} else if (answer > guess) {
setResult(GuessResult.TOO_LOW);
}
else {
} else {
setResult(GuessResult.CORRECT);
}
}

View File

@@ -51,8 +51,7 @@ public class MastermindGame implements Serializable {
public GuessResult makeGuess(String guess) {
if (isGuessValid(guess)) {
setResult(calculateResult(guess));
}
else {
} else {
setResult(GuessResult.INVALID);
}
return getResult();
@@ -86,8 +85,7 @@ public class MastermindGame implements Serializable {
if (digit == answerDigit) {
if (i == j) {
rightPosition++;
}
else {
} else {
correctButWrongPosition++;
}
break;
@@ -97,8 +95,7 @@ public class MastermindGame implements Serializable {
data.recordGuessData(guess, rightPosition, correctButWrongPosition);
if (rightPosition == 4) {
return GuessResult.CORRECT;
}
else {
} else {
return GuessResult.WRONG;
}
}

View File

@@ -23,11 +23,11 @@ import org.springframework.webflow.samples.numberguess.MastermindGame.GuessResul
public class MastermindGameTests extends TestCase {
private MastermindGame action = new MastermindGame();
protected void setUp() {
action = new MastermindGame();
}
public void testGuessNoInputProvided() throws Exception {
GuessResult result = action.makeGuess(null);
assertEquals(GuessResult.INVALID, result);

View File

@@ -1,4 +1,4 @@
#Tue Jul 31 15:11:23 EDT 2007
#Mon Aug 13 12:11:37 EDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -80,7 +80,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
@@ -260,7 +260,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 @@
#Tue Jul 31 15:08:57 EDT 2007
#Mon Aug 13 12:11:37 EDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Spring Java Conventions

View File

@@ -26,8 +26,8 @@ public class SearchCriteriaValidator implements Validator {
}
public void validate(Object obj, Errors errors) {
SearchCriteria query = (SearchCriteria)obj;
if (!StringUtils.hasText(query.getFirstName()) && !StringUtils.hasText(query.getLastName())) {
SearchCriteria query = (SearchCriteria) obj;
if (!StringUtils.hasText(query.getFirstName()) && !StringUtils.hasText(query.getLastName())) {
errors.reject("noCriteria", "Please provide some query criteria!");
}
}

View File

@@ -23,11 +23,11 @@ import org.springframework.webflow.engine.builder.FlowBuilderException;
import org.springframework.webflow.engine.support.ConfigurableFlowAttributeMapper;
/**
* Java-based flow builder that builds the person details flow, exactly like it
* is defined in the <code>detail-flow.xml</code> XML flow definition.
* Java-based flow builder that builds the person details flow, exactly like it is defined in the
* <code>detail-flow.xml</code> XML flow definition.
* <p>
* This encapsulates the page flow of viewing a person's details and their
* collegues in a reusable, self-contained module.
* This encapsulates the page flow of viewing a person's details and their collegues in a reusable, self-contained
* module.
*
* @author Keith Donald
*/

View File

@@ -24,7 +24,7 @@ import org.springframework.webflow.engine.builder.AbstractFlowBuilderFlowRegistr
* @author Keith Donald
*/
public class PhonebookFlowRegistryFactoryBean extends AbstractFlowBuilderFlowRegistryFactoryBean {
protected void doPopulate(FlowDefinitionRegistry registry) {
registerFlowDefinition(registry, "detail-flow", new PersonDetailFlowBuilder());
registerFlowDefinition(registry, "search-flow", new SearchPersonFlowBuilder());

View File

@@ -26,13 +26,11 @@ import org.springframework.webflow.samples.phonebook.SearchCriteria;
import org.springframework.webflow.samples.phonebook.SearchCriteriaValidator;
/**
* Java-based flow builder that searches for people in the phonebook. The flow
* defined by this class is exactly the same as that defined in the
* <code>search-flow.xml</code> XML flow definition.
* Java-based flow builder that searches for people in the phonebook. The flow defined by this class is exactly the same
* as that defined in the <code>search-flow.xml</code> XML flow definition.
* <p>
* This encapsulates the page flow of searching for some people, selecting a
* person you care about, and viewing their person's details and those of their
* collegues in a reusable, self-contained module.
* This encapsulates the page flow of searching for some people, selecting a person you care about, and viewing their
* person's details and those of their collegues in a reusable, self-contained module.
*
* @author Keith Donald
*/

View File

@@ -72,7 +72,7 @@ public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests {
@Override
protected FlowDefinitionResource getFlowDefinitionResource() {
return createFlowDefinitionResource("src/main/webapp/WEB-INF/flows/search-flow.xml");
return createFlowDefinitionResource("src/main/webapp/WEB-INF/flows/search-flow.xml");
}
@Override
@@ -80,7 +80,8 @@ public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests {
Flow mockDetailFlow = new Flow("detail-flow");
mockDetailFlow.setInputMapper(new AttributeMapper() {
public void map(Object source, Object target, MappingContext context) {
assertEquals("id of value 1 not provided as input by calling search flow", new Long(1), ((AttributeMap)source).get("id"));
assertEquals("id of value 1 not provided as input by calling search flow", new Long(1),
((AttributeMap) source).get("id"));
}
});
// test responding to finish result

View File

@@ -1,4 +1,4 @@
#Tue Jul 31 15:11:23 EDT 2007
#Mon Aug 13 12:11:34 EDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -76,7 +76,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
@@ -256,7 +256,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 @@
#Tue Jul 31 15:08:49 EDT 2007
#Mon Aug 13 12:11:34 EDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Spring Java Conventions

View File

@@ -26,8 +26,8 @@ public class SearchCriteriaValidator implements Validator {
}
public void validate(Object obj, Errors errors) {
SearchCriteria query = (SearchCriteria)obj;
if (!StringUtils.hasText(query.getFirstName()) && !StringUtils.hasText(query.getLastName())) {
SearchCriteria query = (SearchCriteria) obj;
if (!StringUtils.hasText(query.getFirstName()) && !StringUtils.hasText(query.getLastName())) {
errors.reject("noCriteria", "Please provide valid search criteria");
}
}

View File

@@ -23,11 +23,11 @@ import org.springframework.webflow.engine.builder.FlowBuilderException;
import org.springframework.webflow.engine.support.ConfigurableFlowAttributeMapper;
/**
* Java-based flow builder that builds the person details flow, exactly like it
* is defined in the <code>detail-flow.xml</code> XML flow definition.
* Java-based flow builder that builds the person details flow, exactly like it is defined in the
* <code>detail-flow.xml</code> XML flow definition.
* <p>
* This encapsulates the page flow of viewing a person's details and their
* collegues in a reusable, self-contained module.
* This encapsulates the page flow of viewing a person's details and their collegues in a reusable, self-contained
* module.
*
* @author Keith Donald
*/

View File

@@ -24,7 +24,7 @@ import org.springframework.webflow.engine.builder.AbstractFlowBuilderFlowRegistr
* @author Keith Donald
*/
public class PhonebookFlowRegistryFactoryBean extends AbstractFlowBuilderFlowRegistryFactoryBean {
protected void doPopulate(FlowDefinitionRegistry registry) {
registerFlowDefinition(registry, "detail-flow", new PersonDetailFlowBuilder());
registerFlowDefinition(registry, "search-flow", new SearchPersonFlowBuilder());

View File

@@ -26,13 +26,11 @@ import org.springframework.webflow.samples.phonebook.SearchCriteria;
import org.springframework.webflow.samples.phonebook.SearchCriteriaValidator;
/**
* Java-based flow builder that searches for people in the phonebook. The flow
* defined by this class is exactly the same as that defined in the
* <code>search-flow.xml</code> XML flow definition.
* Java-based flow builder that searches for people in the phonebook. The flow defined by this class is exactly the same
* as that defined in the <code>search-flow.xml</code> XML flow definition.
* <p>
* This encapsulates the page flow of searching for some people, selecting a
* person you care about, and viewing their person's details and those of their
* collegues in a reusable, self-contained module.
* This encapsulates the page flow of searching for some people, selecting a person you care about, and viewing their
* person's details and those of their collegues in a reusable, self-contained module.
*
* @author Keith Donald
*/

View File

@@ -72,7 +72,7 @@ public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests {
@Override
protected FlowDefinitionResource getFlowDefinitionResource() {
return createFlowDefinitionResource("src/main/webapp/WEB-INF/flows/search-flow.xml");
return createFlowDefinitionResource("src/main/webapp/WEB-INF/flows/search-flow.xml");
}
@Override
@@ -80,7 +80,8 @@ public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests {
Flow mockDetailFlow = new Flow("detail-flow");
mockDetailFlow.setInputMapper(new AttributeMapper() {
public void map(Object source, Object target, MappingContext context) {
assertEquals("id of value 1 not provided as input by calling search flow", new Long(1), ((AttributeMap)source).get("id"));
assertEquals("id of value 1 not provided as input by calling search flow", new Long(1),
((AttributeMap) source).get("id"));
}
});
// test responding to finish result

View File

@@ -1,4 +1,4 @@
#Thu Aug 09 13:12:30 EDT 2007
#Mon Aug 13 12:11:43 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:49 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 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))";
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);
}

View File

@@ -21,7 +21,8 @@ public class JdbcSaleProcessor extends JdbcDaoSupport implements SaleProcessor {
public void process(Sale sale) {
getJdbcTemplate()
.update("insert into T_SALES values (?, ?, ?, ?, ?)",
.update(
"insert into T_SALES values (?, ?, ?, ?, ?)",
new Object[] { null, sale.getItemCount(), sale.getPrice(), sale.getCategory(),
sale.getShippingType() });
}

View File

@@ -89,8 +89,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;
}
@@ -112,8 +111,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,7 +25,7 @@ public class SellItemAction extends AbstractAction {
// an action is not needed for binding, you can still add in an action to do
// something if you need to
protected Event doExecute(RequestContext context) throws Exception {
Sale sale = (Sale)context.getFlowScope().getRequired("sale", Sale.class);
Sale sale = (Sale) context.getFlowScope().getRequired("sale", Sale.class);
sale.getAmount();
return success();
}

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");

View File

@@ -1,4 +1,4 @@
#Tue Jul 31 15:11:23 EDT 2007
#Mon Aug 13 12:12:05 EDT 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
@@ -76,7 +76,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
@@ -256,7 +256,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,9 +1,8 @@
#Tue Jul 31 15:11:23 EDT 2007
#Mon Aug 13 12:12:05 EDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Spring Java Conventions
formatter_settings_version=11
org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8"?><templates/>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true

View File

@@ -34,7 +34,7 @@ public class Rate implements Serializable {
if (!(o instanceof Rate)) {
return false;
}
return value.equals(((Rate)o).value);
return value.equals(((Rate) o).value);
}
public int hashCode() {

View File

@@ -26,7 +26,7 @@ public class RateCriteriaValidator implements Validator {
}
public void validate(Object obj, Errors errors) {
RateCriteria criteria = (RateCriteria)obj;
RateCriteria criteria = (RateCriteria) obj;
validateSender(criteria, errors);
validateReceiver(criteria, errors);
validatePackageDetails(criteria, errors);

View File

@@ -1,5 +1,6 @@
#Tue Jul 31 15:11:23 EDT 2007
#Mon Aug 13 12:06:30 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
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
@@ -142,7 +143,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
@@ -322,7 +323,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,9 +1,9 @@
#Tue Jul 31 15:07:43 EDT 2007
#Mon Aug 13 12:10:07 EDT 2007
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Spring Java Conventions
formatter_settings_version=11
internal.default.compliance=default
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true