diff --git a/spring-binding/.settings/org.eclipse.jdt.core.prefs b/spring-binding/.settings/org.eclipse.jdt.core.prefs index d96886eb..36d07095 100644 --- a/spring-binding/.settings/org.eclipse.jdt.core.prefs +++ b/spring-binding/.settings/org.eclipse.jdt.core.prefs @@ -1,74 +1,336 @@ -#Fri Oct 06 15:22:02 CEST 2006 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.3 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.3 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=ignore -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 +#Wed Aug 15 09:36:23 EDT 2007 +eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.3 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.3 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-binding/.settings/org.eclipse.jdt.ui.prefs b/spring-binding/.settings/org.eclipse.jdt.ui.prefs index 0e971266..b2183d80 100644 --- a/spring-binding/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-binding/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Wed Oct 04 14:36:37 EDT 2006 -eclipse.preferences.version=1 -internal.default.compliance=user +#Wed Aug 15 09:36:23 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.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-binding/src/main/java/org/springframework/binding/collection/CompositeIterator.java b/spring-binding/src/main/java/org/springframework/binding/collection/CompositeIterator.java index 8c9e3a33..ad2009c5 100644 --- a/spring-binding/src/main/java/org/springframework/binding/collection/CompositeIterator.java +++ b/spring-binding/src/main/java/org/springframework/binding/collection/CompositeIterator.java @@ -23,16 +23,15 @@ import java.util.NoSuchElementException; import org.springframework.util.Assert; /** - * Iterator that combines multiple other iterators. This is a simple implementation - * that just maintains a list of iterators which are invoked in sequence untill - * all iterators are exhausted. + * Iterator that combines multiple other iterators. This is a simple implementation that just maintains a list of + * iterators which are invoked in sequence untill all iterators are exhausted. * * @author Erwin Vervaet */ public class CompositeIterator implements Iterator { private List iterators = new LinkedList(); - + private boolean inUse = false; /** @@ -40,7 +39,7 @@ public class CompositeIterator implements Iterator { */ public CompositeIterator() { } - + /** * Add given iterator to this composite. */ @@ -54,8 +53,8 @@ public class CompositeIterator implements Iterator { public boolean hasNext() { inUse = true; - for (Iterator it = iterators.iterator(); it.hasNext(); ) { - if (((Iterator)it.next()).hasNext()) { + for (Iterator it = iterators.iterator(); it.hasNext();) { + if (((Iterator) it.next()).hasNext()) { return true; } } @@ -64,8 +63,8 @@ public class CompositeIterator implements Iterator { public Object next() { inUse = true; - for (Iterator it = iterators.iterator(); it.hasNext(); ) { - Iterator iterator = (Iterator)it.next(); + for (Iterator it = iterators.iterator(); it.hasNext();) { + Iterator iterator = (Iterator) it.next(); if (iterator.hasNext()) { return iterator.next(); } @@ -75,5 +74,5 @@ public class CompositeIterator implements Iterator { public void remove() { throw new UnsupportedOperationException("Remove is not supported"); - } + } } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/collection/MapAccessor.java b/spring-binding/src/main/java/org/springframework/binding/collection/MapAccessor.java index de09a400..419712c3 100644 --- a/spring-binding/src/main/java/org/springframework/binding/collection/MapAccessor.java +++ b/spring-binding/src/main/java/org/springframework/binding/collection/MapAccessor.java @@ -21,8 +21,8 @@ import java.util.Map; import org.springframework.util.Assert; /** - * A simple, generic decorator for getting attributes out of a map. May be - * instantiated directly or used as a base class as a convenience. + * A simple, generic decorator for getting attributes out of a map. May be instantiated directly or used as a base class + * as a convenience. * * @author Keith Donald */ @@ -43,14 +43,13 @@ public class MapAccessor implements MapAdaptable { } // implementing MapAdaptable - + public Map asMap() { return map; } /** - * Returns a value in the map, returning the defaultValue if no value was - * found. + * Returns a value in the map, returning the defaultValue if no value was found. * @param key the key * @param defaultValue the default * @return the attribute value @@ -63,27 +62,24 @@ public class MapAccessor implements MapAdaptable { } /** - * Returns a value in the map, asserting it is of the required type if - * present and returning null if not found. + * Returns a value in the map, asserting it is of the required type if present and returning null if + * not found. * @param key the key * @param requiredType the required type * @return the value - * @throws IllegalArgumentException if the key is present but the value is - * not of the required type + * @throws IllegalArgumentException if the key is present but the value is not of the required type */ public Object get(Object key, Class requiredType) throws IllegalArgumentException { return get(key, requiredType, null); } /** - * Returns a value in the map of the specified type, returning the - * defaultValue if no value is found. + * Returns a value in the map of the specified type, returning the defaultValue if no value is found. * @param key the key * @param requiredType the required type * @param defaultValue the default * @return the attribute value - * @throws IllegalArgumentException if the key is present but the value is - * not of the required type + * @throws IllegalArgumentException if the key is present but the value is not of the required type */ public Object get(Object key, Class requiredType, Object defaultValue) { if (!map.containsKey(key)) { @@ -93,8 +89,7 @@ public class MapAccessor implements MapAdaptable { } /** - * Returns a value in the map, throwing an exception if the attribute is not - * present and of the correct type. + * Returns a value in the map, throwing an exception if the attribute is not present and of the correct type. * @param key the key * @return the value */ @@ -104,8 +99,7 @@ public class MapAccessor implements MapAdaptable { } /** - * Returns an value in the map, asserting it is present and of the required - * type. + * Returns an value in the map, asserting it is present and of the required type. * @param key the key * @param requiredType the required type * @return the value @@ -116,217 +110,195 @@ public class MapAccessor implements MapAdaptable { } /** - * Returns a string value in the map, returning null if no - * value was found. + * Returns a string value in the map, returning null if no value was found. * @param key the key * @return the string value - * @throws IllegalArgumentException if the key is present but the value is - * not a string + * @throws IllegalArgumentException if the key is present but the value is not a string */ public String getString(Object key) throws IllegalArgumentException { return getString(key, null); } /** - * Returns a string value in the map, returning the defaultValue if no value - * was found. + * Returns a string value in the map, returning the defaultValue if no value was found. * @param key the key * @param defaultValue the default * @return the string value - * @throws IllegalArgumentException if the key is present but the value is - * not a string + * @throws IllegalArgumentException if the key is present but the value is not a string */ public String getString(Object key, String defaultValue) throws IllegalArgumentException { if (!map.containsKey(key)) { return defaultValue; } - return (String)assertKeyValueOfType(key, String.class); + return (String) assertKeyValueOfType(key, String.class); } /** - * Returns a string value in the map, throwing an exception if the attribute - * is not present and of the correct type. + * Returns a string value in the map, throwing an exception if the attribute is not present and of the correct type. * @param key the key * @return the string value - * @throws IllegalArgumentException if the key is not present or present but - * the value is not a string + * @throws IllegalArgumentException if the key is not present or present but the value is not a string */ public String getRequiredString(Object key) throws IllegalArgumentException { assertContainsKey(key); - return (String)assertKeyValueOfType(key, String.class); + return (String) assertKeyValueOfType(key, String.class); } /** - * Returns a collection value in the map, returning null if - * no value was found. + * Returns a collection value in the map, returning null if no value was found. * @param key the key * @return the collection value - * @throws IllegalArgumentException if the key is present but the value is - * not a collection + * @throws IllegalArgumentException if the key is present but the value is not a collection */ public Collection getCollection(Object key) throws IllegalArgumentException { if (!map.containsKey(key)) { return null; } - return (Collection)assertKeyValueOfType(key, Collection.class); + return (Collection) assertKeyValueOfType(key, Collection.class); } /** - * Returns a collection value in the map, asserting it is of the required - * type if present and returning null if not found. + * Returns a collection value in the map, asserting it is of the required type if present and returning + * null if not found. * @param key the key * @return the collection value - * @throws IllegalArgumentException if the key is present but the value is - * not a collection + * @throws IllegalArgumentException if the key is present but the value is not a collection */ public Collection getCollection(Object key, Class requiredType) throws IllegalArgumentException { if (!map.containsKey(key)) { return null; } assertAssignableTo(Collection.class, requiredType); - return (Collection)assertKeyValueOfType(key, requiredType); + return (Collection) assertKeyValueOfType(key, requiredType); } /** - * Returns a collection value in the map, throwing an exception if not - * found. + * Returns a collection value in the map, throwing an exception if not found. * @param key the key * @return the collection value - * @throws IllegalArgumentException if the key is not present or present but - * the value is not a collection + * @throws IllegalArgumentException if the key is not present or present but the value is not a collection */ public Collection getRequiredCollection(Object key) throws IllegalArgumentException { assertContainsKey(key); - return (Collection)assertKeyValueOfType(key, Collection.class); + return (Collection) assertKeyValueOfType(key, Collection.class); } /** - * Returns a collection value in the map, asserting it is of the required - * type if present and throwing an exception if not found. + * Returns a collection value in the map, asserting it is of the required type if present and throwing an exception + * if not found. * @param key the key * @return the collection value - * @throws IllegalArgumentException if the key is not present or present but - * the value is not a collection of the required type + * @throws IllegalArgumentException if the key is not present or present but the value is not a collection of the + * required type */ public Collection getRequiredCollection(Object key, Class requiredType) throws IllegalArgumentException { assertContainsKey(key); assertAssignableTo(Collection.class, requiredType); - return (Collection)assertKeyValueOfType(key, requiredType); + return (Collection) assertKeyValueOfType(key, requiredType); } /** - * Returns a array value in the map, asserting it is of the required type if - * present and returning null if not found. + * Returns a array value in the map, asserting it is of the required type if present and returning null + * if not found. * @param key the key * @return the array value - * @throws IllegalArgumentException if the key is present but the value is - * not an array of the required type + * @throws IllegalArgumentException if the key is present but the value is not an array of the required type */ public Object[] getArray(Object key, Class requiredType) throws IllegalArgumentException { assertAssignableTo(Object[].class, requiredType); if (!map.containsKey(key)) { return null; } - return (Object[])assertKeyValueOfType(key, requiredType); + return (Object[]) assertKeyValueOfType(key, requiredType); } /** - * Returns an array value in the map, asserting it is of the required type - * if present and throwing an exception if not found. + * Returns an array value in the map, asserting it is of the required type if present and throwing an exception if + * not found. * @param key the key * @return the array value - * @throws IllegalArgumentException if the key is not present or present but - * the value is not a array of the required type + * @throws IllegalArgumentException if the key is not present or present but the value is not a array of the + * required type */ public Object[] getRequiredArray(Object key, Class requiredType) throws IllegalArgumentException { assertContainsKey(key); assertAssignableTo(Object[].class, requiredType); - return (Object[])assertKeyValueOfType(key, requiredType); + return (Object[]) assertKeyValueOfType(key, requiredType); } /** - * Returns a number value in the map that is of the specified type, - * returning null if no value was found. + * Returns a number value in the map that is of the specified type, returning null if no value was + * found. * @param key the key * @param requiredType the required number type * @return the numbervalue - * @throws IllegalArgumentException if the key is present but the value is - * not a number of the required type + * @throws IllegalArgumentException if the key is present but the value is not a number of the required type */ public Number getNumber(Object key, Class requiredType) throws IllegalArgumentException { return getNumber(key, requiredType, null); } /** - * Returns a number attribute value in the map of the specified type, - * returning the defaultValue if no value was found. + * Returns a number attribute value in the map of the specified type, returning the defaultValue if no value was + * found. * @param key the attribute name * @return the number value * @param defaultValue the default - * @throws IllegalArgumentException if the key is present but the value is - * not a number of the required type + * @throws IllegalArgumentException if the key is present but the value is not a number of the required type */ public Number getNumber(Object key, Class requiredType, Number defaultValue) throws IllegalArgumentException { if (!map.containsKey(key)) { return defaultValue; } assertAssignableTo(Number.class, requiredType); - return (Number)assertKeyValueOfType(key, requiredType); + return (Number) assertKeyValueOfType(key, requiredType); } /** - * Returns a number value in the map, throwing an exception if the attribute - * is not present and of the correct type. + * Returns a number value in the map, throwing an exception if the attribute is not present and of the correct type. * @param key the key * @return the number value - * @throws IllegalArgumentException if the key is not present or present but - * the value is not a number of the required type + * @throws IllegalArgumentException if the key is not present or present but the value is not a number of the + * required type */ public Number getRequiredNumber(Object key, Class requiredType) throws IllegalArgumentException { assertContainsKey(key); - return (Number)assertKeyValueOfType(key, requiredType); + return (Number) assertKeyValueOfType(key, requiredType); } /** - * Returns an integer value in the map, returning null if no - * value was found. + * Returns an integer value in the map, returning null if no value was found. * @param key the key * @return the integer value - * @throws IllegalArgumentException if the key is present but the value is - * not an integer + * @throws IllegalArgumentException if the key is present but the value is not an integer */ public Integer getInteger(Object key) throws IllegalArgumentException { return getInteger(key, null); } /** - * Returns an integer value in the map, returning the defaultValue if no - * value was found. + * Returns an integer value in the map, returning the defaultValue if no value was found. * @param key the key * @param defaultValue the default * @return the integer value - * @throws IllegalArgumentException if the key is present but the value is - * not an integer + * @throws IllegalArgumentException if the key is present but the value is not an integer */ public Integer getInteger(Object key, Integer defaultValue) throws IllegalArgumentException { - return (Integer)getNumber(key, Integer.class, defaultValue); + return (Integer) getNumber(key, Integer.class, defaultValue); } /** - * Returns an integer value in the map, throwing an exception if the value - * is not present and of the correct type. + * Returns an integer value in the map, throwing an exception if the value is not present and of the correct type. * @param key the attribute name * @return the integer attribute value - * @throws IllegalArgumentException if the key is not present or present but - * the value is not an integer + * @throws IllegalArgumentException if the key is not present or present but the value is not an integer */ public Integer getRequiredInteger(Object key) throws IllegalArgumentException { - return (Integer)getRequiredNumber(key, Integer.class); + return (Integer) getRequiredNumber(key, Integer.class); } /** - * Returns a long value in the map, returning null if no - * value was found. + * Returns a long value in the map, returning null if no value was found. * @param key the key * @return the long value * @throws IllegalArgumentException if the key is present but not a long @@ -336,69 +308,59 @@ public class MapAccessor implements MapAdaptable { } /** - * Returns a long value in the map, returning the defaultValue if no value - * was found. + * Returns a long value in the map, returning the defaultValue if no value was found. * @param key the key * @param defaultValue the default * @return the long attribute value - * @throws IllegalArgumentException if the key is present but the value is - * not a long + * @throws IllegalArgumentException if the key is present but the value is not a long */ public Long getLong(Object key, Long defaultValue) throws IllegalArgumentException { - return (Long)getNumber(key, Long.class, defaultValue); + return (Long) getNumber(key, Long.class, defaultValue); } /** - * Returns a long value in the map, throwing an exception if the value is - * not present and of the correct type. + * Returns a long value in the map, throwing an exception if the value is not present and of the correct type. * @param key the key * @return the long attribute value - * @throws IllegalArgumentException if the key is not present or present but - * the value is not a long + * @throws IllegalArgumentException if the key is not present or present but the value is not a long */ public Long getRequiredLong(Object key) throws IllegalArgumentException { - return (Long)getRequiredNumber(key, Long.class); + return (Long) getRequiredNumber(key, Long.class); } /** - * Returns a boolean value in the map, returning null if no - * value was found. + * Returns a boolean value in the map, returning null if no value was found. * @param key the key * @return the boolean value - * @throws IllegalArgumentException if the key is present but the value is - * not a boolean + * @throws IllegalArgumentException if the key is present but the value is not a boolean */ public Boolean getBoolean(Object key) throws IllegalArgumentException { return getBoolean(key, null); } /** - * Returns a boolean value in the map, returning the defaultValue if no - * value was found. + * Returns a boolean value in the map, returning the defaultValue if no value was found. * @param key the key * @param defaultValue the default * @return the boolean value - * @throws IllegalArgumentException if the key is present but the value is - * not a boolean + * @throws IllegalArgumentException if the key is present but the value is not a boolean */ public Boolean getBoolean(Object key, Boolean defaultValue) throws IllegalArgumentException { if (!map.containsKey(key)) { return defaultValue; } - return (Boolean)assertKeyValueOfType(key, Boolean.class); + return (Boolean) assertKeyValueOfType(key, Boolean.class); } /** - * Returns a boolean value in the map, throwing an exception if the value is - * not present and of the correct type. + * Returns a boolean value in the map, throwing an exception if the value is not present and of the correct type. * @param key the attribute * @return the boolean value - * @throws IllegalArgumentException if the key is not present or present but - * the value is not a boolean + * @throws IllegalArgumentException if the key is not present or present but the value is not a boolean */ public Boolean getRequiredBoolean(Object key) throws IllegalArgumentException { assertContainsKey(key); - return (Boolean)assertKeyValueOfType(key, Boolean.class); + return (Boolean) assertKeyValueOfType(key, Boolean.class); } /** @@ -414,8 +376,7 @@ public class MapAccessor implements MapAdaptable { } /** - * Indicates if the attribute is present in the attribute map and of the - * required type. + * Indicates if the attribute is present in the attribute map and of the required type. * @param key the attribute name * @return true if present and of the required type, false if not present. */ @@ -423,8 +384,7 @@ public class MapAccessor implements MapAdaptable { if (map.containsKey(key)) { assertKeyValueOfType(key, requiredType); return true; - } - else { + } else { return false; } } diff --git a/spring-binding/src/main/java/org/springframework/binding/collection/MapAdaptable.java b/spring-binding/src/main/java/org/springframework/binding/collection/MapAdaptable.java index ce3e7ef5..0f83697c 100644 --- a/spring-binding/src/main/java/org/springframework/binding/collection/MapAdaptable.java +++ b/spring-binding/src/main/java/org/springframework/binding/collection/MapAdaptable.java @@ -25,11 +25,11 @@ import java.util.Map; public interface MapAdaptable { /** - * Returns this object's contents as a {@link Map}. The returned map may or - * may not be modifiable depending on this implementation. + * Returns this object's contents as a {@link Map}. The returned map may or may not be modifiable depending on this + * implementation. *

- * Warning: this operation may be called frequently; if so care should be - * taken so that the map contents (if calculated) be cached as appropriate. + * Warning: this operation may be called frequently; if so care should be taken so that the map contents (if + * calculated) be cached as appropriate. * @return the object's contents as a map */ public Map asMap(); diff --git a/spring-binding/src/main/java/org/springframework/binding/collection/SharedMap.java b/spring-binding/src/main/java/org/springframework/binding/collection/SharedMap.java index fb1379a1..8652fe8a 100644 --- a/spring-binding/src/main/java/org/springframework/binding/collection/SharedMap.java +++ b/spring-binding/src/main/java/org/springframework/binding/collection/SharedMap.java @@ -18,20 +18,18 @@ package org.springframework.binding.collection; import java.util.Map; /** - * A simple subinterface of {@link Map} that exposes a mutex that - * application code can synchronize on. + * A simple subinterface of {@link Map} that exposes a mutex that application code can synchronize on. *

- * Expected to be implemented by Maps that are backed by shared objects that - * require synchronization between multiple threads. An example would be the - * HTTP session map. + * Expected to be implemented by Maps that are backed by shared objects that require synchronization between multiple + * threads. An example would be the HTTP session map. * * @author Keith Donald */ public interface SharedMap extends Map { /** - * Returns the shared mutex that may be synchronized on using a - * synchronized block. The returned mutex is guaranteed to be non-null. + * Returns the shared mutex that may be synchronized on using a synchronized block. The returned mutex is guaranteed + * to be non-null. * * Example usage: * diff --git a/spring-binding/src/main/java/org/springframework/binding/collection/SharedMapDecorator.java b/spring-binding/src/main/java/org/springframework/binding/collection/SharedMapDecorator.java index 3d7910af..f2033af4 100644 --- a/spring-binding/src/main/java/org/springframework/binding/collection/SharedMapDecorator.java +++ b/spring-binding/src/main/java/org/springframework/binding/collection/SharedMapDecorator.java @@ -23,9 +23,8 @@ import java.util.Set; import org.springframework.core.style.ToStringCreator; /** - * A map decorator that implements SharedMap. By default, simply - * returns the map itself as the mutex. Subclasses may override to return a - * different mutex object. + * A map decorator that implements SharedMap. By default, simply returns the map itself as the mutex. + * Subclasses may override to return a different mutex object. * * @author Keith Donald */ @@ -43,7 +42,7 @@ public class SharedMapDecorator implements SharedMap, Serializable { public SharedMapDecorator(Map map) { this.map = map; } - + // implementing Map public void clear() { @@ -93,7 +92,7 @@ public class SharedMapDecorator implements SharedMap, Serializable { public Collection values() { return map.values(); } - + // implementing SharedMap public Object getMutex() { diff --git a/spring-binding/src/main/java/org/springframework/binding/collection/StringKeyedMapAdapter.java b/spring-binding/src/main/java/org/springframework/binding/collection/StringKeyedMapAdapter.java index be49017a..d571ad0d 100644 --- a/spring-binding/src/main/java/org/springframework/binding/collection/StringKeyedMapAdapter.java +++ b/spring-binding/src/main/java/org/springframework/binding/collection/StringKeyedMapAdapter.java @@ -22,24 +22,24 @@ import java.util.NoSuchElementException; import java.util.Set; /** - * Base class for map adapters whose keys are String values. Concrete - * classes need only implement the abstract hook methods defined by this class. + * Base class for map adapters whose keys are String values. Concrete classes need only implement the abstract hook + * methods defined by this class. * * @author Keith Donald */ public abstract class StringKeyedMapAdapter implements Map { - + private Set keySet; private Collection values; private Set entrySet; - + // implementing Map public void clear() { for (Iterator it = getAttributeNames(); it.hasNext();) { - removeAttribute((String)it.next()); + removeAttribute((String) it.next()); } } @@ -52,7 +52,7 @@ public abstract class StringKeyedMapAdapter implements Map { return false; } for (Iterator it = getAttributeNames(); it.hasNext();) { - Object aValue = getAttribute((String)it.next()); + Object aValue = getAttribute((String) it.next()); if (value.equals(aValue)) { return true; } @@ -85,7 +85,7 @@ public abstract class StringKeyedMapAdapter implements Map { public void putAll(Map map) { for (Iterator it = map.entrySet().iterator(); it.hasNext();) { - Entry entry = (Entry)it.next(); + Entry entry = (Entry) it.next(); setAttribute(entry.getKey().toString(), entry.getValue()); } } @@ -109,40 +109,38 @@ public abstract class StringKeyedMapAdapter implements Map { public Collection values() { return (values != null) ? values : (values = new Values()); } - + // hook methods /** - * Hook method that needs to be implemented by concrete subclasses. - * Gets a value associated with a key. + * Hook method that needs to be implemented by concrete subclasses. Gets a value associated with a key. * @param key the key to lookup * @return the associated value, or null if none */ protected abstract Object getAttribute(String key); /** - * Hook method that needs to be implemented by concrete subclasses. - * Puts a key-value pair in the map, overwriting any possible earlier - * value associated with the same key. + * Hook method that needs to be implemented by concrete subclasses. Puts a key-value pair in the map, overwriting + * any possible earlier value associated with the same key. * @param key the key to associate the value with * @param value the value to associate with the key */ protected abstract void setAttribute(String key, Object value); /** - * Hook method that needs to be implemented by concrete subclasses. - * Removes a key and its associated value from the map. + * Hook method that needs to be implemented by concrete subclasses. Removes a key and its associated value from the + * map. * @param key the key to remove */ protected abstract void removeAttribute(String key); /** - * Hook method that needs to be implemented by concrete subclasses. - * Returns an enumeration listing all keys known to the map. + * Hook method that needs to be implemented by concrete subclasses. Returns an enumeration listing all keys known to + * the map. * @return the key enumeration */ protected abstract Iterator getAttributeNames(); - + // internal helper classes private abstract class AbstractSet extends java.util.AbstractSet { @@ -233,7 +231,7 @@ public abstract class StringKeyedMapAdapter implements Map { if (!(o instanceof Entry)) { return false; } - Entry entry = (Entry)o; + Entry entry = (Entry) o; Object key = entry.getKey(); Object value = entry.getValue(); if (key == null || value == null) { @@ -246,13 +244,13 @@ public abstract class StringKeyedMapAdapter implements Map { if (!(o instanceof Entry)) { return false; } - Entry entry = (Entry)o; + Entry entry = (Entry) o; Object key = entry.getKey(); Object value = entry.getValue(); if (key == null || value == null || !value.equals(StringKeyedMapAdapter.this.get(key))) { return false; } - return StringKeyedMapAdapter.this.remove(((Entry)o).getKey()) != null; + return StringKeyedMapAdapter.this.remove(((Entry) o).getKey()) != null; } } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionContext.java b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionContext.java index 684c6d51..9396f7fc 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionContext.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionContext.java @@ -18,13 +18,10 @@ package org.springframework.binding.convert; /** * A context object with two main responsibities: *

    - *
  1. Exposing information to a converter to influence - * a type conversion attempt. - *
  2. Providing operations for recording progress or - * errors during the type conversion process. + *
  3. Exposing information to a converter to influence a type conversion attempt. + *
  4. Providing operations for recording progress or errors during the type conversion process. *
- * Empty for now; subclasses may define their own custom context behavior - * accessible by a converter with a downcast. + * Empty for now; subclasses may define their own custom context behavior accessible by a converter with a downcast. * * @author Keith Donald */ diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionException.java b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionException.java index 054742f0..5814cc56 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionException.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionException.java @@ -23,15 +23,14 @@ import org.springframework.core.NestedRuntimeException; * @author Keith Donald */ public class ConversionException extends NestedRuntimeException { - + /** * The source type we tried to convert from */ private Class sourceClass; /** - * The value we tried to convert. - * Transient because we cannot guarantee that the value is Serializable. + * The value we tried to convert. Transient because we cannot guarantee that the value is Serializable. */ private transient Object value; @@ -77,7 +76,7 @@ public class ConversionException extends NestedRuntimeException { this.value = value; this.targetClass = targetClass; } - + /** * Creates a new conversion exception. * @param sourceClass the source type @@ -90,7 +89,7 @@ public class ConversionException extends NestedRuntimeException { this.value = null; // not available this.targetClass = targetClass; } - + /** * Creates a new conversion exception. * @param sourceClass the source type @@ -102,7 +101,7 @@ public class ConversionException extends NestedRuntimeException { this.value = null; // not available this.targetClass = null; // not available } - + /** * Creates a new conversion exception. * @param sourceClass the source type @@ -116,7 +115,7 @@ public class ConversionException extends NestedRuntimeException { this.value = value; this.targetClass = targetClass; } - + /** * Returns the source type. */ diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionExecutor.java b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionExecutor.java index a6041b4d..4c717390 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionExecutor.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionExecutor.java @@ -19,11 +19,11 @@ import org.springframework.core.style.ToStringCreator; import org.springframework.util.Assert; /** - * A command object that is parameterized with the information necessary to - * perform a conversion of a source input to a target output. + * A command object that is parameterized with the information necessary to perform a conversion of a source input to a + * target output. *

- * Specifically, encapsulates knowledge about how to convert source objects to a - * specific target type using a specific converter. + * Specifically, encapsulates knowledge about how to convert source objects to a specific target type using a specific + * converter. * * @author Keith Donald */ @@ -74,7 +74,7 @@ public class ConversionExecutor { public Class getTargetClass() { return targetClass; } - + /** * Returns the converter that will perform the conversion. * @return the converter @@ -94,8 +94,7 @@ public class ConversionExecutor { /** * Execute the conversion for the provided source object. * @param source the source object to convert - * @param context the conversion context, useful for influencing the - * behavior of the converter + * @param context the conversion context, useful for influencing the behavior of the converter */ public Object execute(Object source, ConversionContext context) throws ConversionException { if (getTargetClass().isInstance(source)) { @@ -103,8 +102,8 @@ public class ConversionExecutor { return source; } if (source != null && !getSourceClass().isInstance(source)) { - throw new ConversionException(getSourceClass(), source, getTargetClass(), - "Source object '" + source + "' is expected to be an instance of " + getSourceClass()); + throw new ConversionException(getSourceClass(), source, getTargetClass(), "Source object '" + source + + "' is expected to be an instance of " + getSourceClass()); } return converter.convert(source, targetClass, context); } @@ -113,7 +112,7 @@ public class ConversionExecutor { if (!(o instanceof ConversionExecutor)) { return false; } - ConversionExecutor other = (ConversionExecutor)o; + ConversionExecutor other = (ConversionExecutor) o; return sourceClass.equals(other.sourceClass) && targetClass.equals(other.targetClass); } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionService.java b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionService.java index 3a1973fd..f435233a 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/ConversionService.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/ConversionService.java @@ -16,52 +16,44 @@ package org.springframework.binding.convert; /** - * A service interface for retrieving type conversion executors. The returned - * command objects are thread-safe and may be safely cached for use by client - * code. + * A service interface for retrieving type conversion executors. The returned command objects are thread-safe and may be + * safely cached for use by client code. * * @author Keith Donald */ public interface ConversionService { /** - * Return a conversion executor command object capable of converting source - * objects of the specified sourceClass to instances of the - * targetClass. + * Return a conversion executor command object capable of converting source objects of the specified + * sourceClass to instances of the targetClass. *

- * The returned ConversionExecutor is thread-safe and may safely be cached - * for use in client code. + * The returned ConversionExecutor is thread-safe and may safely be cached for use in client code. * @param sourceClass the source class to convert from * @param targetClass the target class to convert to * @return the executor that can execute instance conversion, never null - * @throws ConversionException an exception occured retrieving a converter - * for the source-to-target pair + * @throws ConversionException an exception occured retrieving a converter for the source-to-target pair */ - public ConversionExecutor getConversionExecutor(Class sourceClass, Class targetClass) - throws ConversionException; + public ConversionExecutor getConversionExecutor(Class sourceClass, Class targetClass) throws ConversionException; /** - * Return a conversion executor command object capable of converting source - * objects of the specified sourceClass to target objects of - * the type associated with the specified alias. + * Return a conversion executor command object capable of converting source objects of the specified + * sourceClass to target objects of the type associated with the specified alias. * @param sourceClass the sourceClass * @param targetAlias the target alias * @return the conversion executor, or null if the alias cannot be found - * @throws ConversionException an exception occured retrieving a converter - * for the source-to-target pair + * @throws ConversionException an exception occured retrieving a converter for the source-to-target pair */ public ConversionExecutor getConversionExecutorByTargetAlias(Class sourceClass, String targetAlias) throws ConversionException; /** - * Return all conversion executors capable of converting source objects of - * the the specified sourceClass. + * Return all conversion executors capable of converting source objects of the the specified + * sourceClass. * @param sourceClass the source class to convert from * @return the matching conversion executors * @throws ConversionException an exception occured retrieving the converters */ - public ConversionExecutor[] getConversionExecutorsForSource(Class sourceClass) - throws ConversionException; + public ConversionExecutor[] getConversionExecutorsForSource(Class sourceClass) throws ConversionException; /** * Return the class with the specified alias. diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/Converter.java b/spring-binding/src/main/java/org/springframework/binding/convert/Converter.java index 8ce04ca1..f1cb60e4 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/Converter.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/Converter.java @@ -16,8 +16,8 @@ package org.springframework.binding.convert; /** - * A type converter converts objects from one type to another. They may support - * conversion of multiple source types to multiple target types. + * A type converter converts objects from one type to another. They may support conversion of multiple source types to + * multiple target types. *

* Implementations of this interface are thread-safe. * @@ -38,14 +38,11 @@ public interface Converter { public Class[] getTargetClasses(); /** - * Convert the provided source object argument to an instance of the - * specified target class. - * @param source the source object to convert, its class must be one of the - * supported sourceClasses - * @param targetClass the target class to convert the source to, must be one - * of the supported targetClasses - * @param context an optional conversion context that may be used to - * influence the conversion process + * Convert the provided source object argument to an instance of the specified target class. + * @param source the source object to convert, its class must be one of the supported sourceClasses + * @param targetClass the target class to convert the source to, must be one of the supported + * targetClasses + * @param context an optional conversion context that may be used to influence the conversion process * @return the converted object, an instance of the target type * @throws ConversionException an exception occured during the conversion */ diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/AbstractConverter.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/AbstractConverter.java index eaa1db19..974845a2 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/AbstractConverter.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/AbstractConverter.java @@ -27,42 +27,36 @@ import org.springframework.binding.convert.Converter; public abstract class AbstractConverter implements Converter { /** - * Convenience convert method that converts the provided source to the first - * target object supported by this converter. Useful when a converter only - * supports conversion to a single target. + * Convenience convert method that converts the provided source to the first target object supported by this + * converter. Useful when a converter only supports conversion to a single target. * @param source the source to convert * @return the converted object - * @throws ConversionException an exception occured converting the source - * value + * @throws ConversionException an exception occured converting the source value */ public Object convert(Object source) throws ConversionException { return convert(source, getTargetClasses()[0], null); } /** - * Convenience convert method that converts the provided source to the - * target class specified with an empty conversion context. + * Convenience convert method that converts the provided source to the target class specified with an empty + * conversion context. * @param source the source to convert - * @param targetClass the target class to convert the source to, must be one - * of the supported targetClasses + * @param targetClass the target class to convert the source to, must be one of the supported + * targetClasses * @return the converted object - * @throws ConversionException an exception occured converting the source - * value + * @throws ConversionException an exception occured converting the source value */ public Object convert(Object source, Class targetClass) throws ConversionException { return convert(source, targetClass, null); } /** - * Convenience convert method that converts the provided source to the first - * target object supported by this converter. Useful when a converter only - * supports conversion to a single target. + * Convenience convert method that converts the provided source to the first target object supported by this + * converter. Useful when a converter only supports conversion to a single target. * @param source the source to convert - * @param context the conversion context, useful for influencing the - * behavior of the converter + * @param context the conversion context, useful for influencing the behavior of the converter * @return the converted object - * @throws ConversionException an exception occured converting the source - * value + * @throws ConversionException an exception occured converting the source value */ public Object convert(Object source, ConversionContext context) throws ConversionException { return convert(source, getTargetClasses()[0], context); @@ -71,11 +65,9 @@ public abstract class AbstractConverter implements Converter { public Object convert(Object source, Class targetClass, ConversionContext context) throws ConversionException { try { return doConvert(source, targetClass, context); - } - catch (ConversionException e) { + } catch (ConversionException e) { throw e; - } - catch (Throwable e) { + } catch (Throwable e) { // wrap in a ConversionException if (targetClass == null) { targetClass = getTargetClasses()[0]; @@ -85,15 +77,12 @@ public abstract class AbstractConverter implements Converter { } /** - * Template method subclasses should override to actually perform the type - * conversion. + * Template method subclasses should override to actually perform the type conversion. * @param source the source to convert from * @param targetClass the target type to convert to - * @param context an optional conversion context that may be used to - * influence the conversion process, could be null + * @param context an optional conversion context that may be used to influence the conversion process, could be null * @return the converted source value - * @throws Exception an exception occured, will be wrapped in a conversion - * exception if necessary + * @throws Exception an exception occured, will be wrapped in a conversion exception if necessary */ protected abstract Object doConvert(Object source, Class targetClass, ConversionContext context) throws Exception; diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/AbstractFormattingConverter.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/AbstractFormattingConverter.java index 40618875..e2acfcac 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/AbstractFormattingConverter.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/AbstractFormattingConverter.java @@ -18,9 +18,8 @@ package org.springframework.binding.convert.support; import org.springframework.binding.format.FormatterFactory; /** - * A converter that delegates to a formatter to perform the conversion. - * Formatters are typically not thread safe, so we use a FormatterFactory that - * is expected to provide us with thread-safe instances as necessary. + * A converter that delegates to a formatter to perform the conversion. Formatters are typically not thread safe, so we + * use a FormatterFactory that is expected to provide us with thread-safe instances as necessary. * * @author Keith Donald */ diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/CompositeConversionService.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/CompositeConversionService.java index a5192ef9..d44e5023 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/CompositeConversionService.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/CompositeConversionService.java @@ -25,16 +25,15 @@ import org.springframework.binding.convert.ConversionService; import org.springframework.util.Assert; /** - * A conversion service that delegates to an ordered chain of other conversion - * services. The first correct reply received from a conversion service in - * the chain is returned to the caller. + * A conversion service that delegates to an ordered chain of other conversion services. The first correct reply + * received from a conversion service in the chain is returned to the caller. * * @author Erwin Vervaet */ public class CompositeConversionService implements ConversionService { - + private ConversionService[] chain; - + /** * Create a new composite conversion service. * @param conversionServices the conversion services in the chain @@ -43,28 +42,24 @@ public class CompositeConversionService implements ConversionService { Assert.notNull(conversionServices, "The conversion services chain is required"); this.chain = conversionServices; } - + /** - * Returns the conversion services in the chain managed by this - * composite conversion service. + * Returns the conversion services in the chain managed by this composite conversion service. */ public ConversionService[] getConversionServices() { return chain; } - public ConversionExecutor getConversionExecutor(Class sourceClass, Class targetClass) - throws ConversionException { + public ConversionExecutor getConversionExecutor(Class sourceClass, Class targetClass) throws ConversionException { for (int i = 0; i < chain.length; i++) { try { return chain[i].getConversionExecutor(sourceClass, targetClass); - } - catch (ConversionException e) { + } catch (ConversionException e) { // ignore and try the next conversion service in the chain } } - throw new ConversionException(sourceClass, targetClass, - "No converter registered to convert from sourceClass '" + sourceClass + - "' to target class '" + targetClass + "'"); + throw new ConversionException(sourceClass, targetClass, "No converter registered to convert from sourceClass '" + + sourceClass + "' to target class '" + targetClass + "'"); } public ConversionExecutor getConversionExecutorByTargetAlias(Class sourceClass, String targetAlias) @@ -76,29 +71,25 @@ public class CompositeConversionService implements ConversionService { if (res != null) { return res; } - } - catch (ConversionException e) { + } catch (ConversionException e) { exceptionThrown = true; } } if (exceptionThrown) { - throw new ConversionException(sourceClass, - "No converter registered to convert from sourceClass '" + sourceClass + - "' to aliased target type '" + targetAlias + "'"); - } - else { + throw new ConversionException(sourceClass, "No converter registered to convert from sourceClass '" + + sourceClass + "' to aliased target type '" + targetAlias + "'"); + } else { // alias was not recognized by any conversion service in the chain return null; } } - public ConversionExecutor[] getConversionExecutorsForSource(Class sourceClass) - throws ConversionException { + public ConversionExecutor[] getConversionExecutorsForSource(Class sourceClass) throws ConversionException { Set executors = new HashSet(); for (int i = 0; i < chain.length; i++) { executors.addAll(Arrays.asList(chain[i].getConversionExecutorsForSource(sourceClass))); } - return (ConversionExecutor[])executors.toArray(new ConversionExecutor[executors.size()]); + return (ConversionExecutor[]) executors.toArray(new ConversionExecutor[executors.size()]); } public Class getClassByAlias(String alias) throws ConversionException { @@ -108,8 +99,7 @@ public class CompositeConversionService implements ConversionService { if (res != null) { return res; } - } - catch (ConversionException e) { + } catch (ConversionException e) { // ignore and try the next conversion service in the chain } } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/ConversionServiceAware.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/ConversionServiceAware.java index 0ccc87ac..5c5f1686 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/ConversionServiceAware.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/ConversionServiceAware.java @@ -18,16 +18,14 @@ package org.springframework.binding.convert.support; import org.springframework.binding.convert.ConversionService; /** - * Marker interface that denotes an object has a dependency on a conversion - * service that is expected to be fulfilled. + * Marker interface that denotes an object has a dependency on a conversion service that is expected to be fulfilled. * * @author Keith Donald */ public interface ConversionServiceAware { /** - * Set the conversion service this object should be made aware of (as it - * presumably depends on it). + * Set the conversion service this object should be made aware of (as it presumably depends on it). * * @param conversionService the conversion service */ diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/ConversionServiceAwareConverter.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/ConversionServiceAwareConverter.java index 4f095cdd..1c5bc8b4 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/ConversionServiceAwareConverter.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/ConversionServiceAwareConverter.java @@ -20,8 +20,7 @@ import org.springframework.binding.convert.ConversionService; import org.springframework.binding.expression.Expression; /** - * Base class for converters that use other converters to convert things, thus - * they are conversion-service aware. + * Base class for converters that use other converters to convert things, thus they are conversion-service aware. * * @author Keith Donald */ @@ -33,8 +32,8 @@ public abstract class ConversionServiceAwareConverter extends AbstractConverter private ConversionService conversionService; /** - * Default constructor, expectes to conversion service to be injected - * using {@link #setConversionService(ConversionService)}. + * Default constructor, expectes to conversion service to be injected using + * {@link #setConversionService(ConversionService)}. */ protected ConversionServiceAwareConverter() { } @@ -61,8 +60,7 @@ public abstract class ConversionServiceAwareConverter extends AbstractConverter } /** - * Returns a conversion executor capable of converting string objects to the - * specified target class. + * Returns a conversion executor capable of converting string objects to the specified target class. * @param targetClass the target class * @return the conversion executor, never null */ @@ -71,19 +69,17 @@ public abstract class ConversionServiceAwareConverter extends AbstractConverter } /** - * Returns a conversion executor capable of converting string objects to the - * target class aliased by the provided alias. + * Returns a conversion executor capable of converting string objects to the target class aliased by the provided + * alias. * @param targetAlias the target class alias, e.g "long" or "float" - * @return the conversion executor, or null if no suitable - * converter exists for alias + * @return the conversion executor, or null if no suitable converter exists for alias */ protected ConversionExecutor fromStringToAliased(String targetAlias) { return getConversionService().getConversionExecutorByTargetAlias(String.class, targetAlias); } /** - * Returns a conversion executor capable of converting objects from one - * class to another. + * Returns a conversion executor capable of converting objects from one class to another. * @param sourceClass the source class to convert from * @param targetClass the target class to convert to * @return the conversion executor, never null @@ -93,12 +89,12 @@ public abstract class ConversionServiceAwareConverter extends AbstractConverter } /** - * Helper that parsers the given expression string into an expression, using - * the installed String->Expression converter. + * Helper that parsers the given expression string into an expression, using the installed String->Expression + * converter. * @param expressionString the expression string to parse * @return the parsed, evaluatable expression */ protected Expression parseExpression(String expressionString) { - return (Expression)fromStringTo(Expression.class).execute(expressionString); + return (Expression) fromStringTo(Expression.class).execute(expressionString); } } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/ConverterPropertyEditorAdapter.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/ConverterPropertyEditorAdapter.java index dcf95faf..27ed638d 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/ConverterPropertyEditorAdapter.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/ConverterPropertyEditorAdapter.java @@ -23,9 +23,8 @@ import org.springframework.util.Assert; /** * Adapts a Converter to the PropertyEditor interface. *

- * Note: with a converter, only forward conversion from-string-to-value is - * supported. Value-to-string conversion is not supported. If you need this - * capability, use a Formatter with a FormatterPropertyEditor adapter. + * Note: with a converter, only forward conversion from-string-to-value is supported. Value-to-string conversion is not + * supported. If you need this capability, use a Formatter with a FormatterPropertyEditor adapter. * * @see org.springframework.binding.format.Formatter * @see org.springframework.binding.format.support.FormatterPropertyEditor diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/CustomConverterConfigurer.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/CustomConverterConfigurer.java index 9bf14643..e5e2af11 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/CustomConverterConfigurer.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/CustomConverterConfigurer.java @@ -24,12 +24,10 @@ import org.springframework.binding.convert.ConversionService; import org.springframework.util.Assert; /** - * Registers all 'from string' converters known to a conversion service with - * a Spring bean factory. + * Registers all 'from string' converters known to a conversion service with a Spring bean factory. *

- * Acts as bean factory post processor, registering property editor adapters for - * each supported conversion with a java.lang.String sourceClass. - * This makes for very convenient use with the Spring container. + * Acts as bean factory post processor, registering property editor adapters for each supported conversion with a + * java.lang.String sourceClass. This makes for very convenient use with the Spring container. * * @author Keith Donald */ diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/DefaultConversionService.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/DefaultConversionService.java index e198e9fd..8b995fde 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/DefaultConversionService.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/DefaultConversionService.java @@ -22,17 +22,15 @@ import org.springframework.binding.format.support.SimpleFormatterFactory; import org.springframework.core.enums.LabeledEnum; /** - * Default, local implementation of a conversion service. Will automatically - * register from string converters for a number of standard Java - * types like Class, Number, Boolean and so on. + * Default, local implementation of a conversion service. Will automatically register from string converters for + * a number of standard Java types like Class, Number, Boolean and so on. * * @author Keith Donald */ public class DefaultConversionService extends GenericConversionService { /** - * Creates a new default conversion service, installing the default - * converters. + * Creates a new default conversion service, installing the default converters. */ public DefaultConversionService() { addDefaultConverters(); @@ -46,7 +44,7 @@ public class DefaultConversionService extends GenericConversionService { addConverter(new TextToNumber(new SimpleFormatterFactory())); addConverter(new TextToBoolean()); addConverter(new TextToLabeledEnum()); - + // we're not using addDefaultAlias here for efficiency reasons addAlias("string", String.class); addAlias("short", Short.class); diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/GenericConversionService.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/GenericConversionService.java index f4299f8a..61aea74b 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/GenericConversionService.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/GenericConversionService.java @@ -33,24 +33,21 @@ import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; /** - * Base implementation of a conversion service. Initially empty, e.g. no converters - * are registered by default. + * Base implementation of a conversion service. Initially empty, e.g. no converters are registered by default. * * @author Keith Donald */ public class GenericConversionService implements ConversionService { /** - * An indexed map of converters. Each entry key is a source class that can - * be converted from, and each entry value is a map of target classes that - * can be convertered to, ultimately mapping to a specific converter that - * can perform the source->target conversion. + * An indexed map of converters. Each entry key is a source class that can be converted from, and each entry value + * is a map of target classes that can be convertered to, ultimately mapping to a specific converter that can + * perform the source->target conversion. */ private Map sourceClassConverters = new HashMap(); /** - * A map of string aliases to convertible classes. Allows lookup of - * converters by alias. + * A map of string aliases to convertible classes. Allows lookup of converters by alias. */ private Map aliasMap = new HashMap(); @@ -74,16 +71,15 @@ public class GenericConversionService implements ConversionService { } /** - * Add given converter to this conversion service. If the converter is - * {@link ConversionServiceAware}, it will get the conversion service - * injected. + * Add given converter to this conversion service. If the converter is {@link ConversionServiceAware}, it will get + * the conversion service injected. */ public void addConverter(Converter converter) { Class[] sourceClasses = converter.getSourceClasses(); Class[] targetClasses = converter.getTargetClasses(); for (int i = 0; i < sourceClasses.length; i++) { Class sourceClass = sourceClasses[i]; - Map sourceMap = (Map)sourceClassConverters.get(sourceClass); + Map sourceMap = (Map) sourceClassConverters.get(sourceClass); if (sourceMap == null) { sourceMap = new HashMap(); sourceClassConverters.put(sourceClass, sourceMap); @@ -94,14 +90,13 @@ public class GenericConversionService implements ConversionService { } } if (converter instanceof ConversionServiceAware) { - ((ConversionServiceAware)converter).setConversionService(this); + ((ConversionServiceAware) converter).setConversionService(this); } } /** - * Add all given converters. If the converters are - * {@link ConversionServiceAware}, they will get the conversion service - * injected. + * Add all given converters. If the converters are {@link ConversionServiceAware}, they will get the conversion + * service injected. */ public void addConverters(Converter[] converters) { for (int i = 0; i < converters.length; i++) { @@ -110,9 +105,8 @@ public class GenericConversionService implements ConversionService { } /** - * Add given converter with an alias to the conversion service. If the - * converter is {@link ConversionServiceAware}, it will get the conversion - * service injected. + * Add given converter with an alias to the conversion service. If the converter is {@link ConversionServiceAware}, + * it will get the conversion service injected. */ public void addConverter(Converter converter, String alias) { aliasMap.put(alias, converter); @@ -127,8 +121,8 @@ public class GenericConversionService implements ConversionService { } /** - * Generate a conventions based alias for given target type. For instance, - * "java.lang.Boolean" will get the "boolean" alias. + * Generate a conventions based alias for given target type. For instance, "java.lang.Boolean" will get the + * "boolean" alias. */ public void addDefaultAlias(Class targetType) { addAlias(StringUtils.uncapitalize(ClassUtils.getShortName(targetType)), targetType); @@ -148,16 +142,14 @@ public class GenericConversionService implements ConversionService { if (converter != null) { // we found a converter return new ConversionExecutor(sourceClass, targetClass, converter); - } - else { + } else { if (parent != null) { // try the parent return parent.getConversionExecutor(sourceClass, targetClass); - } - else { + } else { throw new ConversionException(sourceClass, targetClass, - "No converter registered to convert from sourceClass '" + sourceClass + - "' to target class '" + targetClass + "'"); + "No converter registered to convert from sourceClass '" + sourceClass + "' to target class '" + + targetClass + "'"); } } } @@ -172,18 +164,15 @@ public class GenericConversionService implements ConversionService { if (parent != null) { // try the parent return parent.getConversionExecutorByTargetAlias(sourceClass, alias); - } - else { + } else { // not aliased return null; } - } - else if (targetType instanceof Class) { - return getConversionExecutor(sourceClass, (Class)targetType); - } - else { + } else if (targetType instanceof Class) { + return getConversionExecutor(sourceClass, (Class) targetType); + } else { Assert.isInstanceOf(Converter.class, targetType, "Not a converter: "); - Converter conv = (Converter)targetType; + Converter conv = (Converter) targetType; return new ConversionExecutor(sourceClass, Object.class, conv); } } @@ -195,23 +184,22 @@ public class GenericConversionService implements ConversionService { if (parent != null) { // use the parent return parent.getConversionExecutorsForSource(sourceClass); - } - else { + } else { // no converters for source class return new ConversionExecutor[0]; } - } - else { + } else { Set executors = new HashSet(); if (parent != null) { executors.addAll(Arrays.asList(parent.getConversionExecutorsForSource(sourceClass))); } Iterator it = sourceTargetConverters.entrySet().iterator(); while (it.hasNext()) { - Map.Entry entry = (Map.Entry)it.next(); - executors.add(new ConversionExecutor(sourceClass, (Class)entry.getKey(), (Converter)entry.getValue())); + Map.Entry entry = (Map.Entry) it.next(); + executors + .add(new ConversionExecutor(sourceClass, (Class) entry.getKey(), (Converter) entry.getValue())); } - return (ConversionExecutor[])executors.toArray(new ConversionExecutor[executors.size()]); + return (ConversionExecutor[]) executors.toArray(new ConversionExecutor[executors.size()]); } } @@ -220,28 +208,26 @@ public class GenericConversionService implements ConversionService { Object clazz = aliasMap.get(alias); if (clazz != null) { Assert.isInstanceOf(Class.class, clazz, "Not a Class alias '" + alias + "': "); - return (Class)clazz; - } - else { + return (Class) clazz; + } else { if (parent != null) { - // try parent service - return parent.getClassByAlias(alias); - } - else { + // try parent service + return parent.getClassByAlias(alias); + } else { // alias does not index a class, return null return null; } } } - + // internal helpers private Map findConvertersForSource(Class sourceClass) { LinkedList classQueue = new LinkedList(); classQueue.addFirst(sourceClass); while (!classQueue.isEmpty()) { - sourceClass = (Class)classQueue.removeLast(); - Map sourceTargetConverters = (Map)sourceClassConverters.get(sourceClass); + sourceClass = (Class) classQueue.removeLast(); + Map sourceTargetConverters = (Map) sourceClassConverters.get(sourceClass); if (sourceTargetConverters != null && !sourceTargetConverters.isEmpty()) { return sourceTargetConverters; } @@ -261,8 +247,8 @@ public class GenericConversionService implements ConversionService { LinkedList classQueue = new LinkedList(); classQueue.addFirst(targetClass); while (!classQueue.isEmpty()) { - targetClass = (Class)classQueue.removeLast(); - Converter converter = (Converter)sourceTargetConverters.get(targetClass); + targetClass = (Class) classQueue.removeLast(); + Converter converter = (Converter) sourceTargetConverters.get(targetClass); if (converter != null) { return converter; } @@ -277,13 +263,12 @@ public class GenericConversionService implements ConversionService { } return null; } - + // subclassing support /** - * Returns an indexed map of converters. Each entry key is a source class that - * can be converted from, and each entry value is a map of target classes that - * can be convertered to, ultimately mapping to a specific converter that can + * Returns an indexed map of converters. Each entry key is a source class that can be converted from, and each entry + * value is a map of target classes that can be convertered to, ultimately mapping to a specific converter that can * perform the source->target conversion. */ protected Map getSourceClassConverters() { @@ -291,8 +276,8 @@ public class GenericConversionService implements ConversionService { } /** - * Returns a map of known aliases. Each entry key is a String alias and the - * associated value is either a target class or a converter. + * Returns a map of known aliases. Each entry key is a String alias and the associated value is either a target + * class or a converter. */ protected Map getAliasMap() { return aliasMap; diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToBoolean.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToBoolean.java index 0c2d5b9e..459cd1e1 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToBoolean.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToBoolean.java @@ -19,8 +19,7 @@ import org.springframework.binding.convert.ConversionContext; import org.springframework.util.StringUtils; /** - * Converts a textual representation of a boolean object to a Boolean - * instance. + * Converts a textual representation of a boolean object to a Boolean instance. * * @author Keith Donald */ @@ -54,8 +53,8 @@ public class TextToBoolean extends AbstractConverter { } /** - * Create a text to boolean converter. Take given special string representations - * of true and false into account. + * Create a text to boolean converter. Take given special string representations of true and false into + * account. * @param trueString special true string to consider * @param falseString special false string to consider */ @@ -73,27 +72,22 @@ public class TextToBoolean extends AbstractConverter { } protected Object doConvert(Object source, Class targetClass, ConversionContext context) throws Exception { - String text = (String)source; + String text = (String) source; if (!StringUtils.hasText(text)) { return null; - } - else if (this.trueString != null && text.equalsIgnoreCase(this.trueString)) { + } else if (this.trueString != null && text.equalsIgnoreCase(this.trueString)) { return Boolean.TRUE; - } - else if (this.falseString != null && text.equalsIgnoreCase(this.falseString)) { + } else if (this.falseString != null && text.equalsIgnoreCase(this.falseString)) { return Boolean.FALSE; - } - else if (this.trueString == null + } else if (this.trueString == null && (text.equalsIgnoreCase(VALUE_TRUE) || text.equalsIgnoreCase(VALUE_ON) || text.equalsIgnoreCase(VALUE_YES) || text.equals(VALUE_1))) { return Boolean.TRUE; - } - else if (this.falseString == null + } else if (this.falseString == null && (text.equalsIgnoreCase(VALUE_FALSE) || text.equalsIgnoreCase(VALUE_OFF) || text.equalsIgnoreCase(VALUE_NO) || text.equals(VALUE_0))) { return Boolean.FALSE; - } - else { + } else { throw new IllegalArgumentException("Invalid boolean value [" + text + "]"); } } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToClass.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToClass.java index ad0e7e89..6576c2e8 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToClass.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToClass.java @@ -21,8 +21,7 @@ import org.springframework.util.ClassUtils; import org.springframework.util.StringUtils; /** - * Converts a textual representation of a class object to a Class - * instance. + * Converts a textual representation of a class object to a Class instance. * * @author Keith Donald */ @@ -41,19 +40,17 @@ public class TextToClass extends ConversionServiceAwareConverter { } protected Object doConvert(Object source, Class targetClass, ConversionContext context) throws Exception { - String text = (String)source; + String text = (String) source; if (StringUtils.hasText(text)) { String classNameOrAlias = text.trim(); if (classNameOrAlias.startsWith(CLASS_PREFIX)) { return ClassUtils.forName(text.substring(CLASS_PREFIX.length())); - } - else if (classNameOrAlias.startsWith(ALIAS_PREFIX)) { + } else if (classNameOrAlias.startsWith(ALIAS_PREFIX)) { String alias = text.substring(ALIAS_PREFIX.length()); Class clazz = getConversionService().getClassByAlias(alias); Assert.notNull(clazz, "No class found associated with type alias '" + alias + "'"); return clazz; - } - else { + } else { // try first an aliased based lookup if (getConversionService() != null) { Class aliasedClass = getConversionService().getClassByAlias(classNameOrAlias); @@ -64,8 +61,7 @@ public class TextToClass extends ConversionServiceAwareConverter { // treat as a class name return ClassUtils.forName(classNameOrAlias); } - } - else { + } else { return null; } } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToExpression.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToExpression.java index c632d1ad..311d3d36 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToExpression.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToExpression.java @@ -62,11 +62,10 @@ public class TextToExpression extends AbstractConverter { } protected Object doConvert(Object source, Class targetClass, ConversionContext context) throws Exception { - String expressionString = (String)source; + String expressionString = (String) source; if (getExpressionParser().isDelimitedExpression(expressionString)) { - return getExpressionParser().parseExpression((String)source); - } - else { + return getExpressionParser().parseExpression((String) source); + } else { return new StaticExpression(expressionString); } } diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToLabeledEnum.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToLabeledEnum.java index 441f86ad..cebaaef3 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToLabeledEnum.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToLabeledEnum.java @@ -20,8 +20,7 @@ import org.springframework.binding.format.support.LabeledEnumFormatter; import org.springframework.core.enums.LabeledEnum; /** - * Converter that converts textual representations of enum - * instances to a specific instance of LabeledEnum. + * Converter that converts textual representations of enum instances to a specific instance of LabeledEnum. * * @author Keith Donald */ @@ -38,6 +37,6 @@ public class TextToLabeledEnum extends AbstractConverter { } protected Object doConvert(Object source, Class targetClass, ConversionContext context) throws Exception { - return labeledEnumFormatter.parseValue((String)source, targetClass); + return labeledEnumFormatter.parseValue((String) source, targetClass); } } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToNumber.java b/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToNumber.java index 050a06eb..9f67a642 100644 --- a/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToNumber.java +++ b/spring-binding/src/main/java/org/springframework/binding/convert/support/TextToNumber.java @@ -23,8 +23,8 @@ import org.springframework.binding.format.FormatterFactory; import org.springframework.binding.format.support.SimpleFormatterFactory; /** - * Converts textual representations of numbers to a Number - * specialization. Delegates to a synchronized formatter to parse text strings. + * Converts textual representations of numbers to a Number specialization. Delegates to a synchronized + * formatter to parse text strings. * * @author Keith Donald */ @@ -55,6 +55,6 @@ public class TextToNumber extends AbstractFormattingConverter { } protected Object doConvert(Object source, Class targetClass, ConversionContext context) throws Exception { - return getFormatterFactory().getNumberFormatter(targetClass).parseValue((String)source, targetClass); + return getFormatterFactory().getNumberFormatter(targetClass).parseValue((String) source, targetClass); } } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationAttempt.java b/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationAttempt.java index d011e73d..f2a50bc3 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationAttempt.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationAttempt.java @@ -77,7 +77,6 @@ public class EvaluationAttempt { } protected ToStringCreator createToString(ToStringCreator creator) { - return creator.append("expression", expression).append("target", target).append("context", - context); + return creator.append("expression", expression).append("target", target).append("context", context); } } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationContext.java b/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationContext.java index dcd2c972..26231287 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationContext.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationContext.java @@ -20,10 +20,8 @@ import java.util.Map; /** * A context object with two main responsibities: *

    - *
  1. Exposing information to an expression to influence - * an evaluation attempt. - *
  2. Providing operations for recording progress or - * errors during the expression evaluation process. + *
  3. Exposing information to an expression to influence an evaluation attempt. + *
  4. Providing operations for recording progress or errors during the expression evaluation process. *
* * @author Keith Donald diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationException.java b/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationException.java index e28e1160..bde5e58b 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationException.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/EvaluationException.java @@ -25,8 +25,7 @@ import org.springframework.core.NestedRuntimeException; public class EvaluationException extends NestedRuntimeException { /** - * The evaluation attempt that failed. - * Transient because an EvaluationAttempt is not serializable. + * The evaluation attempt that failed. Transient because an EvaluationAttempt is not serializable. */ private transient EvaluationAttempt evaluationAttempt; diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/Expression.java b/spring-binding/src/main/java/org/springframework/binding/expression/Expression.java index b944f12b..62c00e8c 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/Expression.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/Expression.java @@ -16,17 +16,16 @@ package org.springframework.binding.expression; /** - * Evaluates a single parsed expression on the provided input object in the - * specified context. This provides a common abstraction for expression - * evaluation independent of any language like OGNL or Spring's BeanWrapper. + * Evaluates a single parsed expression on the provided input object in the specified context. This provides a common + * abstraction for expression evaluation independent of any language like OGNL or Spring's BeanWrapper. * * @author Keith Donald */ public interface Expression { /** - * Evaluate the expression encapsulated by this evaluator against the - * provided target object and return the result of the evaluation. + * Evaluate the expression encapsulated by this evaluator against the provided target object and return the result + * of the evaluation. * @param target the target of the expression * @param context the expression evaluation context * @return the evaluation result diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/ExpressionParser.java b/spring-binding/src/main/java/org/springframework/binding/expression/ExpressionParser.java index bd088930..8692af31 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/ExpressionParser.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/ExpressionParser.java @@ -16,24 +16,23 @@ package org.springframework.binding.expression; /** - * Parses expression strings, returing a configured evaluator instance capable - * of performing parsed expression evaluation in a thread safe way. + * Parses expression strings, returing a configured evaluator instance capable of performing parsed expression + * evaluation in a thread safe way. * * @author Keith Donald */ public interface ExpressionParser { /** - * Is this expression string delimited in a manner that indicates it is a - * parseable expression? For example "${expression}". + * Is this expression string delimited in a manner that indicates it is a parseable expression? For example + * "${expression}". * @param expressionString the proposed expression string * @return true if yes, false if not */ public boolean isDelimitedExpression(String expressionString); /** - * Parse the provided expression string, returning an evaluator capable of - * evaluating it against input. + * Parse the provided expression string, returning an evaluator capable of evaluating it against input. * @param expressionString the parseable expression string * @return the evaluator for the parsed expression * @throws ParserException an exception occured during parsing @@ -41,13 +40,12 @@ public interface ExpressionParser { public Expression parseExpression(String expressionString) throws ParserException; /** - * Parse the provided settable expression string, returning an evaluator - * capable of evaluating its value as well as setting its value. + * Parse the provided settable expression string, returning an evaluator capable of evaluating its value as well as + * setting its value. * @param expressionString the parseable expression string * @return the evaluator for the parsed expression * @throws ParserException an exception occured during parsing - * @throws UnsupportedOperationException this parser does not support - * settable expressions + * @throws UnsupportedOperationException this parser does not support settable expressions */ public SettableExpression parseSettableExpression(String expressionString) throws ParserException, UnsupportedOperationException; diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/SetValueAttempt.java b/spring-binding/src/main/java/org/springframework/binding/expression/SetValueAttempt.java index 242f4f46..e4b2b9cd 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/SetValueAttempt.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/SetValueAttempt.java @@ -25,7 +25,7 @@ import org.springframework.core.style.ToStringCreator; public class SetValueAttempt extends EvaluationAttempt { /** - * The new value. + * The new value. */ private Object value; diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/SettableExpression.java b/spring-binding/src/main/java/org/springframework/binding/expression/SettableExpression.java index 48ba4ea3..e5949084 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/SettableExpression.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/SettableExpression.java @@ -16,16 +16,14 @@ package org.springframework.binding.expression; /** - * An evaluator that is capable of setting a value on a target object at the - * path defined by this expression. + * An evaluator that is capable of setting a value on a target object at the path defined by this expression. * * @author Keith Donald */ public interface SettableExpression extends Expression { /** - * Evaluate this expression against the target object to set its value to - * the value provided. + * Evaluate this expression against the target object to set its value to the value provided. * @param target the target object * @param value the new value to be set * @param context the evaluation context diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/support/AbstractExpressionParser.java b/spring-binding/src/main/java/org/springframework/binding/expression/support/AbstractExpressionParser.java index a5a21bb3..e2cddb83 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/support/AbstractExpressionParser.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/support/AbstractExpressionParser.java @@ -91,12 +91,10 @@ public abstract class AbstractExpressionParser implements ExpressionParser { int suffixIndex = expressionString.indexOf(getExpressionSuffix(), prefixIndex); if (suffixIndex == -1) { return false; - } - else { + } else { if (suffixIndex == prefixIndex + getExpressionPrefix().length()) { return false; - } - else { + } else { return true; } } @@ -106,30 +104,27 @@ public abstract class AbstractExpressionParser implements ExpressionParser { Expression[] expressions = parseExpressions(expressionString); if (expressions.length == 1) { return expressions[0]; - } - else { + } else { return new CompositeStringExpression(expressions); } } - public final SettableExpression parseSettableExpression(String expressionString) - throws ParserException, UnsupportedOperationException { + public final SettableExpression parseSettableExpression(String expressionString) throws ParserException, + UnsupportedOperationException { expressionString = expressionString.trim(); // a settable expression should just be a single expression if (expressionString.startsWith(getExpressionPrefix()) && expressionString.endsWith(getExpressionSuffix())) { - expressionString = expressionString.substring(getExpressionPrefix().length(), - expressionString.length() - getExpressionSuffix().length()); + expressionString = expressionString.substring(getExpressionPrefix().length(), expressionString.length() + - getExpressionSuffix().length()); } return doParseSettableExpression(expressionString); } /** - * Helper that parses given expression string using the configured parser. - * The expression string can contain any number of expressions all contained - * in "${...}" markers. For instance: "foo${expr0}bar${expr1}". The static - * pieces of text will also be returned as Expressions that just return that - * static piece of text. As a result, evaluating all returned expressions - * and concatenating the results produces the complete evaluated string. + * Helper that parses given expression string using the configured parser. The expression string can contain any + * number of expressions all contained in "${...}" markers. For instance: "foo${expr0}bar${expr1}". The static + * pieces of text will also be returned as Expressions that just return that static piece of text. As a result, + * evaluating all returned expressions and concatenating the results produces the complete evaluated string. * @param expressionString the expression string * @return the parsed expressions * @throws ParserException when the expressions cannot be parsed @@ -146,74 +141,64 @@ public abstract class AbstractExpressionParser implements ExpressionParser { expressions.add(new StaticExpression(expressionString.substring(startIdx, prefixIndex))); startIdx = prefixIndex; } - int nextPrefixIndex = expressionString.indexOf(getExpressionPrefix(), - prefixIndex + getExpressionPrefix().length()); + int nextPrefixIndex = expressionString.indexOf(getExpressionPrefix(), prefixIndex + + getExpressionPrefix().length()); int suffixIndex; - if (nextPrefixIndex == -1) { + if (nextPrefixIndex == -1) { // this is the last expression in the expression string - suffixIndex = expressionString.lastIndexOf(getExpressionSuffix()); - } - else { + suffixIndex = expressionString.lastIndexOf(getExpressionSuffix()); + } else { // another expression exists after this one in the expression string - suffixIndex = expressionString.lastIndexOf(getExpressionSuffix(), nextPrefixIndex); - } + suffixIndex = expressionString.lastIndexOf(getExpressionSuffix(), nextPrefixIndex); + } if (suffixIndex < (prefixIndex + getExpressionPrefix().length())) { throw new ParserException(expressionString, "No ending suffix '" + getExpressionSuffix() + "' for expression starting at character " + prefixIndex + ": " + expressionString.substring(prefixIndex), null); - } - else if (suffixIndex == prefixIndex + getExpressionPrefix().length()) { + } else if (suffixIndex == prefixIndex + getExpressionPrefix().length()) { throw new ParserException(expressionString, "No expression defined within delimiter '" - + getExpressionPrefix() + getExpressionSuffix() + "' at character " + prefixIndex, - null); - } - else { + + getExpressionPrefix() + getExpressionSuffix() + "' at character " + prefixIndex, null); + } else { String expr = expressionString.substring(prefixIndex + getExpressionPrefix().length(), suffixIndex); expressions.add(doParseExpression(expr)); startIdx = suffixIndex + 1; } - } - else { + } else { if (startIdx == 0) { // treat entire string as one expression expressions.add(doParseExpression(expressionString)); - } - else { + } else { // no more ${expressions} found in string expressions.add(new StaticExpression(expressionString.substring(startIdx))); } startIdx = expressionString.length(); } } - } - else { + } else { expressions.add(new StaticExpression(expressionString)); } return (Expression[]) expressions.toArray(new Expression[expressions.size()]); } - + // template methods /** - * Template method for parsing a filtered expression string. Subclasses should - * override. + * Template method for parsing a filtered expression string. Subclasses should override. * @param expressionString the expression string * @return the parsed expression * @throws ParserException an exception occured during parsing */ protected abstract Expression doParseExpression(String expressionString) throws ParserException; - + /** - * Template method for parsing a filtered settable expression string. Subclasses - * should override. + * Template method for parsing a filtered settable expression string. Subclasses should override. * @param expressionString the expression string * @return the parsed expression * @throws ParserException an exception occured during parsing - * @throws UnsupportedOperationException this parser does not support - * settable expressions + * @throws UnsupportedOperationException this parser does not support settable expressions */ - protected abstract SettableExpression doParseSettableExpression(String expressionString) - throws ParserException, UnsupportedOperationException; + protected abstract SettableExpression doParseSettableExpression(String expressionString) throws ParserException, + UnsupportedOperationException; } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/support/BeanWrapperExpression.java b/spring-binding/src/main/java/org/springframework/binding/expression/support/BeanWrapperExpression.java index 170be0c3..1e67ed4c 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/support/BeanWrapperExpression.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/support/BeanWrapperExpression.java @@ -48,15 +48,14 @@ class BeanWrapperExpression implements SettableExpression { if (!(o instanceof BeanWrapperExpression)) { return false; } - BeanWrapperExpression other = (BeanWrapperExpression)o; + BeanWrapperExpression other = (BeanWrapperExpression) o; return expression.equals(other.expression); } public Object evaluate(Object target, EvaluationContext context) throws EvaluationException { try { return new BeanWrapperImpl(target).getPropertyValue(expression); - } - catch (BeansException e) { + } catch (BeansException e) { throw new EvaluationException(new EvaluationAttempt(this, target, context), e); } } @@ -65,8 +64,7 @@ class BeanWrapperExpression implements SettableExpression { try { Assert.notNull(target, "The target object to evaluate is required"); new BeanWrapperImpl(target).setPropertyValue(expression, value); - } - catch (BeansException e) { + } catch (BeansException e) { throw new EvaluationException(new SetValueAttempt(this, target, value, context), e); } } diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/support/BeanWrapperExpressionParser.java b/spring-binding/src/main/java/org/springframework/binding/expression/support/BeanWrapperExpressionParser.java index abea91ff..bd4f6b96 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/support/BeanWrapperExpressionParser.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/support/BeanWrapperExpressionParser.java @@ -25,7 +25,7 @@ import org.springframework.binding.expression.SettableExpression; * @author Keith Donald */ public class BeanWrapperExpressionParser extends AbstractExpressionParser { - + protected Expression doParseExpression(String expressionString) throws ParserException { return doParseSettableExpression(expressionString); } diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/support/CollectionAddingExpression.java b/spring-binding/src/main/java/org/springframework/binding/expression/support/CollectionAddingExpression.java index 82d206f1..e18136a6 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/support/CollectionAddingExpression.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/support/CollectionAddingExpression.java @@ -27,7 +27,7 @@ import org.springframework.util.Assert; /** * A settable expression that adds non-null values to a collection. - * + * * @author Keith Donald */ public class CollectionAddingExpression implements SettableExpression { @@ -52,13 +52,13 @@ public class CollectionAddingExpression implements SettableExpression { public void evaluateToSet(Object target, Object value, EvaluationContext context) throws EvaluationException { Object result = evaluate(target, context); if (result == null) { - throw new EvaluationException(new SetValueAttempt(this, target, value, null), - new IllegalArgumentException("The collection expression evaluated to a [null] reference")); + throw new EvaluationException(new SetValueAttempt(this, target, value, null), new IllegalArgumentException( + "The collection expression evaluated to a [null] reference")); } Assert.isInstanceOf(Collection.class, result, "Not a collection: "); if (value != null) { // add the value to the collection - ((Collection)result).add(value); + ((Collection) result).add(value); } } diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/support/CompositeStringExpression.java b/spring-binding/src/main/java/org/springframework/binding/expression/support/CompositeStringExpression.java index 3070894c..89ce2581 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/support/CompositeStringExpression.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/support/CompositeStringExpression.java @@ -34,8 +34,8 @@ public class CompositeStringExpression implements Expression { /** * Creates a new composite string expression. - * @param expressions the ordered set of expressions that when evaluated - * will have their results stringed together to build the composite string + * @param expressions the ordered set of expressions that when evaluated will have their results stringed together + * to build the composite string */ public CompositeStringExpression(Expression[] expressions) { this.expressions = expressions; diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/support/OgnlExpression.java b/spring-binding/src/main/java/org/springframework/binding/expression/support/OgnlExpression.java index 3f6d2fd4..b4d9ef36 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/support/OgnlExpression.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/support/OgnlExpression.java @@ -31,9 +31,8 @@ import org.springframework.util.Assert; /** * Evaluates a parsed Ognl expression. *

- * IMPLEMENTATION NOTE: Ognl 2.6.7 expression objects do not respect equality - * properly, so the equality operations defined within this class do not - * function properly. + * IMPLEMENTATION NOTE: Ognl 2.6.7 expression objects do not respect equality properly, so the equality operations + * defined within this class do not function properly. * * @author Keith Donald */ @@ -71,14 +70,12 @@ class OgnlExpression implements SettableExpression { Map contextAttributes = (context != null ? context.getAttributes() : Collections.EMPTY_MAP); try { return Ognl.getValue(expression, contextAttributes, target); - } - catch (OgnlException e) { + } catch (OgnlException e) { if (e.getReason() != null && e.getReason() != e) { // unwrap the OgnlException since the actual exception is wrapped inside it // and there is not generic (getCause) way to get to it later on throw new EvaluationException(new EvaluationAttempt(this, target, context), e.getReason()); - } - else { + } else { throw new EvaluationException(new EvaluationAttempt(this, target, context), e); } } @@ -89,8 +86,7 @@ class OgnlExpression implements SettableExpression { Map contextAttributes = (context != null ? context.getAttributes() : Collections.EMPTY_MAP); try { Ognl.setValue(expression, contextAttributes, target, value); - } - catch (OgnlException e) { + } catch (OgnlException e) { throw new EvaluationException(new SetValueAttempt(this, target, value, context), e); } } diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/support/OgnlExpressionParser.java b/spring-binding/src/main/java/org/springframework/binding/expression/support/OgnlExpressionParser.java index 4066423f..93bfe8c7 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/support/OgnlExpressionParser.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/support/OgnlExpressionParser.java @@ -38,8 +38,7 @@ public class OgnlExpressionParser extends AbstractExpressionParser { public SettableExpression doParseSettableExpression(String expressionString) throws ParserException { try { return new OgnlExpression(Ognl.parseExpression(expressionString)); - } - catch (OgnlException e) { + } catch (OgnlException e) { throw new ParserException(expressionString, e); } } diff --git a/spring-binding/src/main/java/org/springframework/binding/expression/support/StaticExpression.java b/spring-binding/src/main/java/org/springframework/binding/expression/support/StaticExpression.java index dec94e9e..7ed9bdf9 100644 --- a/spring-binding/src/main/java/org/springframework/binding/expression/support/StaticExpression.java +++ b/spring-binding/src/main/java/org/springframework/binding/expression/support/StaticExpression.java @@ -21,8 +21,7 @@ import org.springframework.binding.expression.Expression; import org.springframework.util.ObjectUtils; /** - * A simple expression evaluator that just returns a fixed result on each - * evaluation. + * A simple expression evaluator that just returns a fixed result on each evaluation. * * @author Keith Donald */ @@ -44,8 +43,7 @@ public class StaticExpression implements Expression { public int hashCode() { if (value == null) { return 0; - } - else { + } else { return value.hashCode(); } } @@ -54,7 +52,7 @@ public class StaticExpression implements Expression { if (!(o instanceof StaticExpression)) { return false; } - StaticExpression other = (StaticExpression)o; + StaticExpression other = (StaticExpression) o; return ObjectUtils.nullSafeEquals(value, other.value); } diff --git a/spring-binding/src/main/java/org/springframework/binding/format/Formatter.java b/spring-binding/src/main/java/org/springframework/binding/format/Formatter.java index e3db0db6..b77fa088 100644 --- a/spring-binding/src/main/java/org/springframework/binding/format/Formatter.java +++ b/spring-binding/src/main/java/org/springframework/binding/format/Formatter.java @@ -16,8 +16,7 @@ package org.springframework.binding.format; /** - * A lightweight interface for formatting a value and parsing a value from its - * formatted form. + * A lightweight interface for formatting a value and parsing a value from its formatted form. * * @author Keith Donald */ @@ -32,8 +31,7 @@ public interface Formatter { public String formatValue(Object value) throws IllegalArgumentException; /** - * Parse the formatted string representation of a value, restoring the - * value. + * Parse the formatted string representation of a value, restoring the value. * @param formattedString the formatted string representation * @param targetClass the target class to convert the formatted value to * @return the parsed value diff --git a/spring-binding/src/main/java/org/springframework/binding/format/FormatterFactory.java b/spring-binding/src/main/java/org/springframework/binding/format/FormatterFactory.java index 7a2cb209..76618e8c 100644 --- a/spring-binding/src/main/java/org/springframework/binding/format/FormatterFactory.java +++ b/spring-binding/src/main/java/org/springframework/binding/format/FormatterFactory.java @@ -18,9 +18,8 @@ package org.springframework.binding.format; /** * Source for shared and commonly used Formatters. *

- * Formatters are typically not thread safe as Format objects - * aren't thread safe: so implementations of this service should take care to - * synchronize them as neccessary. + * Formatters are typically not thread safe as Format objects aren't thread safe: so implementations of + * this service should take care to synchronize them as neccessary. * * @see java.text.Format * diff --git a/spring-binding/src/main/java/org/springframework/binding/format/InvalidFormatException.java b/spring-binding/src/main/java/org/springframework/binding/format/InvalidFormatException.java index e6c61b11..23643ade 100644 --- a/spring-binding/src/main/java/org/springframework/binding/format/InvalidFormatException.java +++ b/spring-binding/src/main/java/org/springframework/binding/format/InvalidFormatException.java @@ -44,7 +44,8 @@ public class InvalidFormatException extends NestedRuntimeException { * @param cause the underlying cause of this exception */ public InvalidFormatException(String invalidValue, String expectedFormat, Throwable cause) { - super("Invalid format for value '" + invalidValue + "'; the expected format was '" + expectedFormat + "'", cause); + super("Invalid format for value '" + invalidValue + "'; the expected format was '" + expectedFormat + "'", + cause); this.invalidValue = invalidValue; this.expectedFormat = expectedFormat; } diff --git a/spring-binding/src/main/java/org/springframework/binding/format/support/AbstractFormatter.java b/spring-binding/src/main/java/org/springframework/binding/format/support/AbstractFormatter.java index df4327b8..cc0294e1 100644 --- a/spring-binding/src/main/java/org/springframework/binding/format/support/AbstractFormatter.java +++ b/spring-binding/src/main/java/org/springframework/binding/format/support/AbstractFormatter.java @@ -62,18 +62,16 @@ public abstract class AbstractFormatter implements Formatter { Assert.isTrue(!isEmpty(value), "Object to format cannot be empty"); return doFormatValue(value); } - + /** - * Template method subclasses should override to encapsulate formatting - * logic. + * Template method subclasses should override to encapsulate formatting logic. * @param value the value to format * @return the formatted string representation */ protected abstract String doFormatValue(Object value); /** - * Returns the formatted form of an empty value. Default implementation - * just returns the empty string. + * Returns the formatted form of an empty value. Default implementation just returns the empty string. */ protected String getEmptyFormattedValue() { return ""; @@ -85,8 +83,7 @@ public abstract class AbstractFormatter implements Formatter { return getEmptyValue(); } return doParseValue(formattedString, targetClass); - } - catch (ParseException ex) { + } catch (ParseException ex) { throw new InvalidFormatException(formattedString, getExpectedFormat(targetClass), ex); } } @@ -102,16 +99,15 @@ public abstract class AbstractFormatter implements Formatter { ParseException; /** - * Returns the empty value (resulting from parsing an empty input string). - * This default implementation just returns null. + * Returns the empty value (resulting from parsing an empty input string). This default implementation just returns + * null. */ protected Object getEmptyValue() { return null; } /** - * Returns the expected string format for the given target class. - * The default implementation just returns null. + * Returns the expected string format for the given target class. The default implementation just returns null. */ protected String getExpectedFormat(Class targetClass) { return null; @@ -123,11 +119,9 @@ public abstract class AbstractFormatter implements Formatter { protected boolean isEmpty(Object o) { if (o == null) { return true; - } - else if (o instanceof String) { - return !StringUtils.hasText((String)o); - } - else { + } else if (o instanceof String) { + return !StringUtils.hasText((String) o); + } else { return false; } } diff --git a/spring-binding/src/main/java/org/springframework/binding/format/support/AbstractFormatterFactory.java b/spring-binding/src/main/java/org/springframework/binding/format/support/AbstractFormatterFactory.java index 23a585d9..165e35fa 100644 --- a/spring-binding/src/main/java/org/springframework/binding/format/support/AbstractFormatterFactory.java +++ b/spring-binding/src/main/java/org/springframework/binding/format/support/AbstractFormatterFactory.java @@ -24,8 +24,8 @@ import org.springframework.context.i18n.LocaleContext; import org.springframework.context.i18n.SimpleLocaleContext; /** - * Base class for formatter factories. Manages the locale used by the produced - * formatters using Spring's {@link org.springframework.context.i18n.LocaleContext} system. + * Base class for formatter factories. Manages the locale used by the produced formatters using Spring's + * {@link org.springframework.context.i18n.LocaleContext} system. * * @author Keith Donald */ @@ -38,8 +38,7 @@ public abstract class AbstractFormatterFactory implements FormatterFactory { private Style defaultTimeStyle = Style.MEDIUM; /** - * Sets the locale context used. Defaults to a {@link SimpleLocaleContext} holding - * the system default locale. + * Sets the locale context used. Defaults to a {@link SimpleLocaleContext} holding the system default locale. */ public void setLocaleContext(LocaleContext localeContext) { this.localeContext = localeContext; diff --git a/spring-binding/src/main/java/org/springframework/binding/format/support/DateFormatter.java b/spring-binding/src/main/java/org/springframework/binding/format/support/DateFormatter.java index f094beca..7c938a38 100644 --- a/spring-binding/src/main/java/org/springframework/binding/format/support/DateFormatter.java +++ b/spring-binding/src/main/java/org/springframework/binding/format/support/DateFormatter.java @@ -31,8 +31,7 @@ public class DateFormatter extends AbstractFormatter { private DateFormat dateFormat; /** - * Constructs a date formatter that will delegate to the specified date - * format. + * Constructs a date formatter that will delegate to the specified date format. * @param dateFormat the date format to use */ public DateFormatter(DateFormat dateFormat) { @@ -40,8 +39,7 @@ public class DateFormatter extends AbstractFormatter { } /** - * Constructs a date formatter that will delegate to the specified date - * format. + * Constructs a date formatter that will delegate to the specified date format. * @param dateFormat the date format to use * @param allowEmpty should this formatter allow empty input arguments? */ @@ -52,7 +50,7 @@ public class DateFormatter extends AbstractFormatter { // convert from date to string protected String doFormatValue(Object date) { - return dateFormat.format((Date)date); + return dateFormat.format((Date) date); } // convert back from string to date @@ -64,6 +62,6 @@ public class DateFormatter extends AbstractFormatter { * Convenience method to parse a date. */ public Date parseDate(String formattedString) throws InvalidFormatException { - return (Date)parseValue(formattedString, Date.class); + return (Date) parseValue(formattedString, Date.class); } } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/format/support/LabeledEnumFormatter.java b/spring-binding/src/main/java/org/springframework/binding/format/support/LabeledEnumFormatter.java index a2f1cb45..c148226c 100644 --- a/spring-binding/src/main/java/org/springframework/binding/format/support/LabeledEnumFormatter.java +++ b/spring-binding/src/main/java/org/springframework/binding/format/support/LabeledEnumFormatter.java @@ -53,7 +53,7 @@ public class LabeledEnumFormatter extends AbstractFormatter { } protected String doFormatValue(Object value) { - LabeledEnum labeledEnum = (LabeledEnum)value; + LabeledEnum labeledEnum = (LabeledEnum) value; return labeledEnum.getLabel(); } @@ -71,6 +71,6 @@ public class LabeledEnumFormatter extends AbstractFormatter { * Convenience method to parse a LabeledEnum. */ public LabeledEnum parseLabeledEnum(String formattedString, Class enumClass) throws InvalidFormatException { - return (LabeledEnum)parseValue(formattedString, enumClass); + return (LabeledEnum) parseValue(formattedString, enumClass); } } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/format/support/NumberFormatter.java b/spring-binding/src/main/java/org/springframework/binding/format/support/NumberFormatter.java index 59a110eb..d1d78565 100644 --- a/spring-binding/src/main/java/org/springframework/binding/format/support/NumberFormatter.java +++ b/spring-binding/src/main/java/org/springframework/binding/format/support/NumberFormatter.java @@ -23,18 +23,17 @@ import org.springframework.binding.format.InvalidFormatException; import org.springframework.util.NumberUtils; /** - * Converts from various Number specializations to - * String and back. + * Converts from various Number specializations to String and back. * * @author Keith Donald */ public class NumberFormatter extends AbstractFormatter { private NumberFormat numberFormat; - + /** - * Default constructor. The formatter will use "toString" when formatting - * a value and "valueOf" when parsing a value. + * Default constructor. The formatter will use "toString" when formatting a value and "valueOf" when parsing a + * value. */ public NumberFormatter() { } @@ -61,8 +60,7 @@ public class NumberFormatter extends AbstractFormatter { if (this.numberFormat != null) { // use NumberFormat for rendering value return this.numberFormat.format(number); - } - else { + } else { // use toString method for rendering value return number.toString(); } @@ -78,38 +76,38 @@ public class NumberFormatter extends AbstractFormatter { return NumberUtils.parseNumber(text, targetClass); } } - + // convenience methods public Byte parseByte(String formattedString) throws InvalidFormatException { - return (Byte)parseValue(formattedString, Byte.class); + return (Byte) parseValue(formattedString, Byte.class); } public Short parseShort(String formattedString) throws InvalidFormatException { - return (Short)parseValue(formattedString, Short.class); + return (Short) parseValue(formattedString, Short.class); } public Integer parseInteger(String formattedString) throws InvalidFormatException { - return (Integer)parseValue(formattedString, Integer.class); + return (Integer) parseValue(formattedString, Integer.class); } public Long parseLong(String formattedString) throws InvalidFormatException { - return (Long)parseValue(formattedString, Long.class); + return (Long) parseValue(formattedString, Long.class); } public Float parseFloat(String formattedString) throws InvalidFormatException { - return (Float)parseValue(formattedString, Float.class); + return (Float) parseValue(formattedString, Float.class); } public Double parseDouble(String formattedString) throws InvalidFormatException { - return (Double)parseValue(formattedString, Double.class); + return (Double) parseValue(formattedString, Double.class); } public BigInteger parseBigInteger(String formattedString) throws InvalidFormatException { - return (BigInteger)parseValue(formattedString, BigInteger.class); + return (BigInteger) parseValue(formattedString, BigInteger.class); } - + public BigDecimal parseBigDecimal(String formattedString) throws InvalidFormatException { - return (BigDecimal)parseValue(formattedString, BigDecimal.class); + return (BigDecimal) parseValue(formattedString, BigDecimal.class); } } \ No newline at end of file diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/AttributeMapper.java b/spring-binding/src/main/java/org/springframework/binding/mapping/AttributeMapper.java index cba73828..89af6730 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/AttributeMapper.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/AttributeMapper.java @@ -18,9 +18,8 @@ package org.springframework.binding.mapping; /** * A lightweight service interface for mapping between two attribute sources. *

- * Implementations of this interface are expected to encapsulate the mapping - * configuration information as well as the logic to act on it to perform - * mapping between a given source and target attribute source. + * Implementations of this interface are expected to encapsulate the mapping configuration information as well as the + * logic to act on it to perform mapping between a given source and target attribute source. * * @author Keith Donald */ diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/DefaultAttributeMapper.java b/spring-binding/src/main/java/org/springframework/binding/mapping/DefaultAttributeMapper.java index b054036a..5de07f65 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/DefaultAttributeMapper.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/DefaultAttributeMapper.java @@ -23,8 +23,7 @@ import java.util.List; import org.springframework.core.style.ToStringCreator; /** - * Generic attributes mapper implementation that allows mappings to be - * configured programatically. + * Generic attributes mapper implementation that allows mappings to be configured programatically. * * @author Erwin Vervaet * @author Keith Donald @@ -49,7 +48,7 @@ public class DefaultAttributeMapper implements AttributeMapper { /** * Add a set of mappings. - * @param mappings the mappings + * @param mappings the mappings */ public void addMappings(AttributeMapper[] mappings) { if (mappings == null) { @@ -63,14 +62,14 @@ public class DefaultAttributeMapper implements AttributeMapper { * @return the list of mappings */ public AttributeMapper[] getMappings() { - return (AttributeMapper[])mappings.toArray(new AttributeMapper[mappings.size()]); + return (AttributeMapper[]) mappings.toArray(new AttributeMapper[mappings.size()]); } public void map(Object source, Object target, MappingContext context) { if (mappings != null) { Iterator it = mappings.iterator(); while (it.hasNext()) { - AttributeMapper mapping = (AttributeMapper)it.next(); + AttributeMapper mapping = (AttributeMapper) it.next(); mapping.map(source, target, context); } } diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/Mapping.java b/spring-binding/src/main/java/org/springframework/binding/mapping/Mapping.java index 13926ace..c58db23b 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/Mapping.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/Mapping.java @@ -24,10 +24,8 @@ import org.springframework.core.style.ToStringCreator; import org.springframework.util.Assert; /** - * A single mapping definition, encapulating the information neccessary to map - * the result of evaluating an expression on a source object to a property on a - * target object, optionally applying a type conversion during the mapping - * process. + * A single mapping definition, encapulating the information neccessary to map the result of evaluating an expression on + * a source object to a property on a target object, optionally applying a type conversion during the mapping process. * * @author Keith Donald */ @@ -51,8 +49,7 @@ public class Mapping implements AttributeMapper { private final ConversionExecutor typeConverter; /** - * Whether or not this is a required mapping; if true, the source expression - * must return a non-null value. + * Whether or not this is a required mapping; if true, the source expression must return a non-null value. */ private boolean required; @@ -62,8 +59,7 @@ public class Mapping implements AttributeMapper { * @param targetExpression the target expression * @param typeConverter a type converter */ - public Mapping(Expression sourceExpression, SettableExpression targetExpression, - ConversionExecutor typeConverter) { + public Mapping(Expression sourceExpression, SettableExpression targetExpression, ConversionExecutor typeConverter) { this(sourceExpression, targetExpression, typeConverter, false); } @@ -85,9 +81,8 @@ public class Mapping implements AttributeMapper { } /** - * Map the sourceAttribute in to the - * targetAttribute target map, performing type conversion if - * necessary. + * Map the sourceAttribute in to the targetAttribute target map, performing type + * conversion if necessary. * @param source The source data structure * @param target The target data structure */ @@ -99,8 +94,7 @@ public class Mapping implements AttributeMapper { throw new RequiredMappingException("This mapping is required; evaluation of expression '" + sourceExpression + "' against source of type [" + source.getClass() + "] must return a non-null value"); - } - else { + } else { // source expression returned no value, simply abort mapping return; } @@ -121,9 +115,8 @@ public class Mapping implements AttributeMapper { if (!(o instanceof Mapping)) { return false; } - Mapping other = (Mapping)o; - return sourceExpression.equals(other.sourceExpression) - && targetExpression.equals(other.targetExpression); + Mapping other = (Mapping) o; + return sourceExpression.equals(other.sourceExpression) && targetExpression.equals(other.targetExpression); } public int hashCode() { diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingBuilder.java b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingBuilder.java index a7cd3f8b..6d836956 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingBuilder.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingBuilder.java @@ -25,8 +25,8 @@ import org.springframework.binding.expression.support.CollectionAddingExpression import org.springframework.util.Assert; /** - * A stateful builder that builds {@link Mapping} objects. Designed for - * convenience to build mappings in a clear, readable manner. + * A stateful builder that builds {@link Mapping} objects. Designed for convenience to build mappings in a clear, + * readable manner. *

* Example usage: * @@ -35,8 +35,8 @@ import org.springframework.util.Assert; * Mapping result = mapping.source("foo").target("bar").from(String.class).to(Long.class).value(); * * - * Calling the {@link #value()} result method clears out this builder's state so - * it can be reused to build another mapping. + * Calling the {@link #value()} result method clears out this builder's state so it can be reused to build another + * mapping. * * @author Keith Donald * @author Erwin Vervaet @@ -77,10 +77,9 @@ public class MappingBuilder { * Whether or not the built mapping is a required mapping. */ private boolean required; - + /** - * Creates a mapping builder that uses the expression parser to parse - * attribute mapping expressions. + * Creates a mapping builder that uses the expression parser to parse attribute mapping expressions. * @param expressionParser the expression parser */ public MappingBuilder(ExpressionParser expressionParser) { @@ -89,9 +88,8 @@ public class MappingBuilder { } /** - * Sets the conversion service that will convert the object returned by - * evaluating the source expression to the {@link #to(Class)} type if - * necessary. + * Sets the conversion service that will convert the object returned by evaluating the source expression to the + * {@link #to(Class)} type if necessary. * @param conversionService the conversion service */ public void setConversionService(ConversionService conversionService) { @@ -114,7 +112,7 @@ public class MappingBuilder { * @return this, to support call-chaining */ public MappingBuilder target(String expressionString) { - targetExpression = (SettableExpression)expressionParser.parseExpression(expressionString); + targetExpression = (SettableExpression) expressionParser.parseExpression(expressionString); return this; } @@ -124,15 +122,13 @@ public class MappingBuilder { * @return this, to support call-chaining */ public MappingBuilder targetCollection(String expressionString) { - targetExpression = new CollectionAddingExpression( - expressionParser.parseSettableExpression(expressionString)); + targetExpression = new CollectionAddingExpression(expressionParser.parseSettableExpression(expressionString)); return this; } /** - * Sets the expected type of the object returned by evaluating the source - * expression. Used in conjunction with {@link #to(Class)} to perform a type - * conversion during the mapping process. + * Sets the expected type of the object returned by evaluating the source expression. Used in conjunction with + * {@link #to(Class)} to perform a type conversion during the mapping process. * @param sourceType the source type * @return this, to support call-chaining */ @@ -159,17 +155,16 @@ public class MappingBuilder { this.required = true; return this; } - + /** - * The logical GoF builder getResult method, returning a fully constructed - * Mapping from the configured pieces. Once called, the state of this - * builder is nulled out to support building a new mapping object again. + * The logical GoF builder getResult method, returning a fully constructed Mapping from the configured pieces. Once + * called, the state of this builder is nulled out to support building a new mapping object again. * @return the mapping result */ public Mapping value() { Assert.notNull(sourceExpression, "The source expression must be set at a minimum"); if (targetExpression == null) { - targetExpression = (SettableExpression)sourceExpression; + targetExpression = (SettableExpression) sourceExpression; } ConversionExecutor typeConverter = null; if (sourceType != null) { @@ -179,14 +174,13 @@ public class MappingBuilder { Mapping result; if (required) { result = new RequiredMapping(sourceExpression, targetExpression, typeConverter); - } - else { + } else { result = new Mapping(sourceExpression, targetExpression, typeConverter); } reset(); return result; } - + /** * Reset this mapping builder. */ diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingContext.java b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingContext.java index 3595fb97..73aa66c9 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/MappingContext.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/MappingContext.java @@ -18,13 +18,10 @@ package org.springframework.binding.mapping; /** * A context object with two main responsibities: *

    - *
  1. Exposing information to a mapper to influence - * a mapping attempt. - *
  2. Providing operations for recording progress or - * errors during the mapping process. + *
  3. Exposing information to a mapper to influence a mapping attempt. + *
  4. Providing operations for recording progress or errors during the mapping process. *
- * Empty for now; subclasses may define their own custom context behavior - * accessible by a mapper with a downcast. + * Empty for now; subclasses may define their own custom context behavior accessible by a mapper with a downcast. * * @author Keith Donald */ diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/RequiredMapping.java b/spring-binding/src/main/java/org/springframework/binding/mapping/RequiredMapping.java index b2291e56..0e659319 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/RequiredMapping.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/RequiredMapping.java @@ -25,7 +25,7 @@ import org.springframework.binding.expression.SettableExpression; * @author Keith Donald */ public class RequiredMapping extends Mapping { - + /** * Creates a required mapping. * @param sourceExpression the source mapping expression diff --git a/spring-binding/src/main/java/org/springframework/binding/mapping/RequiredMappingException.java b/spring-binding/src/main/java/org/springframework/binding/mapping/RequiredMappingException.java index 4c2c09c8..1cba4ce0 100644 --- a/spring-binding/src/main/java/org/springframework/binding/mapping/RequiredMappingException.java +++ b/spring-binding/src/main/java/org/springframework/binding/mapping/RequiredMappingException.java @@ -21,7 +21,7 @@ package org.springframework.binding.mapping; * @author Keith Donald */ public class RequiredMappingException extends IllegalStateException { - + /** * Create a new required mapping exception. * @param message a descriptive message diff --git a/spring-binding/src/main/java/org/springframework/binding/method/InvalidMethodKeyException.java b/spring-binding/src/main/java/org/springframework/binding/method/InvalidMethodKeyException.java index f8690ea8..42b8672b 100644 --- a/spring-binding/src/main/java/org/springframework/binding/method/InvalidMethodKeyException.java +++ b/spring-binding/src/main/java/org/springframework/binding/method/InvalidMethodKeyException.java @@ -18,8 +18,7 @@ package org.springframework.binding.method; import org.springframework.core.NestedRuntimeException; /** - * Thrown when a method key could not be resolved to an invokable java Method on - * a Class. + * Thrown when a method key could not be resolved to an invokable java Method on a Class. * * @author Keith Donald */ @@ -29,7 +28,7 @@ public class InvalidMethodKeyException extends NestedRuntimeException { * The method key that could not be resolved. */ private MethodKey methodKey; - + /** * Creates an exception signaling an invalid method signature. * @param methodKey the class method key diff --git a/spring-binding/src/main/java/org/springframework/binding/method/MethodInvocationException.java b/spring-binding/src/main/java/org/springframework/binding/method/MethodInvocationException.java index 764bf189..5a8640cd 100644 --- a/spring-binding/src/main/java/org/springframework/binding/method/MethodInvocationException.java +++ b/spring-binding/src/main/java/org/springframework/binding/method/MethodInvocationException.java @@ -28,20 +28,17 @@ import org.springframework.core.style.StylerUtils; public class MethodInvocationException extends NestedRuntimeException { /** - * The method signature. - * Transient because a MethodSignature is not Serializable. + * The method signature. Transient because a MethodSignature is not Serializable. */ private transient MethodSignature methodSignature; /** - * The method invocation argument values. - * Transient because we cannot guarantee that the arguments are Serializable. + * The method invocation argument values. Transient because we cannot guarantee that the arguments are Serializable. */ private transient Object[] arguments; /** - * Signals that the method with the specified signature could not be invoked - * with the provided arguments. + * Signals that the method with the specified signature could not be invoked with the provided arguments. * @param methodSignature the method signature * @param arguments the arguments * @param cause the root cause @@ -73,7 +70,7 @@ public class MethodInvocationException extends NestedRuntimeException { public Throwable getTargetException() { Throwable targetException = getCause(); while (targetException instanceof InvocationTargetException) { - targetException = ((InvocationTargetException)targetException).getTargetException(); + targetException = ((InvocationTargetException) targetException).getTargetException(); } return targetException; } diff --git a/spring-binding/src/main/java/org/springframework/binding/method/MethodInvoker.java b/spring-binding/src/main/java/org/springframework/binding/method/MethodInvoker.java index 44832a6a..28e30520 100644 --- a/spring-binding/src/main/java/org/springframework/binding/method/MethodInvoker.java +++ b/spring-binding/src/main/java/org/springframework/binding/method/MethodInvoker.java @@ -26,9 +26,8 @@ import org.springframework.core.style.StylerUtils; import org.springframework.util.CachingMapDecorator; /** - * A helper for invoking typed methods on abritrary objects, with support for - * argument value type conversion from values retrieved from a argument - * attribute source. + * A helper for invoking typed methods on abritrary objects, with support for argument value type conversion from values + * retrieved from a argument attribute source. * * @author Keith Donald */ @@ -37,8 +36,7 @@ public class MethodInvoker { private static final Log logger = LogFactory.getLog(MethodInvoker.class); /** - * Conversion service for converting arguments to the neccessary type if - * required. + * Conversion service for converting arguments to the neccessary type if required. */ private ConversionService conversionService = new DefaultConversionService(); @@ -59,10 +57,8 @@ public class MethodInvoker { } /** - * Invoke the method on the bean provided. Argument values are pulled from - * the provided argument source. - * @param signature the definition of the method to invoke, including the - * method name and the method argument types + * Invoke the method on the bean provided. Argument values are pulled from the provided argument source. + * @param signature the definition of the method to invoke, including the method name and the method argument types * @param bean the bean to invoke * @param argumentSource the source for method arguments * @return the invoked method's return value @@ -99,11 +95,9 @@ public class MethodInvoker { logger.debug("Invoked method with signature [" + key + "] returned value [" + returnValue + "]"); } return returnValue; - } - catch (InvocationTargetException e) { + } catch (InvocationTargetException e) { throw new MethodInvocationException(signature, arguments, e.getTargetException()); - } - catch (Exception e) { + } catch (Exception e) { throw new MethodInvocationException(signature, arguments, e); } } diff --git a/spring-binding/src/main/java/org/springframework/binding/method/MethodKey.java b/spring-binding/src/main/java/org/springframework/binding/method/MethodKey.java index 29f6049e..b842f74a 100644 --- a/spring-binding/src/main/java/org/springframework/binding/method/MethodKey.java +++ b/spring-binding/src/main/java/org/springframework/binding/method/MethodKey.java @@ -42,9 +42,8 @@ public class MethodKey implements Serializable { private String methodName; /** - * The method's actual parameter types. Could contain null values - * if the user did not specify a parameter type for the corresponding - * parameter + * The method's actual parameter types. Could contain null values if the user did not specify a parameter type for + * the corresponding parameter */ private Class[] parameterTypes; @@ -57,8 +56,7 @@ public class MethodKey implements Serializable { * Create a new method key. * @param declaredType the class the method is a member of * @param methodName the method name - * @param parameterTypes the method's parameter types, or null - * if the method has no parameters + * @param parameterTypes the method's parameter types, or null if the method has no parameters */ public MethodKey(Class declaredType, String methodName, Class[] parameterTypes) { Assert.notNull(declaredType, "The method's declared type is required"); @@ -83,8 +81,8 @@ public class MethodKey implements Serializable { } /** - * Returns the method parameter types. Could contain null values - * if no type was specified for the corresponding parameter. + * Returns the method parameter types. Could contain null values if no type was specified for the corresponding + * parameter. */ public Class[] getParameterTypes() { return parameterTypes; @@ -108,13 +106,11 @@ public class MethodKey implements Serializable { protected Method resolveMethod() throws InvalidMethodKeyException { try { return declaredType.getMethod(methodName, parameterTypes); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { Method method = findMethodConsiderAssignableParameterTypes(); if (method != null) { return method; - } - else { + } else { throw new InvalidMethodKeyException(this, e); } } @@ -140,8 +136,7 @@ public class MethodKey implements Serializable { if (isAssignable(candidateType, parameterType)) { numberOfCorrectArguments++; } - } - else { + } else { // just match on a null param type (effectively 'any') numberOfCorrectArguments++; } @@ -202,16 +197,14 @@ public class MethodKey implements Serializable { } /** - * Convenience method that returns the parameter types describing the - * signature of the method as a string. + * Convenience method that returns the parameter types describing the signature of the method as a string. */ private String parameterTypesString() { StringBuffer parameterTypesString = new StringBuffer(); for (int i = 0; i < parameterTypes.length; i++) { if (parameterTypes[i] == null) { parameterTypesString.append(""); - } - else { + } else { parameterTypesString.append(ClassUtils.getShortName(parameterTypes[i])); } if (i < parameterTypes.length - 1) { @@ -224,13 +217,12 @@ public class MethodKey implements Serializable { // internal helpers /** - * Determine if the given target type is assignable from the given value - * type, assuming setting by reflection. Considers primitive wrapper classes - * as assignable to the corresponding primitive types.

NOTE: Pulled from - * ClassUtils in Spring 2.0 for 1.2.8 compatability. + * Determine if the given target type is assignable from the given value type, assuming setting by reflection. + * Considers primitive wrapper classes as assignable to the corresponding primitive types. + *

+ * NOTE: Pulled from ClassUtils in Spring 2.0 for 1.2.8 compatability. * @param targetType the target type - * @param valueType the value type that should be assigned to the target - * type + * @param valueType the value type that should be assigned to the target type * @return if the target type is assignable from the value type */ private static boolean isAssignable(Class targetType, Class valueType) { @@ -238,8 +230,8 @@ public class MethodKey implements Serializable { } /** - * Map with primitive wrapper type as key and corresponding primitive type - * as value, for example: Integer.class -> int.class. + * Map with primitive wrapper type as key and corresponding primitive type as value, for example: Integer.class -> + * int.class. */ private static final Map primitiveWrapperTypeMap = new HashMap(8); diff --git a/spring-binding/src/main/java/org/springframework/binding/method/MethodSignature.java b/spring-binding/src/main/java/org/springframework/binding/method/MethodSignature.java index cade750e..3daeafdc 100644 --- a/spring-binding/src/main/java/org/springframework/binding/method/MethodSignature.java +++ b/spring-binding/src/main/java/org/springframework/binding/method/MethodSignature.java @@ -19,9 +19,8 @@ import org.springframework.core.style.ToStringCreator; import org.springframework.util.Assert; /** - * A specification for a method consisting of the methodName and an optional set - * of named arguments. This class provides the ability to resolve a method with - * parameters and evaluate its argument values as part of a + * A specification for a method consisting of the methodName and an optional set of named arguments. This class provides + * the ability to resolve a method with parameters and evaluate its argument values as part of a * {@link MethodInvoker method invoker attempt}. * * @author Keith Donald diff --git a/spring-binding/src/main/java/org/springframework/binding/method/Parameter.java b/spring-binding/src/main/java/org/springframework/binding/method/Parameter.java index e6f65798..45888eef 100644 --- a/spring-binding/src/main/java/org/springframework/binding/method/Parameter.java +++ b/spring-binding/src/main/java/org/springframework/binding/method/Parameter.java @@ -22,8 +22,7 @@ import org.springframework.util.Assert; import org.springframework.util.ObjectUtils; /** - * A named method parameter. Each parameter has an identifying name and is of a - * specified type (class). + * A named method parameter. Each parameter has an identifying name and is of a specified type (class). * * @author Keith Donald */ @@ -35,14 +34,13 @@ public class Parameter { private Class type; /** - * The name of the parameter as an evaluatable expression, e.g - * "accountNumber". + * The name of the parameter as an evaluatable expression, e.g "accountNumber". */ private Expression name; /** - * Create a new named parameter definition. Named parameters are capable of resolving - * parameter values (arguments) from argument sources. + * Create a new named parameter definition. Named parameters are capable of resolving parameter values (arguments) + * from argument sources. * @param type the parameter type, may be null * @param name the name the method argument expression (required) */ @@ -53,8 +51,7 @@ public class Parameter { } /** - * Returns the parameter type. Could be null if no parameter type - * was specified. + * Returns the parameter type. Could be null if no parameter type was specified. */ public Class getType() { return type; @@ -68,8 +65,7 @@ public class Parameter { } /** - * Evaluate this method parameter against the provided argument source, - * returning a single method argument value. + * Evaluate this method parameter against the provided argument source, returning a single method argument value. * @param argumentSource the meyhod argument source * @param context the evaluation context * @return the method argument value diff --git a/spring-binding/src/main/java/org/springframework/binding/method/Parameters.java b/spring-binding/src/main/java/org/springframework/binding/method/Parameters.java index f900efd5..54bcca30 100644 --- a/spring-binding/src/main/java/org/springframework/binding/method/Parameters.java +++ b/spring-binding/src/main/java/org/springframework/binding/method/Parameters.java @@ -95,16 +95,15 @@ public class Parameters { } /** - * Get an array containing each parameter type. The resulting array - * could contain null values if the corresponding parameters did - * not specify a parameter type. + * Get an array containing each parameter type. The resulting array could contain null values if the corresponding + * parameters did not specify a parameter type. * @return the types */ public Class[] getTypesArray() { int i = 0; Class[] types = new Class[parameters.size()]; for (Iterator it = parameters.iterator(); it.hasNext();) { - Parameter param = (Parameter)it.next(); + Parameter param = (Parameter) it.next(); types[i] = param.getType(); i++; } @@ -126,14 +125,14 @@ public class Parameters { * @throws IndexOutOfBoundsException if the provided index is out of bounds */ public Parameter getParameter(int index) throws IndexOutOfBoundsException { - return (Parameter)parameters.get(index); + return (Parameter) parameters.get(index); } public boolean equals(Object obj) { if (!(obj instanceof Parameters)) { return false; } - Parameters other = (Parameters)obj; + Parameters other = (Parameters) obj; return parameters.equals(other.parameters); } diff --git a/spring-binding/src/main/java/org/springframework/binding/method/TextToMethodSignature.java b/spring-binding/src/main/java/org/springframework/binding/method/TextToMethodSignature.java index b015918e..2cf85125 100644 --- a/spring-binding/src/main/java/org/springframework/binding/method/TextToMethodSignature.java +++ b/spring-binding/src/main/java/org/springframework/binding/method/TextToMethodSignature.java @@ -25,20 +25,17 @@ import org.springframework.binding.convert.support.ConversionServiceAwareConvert import org.springframework.binding.expression.Expression; /** - * Converter that takes an encoded string representation and produces a - * corresponding MethodSignature object. + * Converter that takes an encoded string representation and produces a corresponding MethodSignature + * object. *

* This converter supports the following encoded forms: *

* * @see MethodSignature @@ -71,14 +68,13 @@ public class TextToMethodSignature extends ConversionServiceAwareConverter { } protected Object doConvert(Object source, Class targetClass, ConversionContext context) throws Exception { - String encodedMethodSignature = (String)source; + String encodedMethodSignature = (String) source; encodedMethodSignature = encodedMethodSignature.trim(); int openParan = encodedMethodSignature.indexOf('('); if (openParan == -1) { // form "foo" return new MethodSignature(encodedMethodSignature); - } - else { + } else { // form "foo(...)" String methodName = encodedMethodSignature.substring(0, openParan); int closeParan = encodedMethodSignature.lastIndexOf(')'); @@ -94,13 +90,12 @@ public class TextToMethodSignature extends ConversionServiceAwareConverter { String param = paramArray[i].trim(); int space = param.indexOf(' '); int expr = param.indexOf('{'); - if (space == -1 || (expr != -1 && space > expr)) { + if (space == -1 || (expr != -1 && space > expr)) { // "name" or "${name}" params.add(new Parameter(null, parseExpression(param))); - } - else { + } else { // "type name" or "type ${name}" - Class type = (Class)fromStringTo(Class.class).execute(param.substring(0, space).trim()); + Class type = (Class) fromStringTo(Class.class).execute(param.substring(0, space).trim()); Expression name = parseExpression(param.substring(space + 1).trim()); params.add(new Parameter(type, name)); } @@ -108,31 +103,31 @@ public class TextToMethodSignature extends ConversionServiceAwareConverter { return new MethodSignature(methodName, params); } } - + /** * Split given parameter string into individual parameter definitions. */ private String[] splitParameters(String encodedMethodSignature, String parameters) { List res = new LinkedList(); - + int paramStart = 0; int blockNestingCount = 0; for (int i = 0; i < parameters.length(); i++) { switch (parameters.charAt(i)) { - case '{': - blockNestingCount++; - break; - case '}': - blockNestingCount--; - break; - case ',': - if (blockNestingCount == 0) { - // only take comma delimiter into account when not inside - // a block - res.add(parameters.substring(paramStart, i)); - paramStart = i + 1; - } - break; + case '{': + blockNestingCount++; + break; + case '}': + blockNestingCount--; + break; + case ',': + if (blockNestingCount == 0) { + // only take comma delimiter into account when not inside + // a block + res.add(parameters.substring(paramStart, i)); + paramStart = i + 1; + } + break; } } if (blockNestingCount != 0) { @@ -142,7 +137,7 @@ public class TextToMethodSignature extends ConversionServiceAwareConverter { if (paramStart < parameters.length()) { res.add(parameters.substring(paramStart)); } - - return (String[])res.toArray(new String[res.size()]); + + return (String[]) res.toArray(new String[res.size()]); } } \ No newline at end of file diff --git a/spring-binding/src/test/java/org/springframework/binding/collection/CompositeIteratorTests.java b/spring-binding/src/test/java/org/springframework/binding/collection/CompositeIteratorTests.java index cc730dc5..cc87e6eb 100644 --- a/spring-binding/src/test/java/org/springframework/binding/collection/CompositeIteratorTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/collection/CompositeIteratorTests.java @@ -28,19 +28,18 @@ import junit.framework.TestCase; * @author Erwin Vervaet */ public class CompositeIteratorTests extends TestCase { - + public void testNoIterators() { CompositeIterator it = new CompositeIterator(); assertFalse(it.hasNext()); try { it.next(); fail(); - } - catch (NoSuchElementException e) { + } catch (NoSuchElementException e) { // expected } } - + public void testSingleIterator() { CompositeIterator it = new CompositeIterator(); it.add(Arrays.asList(new String[] { "0", "1" }).iterator()); @@ -52,12 +51,11 @@ public class CompositeIteratorTests extends TestCase { try { it.next(); fail(); - } - catch (NoSuchElementException e) { + } catch (NoSuchElementException e) { // expected } } - + public void testMultipleIterators() { CompositeIterator it = new CompositeIterator(); it.add(Arrays.asList(new String[] { "0", "1" }).iterator()); @@ -71,12 +69,11 @@ public class CompositeIteratorTests extends TestCase { try { it.next(); fail(); - } - catch (NoSuchElementException e) { + } catch (NoSuchElementException e) { // expected } } - + public void testInUse() { List list = Arrays.asList(new String[] { "0", "1" }); CompositeIterator it = new CompositeIterator(); @@ -85,8 +82,7 @@ public class CompositeIteratorTests extends TestCase { try { it.add(list.iterator()); fail(); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { // expected } it = new CompositeIterator(); @@ -95,12 +91,11 @@ public class CompositeIteratorTests extends TestCase { try { it.add(list.iterator()); fail(); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { // expected } } - + public void testDuplicateIterators() { List list = Arrays.asList(new String[] { "0", "1" }); Iterator iterator = list.iterator(); @@ -110,8 +105,7 @@ public class CompositeIteratorTests extends TestCase { try { it.add(iterator); fail(); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { // expected } } diff --git a/spring-binding/src/test/java/org/springframework/binding/convert/ConversionExecutorTests.java b/spring-binding/src/test/java/org/springframework/binding/convert/ConversionExecutorTests.java index 7d9c2d3a..17b411f9 100644 --- a/spring-binding/src/test/java/org/springframework/binding/convert/ConversionExecutorTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/convert/ConversionExecutorTests.java @@ -25,42 +25,41 @@ import org.springframework.binding.convert.support.AbstractConverter; * Test case for {@link ConversionExecutor}. */ public class ConversionExecutorTests extends TestCase { - + private ConversionExecutor conversionExecutor; - + protected void setUp() throws Exception { conversionExecutor = new ConversionExecutor(String.class, Date.class, new TestTextToDate()); } - + public void testTypeConversion() { assertTrue(conversionExecutor.execute("10-10-2008").getClass().equals(Date.class)); } - + public void testAssignmentCompatibleTypeConversion() { java.sql.Date date = new java.sql.Date(123L); assertSame(date, conversionExecutor.execute(date)); } - + public void testConvertNull() { assertNull(conversionExecutor.execute(null)); } - + public void testIllegalType() { try { conversionExecutor.execute(new StringBuffer()); fail(); - } - catch (ConversionException e) { + } catch (ConversionException e) { // expected } } private class TestTextToDate extends AbstractConverter { - + public Class[] getSourceClasses() { return new Class[] { String.class }; } - + public Class[] getTargetClasses() { return new Class[] { Date.class }; } diff --git a/spring-binding/src/test/java/org/springframework/binding/convert/support/CompositeConversionServiceTests.java b/spring-binding/src/test/java/org/springframework/binding/convert/support/CompositeConversionServiceTests.java index 74c514ea..12b8cd64 100644 --- a/spring-binding/src/test/java/org/springframework/binding/convert/support/CompositeConversionServiceTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/convert/support/CompositeConversionServiceTests.java @@ -25,13 +25,13 @@ import org.springframework.binding.convert.ConversionService; /** * Test case for the {@link CompositeConversionService}. - * + * * @author Erwin Vervaet */ public class CompositeConversionServiceTests extends TestCase { - + private CompositeConversionService service; - + protected void setUp() throws Exception { GenericConversionService first = new GenericConversionService(); first.addConverter(new TextToClass()); @@ -52,24 +52,21 @@ public class CompositeConversionServiceTests extends TestCase { try { service.getConversionExecutor(String.class, Date.class); fail(); - } - catch (ConversionException e) { + } catch (ConversionException e) { // expected } } - + public void testGetConversionExecutorByTargetAlias() { assertNotNull(service.getConversionExecutorByTargetAlias(String.class, "boolean")); assertEquals(Boolean.TRUE, service.getConversionExecutorByTargetAlias(String.class, "boolean").execute("ja")); assertNotNull(service.getConversionExecutorByTargetAlias(String.class, "integer")); assertNull(service.getConversionExecutorByTargetAlias(String.class, "class")); } - + public void testGetConversionExecutorsForSource() { - assertEquals( - new TextToClass().getTargetClasses().length + - new TextToBoolean().getTargetClasses().length + - new TextToNumber().getTargetClasses().length, + assertEquals(new TextToClass().getTargetClasses().length + new TextToBoolean().getTargetClasses().length + + new TextToNumber().getTargetClasses().length, service.getConversionExecutorsForSource(String.class).length); assertEquals(0, service.getConversionExecutorsForSource(Date.class).length); ConversionExecutor[] fromStringConversionExecutors = service.getConversionExecutorsForSource(String.class); @@ -81,7 +78,7 @@ public class CompositeConversionServiceTests extends TestCase { } assertEquals(Boolean.TRUE, booleanConversionExecutor.execute("ja")); } - + public void testGetClassByAlias() { assertEquals(Boolean.class, service.getClassByAlias("boolean")); assertEquals(Integer.class, service.getClassByAlias("integer")); diff --git a/spring-binding/src/test/java/org/springframework/binding/convert/support/DefaultConversionServiceTests.java b/spring-binding/src/test/java/org/springframework/binding/convert/support/DefaultConversionServiceTests.java index d74da8bf..e07b2876 100644 --- a/spring-binding/src/test/java/org/springframework/binding/convert/support/DefaultConversionServiceTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/convert/support/DefaultConversionServiceTests.java @@ -32,7 +32,7 @@ import org.springframework.core.enums.ShortCodedLabeledEnum; * @author Keith Donald */ public class DefaultConversionServiceTests extends TestCase { - + public void testConvertCompatibleTypes() { DefaultConversionService service = new DefaultConversionService(); service.addAlias("list", List.class); @@ -40,36 +40,34 @@ public class DefaultConversionServiceTests extends TestCase { List lst = new ArrayList(); assertSame(lst, service.getConversionExecutor(ArrayList.class, List.class).execute(lst)); assertSame(lst, service.getConversionExecutorByTargetAlias(ArrayList.class, "list").execute(lst)); - + try { service.getConversionExecutor(List.class, ArrayList.class); fail(); - } - catch (ConversionException e) { + } catch (ConversionException e) { // expected } } - + public void testOverrideConverter() { Converter customConverter = new TextToBoolean("ja", "nee"); - + DefaultConversionService service = new DefaultConversionService(); - + ConversionExecutor executor = service.getConversionExecutor(String.class, Boolean.class); assertNotSame(customConverter, executor.getConverter()); try { executor.execute("ja"); fail(); - } - catch (ConversionException e) { + } catch (ConversionException e) { // expected } - + service.addConverter(customConverter); - + executor = service.getConversionExecutor(String.class, Boolean.class); assertSame(customConverter, executor.getConverter()); - assertTrue(((Boolean)executor.execute("ja")).booleanValue()); + assertTrue(((Boolean) executor.execute("ja")).booleanValue()); } public void testTargetClassNotSupported() { @@ -77,15 +75,14 @@ public class DefaultConversionServiceTests extends TestCase { try { service.getConversionExecutor(String.class, HashMap.class); fail("Should have thrown an exception"); - } - catch (ConversionException e) { + } catch (ConversionException e) { } } public void testValidConversion() { DefaultConversionService service = new DefaultConversionService(); ConversionExecutor executor = service.getConversionExecutor(String.class, Integer.class); - Integer three = (Integer)executor.execute("3"); + Integer three = (Integer) executor.execute("3"); assertEquals(3, three.intValue()); } @@ -95,15 +92,14 @@ public class DefaultConversionServiceTests extends TestCase { try { executor.execute("My Invalid Label"); fail("Should have failed"); - } - catch (ConversionException e) { + } catch (ConversionException e) { } } public void testValidLabeledEnumConversion() { DefaultConversionService service = new DefaultConversionService(); ConversionExecutor executor = service.getConversionExecutor(String.class, MyEnum.class); - MyEnum myEnum = (MyEnum)executor.execute("My Label 1"); + MyEnum myEnum = (MyEnum) executor.execute("My Label 1"); assertEquals(MyEnum.ONE, myEnum); } diff --git a/spring-binding/src/test/java/org/springframework/binding/expression/support/CollectionAddingExpressionTests.java b/spring-binding/src/test/java/org/springframework/binding/expression/support/CollectionAddingExpressionTests.java index e9a342fe..5cf232bd 100644 --- a/spring-binding/src/test/java/org/springframework/binding/expression/support/CollectionAddingExpressionTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/expression/support/CollectionAddingExpressionTests.java @@ -47,18 +47,17 @@ public class CollectionAddingExpressionTests extends TestCase { assertEquals("1", bean.getList().get(0)); assertEquals("2", bean.getList().get(1)); } - + public void testNotACollection() { - Expression exp = parser.parseExpression("flag"); + Expression exp = parser.parseExpression("flag"); CollectionAddingExpression colExp = new CollectionAddingExpression(exp); try { colExp.evaluateToSet(bean, "1", null); fail("not a collection"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } - + public void testNoAddOnNullValue() { CollectionAddingExpression colExp = new CollectionAddingExpression(exp); colExp.evaluateToSet(bean, null, null); diff --git a/spring-binding/src/test/java/org/springframework/binding/expression/support/OgnlExpressionParserTests.java b/spring-binding/src/test/java/org/springframework/binding/expression/support/OgnlExpressionParserTests.java index 0c64dc18..21a45ed0 100644 --- a/spring-binding/src/test/java/org/springframework/binding/expression/support/OgnlExpressionParserTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/expression/support/OgnlExpressionParserTests.java @@ -28,29 +28,29 @@ public class OgnlExpressionParserTests extends TestCase { private OgnlExpressionParser parser = new OgnlExpressionParser(); private TestBean bean = new TestBean(); - + public void testParseSimpleDelimited() { String exp = "${flag}"; Expression e = parser.parseExpression(exp); assertNotNull(e); - Boolean b = (Boolean)e.evaluate(bean, null); + Boolean b = (Boolean) e.evaluate(bean, null); assertFalse(b.booleanValue()); } - + public void testParseSimple() { String exp = "flag"; Expression e = parser.parseExpression(exp); assertNotNull(e); - Boolean b = (Boolean)e.evaluate(bean, null); + Boolean b = (Boolean) e.evaluate(bean, null); assertFalse(b.booleanValue()); } - + public void testParseNull() { Expression e = parser.parseExpression(null); assertNotNull(e); assertNull(e.evaluate(bean, null)); } - + public void testParseEmpty() { Expression e = parser.parseExpression(""); assertNotNull(e); @@ -61,7 +61,7 @@ public class OgnlExpressionParserTests extends TestCase { String exp = "hello ${flag} ${flag} ${flag}"; Expression e = parser.parseExpression(exp); assertNotNull(e); - String str = (String)e.evaluate(bean, null); + String str = (String) e.evaluate(bean, null); assertEquals("hello false false false", str); } @@ -70,8 +70,7 @@ public class OgnlExpressionParserTests extends TestCase { try { parser.parseExpression(exp); fail("Should've failed - not intended use"); - } - catch (ParserException e) { + } catch (ParserException e) { } } @@ -79,58 +78,54 @@ public class OgnlExpressionParserTests extends TestCase { try { parser.parseExpression("${"); fail(); - } - catch (ParserException e) { + } catch (ParserException e) { } try { String exp = "hello ${flag} ${abcd defg"; parser.parseExpression(exp); fail("Should've failed - not intended use"); - } - catch (ParserException e) { + } catch (ParserException e) { } } - + public void testSyntaxError2() { try { parser.parseExpression("${}"); fail("Should've failed - not intended use"); - } - catch (ParserException e) { + } catch (ParserException e) { } try { String exp = "hello ${flag} ${}"; parser.parseExpression(exp); fail("Should've failed - not intended use"); - } - catch (ParserException e) { + } catch (ParserException e) { } } - + public void testIsDelimitedExpression() { assertTrue(parser.isDelimitedExpression("${foo}")); assertTrue(parser.isDelimitedExpression("${foo ${foo}}")); assertTrue(parser.isDelimitedExpression("foo ${bar}")); } - + public void testIsNotDelimitedExpression() { assertFalse(parser.isDelimitedExpression("foo")); assertFalse(parser.isDelimitedExpression("foo ${")); assertFalse(parser.isDelimitedExpression("$foo}")); assertFalse(parser.isDelimitedExpression("foo ${}")); } - + public void testCollectionContructionSyntax() { // lists parser.parseExpression("name in {null, \"Untitled\"}"); parser.parseExpression("${name in {null, \"Untitled\"}}"); - + // native arrays parser.parseExpression("new int[] {1, 2, 3}"); parser.parseExpression("${new int[] {1, 2, 3}}"); - + // maps parser.parseExpression("#{ 'foo' : 'foo value', 'bar' : 'bar value' }"); parser.parseExpression("${#{ 'foo' : 'foo value', 'bar' : 'bar value' }}"); diff --git a/spring-binding/src/test/java/org/springframework/binding/expression/support/SimpleExpressionTests.java b/spring-binding/src/test/java/org/springframework/binding/expression/support/SimpleExpressionTests.java index 5d27c0b3..d3623834 100644 --- a/spring-binding/src/test/java/org/springframework/binding/expression/support/SimpleExpressionTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/expression/support/SimpleExpressionTests.java @@ -26,16 +26,16 @@ import junit.framework.TestCase; import junit.framework.TestSuite; /** - * Tests simple expressions. Any expression language capable enough for - * real life usage should be able to pass these tests. - * + * Tests simple expressions. Any expression language capable enough for real life usage should be able to pass these + * tests. + * * @author Erwin Vervaet */ public class SimpleExpressionTests extends TestCase { - + private ExpressionParser expressionParser; private TestBean bean; - + public static TestSuite suite() { TestSuite suite = new TestSuite(); suite.addTest(new SimpleExpressionTests("testGetValue", new OgnlExpressionParser())); @@ -46,12 +46,12 @@ public class SimpleExpressionTests extends TestCase { suite.addTest(new SimpleExpressionTests("testSyntaxError", new BeanWrapperExpressionParser())); return suite; } - + public SimpleExpressionTests(String name, ExpressionParser expressionParser) { super(name); this.expressionParser = expressionParser; } - + protected void setUp() throws Exception { bean = new TestBean(); bean.setFlag(true); @@ -60,7 +60,7 @@ public class SimpleExpressionTests extends TestCase { list.add("bar"); bean.setList(list); } - + public void testGetValue() { assertEquals(Boolean.TRUE, expressionParser.parseExpression("${flag}").evaluate(bean, null)); assertEquals(Boolean.TRUE, expressionParser.parseExpression("flag").evaluate(bean, null)); @@ -80,15 +80,13 @@ public class SimpleExpressionTests extends TestCase { expressionParser.parseSettableExpression("${list[0]}").evaluateToSet(bean, "baa", null); assertEquals("baa", bean.getList().get(0)); } - + public void testSyntaxError() { try { expressionParser.parseExpression("foo(").evaluate(bean, null); fail("should have failed"); - } - catch (ParserException e) { - } - catch (EvaluationException e) { + } catch (ParserException e) { + } catch (EvaluationException e) { } } } diff --git a/spring-binding/src/test/java/org/springframework/binding/expression/support/TestBean.java b/spring-binding/src/test/java/org/springframework/binding/expression/support/TestBean.java index c28f43cb..e8f97636 100644 --- a/spring-binding/src/test/java/org/springframework/binding/expression/support/TestBean.java +++ b/spring-binding/src/test/java/org/springframework/binding/expression/support/TestBean.java @@ -19,11 +19,11 @@ import java.util.ArrayList; import java.util.List; public class TestBean { - + private boolean flag; private List list = new ArrayList(); - + public boolean isFlag() { return flag; } @@ -35,7 +35,7 @@ public class TestBean { public List getList() { return list; } - + public void setList(List list) { this.list = list; } diff --git a/spring-binding/src/test/java/org/springframework/binding/format/support/NumberFormatterTests.java b/spring-binding/src/test/java/org/springframework/binding/format/support/NumberFormatterTests.java index 213199e7..51feb701 100644 --- a/spring-binding/src/test/java/org/springframework/binding/format/support/NumberFormatterTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/format/support/NumberFormatterTests.java @@ -29,18 +29,18 @@ import junit.framework.TestCase; * @author Erwin Vervaet */ public class NumberFormatterTests extends TestCase { - + private Locale systemDefaultLocale; - + protected void setUp() throws Exception { systemDefaultLocale = Locale.getDefault(); } - + protected void tearDown() throws Exception { // restore default Locale.setDefault(systemDefaultLocale); } - + public void testParseUsBigDecimalInUs() { Locale.setDefault(Locale.US); SimpleFormatterFactory formatterFactory = new SimpleFormatterFactory(); @@ -56,7 +56,7 @@ public class NumberFormatterTests extends TestCase { Formatter formatter = formatterFactory.getNumberFormatter(BigDecimal.class); assertEquals(new BigDecimal("123.45"), formatter.parseValue("123.45", BigDecimal.class)); } - + public void testParseGermanBigDecimalInGermany() { Locale.setDefault(Locale.GERMANY); SimpleFormatterFactory formatterFactory = new SimpleFormatterFactory(); diff --git a/spring-binding/src/test/java/org/springframework/binding/mapping/RequiredMappingTests.java b/spring-binding/src/test/java/org/springframework/binding/mapping/RequiredMappingTests.java index f83ec8aa..b11be43c 100644 --- a/spring-binding/src/test/java/org/springframework/binding/mapping/RequiredMappingTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/mapping/RequiredMappingTests.java @@ -25,7 +25,7 @@ import org.springframework.binding.expression.support.OgnlExpressionParser; * Unit tests for the {@link org.springframework.binding.mapping.RequiredMapping}. */ public class RequiredMappingTests extends TestCase { - + public void testRequired() { MappingBuilder builder = new MappingBuilder(new OgnlExpressionParser()); Mapping mapping = builder.source("foo").target("bar").required().value(); @@ -35,7 +35,7 @@ public class RequiredMappingTests extends TestCase { mapping.map(source, target, null); assertEquals("baz", target.get("bar")); } - + public void testRequiredExceptionOnNull() { MappingBuilder builder = new MappingBuilder(new OgnlExpressionParser()); Mapping mapping = builder.source("foo").target("bar").required().value(); @@ -44,8 +44,7 @@ public class RequiredMappingTests extends TestCase { HashMap target = new HashMap(); try { mapping.map(source, target, null); - } - catch (RequiredMappingException e) { + } catch (RequiredMappingException e) { } } @@ -56,8 +55,7 @@ public class RequiredMappingTests extends TestCase { HashMap target = new HashMap(); try { mapping.map(source, target, null); - } - catch (RequiredMappingException e) { + } catch (RequiredMappingException e) { } } diff --git a/spring-binding/src/test/java/org/springframework/binding/method/MethodInvocationExceptionTests.java b/spring-binding/src/test/java/org/springframework/binding/method/MethodInvocationExceptionTests.java index 87d9c7ef..8d53dd95 100644 --- a/spring-binding/src/test/java/org/springframework/binding/method/MethodInvocationExceptionTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/method/MethodInvocationExceptionTests.java @@ -32,7 +32,7 @@ public class MethodInvocationExceptionTests extends TestCase { IllegalArgumentException iae = new IllegalArgumentException("test"); MethodInvocationException ex = testException(iae); assertSame(iae, ex.getTargetException()); - + // exception IOException ioe = new IOException("test"); ex = testException(ioe); @@ -42,15 +42,15 @@ public class MethodInvocationExceptionTests extends TestCase { InvocationTargetException ite = new InvocationTargetException(ioe); ex = testException(ite); assertSame(ioe, ex.getTargetException()); - + // deep nesting ite = new InvocationTargetException(new InvocationTargetException(ioe)); ex = testException(ite); assertSame(ioe, ex.getTargetException()); } - + // internal helpers - + private MethodInvocationException testException(Throwable cause) { return new MethodInvocationException(new MethodSignature("test"), null, cause); } diff --git a/spring-binding/src/test/java/org/springframework/binding/method/MethodInvokerTests.java b/spring-binding/src/test/java/org/springframework/binding/method/MethodInvokerTests.java index 6cfde2d0..ebb97ecd 100644 --- a/spring-binding/src/test/java/org/springframework/binding/method/MethodInvokerTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/method/MethodInvokerTests.java @@ -36,8 +36,7 @@ public class MethodInvokerTests extends TestCase { try { methodInvoker.invoke(new MethodSignature("test"), new TestObject(), null); fail(); - } - catch (MethodInvocationException e) { + } catch (MethodInvocationException e) { assertTrue(e.getTargetException() instanceof IllegalArgumentException); assertEquals("just testing", e.getTargetException().getMessage()); } @@ -47,8 +46,7 @@ public class MethodInvokerTests extends TestCase { try { methodInvoker.invoke(new MethodSignature("bogus"), new TestObject(), null); fail(); - } - catch (MethodInvocationException e) { + } catch (MethodInvocationException e) { assertTrue(e.getTargetException() instanceof InvalidMethodKeyException); } } diff --git a/spring-binding/src/test/java/org/springframework/binding/method/MethodKeyTests.java b/spring-binding/src/test/java/org/springframework/binding/method/MethodKeyTests.java index b96ae7da..a75c6e96 100644 --- a/spring-binding/src/test/java/org/springframework/binding/method/MethodKeyTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/method/MethodKeyTests.java @@ -31,7 +31,7 @@ public class MethodKeyTests extends TestCase { private static final Method LIST_FILENAME_FILTER = safeGetMethod(File.class, "list", new Class[] { FilenameFilter.class }); - + public void testGetMethodWithNoArgs() throws Exception { MethodKey key = new MethodKey(File.class, "list", new Class[0]); Method m = key.getMethod(); @@ -62,8 +62,7 @@ public class MethodKeyTests extends TestCase { private static final Method safeGetMethod(Class type, String name, Class[] argTypes) { try { return type.getMethod(name, argTypes); - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { throw new IllegalStateException("Unable to safely access a known method via reflection. " + e.getMessage()); } } diff --git a/spring-binding/src/test/java/org/springframework/binding/method/TextToMethodSignatureTests.java b/spring-binding/src/test/java/org/springframework/binding/method/TextToMethodSignatureTests.java index 339eae92..79a8e428 100644 --- a/spring-binding/src/test/java/org/springframework/binding/method/TextToMethodSignatureTests.java +++ b/spring-binding/src/test/java/org/springframework/binding/method/TextToMethodSignatureTests.java @@ -28,9 +28,9 @@ import org.springframework.binding.expression.support.OgnlExpressionParser; * @author Erwin Vervaet */ public class TextToMethodSignatureTests extends TestCase { - + private TextToMethodSignature converter; - + protected void setUp() throws Exception { DefaultConversionService conversionService = new DefaultConversionService(); conversionService.addConverter(new TextToExpression(new OgnlExpressionParser())); @@ -38,102 +38,101 @@ public class TextToMethodSignatureTests extends TestCase { } public void testParseNoArguments() { - MethodSignature signature = (MethodSignature)converter.convert("foo"); + MethodSignature signature = (MethodSignature) converter.convert("foo"); assertEquals("foo", signature.getMethodName()); assertEquals(0, signature.getParameters().size()); - - signature = (MethodSignature)converter.convert("foo()"); + + signature = (MethodSignature) converter.convert("foo()"); assertEquals("foo", signature.getMethodName()); assertEquals(0, signature.getParameters().size()); } - + public void testSingleArgument() { - MethodSignature signature = (MethodSignature)converter.convert("foo(${flowScope.bar})"); + MethodSignature signature = (MethodSignature) converter.convert("foo(${flowScope.bar})"); assertEquals("foo", signature.getMethodName()); assertEquals(1, signature.getParameters().size()); assertNull(signature.getParameters().getParameter(0).getType()); assertEquals("flowScope.bar", signature.getParameters().getParameter(0).getName().toString()); - - signature = (MethodSignature)converter.convert("foo(${'Foo' + flowScope.bar})"); + + signature = (MethodSignature) converter.convert("foo(${'Foo' + flowScope.bar})"); assertEquals("foo", signature.getMethodName()); assertEquals(1, signature.getParameters().size()); assertEquals("\"Foo\" + flowScope.bar", signature.getParameters().getParameter(0).getName().toString()); } - + public void testSingleArgumentWithType() { - MethodSignature signature = (MethodSignature)converter.convert("foo(java.lang.String ${flowScope.bar})"); + MethodSignature signature = (MethodSignature) converter.convert("foo(java.lang.String ${flowScope.bar})"); assertEquals("foo", signature.getMethodName()); assertEquals(1, signature.getParameters().size()); assertEquals(String.class, signature.getParameters().getParameter(0).getType()); assertEquals("flowScope.bar", signature.getParameters().getParameter(0).getName().toString()); - - signature = (MethodSignature)converter.convert("foo(long ${flowScope.bar})"); + + signature = (MethodSignature) converter.convert("foo(long ${flowScope.bar})"); assertEquals("foo", signature.getMethodName()); assertEquals(1, signature.getParameters().size()); assertEquals(Long.class, signature.getParameters().getParameter(0).getType()); assertEquals("flowScope.bar", signature.getParameters().getParameter(0).getName().toString()); } - + public void testMultipleArguments() { - MethodSignature signature = (MethodSignature)converter.convert( - "foo(${flowScope.bar}, ${externalContext.requestParameterMap.test})"); + MethodSignature signature = (MethodSignature) converter + .convert("foo(${flowScope.bar}, ${externalContext.requestParameterMap.test})"); assertEquals("foo", signature.getMethodName()); assertEquals(2, signature.getParameters().size()); assertNull(signature.getParameters().getParameter(0).getType()); assertEquals("flowScope.bar", signature.getParameters().getParameter(0).getName().toString()); assertNull(signature.getParameters().getParameter(1).getType()); - assertEquals("externalContext.requestParameterMap.test", signature.getParameters().getParameter(1).getName().toString()); + assertEquals("externalContext.requestParameterMap.test", signature.getParameters().getParameter(1).getName() + .toString()); } - + public void testMultipleArgumentsWithType() { - MethodSignature signature = (MethodSignature)converter.convert( - "foo(long ${flowScope.bar}, java.lang.String ${externalContext.requestParameterMap.test})"); + MethodSignature signature = (MethodSignature) converter + .convert("foo(long ${flowScope.bar}, java.lang.String ${externalContext.requestParameterMap.test})"); assertEquals("foo", signature.getMethodName()); assertEquals(2, signature.getParameters().size()); assertEquals(Long.class, signature.getParameters().getParameter(0).getType()); assertEquals("flowScope.bar", signature.getParameters().getParameter(0).getName().toString()); assertEquals(String.class, signature.getParameters().getParameter(1).getType()); - assertEquals("externalContext.requestParameterMap.test", signature.getParameters().getParameter(1).getName().toString()); + assertEquals("externalContext.requestParameterMap.test", signature.getParameters().getParameter(1).getName() + .toString()); } - + public void testCollectionConstructionSyntax() { - MethodSignature signature = (MethodSignature)converter.convert("foo({1, 2, 3})"); + MethodSignature signature = (MethodSignature) converter.convert("foo({1, 2, 3})"); assertEquals("foo", signature.getMethodName()); assertEquals(1, signature.getParameters().size()); assertNull(signature.getParameters().getParameter(0).getType()); assertEquals("{1, 2, 3}", signature.getParameters().getParameter(0).getName().toString()); } - + public void testCollectionConstructionSyntaxWithType() { - MethodSignature signature = (MethodSignature)converter.convert("foo(java.util.List {1, 2, 3})"); + MethodSignature signature = (MethodSignature) converter.convert("foo(java.util.List {1, 2, 3})"); assertEquals("foo", signature.getMethodName()); assertEquals(1, signature.getParameters().size()); assertEquals(java.util.List.class, signature.getParameters().getParameter(0).getType()); assertEquals("{1, 2, 3}", signature.getParameters().getParameter(0).getName().toString()); - - signature = (MethodSignature)converter.convert("foo(a${b,#{1:2},e}f${g,#{3:4},j}k)"); + + signature = (MethodSignature) converter.convert("foo(a${b,#{1:2},e}f${g,#{3:4},j}k)"); } - + public void testSyntaxErrors() { try { converter.convert("foo("); fail(); - } - catch (ConversionException e) { + } catch (ConversionException e) { } try { converter.convert("foo(long 1, ${bar()}"); fail(); + } catch (ConversionException e) { } - catch (ConversionException e) { - } - + try { converter.convert("foo(long 1, {1, 2)"); fail(); - } - catch (ConversionException e) { + } catch (ConversionException e) { } } } diff --git a/spring-webflow-samples/birthdate/.settings/org.eclipse.jdt.core.prefs b/spring-webflow-samples/birthdate/.settings/org.eclipse.jdt.core.prefs index 52db45d8..9cfedff3 100644 --- a/spring-webflow-samples/birthdate/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow-samples/birthdate/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,270 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:35:42 EDT 2007 eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow-samples/birthdate/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow-samples/birthdate/.settings/org.eclipse.jdt.ui.prefs index 31c851b5..7acc5571 100644 --- a/spring-webflow-samples/birthdate/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow-samples/birthdate/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,59 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:35:42 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 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow-samples/birthdate/src/main/java/org/springframework/webflow/samples/birthdate/BirthDateFormAction.java b/spring-webflow-samples/birthdate/src/main/java/org/springframework/webflow/samples/birthdate/BirthDateFormAction.java index 45c6d09c..137dd22c 100644 --- a/spring-webflow-samples/birthdate/src/main/java/org/springframework/webflow/samples/birthdate/BirthDateFormAction.java +++ b/spring-webflow-samples/birthdate/src/main/java/org/springframework/webflow/samples/birthdate/BirthDateFormAction.java @@ -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 diff --git a/spring-webflow-samples/birthdate/src/main/java/org/springframework/webflow/samples/birthdate/BirthDateValidator.java b/spring-webflow-samples/birthdate/src/main/java/org/springframework/webflow/samples/birthdate/BirthDateValidator.java index ab6e7c66..49f50170 100644 --- a/spring-webflow-samples/birthdate/src/main/java/org/springframework/webflow/samples/birthdate/BirthDateValidator.java +++ b/spring-webflow-samples/birthdate/src/main/java/org/springframework/webflow/samples/birthdate/BirthDateValidator.java @@ -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."); } diff --git a/spring-webflow-samples/fileupload/.settings/org.eclipse.jdt.core.prefs b/spring-webflow-samples/fileupload/.settings/org.eclipse.jdt.core.prefs index 52db45d8..7adbfff9 100644 --- a/spring-webflow-samples/fileupload/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow-samples/fileupload/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,270 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:35:31 EDT 2007 eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow-samples/fileupload/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow-samples/fileupload/.settings/org.eclipse.jdt.ui.prefs index 31c851b5..c2a5412f 100644 --- a/spring-webflow-samples/fileupload/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow-samples/fileupload/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:35:31 EDT 2007 eclipse.preferences.version=1 -internal.default.compliance=default +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spring Java Conventions +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow-samples/fileupload/src/main/java/org/springframework/webflow/samples/fileupload/FileUploadAction.java b/spring-webflow-samples/fileupload/src/main/java/org/springframework/webflow/samples/fileupload/FileUploadAction.java index 7b15dae9..20ada647 100644 --- a/spring-webflow-samples/fileupload/src/main/java/org/springframework/webflow/samples/fileupload/FileUploadAction.java +++ b/spring-webflow-samples/fileupload/src/main/java/org/springframework/webflow/samples/fileupload/FileUploadAction.java @@ -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(); } } diff --git a/spring-webflow-samples/flowlauncher/.settings/org.eclipse.jdt.core.prefs b/spring-webflow-samples/flowlauncher/.settings/org.eclipse.jdt.core.prefs index 52db45d8..1e693489 100644 --- a/spring-webflow-samples/flowlauncher/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow-samples/flowlauncher/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,270 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:34:57 EDT 2007 eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow-samples/flowlauncher/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow-samples/flowlauncher/.settings/org.eclipse.jdt.ui.prefs index 31c851b5..364f9660 100644 --- a/spring-webflow-samples/flowlauncher/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow-samples/flowlauncher/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:34:57 EDT 2007 eclipse.preferences.version=1 -internal.default.compliance=default +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spring Java Conventions +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow-samples/itemlist/.settings/org.eclipse.jdt.core.prefs b/spring-webflow-samples/itemlist/.settings/org.eclipse.jdt.core.prefs index 52db45d8..1230ed14 100644 --- a/spring-webflow-samples/itemlist/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow-samples/itemlist/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,270 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:34:42 EDT 2007 eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow-samples/itemlist/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow-samples/itemlist/.settings/org.eclipse.jdt.ui.prefs index 31c851b5..484a9db6 100644 --- a/spring-webflow-samples/itemlist/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow-samples/itemlist/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:34:42 EDT 2007 eclipse.preferences.version=1 -internal.default.compliance=default +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spring Java Conventions +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow-samples/itemlist/src/main/java/org/springframework/webflow/samples/itemlist/AddItemAction.java b/spring-webflow-samples/itemlist/src/main/java/org/springframework/webflow/samples/itemlist/AddItemAction.java index 65f7f04c..efbae1a4 100644 --- a/spring-webflow-samples/itemlist/src/main/java/org/springframework/webflow/samples/itemlist/AddItemAction.java +++ b/spring-webflow-samples/itemlist/src/main/java/org/springframework/webflow/samples/itemlist/AddItemAction.java @@ -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(); diff --git a/spring-webflow-samples/numberguess/.settings/org.eclipse.jdt.core.prefs b/spring-webflow-samples/numberguess/.settings/org.eclipse.jdt.core.prefs index 52db45d8..ee52594d 100644 --- a/spring-webflow-samples/numberguess/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow-samples/numberguess/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,270 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:34:27 EDT 2007 eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow-samples/numberguess/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow-samples/numberguess/.settings/org.eclipse.jdt.ui.prefs index 31c851b5..218f34f2 100644 --- a/spring-webflow-samples/numberguess/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow-samples/numberguess/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:34:27 EDT 2007 eclipse.preferences.version=1 -internal.default.compliance=default +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spring Java Conventions +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow-samples/numberguess/src/main/java/org/springframework/webflow/samples/numberguess/HigherLowerGame.java b/spring-webflow-samples/numberguess/src/main/java/org/springframework/webflow/samples/numberguess/HigherLowerGame.java index eccea80a..12df15e6 100644 --- a/spring-webflow-samples/numberguess/src/main/java/org/springframework/webflow/samples/numberguess/HigherLowerGame.java +++ b/spring-webflow-samples/numberguess/src/main/java/org/springframework/webflow/samples/numberguess/HigherLowerGame.java @@ -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); } } diff --git a/spring-webflow-samples/numberguess/src/main/java/org/springframework/webflow/samples/numberguess/MastermindGame.java b/spring-webflow-samples/numberguess/src/main/java/org/springframework/webflow/samples/numberguess/MastermindGame.java index 2d05209e..4c798647 100644 --- a/spring-webflow-samples/numberguess/src/main/java/org/springframework/webflow/samples/numberguess/MastermindGame.java +++ b/spring-webflow-samples/numberguess/src/main/java/org/springframework/webflow/samples/numberguess/MastermindGame.java @@ -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; } } diff --git a/spring-webflow-samples/numberguess/src/test/java/org/springframework/webflow/samples/numberguess/MastermindGameTests.java b/spring-webflow-samples/numberguess/src/test/java/org/springframework/webflow/samples/numberguess/MastermindGameTests.java index e9732a34..41cbd85c 100644 --- a/spring-webflow-samples/numberguess/src/test/java/org/springframework/webflow/samples/numberguess/MastermindGameTests.java +++ b/spring-webflow-samples/numberguess/src/test/java/org/springframework/webflow/samples/numberguess/MastermindGameTests.java @@ -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); diff --git a/spring-webflow-samples/phonebook-portlet/.settings/org.eclipse.jdt.core.prefs b/spring-webflow-samples/phonebook-portlet/.settings/org.eclipse.jdt.core.prefs index dcae5b26..a58426b1 100644 --- a/spring-webflow-samples/phonebook-portlet/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow-samples/phonebook-portlet/.settings/org.eclipse.jdt.core.prefs @@ -1,5 +1,13 @@ -#Sun Apr 16 11:53:00 EDT 2006 +#Wed Aug 15 09:34:00 EDT 2007 eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= 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 @@ -10,3 +18,257 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow-samples/phonebook-portlet/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow-samples/phonebook-portlet/.settings/org.eclipse.jdt.ui.prefs index 12c73352..87dd9638 100644 --- a/spring-webflow-samples/phonebook-portlet/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow-samples/phonebook-portlet/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Tue Feb 07 10:23:17 EST 2006 +#Wed Aug 15 09:34:00 EDT 2007 eclipse.preferences.version=1 -internal.default.compliance=default +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spring Java Conventions +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/SearchCriteriaValidator.java b/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/SearchCriteriaValidator.java index b915ba51..5cd8aab2 100644 --- a/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/SearchCriteriaValidator.java +++ b/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/SearchCriteriaValidator.java @@ -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!"); } } diff --git a/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PersonDetailFlowBuilder.java b/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PersonDetailFlowBuilder.java index 0b246f12..7c397bd8 100644 --- a/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PersonDetailFlowBuilder.java +++ b/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PersonDetailFlowBuilder.java @@ -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 detail-flow.xml XML flow definition. + * Java-based flow builder that builds the person details flow, exactly like it is defined in the + * detail-flow.xml XML flow definition. *

- * 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 */ diff --git a/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PhonebookFlowRegistryFactoryBean.java b/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PhonebookFlowRegistryFactoryBean.java index 4e199be7..451198e7 100644 --- a/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PhonebookFlowRegistryFactoryBean.java +++ b/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PhonebookFlowRegistryFactoryBean.java @@ -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()); diff --git a/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/SearchPersonFlowBuilder.java b/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/SearchPersonFlowBuilder.java index b4148584..53f5860c 100644 --- a/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/SearchPersonFlowBuilder.java +++ b/spring-webflow-samples/phonebook-portlet/src/main/java/org/springframework/webflow/samples/phonebook/webflow/SearchPersonFlowBuilder.java @@ -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 - * search-flow.xml 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 search-flow.xml XML flow definition. *

- * 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 */ diff --git a/spring-webflow-samples/phonebook-portlet/src/test/java/org/springframework/webflow/samples/phonebook/webflow/SearchFlowExecutionTests.java b/spring-webflow-samples/phonebook-portlet/src/test/java/org/springframework/webflow/samples/phonebook/webflow/SearchFlowExecutionTests.java index da233851..c4f76b74 100644 --- a/spring-webflow-samples/phonebook-portlet/src/test/java/org/springframework/webflow/samples/phonebook/webflow/SearchFlowExecutionTests.java +++ b/spring-webflow-samples/phonebook-portlet/src/test/java/org/springframework/webflow/samples/phonebook/webflow/SearchFlowExecutionTests.java @@ -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 diff --git a/spring-webflow-samples/phonebook/.settings/org.eclipse.jdt.core.prefs b/spring-webflow-samples/phonebook/.settings/org.eclipse.jdt.core.prefs index 52db45d8..b1fcfde6 100644 --- a/spring-webflow-samples/phonebook/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow-samples/phonebook/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,270 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:34:14 EDT 2007 eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow-samples/phonebook/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow-samples/phonebook/.settings/org.eclipse.jdt.ui.prefs index 31c851b5..6a50854e 100644 --- a/spring-webflow-samples/phonebook/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow-samples/phonebook/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:34:15 EDT 2007 eclipse.preferences.version=1 -internal.default.compliance=default +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spring Java Conventions +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/SearchCriteriaValidator.java b/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/SearchCriteriaValidator.java index 080540a6..ac57b80d 100644 --- a/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/SearchCriteriaValidator.java +++ b/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/SearchCriteriaValidator.java @@ -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"); } } diff --git a/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PersonDetailFlowBuilder.java b/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PersonDetailFlowBuilder.java index 0b246f12..7c397bd8 100644 --- a/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PersonDetailFlowBuilder.java +++ b/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PersonDetailFlowBuilder.java @@ -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 detail-flow.xml XML flow definition. + * Java-based flow builder that builds the person details flow, exactly like it is defined in the + * detail-flow.xml XML flow definition. *

- * 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 */ diff --git a/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PhonebookFlowRegistryFactoryBean.java b/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PhonebookFlowRegistryFactoryBean.java index 4e199be7..451198e7 100644 --- a/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PhonebookFlowRegistryFactoryBean.java +++ b/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/PhonebookFlowRegistryFactoryBean.java @@ -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()); diff --git a/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/SearchPersonFlowBuilder.java b/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/SearchPersonFlowBuilder.java index b4148584..53f5860c 100644 --- a/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/SearchPersonFlowBuilder.java +++ b/spring-webflow-samples/phonebook/src/main/java/org/springframework/webflow/samples/phonebook/webflow/SearchPersonFlowBuilder.java @@ -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 - * search-flow.xml 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 search-flow.xml XML flow definition. *

- * 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 */ diff --git a/spring-webflow-samples/phonebook/src/test/java/org/springframework/webflow/samples/phonebook/webflow/SearchFlowExecutionTests.java b/spring-webflow-samples/phonebook/src/test/java/org/springframework/webflow/samples/phonebook/webflow/SearchFlowExecutionTests.java index da233851..c4f76b74 100644 --- a/spring-webflow-samples/phonebook/src/test/java/org/springframework/webflow/samples/phonebook/webflow/SearchFlowExecutionTests.java +++ b/spring-webflow-samples/phonebook/src/test/java/org/springframework/webflow/samples/phonebook/webflow/SearchFlowExecutionTests.java @@ -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 diff --git a/spring-webflow-samples/sellitem-jsf/.settings/org.eclipse.jdt.core.prefs b/spring-webflow-samples/sellitem-jsf/.settings/org.eclipse.jdt.core.prefs index 52db45d8..80397d0f 100644 --- a/spring-webflow-samples/sellitem-jsf/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow-samples/sellitem-jsf/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,270 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:31:49 EDT 2007 eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow-samples/sellitem-jsf/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow-samples/sellitem-jsf/.settings/org.eclipse.jdt.ui.prefs index 350fecbc..4313f5bf 100644 --- a/spring-webflow-samples/sellitem-jsf/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow-samples/sellitem-jsf/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Sat Nov 05 22:15:26 EST 2005 +#Wed Aug 15 09:31:49 EDT 2007 eclipse.preferences.version=1 -internal.default.compliance=default +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spring Java Conventions +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/InMemoryDatabaseCreator.java b/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/InMemoryDatabaseCreator.java index baafe632..45cc5d36 100644 --- a/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/InMemoryDatabaseCreator.java +++ b/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/InMemoryDatabaseCreator.java @@ -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); } diff --git a/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/JdbcSaleProcessor.java b/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/JdbcSaleProcessor.java index b0506d87..a3a56bf6 100644 --- a/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/JdbcSaleProcessor.java +++ b/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/JdbcSaleProcessor.java @@ -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.getPrice(), sale.getItemCount(), sale.getCategory(), sale.getShippingType() }); } diff --git a/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java b/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java index 99a632f5..2b35bf86 100644 --- a/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java +++ b/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java @@ -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; diff --git a/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/SellItemAction.java b/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/SellItemAction.java index 7d834edb..80ab1d4d 100644 --- a/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/SellItemAction.java +++ b/spring-webflow-samples/sellitem-jsf/src/main/java/org/springframework/webflow/samples/sellitem/SellItemAction.java @@ -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(); } diff --git a/spring-webflow-samples/sellitem/.settings/org.eclipse.jdt.core.prefs b/spring-webflow-samples/sellitem/.settings/org.eclipse.jdt.core.prefs index 52db45d8..fad6c791 100644 --- a/spring-webflow-samples/sellitem/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow-samples/sellitem/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,270 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:33:42 EDT 2007 eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow-samples/sellitem/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow-samples/sellitem/.settings/org.eclipse.jdt.ui.prefs index 350fecbc..06d4eeac 100644 --- a/spring-webflow-samples/sellitem/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow-samples/sellitem/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Sat Nov 05 22:15:26 EST 2005 +#Wed Aug 15 09:33:42 EDT 2007 eclipse.preferences.version=1 -internal.default.compliance=default +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spring Java Conventions +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/InMemoryDatabaseCreator.java b/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/InMemoryDatabaseCreator.java index a0365260..b9eb2afa 100644 --- a/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/InMemoryDatabaseCreator.java +++ b/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/InMemoryDatabaseCreator.java @@ -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); } diff --git a/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/JdbcSaleProcessor.java b/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/JdbcSaleProcessor.java index 3e2a8bff..a3a56bf6 100644 --- a/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/JdbcSaleProcessor.java +++ b/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/JdbcSaleProcessor.java @@ -20,7 +20,10 @@ 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() }); + getJdbcTemplate() + .update( + "insert into T_SALES values (?, ?, ?, ?, ?)", + new Object[] { null, sale.getPrice(), sale.getItemCount(), sale.getCategory(), + sale.getShippingType() }); } } diff --git a/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java b/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java index f6b1fdf3..13f42bac 100644 --- a/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java +++ b/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java @@ -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; diff --git a/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/SaleValidator.java b/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/SaleValidator.java index a3f493a1..060afdb8 100644 --- a/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/SaleValidator.java +++ b/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/SaleValidator.java @@ -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"); diff --git a/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java b/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java index 1b757892..27347a31 100644 --- a/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java +++ b/spring-webflow-samples/sellitem/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java @@ -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 diff --git a/spring-webflow-samples/sellitem/src/test/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionTests.java b/spring-webflow-samples/sellitem/src/test/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionTests.java index b482eae7..e3be17d3 100644 --- a/spring-webflow-samples/sellitem/src/test/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionTests.java +++ b/spring-webflow-samples/sellitem/src/test/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionTests.java @@ -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"); diff --git a/spring-webflow-samples/shippingrate/.settings/org.eclipse.jdt.core.prefs b/spring-webflow-samples/shippingrate/.settings/org.eclipse.jdt.core.prefs index 52db45d8..af9c5473 100644 --- a/spring-webflow-samples/shippingrate/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow-samples/shippingrate/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,270 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:31:27 EDT 2007 eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 org.eclipse.jdt.core.compiler.compliance=1.5 org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow-samples/shippingrate/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow-samples/shippingrate/.settings/org.eclipse.jdt.ui.prefs index 31c851b5..2fa1ac74 100644 --- a/spring-webflow-samples/shippingrate/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow-samples/shippingrate/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Mon Nov 13 17:29:33 PST 2006 +#Wed Aug 15 09:30:17 EDT 2007 eclipse.preferences.version=1 -internal.default.compliance=default +editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true +formatter_profile=_Spring Java Conventions +formatter_settings_version=11 +org.eclipse.jdt.ui.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow-samples/shippingrate/src/main/java/org/springframework/webflow/samples/shippingrate/domain/Rate.java b/spring-webflow-samples/shippingrate/src/main/java/org/springframework/webflow/samples/shippingrate/domain/Rate.java index 93f13223..edfd7bba 100644 --- a/spring-webflow-samples/shippingrate/src/main/java/org/springframework/webflow/samples/shippingrate/domain/Rate.java +++ b/spring-webflow-samples/shippingrate/src/main/java/org/springframework/webflow/samples/shippingrate/domain/Rate.java @@ -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() { diff --git a/spring-webflow-samples/shippingrate/src/main/java/org/springframework/webflow/samples/shippingrate/domain/RateCriteriaValidator.java b/spring-webflow-samples/shippingrate/src/main/java/org/springframework/webflow/samples/shippingrate/domain/RateCriteriaValidator.java index 2260aade..4bc5d845 100644 --- a/spring-webflow-samples/shippingrate/src/main/java/org/springframework/webflow/samples/shippingrate/domain/RateCriteriaValidator.java +++ b/spring-webflow-samples/shippingrate/src/main/java/org/springframework/webflow/samples/shippingrate/domain/RateCriteriaValidator.java @@ -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); diff --git a/spring-webflow-sandbox/.settings/org.eclipse.jdt.core.prefs b/spring-webflow-sandbox/.settings/org.eclipse.jdt.core.prefs index 066111a1..3aa8951d 100644 --- a/spring-webflow-sandbox/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow-sandbox/.settings/org.eclipse.jdt.core.prefs @@ -1,74 +1,336 @@ -#Wed Mar 07 21:33:41 CET 2007 -eclipse.preferences.version=1 -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 -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=ignore -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.5 +#Wed Aug 15 09:35:57 EDT 2007 +eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +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 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.5 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow-sandbox/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow-sandbox/.settings/org.eclipse.jdt.ui.prefs index 43086fa6..aed7a61c 100644 --- a/spring-webflow-sandbox/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow-sandbox/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Wed Mar 07 21:34:27 CET 2007 -eclipse.preferences.version=1 -internal.default.compliance=default +#Wed Aug 15 09:35:57 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.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractReadOnlyResourceHolder.java b/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractReadOnlyResourceHolder.java index 5823badb..71478e89 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractReadOnlyResourceHolder.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractReadOnlyResourceHolder.java @@ -2,11 +2,11 @@ package org.springframework.util; /** * Read-only resource holder. - * + * * @author Maxim Petrashev */ public abstract class AbstractReadOnlyResourceHolder extends AbstractResourceHolder { - public final void set(E aObject) { - throw new UnsupportedOperationException(); - } + public final void set(E aObject) { + throw new UnsupportedOperationException(); + } } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractResourceHolder.java b/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractResourceHolder.java index f63da202..3d002671 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractResourceHolder.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/util/AbstractResourceHolder.java @@ -6,19 +6,19 @@ import java.lang.reflect.Method; /** * Base abstract implementation of resource holder that implement method replacment logic. - * + * * @author Maxim Petrashev */ -public abstract class AbstractResourceHolder implements ResourceHolder - , MethodReplacer {//todo replace on injector in config +public abstract class AbstractResourceHolder implements ResourceHolder, MethodReplacer {// todo replace on + // injector in config @SuppressWarnings("unchecked") - public Object reimplement(Object aObj, Method aMethod, Object[] aArgs) throws Throwable { - Object retVal = null; - if( aArgs.length == 0 ){ - retVal = get(); - } else { - set( (E) aArgs[0] ); - } - return retVal; - } + public Object reimplement(Object aObj, Method aMethod, Object[] aArgs) throws Throwable { + Object retVal = null; + if (aArgs.length == 0) { + retVal = get(); + } else { + set((E) aArgs[0]); + } + return retVal; + } } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/util/ResourceHolder.java b/spring-webflow-sandbox/src/main/java/org/springframework/util/ResourceHolder.java index 1e9ab9b2..68a2b3d2 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/util/ResourceHolder.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/util/ResourceHolder.java @@ -2,10 +2,11 @@ package org.springframework.util; /** * Base interface for object holder concept. - * + * * @author Maxim Petrashev */ public interface ResourceHolder { - E get(); - void set(E aObject); + E get(); + + void set(E aObject); } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ConversationLifecycleListener.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ConversationLifecycleListener.java index a5b822ba..7689b48c 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ConversationLifecycleListener.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ConversationLifecycleListener.java @@ -5,92 +5,93 @@ import org.springframework.webflow.core.collection.MutableAttributeMap; /** * Listener interface for callback notification about phases in during conversation - * + * * @author Maxim Petrashev */ public interface ConversationLifecycleListener { - /** - * Invoked when a flow is launched. The launching flow is not active. - * - * @param aNewFlow The launching flow - * @param aContext The request context - */ + /** + * Invoked when a flow is launched. The launching flow is not active. + * + * @param aNewFlow The launching flow + * @param aContext The request context + */ - void startingFlow(FlowDefinition aNewFlow, RequestContext aContext); + void startingFlow(FlowDefinition aNewFlow, RequestContext aContext); - void flowStarted(RequestContext aContext, MutableAttributeMap aInput); - /** - * Invoked when the root flow session has ended. - * - * @param aEndedSession The ended session - * @param aContext The request context - */ - void flowEnded(FlowSession aEndedSession, RequestContext aContext); + void flowStarted(RequestContext aContext, MutableAttributeMap aInput); - void endingFlow(RequestContext aContext, MutableAttributeMap aOutput); - /** - * Invoked in parent flow before spawning in subflow but after input mapping has been happened. - * The child flow session is not available to implementations of this method because the flow session for - * the child flow has not yet started.

If you need to add items to the - * subflow scope, put them in aInput. - * - * @param aParentSession The active parent flow session - * @param aChild The child flow - * @param aContext The request context - * @param aInput The input map - */ - void startingSubflow(FlowSession aParentSession, FlowDefinition aChild, RequestContext aContext - , MutableAttributeMap aInput); - /** - * Invoked when a subflow is launched. The child flow session is not - * available to implementations of this method because the flow session for - * the child flow has not yet started.

If you need to add items to the - * subflow scope, put them in aInput. - * - * @param aContext The request context - * @param aInput The input map - */ - void subflowStarted(RequestContext aContext , MutableAttributeMap aInput); - /** - * Invoked in subflow flow before spawning back to parent flot but after output mapping has been happened. - * The parent flow session is not available to implementations of this method because the flow session for - * the parent flow has not yet continued.

If you need to add items to the - * parent flow scope, put them in aOutput. - * - * @param aContext The request context - * @param aOutput The input map - */ - void endingSubflow(RequestContext aContext , MutableAttributeMap aOutput); - /** - * Invoked when a parent flow is launched back. The child flow session is not - * available to implementations of this method because the flow session for - * the child flow has not yet started.

If you need to add items to the - * subflow scope, put them in aInput. - * - * @param aParentSession The active parent flow session - * @param aChild The child flow - * @param aContext The request context - * @param aOutput The input map - */ - void subflowEnded(FlowSession aParentSession, FlowDefinition aChild, RequestContext aContext - , MutableAttributeMap aOutput); - /** - * The currently executing flow session is active. This occurs after the - * first event for the executing request has been signaled or resume event has been happended. Invoked once per - * request and provides access to the active flow session prior to any - * actions being performed. - * - * @param aContext The request context - */ - void sessionActive(RequestContext aContext); - /** - * The currently executing flow session is active. This occurs after the - * first event for the executing request has been signaled or resume event has been happended. Invoked once per - * request and provides access to the active flow session prior to any - * actions being performed. - * - * @param aContext The request context - */ - void sessionDeactive(RequestContext aContext); + /** + * Invoked when the root flow session has ended. + * + * @param aEndedSession The ended session + * @param aContext The request context + */ + void flowEnded(FlowSession aEndedSession, RequestContext aContext); + + void endingFlow(RequestContext aContext, MutableAttributeMap aOutput); + + /** + * Invoked in parent flow before spawning in subflow but after input mapping has been happened. The child flow + * session is not available to implementations of this method because the flow session for the child flow has not + * yet started.

If you need to add items to the subflow scope, put them in aInput. + * + * @param aParentSession The active parent flow session + * @param aChild The child flow + * @param aContext The request context + * @param aInput The input map + */ + void startingSubflow(FlowSession aParentSession, FlowDefinition aChild, RequestContext aContext, + MutableAttributeMap aInput); + + /** + * Invoked when a subflow is launched. The child flow session is not available to implementations of this method + * because the flow session for the child flow has not yet started.

If you need to add items to the subflow + * scope, put them in aInput. + * + * @param aContext The request context + * @param aInput The input map + */ + void subflowStarted(RequestContext aContext, MutableAttributeMap aInput); + + /** + * Invoked in subflow flow before spawning back to parent flot but after output mapping has been happened. The + * parent flow session is not available to implementations of this method because the flow session for the parent + * flow has not yet continued.

If you need to add items to the parent flow scope, put them in aOutput. + * + * @param aContext The request context + * @param aOutput The input map + */ + void endingSubflow(RequestContext aContext, MutableAttributeMap aOutput); + + /** + * Invoked when a parent flow is launched back. The child flow session is not available to implementations of this + * method because the flow session for the child flow has not yet started.

If you need to add items to the + * subflow scope, put them in aInput. + * + * @param aParentSession The active parent flow session + * @param aChild The child flow + * @param aContext The request context + * @param aOutput The input map + */ + void subflowEnded(FlowSession aParentSession, FlowDefinition aChild, RequestContext aContext, + MutableAttributeMap aOutput); + + /** + * The currently executing flow session is active. This occurs after the first event for the executing request has + * been signaled or resume event has been happended. Invoked once per request and provides access to the active flow + * session prior to any actions being performed. + * + * @param aContext The request context + */ + void sessionActive(RequestContext aContext); + + /** + * The currently executing flow session is active. This occurs after the first event for the executing request has + * been signaled or resume event has been happended. Invoked once per request and provides access to the active flow + * session prior to any actions being performed. + * + * @param aContext The request context + */ + void sessionDeactive(RequestContext aContext); } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ConversationLifecycleListenerAdapter.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ConversationLifecycleListenerAdapter.java index 0dbc5137..d2cfe0b0 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ConversationLifecycleListenerAdapter.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ConversationLifecycleListenerAdapter.java @@ -4,41 +4,44 @@ import org.springframework.webflow.definition.FlowDefinition; import org.springframework.webflow.core.collection.MutableAttributeMap; /** - * + * * @author Maxim Petrashev */ public abstract class ConversationLifecycleListenerAdapter implements ConversationLifecycleListener { - public void startingFlow(FlowDefinition aNewFlow, RequestContext aContext) { - } + public void startingFlow(FlowDefinition aNewFlow, RequestContext aContext) { + } - public void flowStarted(RequestContext aContext, MutableAttributeMap aInput) { - } + public void flowStarted(RequestContext aContext, MutableAttributeMap aInput) { + } - public void flowEnded(FlowSession aEndedSession, RequestContext aContext) { - } + public void flowEnded(FlowSession aEndedSession, RequestContext aContext) { + } - public void endingFlow(RequestContext aContext, MutableAttributeMap aOutput) { - } + public void endingFlow(RequestContext aContext, MutableAttributeMap aOutput) { + } - public void startingSubflow(FlowSession aParentSession, FlowDefinition aChild, RequestContext aContext, MutableAttributeMap aInput) { - } + public void startingSubflow(FlowSession aParentSession, FlowDefinition aChild, RequestContext aContext, + MutableAttributeMap aInput) { + } - public void subflowStarted(RequestContext aContext, MutableAttributeMap aInput) { - } + public void subflowStarted(RequestContext aContext, MutableAttributeMap aInput) { + } - public void subflowStarted(FlowSession aParentSession, FlowDefinition aChild, RequestContext aContext, MutableAttributeMap aInput) { - } + public void subflowStarted(FlowSession aParentSession, FlowDefinition aChild, RequestContext aContext, + MutableAttributeMap aInput) { + } - public void endingSubflow(RequestContext aContext, MutableAttributeMap aOutput) { - } + public void endingSubflow(RequestContext aContext, MutableAttributeMap aOutput) { + } - public void subflowEnded(FlowSession aParentSession, FlowDefinition aChild, RequestContext aContext, MutableAttributeMap aOutput) { - } + public void subflowEnded(FlowSession aParentSession, FlowDefinition aChild, RequestContext aContext, + MutableAttributeMap aOutput) { + } - public void sessionActive(RequestContext aContext) { - } + public void sessionActive(RequestContext aContext) { + } - public void sessionDeactive(RequestContext aContext) { - } + public void sessionDeactive(RequestContext aContext) { + } } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ExtendedFlowExecutionListenerInterceptor.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ExtendedFlowExecutionListenerInterceptor.java index 28c2b2ff..401e0213 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ExtendedFlowExecutionListenerInterceptor.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/execution/ExtendedFlowExecutionListenerInterceptor.java @@ -9,173 +9,167 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /** - * A listener/interceptor whose purpose is to adapt a HandlerInterceptor and - * FlowExecutionListener to provide expanded coverage at the beginning and - * ending of a request coming into a flow controller. The idea is to signal when - * a flow starts/activates, then signal when it has deactivated or ended. In - * addition, it should be signaled when a subflow starts/activates and - * ends/deactivates. + * A listener/interceptor whose purpose is to adapt a HandlerInterceptor and FlowExecutionListener to provide expanded + * coverage at the beginning and ending of a request coming into a flow controller. The idea is to signal when a flow + * starts/activates, then signal when it has deactivated or ended. In addition, it should be signaled when a subflow + * starts/activates and ends/deactivates. *

- * Adapted from Alex Wolfe's post at + * Adapted from Alex Wolfe's post at * http://forum.springframework.org/showthread.php?t=17633 - * - * + * + * * @author Andrew Ebaugh * @author Maxim Petrashev */ public class ExtendedFlowExecutionListenerInterceptor extends FlowExecutionListenerAdapter { - protected final Log _logger = LogFactory.getLog(getClass()); + protected final Log _logger = LogFactory.getLog(getClass()); - private static String FIRST_EVENT_SIGNALED = ExtendedFlowExecutionListenerInterceptor.class.getName() + ".FIRST_EVENT_SIGNALED"; - private static String CURRENT_SESSION_ENDED = ExtendedFlowExecutionListenerInterceptor.class.getName() + ".CURRENT_SESSION_ENDED"; + private static String FIRST_EVENT_SIGNALED = ExtendedFlowExecutionListenerInterceptor.class.getName() + + ".FIRST_EVENT_SIGNALED"; + private static String CURRENT_SESSION_ENDED = ExtendedFlowExecutionListenerInterceptor.class.getName() + + ".CURRENT_SESSION_ENDED"; + public ExtendedFlowExecutionListenerInterceptor(ConversationLifecycleListener aConversationLifecycleListener) { + _conversationLifecycleListener = aConversationLifecycleListener; + } - public ExtendedFlowExecutionListenerInterceptor(ConversationLifecycleListener aConversationLifecycleListener) { - _conversationLifecycleListener = aConversationLifecycleListener; - } + private ConversationLifecycleListener _conversationLifecycleListener; - private ConversationLifecycleListener _conversationLifecycleListener; + /** + * Called when any client request is submitted to manipulate this flow execution. Sets a flag in the request scope + * that is activated when the first state is entered during this request. This flag is required in order to trigger + * execution of the {@link ConversationLifecycleListener#sessionActive(RequestContext)} method. + * + * @param aContext The request aContext + */ + public final void requestSubmitted(RequestContext aContext) { + aContext.getRequestScope().put(FIRST_EVENT_SIGNALED, Boolean.FALSE); + aContext.getRequestScope().put(CURRENT_SESSION_ENDED, Boolean.FALSE); + } - /** - * Called when any client request is submitted to manipulate this flow - * execution. Sets a flag in the request scope that is activated when the - * first state is entered during this request. This flag is required in - * order to trigger execution of the {@link ConversationLifecycleListener#sessionActive(RequestContext)} - * method. - * - * @param aContext The request aContext - */ - public final void requestSubmitted(RequestContext aContext) { - aContext.getRequestScope().put(FIRST_EVENT_SIGNALED, Boolean.FALSE); - aContext.getRequestScope().put(CURRENT_SESSION_ENDED, Boolean.FALSE); - } + public final void eventSignaled(RequestContext aContext, Event aEvent) { + signalAction(aContext); + } - public final void eventSignaled(RequestContext aContext, Event aEvent) { - signalAction(aContext); - } + public final void stateEntered(RequestContext aContext, StateDefinition aPreviousState, StateDefinition aState) { + signalAction(aContext); + } - public final void stateEntered(RequestContext aContext, StateDefinition aPreviousState, StateDefinition aState) { - signalAction(aContext); - } + /** + * Called when an event is signaled, or a state is entered, but before any potential transition or actions occurs. + * If the action signaled is the first for the request, then the + * {@link ConversationLifecycleListener#sessionActive(RequestContext)} method is invoked. It is necessary that this + * be called prior to any state transitions to provide listeners coverage of any state exit/transition/entry + * actions. + * + * @param aContext The request aContext + */ + private void signalAction(RequestContext aContext) { + if (!firstEventSignaled(aContext)) { + aContext.getRequestScope().put(FIRST_EVENT_SIGNALED, Boolean.TRUE); + _conversationLifecycleListener.sessionActive(aContext); + } + } - /** - * Called when an event is signaled, or a state is entered, but before any - * potential transition or actions occurs. If the action signaled is the - * first for the request, then the {@link ConversationLifecycleListener#sessionActive(RequestContext)} - * method is invoked. It is necessary that this be called prior to any state - * transitions to provide listeners coverage of any state - * exit/transition/entry actions. - * - * @param aContext The request aContext - */ - private void signalAction(RequestContext aContext) { - if (!firstEventSignaled(aContext)) { - aContext.getRequestScope().put(FIRST_EVENT_SIGNALED, Boolean.TRUE); - _conversationLifecycleListener.sessionActive(aContext); - } - } + /** + * A aFlow session is starting. This method invokes + * {@link ConversationLifecycleListener#startingFlow(FlowDefinition, RequestContext)} if the launching aFlow session + * is the root aFlow. Otherwise, the + * {@link ConversationLifecycleListener#startingSubflow(FlowSession, FlowDefinition, RequestContext,MutableAttributeMap)} + * method is invoked. + * + * @param aContext The request aContext + * @param aFlowDefinition + * @param aInput + * @throws EnterStateVetoException The start state transition was not allowed + */ + public final void sessionStarting(RequestContext aContext, FlowDefinition aFlowDefinition, + MutableAttributeMap aInput) { + aContext.getRequestScope().put(FIRST_EVENT_SIGNALED, Boolean.TRUE); + aContext.getRequestScope().put(CURRENT_SESSION_ENDED, Boolean.FALSE); + FlowExecutionContext executionContext = aContext.getFlowExecutionContext(); + FlowSession activeSession = executionContext.isActive() ? executionContext.getActiveSession() : null; + // when starting in default subflow start state? + if (activeSession != null && SubflowState.class.isInstance(activeSession.getState())) { + aFlowDefinition = ((SubflowState) activeSession.getState()).getSubflow(); + } - /** - * A aFlow session is starting. This method invokes - * {@link ConversationLifecycleListener#startingFlow(FlowDefinition, RequestContext)} if the launching aFlow - * session is the root aFlow. Otherwise, the - * {@link ConversationLifecycleListener#startingSubflow(FlowSession, FlowDefinition, RequestContext,MutableAttributeMap)} method is - * invoked. - * - * @param aContext The request aContext - * @param aFlowDefinition - * @param aInput - * @throws EnterStateVetoException - * The start state transition was not allowed - */ - public final void sessionStarting(RequestContext aContext, FlowDefinition aFlowDefinition, MutableAttributeMap aInput) { - aContext.getRequestScope().put(FIRST_EVENT_SIGNALED, Boolean.TRUE); - aContext.getRequestScope().put(CURRENT_SESSION_ENDED, Boolean.FALSE); - FlowExecutionContext executionContext = aContext.getFlowExecutionContext(); - FlowSession activeSession = executionContext.isActive() ? executionContext .getActiveSession() : null; - // when starting in default subflow start state? - if (activeSession != null - && SubflowState.class.isInstance(activeSession.getState())) { - aFlowDefinition = ((SubflowState) activeSession.getState()).getSubflow(); - } + if (activeSession == null) { + _conversationLifecycleListener.startingFlow(aFlowDefinition, aContext); + } else { + _conversationLifecycleListener.startingSubflow(activeSession, aFlowDefinition, aContext, null); + } + } - if (activeSession == null) { - _conversationLifecycleListener.startingFlow(aFlowDefinition, aContext); - } else { - _conversationLifecycleListener.startingSubflow(activeSession, aFlowDefinition, aContext, null); - } - } + public void sessionStarted(RequestContext aContext, FlowSession aSession) { + if (aSession.isRoot()) { + _conversationLifecycleListener.flowStarted(aContext, null); + } else { + _conversationLifecycleListener.subflowStarted(aContext, null); + } + } - public void sessionStarted(RequestContext aContext, FlowSession aSession) { - if( aSession.isRoot() ) { - _conversationLifecycleListener.flowStarted(aContext, null ); - } else { - _conversationLifecycleListener.subflowStarted(aContext,null); - } - } + public void sessionEnding(RequestContext aContext, FlowSession aSession, MutableAttributeMap aOutput) { + if (aSession.isRoot()) { + _conversationLifecycleListener.endingFlow(aContext, null); + } else { + _conversationLifecycleListener.endingSubflow(aContext, null); + } + } - public void sessionEnding(RequestContext aContext, FlowSession aSession, MutableAttributeMap aOutput) { - if( aSession.isRoot() ) { - _conversationLifecycleListener.endingFlow(aContext, null ); - } else { - _conversationLifecycleListener.endingSubflow(aContext,null); - } - } + public void requestProcessed(RequestContext aContext) { + FlowExecutionContext executionContext = aContext.getFlowExecutionContext(); + if (executionContext.isActive()) { + _conversationLifecycleListener.sessionDeactive(aContext); + } + } - public void requestProcessed(RequestContext aContext) { - FlowExecutionContext executionContext = aContext.getFlowExecutionContext(); - if( executionContext.isActive() ) { - _conversationLifecycleListener.sessionDeactive(aContext ); - } - } + /** + * Called when a flow execution session ends. If the ended session was the root session of the flow execution, the + * {@link ConversationLifecycleListener#flowEnded(FlowSession, RequestContext)} method is invoked.

If the ended + * session was not the root session, then the + * {@link ConversationLifecycleListener#subflowEnded(FlowSession, FlowDefinition, RequestContext, MutableAttributeMap)} } + * method is invoked. Prior to this, and in either case, the + * {@link ConversationLifecycleListener#sessionDeactive(RequestContext)} method is invoked. + * + * @param aContext The source of the event + * @param aEndedSession The ended FlowSession + */ + public final void sessionEnded(RequestContext aContext, FlowSession aEndedSession, AttributeMap aSessionOutput) { + FlowExecutionContext exeCtx = aContext.getFlowExecutionContext(); + FlowSession newSession = exeCtx.isActive() ? exeCtx.getActiveSession() : null; + if (aEndedSession != null) { + try { + if (aEndedSession.isRoot()) { + _conversationLifecycleListener.flowEnded(aEndedSession, aContext); + } else { + _conversationLifecycleListener.subflowEnded(newSession, aEndedSession.getDefinition(), aContext, + null); + } + } catch (RuntimeException e) { // todo to think which base exception need wrap + String message = "Can't end session"; + if (_logger.isWarnEnabled()) { + _logger.warn(message, e); + } + throw new FlowExecutionException(exeCtx.getDefinition().getId(), newSession != null ? newSession + .getState().getId() : aEndedSession.getState().getId(), message, e); + } + } + aContext.getRequestScope().put(CURRENT_SESSION_ENDED, Boolean.TRUE); + } - /** - * Called when a flow execution session ends. If the ended session was the - * root session of the flow execution, the - * {@link ConversationLifecycleListener#flowEnded(FlowSession, RequestContext)} method is - * invoked.

If the ended session was not the root session, then the - * {@link ConversationLifecycleListener#subflowEnded(FlowSession, FlowDefinition, RequestContext, MutableAttributeMap)} } - * method is invoked. Prior to this, and in either case, the - * {@link ConversationLifecycleListener#sessionDeactive(RequestContext)} method is invoked. - * - * @param aContext The source of the event - * @param aEndedSession The ended FlowSession - */ - public final void sessionEnded(RequestContext aContext, FlowSession aEndedSession, AttributeMap aSessionOutput) { - FlowExecutionContext exeCtx = aContext.getFlowExecutionContext(); - FlowSession newSession = exeCtx.isActive() ? exeCtx.getActiveSession() : null; - if (aEndedSession != null) { - try{ - if (aEndedSession.isRoot()) { - _conversationLifecycleListener.flowEnded(aEndedSession, aContext); - } else { - _conversationLifecycleListener.subflowEnded(newSession, aEndedSession.getDefinition(), aContext, null); - } - } catch( RuntimeException e ){ //todo to think which base exception need wrap - String message = "Can't end session"; - if( _logger.isWarnEnabled() ) { - _logger.warn(message,e); - } - throw new FlowExecutionException( exeCtx.getDefinition().getId() - , newSession != null ? newSession.getState().getId() : aEndedSession.getState().getId() - , message, e); - } - } - aContext.getRequestScope().put(CURRENT_SESSION_ENDED, Boolean.TRUE); - } + /** + * Determine whether the current request has handled an event. + * + * @param aContext The request context + * @return true if an event has already been signaled during the current request, otherwise + * false + */ + private boolean firstEventSignaled(RequestContext aContext) { + return aContext.getRequestScope().get(FIRST_EVENT_SIGNALED).equals(Boolean.TRUE); + } - /** - * Determine whether the current request has handled an event. - * - * @param aContext The request context - * @return true if an event has already been signaled during - * the current request, otherwise false - */ - private boolean firstEventSignaled(RequestContext aContext) { - return aContext.getRequestScope().get(FIRST_EVENT_SIGNALED).equals(Boolean.TRUE); - } - public void resumed(RequestContext context) { - signalAction(context); - } + public void resumed(RequestContext context) { + signalAction(context); + } } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/DefaultEntityManagerLifecycleController.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/DefaultEntityManagerLifecycleController.java index 0d46b356..6d462cc7 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/DefaultEntityManagerLifecycleController.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/DefaultEntityManagerLifecycleController.java @@ -11,61 +11,65 @@ import javax.persistence.EntityManagerFactory; /** * Default abstract JPA implementation for {@link EntityManagerLifecycleController}. - * + * * @author Maxim Petrashev */ public abstract class DefaultEntityManagerLifecycleController implements EntityManagerLifecycleController { - private EntityManagerFactory _entityManagerFactory; + private EntityManagerFactory _entityManagerFactory; - public DefaultEntityManagerLifecycleController(EntityManagerFactory aEntityManagerFactory) { - _entityManagerFactory = aEntityManagerFactory; - } + public DefaultEntityManagerLifecycleController(EntityManagerFactory aEntityManagerFactory) { + _entityManagerFactory = aEntityManagerFactory; + } - public void close(EntityManager aEntityManager) { - Assert.isTrue(aEntityManager.isOpen(), "Entity manager was already closed"); - aEntityManager.close(); - } + public void close(EntityManager aEntityManager) { + Assert.isTrue(aEntityManager.isOpen(), "Entity manager was already closed"); + aEntityManager.close(); + } - public void deactivate(EntityManager aEntityManager) { - unbind(aEntityManager); - if (_log.isDebugEnabled()) { - _log.debug("Entity manager unbinded: " + aEntityManager.isOpen()); - } - } + public void deactivate(EntityManager aEntityManager) { + unbind(aEntityManager); + if (_log.isDebugEnabled()) { + _log.debug("Entity manager unbinded: " + aEntityManager.isOpen()); + } + } - public EntityManager create() { - return _entityManagerFactory.createEntityManager(); - } + public EntityManager create() { + return _entityManagerFactory.createEntityManager(); + } - public void flush(EntityManager aEntityManager) { - try { - aEntityManager.flush(); - } catch (RuntimeException e) {//todo review this code - aEntityManager.getTransaction().rollback(); - throw e; - } - } + public void flush(EntityManager aEntityManager) { + try { + aEntityManager.flush(); + } catch (RuntimeException e) {// todo review this code + aEntityManager.getTransaction().rollback(); + throw e; + } + } - public void activate(EntityManager aEntityManager) { - bind(aEntityManager); - if (_log.isDebugEnabled()) { - _log.debug("Session activate: " + aEntityManager.isOpen()); - } - } - protected void bind(EntityManager aEntityManager) { - TransactionSynchronizationManager.bindResource(_entityManagerFactory, new EntityManagerHolder(aEntityManager)); - } + public void activate(EntityManager aEntityManager) { + bind(aEntityManager); + if (_log.isDebugEnabled()) { + _log.debug("Session activate: " + aEntityManager.isOpen()); + } + } - protected void unbind( EntityManager aEntityManager ) { - synchronized(_entityManagerFactory){//todo is this need? - Assert.isTrue( TransactionSynchronizationManager.hasResource(_entityManagerFactory) ); //todo remove this code. Resource must be already present. - TransactionSynchronizationManager.unbindResource(_entityManagerFactory); - } - } + protected void bind(EntityManager aEntityManager) { + TransactionSynchronizationManager.bindResource(_entityManagerFactory, new EntityManagerHolder(aEntityManager)); + } - protected EntityManagerFactory getEntityManagerFactory() { - return _entityManagerFactory; - } + protected void unbind(EntityManager aEntityManager) { + synchronized (_entityManagerFactory) {// todo is this need? + Assert.isTrue(TransactionSynchronizationManager.hasResource(_entityManagerFactory)); // todo remove this + // code. Resource + // must be already + // present. + TransactionSynchronizationManager.unbindResource(_entityManagerFactory); + } + } - protected final Log _log = LogFactory.getLog(getClass()); + protected EntityManagerFactory getEntityManagerFactory() { + return _entityManagerFactory; + } + + protected final Log _log = LogFactory.getLog(getClass()); } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/EntityManagerLifecycleController.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/EntityManagerLifecycleController.java index 2ec54785..74eb6b4e 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/EntityManagerLifecycleController.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/EntityManagerLifecycleController.java @@ -9,35 +9,37 @@ import javax.persistence.EntityManager; * org.hibernate.annotations.FlushModeType.MANUAL *

  • Binding/Unbinding persistence context resources for current thread
  • * - * + * * @author Maxim Petrashev */ public interface EntityManagerLifecycleController { - /** - * Create new entity manager and return wrapper for it with aId id. - */ - EntityManager create(); + /** + * Create new entity manager and return wrapper for it with aId id. + */ + EntityManager create(); - /** - * Reconnect entity manager and bind to current thread. - * @param aEntityManager - */ - void activate(EntityManager aEntityManager); - /** - * Disconnect current session and unbind from current thread. - * @param aEntityManager - */ - void deactivate(EntityManager aEntityManager); + /** + * Reconnect entity manager and bind to current thread. + * @param aEntityManager + */ + void activate(EntityManager aEntityManager); - /** - * Commit application transaction. - * @param aEntityManager - */ - void flush(EntityManager aEntityManager); - /** - * Close opened entity manager. - * @param aEntityManager - */ - void close(EntityManager aEntityManager); + /** + * Disconnect current session and unbind from current thread. + * @param aEntityManager + */ + void deactivate(EntityManager aEntityManager); + + /** + * Commit application transaction. + * @param aEntityManager + */ + void flush(EntityManager aEntityManager); + + /** + * Close opened entity manager. + * @param aEntityManager + */ + void close(EntityManager aEntityManager); } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/OpenEntityManagerPerConversationFlowListener.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/OpenEntityManagerPerConversationFlowListener.java index dd6dd603..8bff4dd3 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/OpenEntityManagerPerConversationFlowListener.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/OpenEntityManagerPerConversationFlowListener.java @@ -12,130 +12,125 @@ import org.springframework.webflow.execution.ConversationLifecycleListenerAdapte import org.springframework.webflow.execution.FlowExecutionContext; import org.springframework.webflow.execution.FlowSession; import org.springframework.webflow.execution.RequestContext; + /** - * Intended for those wating a long session model within webflows. A entity - * manager is created when the flow begins, and is disconnected and reconnected - * as necessary throughout the lifecycle of the flow. In particular, it should - * be thought of as both a - * {@link org.springframework.webflow.execution.FlowExecutionListener} and - * {@link WebRequestInterceptor} - * that binds a - * entity manager to the current thread for the activate span of a FlowSession. - * This implementation shares the entity manager between a parent flow and any - * subflows. + * Intended for those wating a long session model within webflows. A entity manager is created when the flow begins, and + * is disconnected and reconnected as necessary throughout the lifecycle of the flow. In particular, it should be + * thought of as both a {@link org.springframework.webflow.execution.FlowExecutionListener} and + * {@link WebRequestInterceptor} that binds a entity manager to the current thread for the activate span of a + * FlowSession. This implementation shares the entity manager between a parent flow and any subflows. *

    - * To facilitate the long session idea, objects within the flow will be - * reassociated with the jpa persistence context when the flow is - * re-activated. Deserialized jpa flow scope - * objects lose their association to the persistence context, and thus result in - * problems when you attempt to perform persistence operations (run into - * non-unique object exceptions, null sessions in persistent collections, and a - * host of other weird behaviors). There is a basic facility to apply a - * flushMode to new entity managers that are created, but not as - * sophisticated as that provided by a HibernateAccessor. Config example: - * + * To facilitate the long session idea, objects within the flow will be reassociated with the jpa persistence context + * when the flow is re-activated. Deserialized jpa flow scope objects lose their association to the persistence context, + * and thus result in problems when you attempt to perform persistence operations (run into non-unique object + * exceptions, null sessions in persistent collections, and a host of other weird behaviors). There is a basic facility + * to apply a flushMode to new entity managers that are created, but not as sophisticated as that provided by a + * HibernateAccessor. Config example: + * *
      *      	<bean id="openEntityManagerFlowListener"
      *       			class="org.springframework.webflow.jpa.OpenEntityManagerPerConversationFlowListener">
      *       		<constructor ref="_lifecycleController"/>
      *      	</bean>
      * 
    - * + * *

    - * Adapted from Alex Wolfe's post at + * Adapted from Alex Wolfe's post at * http://forum.springframework.org/showthread.php?t=17633 - * + * * @author Maxim Petrashev */ public class OpenEntityManagerPerConversationFlowListener extends ConversationLifecycleListenerAdapter { - protected final Log _logger = LogFactory.getLog( getClass() ); + protected final Log _logger = LogFactory.getLog(getClass()); - private final EntityManagerLifecycleController _lifecycleController; + private final EntityManagerLifecycleController _lifecycleController; - /** - * Attribute name for annotated state which mark end-state and application commit end-state. - */ - public static final String APPLICATION_TRANSACTION_COMMIT_ATTR_NAME = "applicationTransactionCommit"; - /** - * Attribute name under wich in conversation scope will be stored entity manager for conversation. - */ - private static final String ENTITY_MANAGER_ATTR_NAME = OpenEntityManagerPerConversationFlowListener.class.getName() + ".ENTITY_MANAGER"; + /** + * Attribute name for annotated state which mark end-state and application commit end-state. + */ + public static final String APPLICATION_TRANSACTION_COMMIT_ATTR_NAME = "applicationTransactionCommit"; + /** + * Attribute name under wich in conversation scope will be stored entity manager for conversation. + */ + private static final String ENTITY_MANAGER_ATTR_NAME = OpenEntityManagerPerConversationFlowListener.class.getName() + + ".ENTITY_MANAGER"; - protected OpenEntityManagerPerConversationFlowListener(EntityManagerLifecycleController aLifecycleController ) { - _lifecycleController = aLifecycleController; - } + protected OpenEntityManagerPerConversationFlowListener(EntityManagerLifecycleController aLifecycleController) { + _lifecycleController = aLifecycleController; + } - protected EntityManager getEntityManager(RequestContext aContext){ - return (EntityManager) aContext.getConversationScope().get( ENTITY_MANAGER_ATTR_NAME ); - } + protected EntityManager getEntityManager(RequestContext aContext) { + return (EntityManager) aContext.getConversationScope().get(ENTITY_MANAGER_ATTR_NAME); + } - /** - * Create entity manager for new conversation. - * @param aNewFlow - * @param aContext - */ - public void startingFlow(FlowDefinition aNewFlow, RequestContext aContext) { - _logger.debug("Creating entity manager for flow: " + aNewFlow.getId()); - EntityManager entityManager = _lifecycleController.create(); - _lifecycleController.activate( entityManager ); - aContext.getConversationScope().put(ENTITY_MANAGER_ATTR_NAME, entityManager); - } + /** + * Create entity manager for new conversation. + * @param aNewFlow + * @param aContext + */ + public void startingFlow(FlowDefinition aNewFlow, RequestContext aContext) { + _logger.debug("Creating entity manager for flow: " + aNewFlow.getId()); + EntityManager entityManager = _lifecycleController.create(); + _lifecycleController.activate(entityManager); + aContext.getConversationScope().put(ENTITY_MANAGER_ATTR_NAME, entityManager); + } - /** - * Try commit application transaction on application transaction commit end state. - * Clean also all resources that were allocated for conversation entity manager. - * @param aEndedSession - * @param aContext - */ - public void flowEnded(FlowSession aEndedSession, RequestContext aContext) { - EntityManager entityManager = getEntityManager(aContext); - try{ - if (isApplicationTransactionCommitState(aEndedSession.getState())) { - _lifecycleController.flush(entityManager); - } - }finally{ - try{ - _lifecycleController.deactivate(entityManager); - }finally{ - _lifecycleController.close( entityManager ); - } - } - } + /** + * Try commit application transaction on application transaction commit end state. Clean also all resources that + * were allocated for conversation entity manager. + * @param aEndedSession + * @param aContext + */ + public void flowEnded(FlowSession aEndedSession, RequestContext aContext) { + EntityManager entityManager = getEntityManager(aContext); + try { + if (isApplicationTransactionCommitState(aEndedSession.getState())) { + _lifecycleController.flush(entityManager); + } + } finally { + try { + _lifecycleController.deactivate(entityManager); + } finally { + _lifecycleController.close(entityManager); + } + } + } - /** - * {@inheritDoc} - */ - public void sessionActive(RequestContext aContext) { - EntityManager entityManager = getEntityManager(aContext); - _lifecycleController.activate( entityManager ); - } + /** + * {@inheritDoc} + */ + public void sessionActive(RequestContext aContext) { + EntityManager entityManager = getEntityManager(aContext); + _lifecycleController.activate(entityManager); + } - /** - * Deactivate current entity manager on end of request handling process. - */ - public void sessionDeactive(RequestContext aContext) { - FlowExecutionContext flowExecutionContext = aContext.getFlowExecutionContext(); - if( flowExecutionContext.isActive() ) {//todo need CommandManager or request specific lifecycleController - EntityManager entityManager = getEntityManager(aContext); - _lifecycleController.deactivate( entityManager ); - } else { - //entity manager already was closed in flowEnded method - } - } + /** + * Deactivate current entity manager on end of request handling process. + */ + public void sessionDeactive(RequestContext aContext) { + FlowExecutionContext flowExecutionContext = aContext.getFlowExecutionContext(); + if (flowExecutionContext.isActive()) {// todo need CommandManager or request specific lifecycleController + EntityManager entityManager = getEntityManager(aContext); + _lifecycleController.deactivate(entityManager); + } else { + // entity manager already was closed in flowEnded method + } + } - /** - * Return is aState application commit state or not. Returns true if aState is EndState and aState is annotated - * by {@link #APPLICATION_TRANSACTION_COMMIT_ATTR_NAME} attribute. - */ - protected boolean isApplicationTransactionCommitState(StateDefinition aState) { - boolean retVal = false; - if (aState instanceof EndState) { - retVal = aState.getAttributes().get(APPLICATION_TRANSACTION_COMMIT_ATTR_NAME, "false").equals("true"); - } - return retVal; - } + /** + * Return is aState application commit state or not. Returns true if aState is EndState and aState is annotated by + * {@link #APPLICATION_TRANSACTION_COMMIT_ATTR_NAME} attribute. + */ + protected boolean isApplicationTransactionCommitState(StateDefinition aState) { + boolean retVal = false; + if (aState instanceof EndState) { + retVal = aState.getAttributes().get(APPLICATION_TRANSACTION_COMMIT_ATTR_NAME, "false").equals("true"); + } + return retVal; + } - public static final String CURRENT_ENTITY_MANAGER_KEY_ATTR_NAME = OpenEntityManagerPerConversationFlowListener.class.getName() + ".CURRENT_ENTITY_MANAGER_KEY"; - //todo review exceptionThrown + public static final String CURRENT_ENTITY_MANAGER_KEY_ATTR_NAME = OpenEntityManagerPerConversationFlowListener.class + .getName() + + ".CURRENT_ENTITY_MANAGER_KEY"; + // todo review exceptionThrown } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/TransactionSynchronizationManagerEnityManagerHolder.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/TransactionSynchronizationManagerEnityManagerHolder.java index e9a2d7c8..0b4254fa 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/TransactionSynchronizationManagerEnityManagerHolder.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/TransactionSynchronizationManagerEnityManagerHolder.java @@ -8,18 +8,18 @@ import javax.persistence.EntityManager; /** * Resource holder that is wrapper for TransactionSynchronizationManager. - * + * * @author Maxim Petrashev */ public class TransactionSynchronizationManagerEnityManagerHolder extends AbstractReadOnlyResourceHolder { - public EntityManager get() { - EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager.getResource( _key ); - return emHolder.getEntityManager(); - } + public EntityManager get() { + EntityManagerHolder emHolder = (EntityManagerHolder) TransactionSynchronizationManager.getResource(_key); + return emHolder.getEntityManager(); + } - public TransactionSynchronizationManagerEnityManagerHolder(Object aKey) { - _key = aKey; - } + public TransactionSynchronizationManagerEnityManagerHolder(Object aKey) { + _key = aKey; + } - private Object _key; + private Object _key; } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/EntityManagerLifecycleController.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/EntityManagerLifecycleController.java index 65c44c2c..07c8e7b9 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/EntityManagerLifecycleController.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/EntityManagerLifecycleController.java @@ -13,56 +13,61 @@ import javax.persistence.EntityTransaction; /** * Hibernate specific implementation of EntityManagerLifecycleController interface. Set for each new entity manager * hibernate specific flush mode and starts new JPA transaction on activation, and commit it on deactivation - * + * * @author Maxim Petrashev */ public class EntityManagerLifecycleController extends DefaultEntityManagerLifecycleController { - public EntityManagerLifecycleController(EntityManagerFactory aEntityManagerFactory) { - super(aEntityManagerFactory); - } - public EntityManager create() { - EntityManager retVal = super.create(); - Session session = HibernateUtils.getSession(retVal); - session.setFlushMode(FlushMode.MANUAL); //todo review this code - return retVal; - } - protected void unbind( EntityManager aEntityManager ) { - try{ - SessionFactory sessionFactory = HibernateUtils.getSessionFactory( getEntityManagerFactory() ); - ManagedSessionContext.unbind(sessionFactory); - }finally{ - super.unbind( aEntityManager ); - } - } + public EntityManagerLifecycleController(EntityManagerFactory aEntityManagerFactory) { + super(aEntityManagerFactory); + } - protected void bind(EntityManager aEntityManager) { - super.bind(aEntityManager); - //todo remove this code in hibernate specific class - ManagedSessionContext.bind( HibernateUtils.getSession( aEntityManager ) ); - } + public EntityManager create() { + EntityManager retVal = super.create(); + Session session = HibernateUtils.getSession(retVal); + session.setFlushMode(FlushMode.MANUAL); // todo review this code + return retVal; + } - public void activate(EntityManager aEntityManager) { - beginTransaction(aEntityManager); - super.activate(aEntityManager); - } + protected void unbind(EntityManager aEntityManager) { + try { + SessionFactory sessionFactory = HibernateUtils.getSessionFactory(getEntityManagerFactory()); + ManagedSessionContext.unbind(sessionFactory); + } finally { + super.unbind(aEntityManager); + } + } - public void deactivate(EntityManager aEntityManager) { - try{ - disconnectSession(aEntityManager); - } finally { - super.deactivate(aEntityManager); - } - } + protected void bind(EntityManager aEntityManager) { + super.bind(aEntityManager); + // todo remove this code in hibernate specific class + ManagedSessionContext.bind(HibernateUtils.getSession(aEntityManager)); + } - protected void beginTransaction(EntityManager aEntityManager) {//todo is it method need? May be transaction aspect has to cover it? - //begin database transaction for taking available connection - aEntityManager.getTransaction().begin(); - } - protected void disconnectSession(EntityManager aEntityManager) {//todo is it method need? May be transaction aspect has to cover it? - EntityTransaction transaction = aEntityManager.getTransaction(); - transaction.commit(); - //todo is it need ? aSession.disconnect(); - } + public void activate(EntityManager aEntityManager) { + beginTransaction(aEntityManager); + super.activate(aEntityManager); + } + + public void deactivate(EntityManager aEntityManager) { + try { + disconnectSession(aEntityManager); + } finally { + super.deactivate(aEntityManager); + } + } + + protected void beginTransaction(EntityManager aEntityManager) {// todo is it method need? May be transaction aspect + // has to cover it? + // begin database transaction for taking available connection + aEntityManager.getTransaction().begin(); + } + + protected void disconnectSession(EntityManager aEntityManager) {// todo is it method need? May be transaction aspect + // has to cover it? + EntityTransaction transaction = aEntityManager.getTransaction(); + transaction.commit(); + // todo is it need ? aSession.disconnect(); + } } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/HibernateUtils.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/HibernateUtils.java index 4aaad430..2ee3672a 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/HibernateUtils.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/jpa/hibernate/HibernateUtils.java @@ -15,30 +15,33 @@ import java.util.LinkedList; /** * Utils class for common hibernate JPA routines. - * + * * @author Maxim Petrashev */ public abstract class HibernateUtils { - public static SessionFactory getSessionFactory(EntityManagerFactory aEntityManagerFactory) { - HibernateEntityManagerFactory hibernateEntityManagerFactory - = (HibernateEntityManagerFactory) aEntityManagerFactory; - return hibernateEntityManagerFactory.getSessionFactory(); - } - public static Session getSession(EntityManager aEntityManager) { - return (Session) ((HibernateEntityManager)aEntityManager).getSession(); - } - @Deprecated public static List getEntityClasses( EntityManager aEntityManager ) { - SessionFactory sessionFactory = getSession(aEntityManager).getSessionFactory(); - @SuppressWarnings("unchecked") - Map metadataMap = sessionFactory.getAllClassMetadata(); - List retVal = new LinkedList(); - for (ClassMetadata classMetadata : metadataMap.values()) { - Class type = classMetadata.getMappedClass(EntityMode.POJO); - retVal.add( type ); - } - return retVal; - } - public static Object getIdentifier(SessionFactory aSessionFactory, Object aEntity) { - return aSessionFactory.getCurrentSession().getIdentifier( aEntity ); - } + public static SessionFactory getSessionFactory(EntityManagerFactory aEntityManagerFactory) { + HibernateEntityManagerFactory hibernateEntityManagerFactory = (HibernateEntityManagerFactory) aEntityManagerFactory; + return hibernateEntityManagerFactory.getSessionFactory(); + } + + public static Session getSession(EntityManager aEntityManager) { + return (Session) ((HibernateEntityManager) aEntityManager).getSession(); + } + + @Deprecated + public static List getEntityClasses(EntityManager aEntityManager) { + SessionFactory sessionFactory = getSession(aEntityManager).getSessionFactory(); + @SuppressWarnings("unchecked") + Map metadataMap = sessionFactory.getAllClassMetadata(); + List retVal = new LinkedList(); + for (ClassMetadata classMetadata : metadataMap.values()) { + Class type = classMetadata.getMappedClass(EntityMode.POJO); + retVal.add(type); + } + return retVal; + } + + public static Object getIdentifier(SessionFactory aSessionFactory, Object aEntity) { + return aSessionFactory.getCurrentSession().getIdentifier(aEntity); + } } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java index 01fce276..46204cc3 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/Sale.java @@ -31,23 +31,23 @@ import javax.persistence.Transient; @Entity @Table(name = "T_SALES") -@Proxy(lazy=true) +@Proxy(lazy = true) public class Sale implements Serializable { - @Id - @TableGenerator( name="ids" ) - @GeneratedValue(strategy= GenerationType.TABLE) - public int getId() { - return id; - } + @Id + @TableGenerator(name = "ids") + @GeneratedValue(strategy = GenerationType.TABLE) + public int getId() { + return id; + } - public void setId(int aId) { - id = aId; - } + public void setId(int aId) { + id = aId; + } - private int id; + private int id; - private double price; + private double price; private int itemCount; @@ -113,22 +113,21 @@ public class Sale implements Serializable { * Returns the base amount of the sale, without discount or delivery costs. */ @Transient - public double getAmount() { + public double getAmount() { return price * itemCount; } /** * Returns the discount rate to apply. */ - @Transient - public double getDiscountRate() { + @Transient + public double getDiscountRate() { double discount = 0.02; if ("A".equals(category)) { if (itemCount >= 100) { discount = 0.1; } - } - else if ("B".equals(category)) { + } else if ("B".equals(category)) { if (itemCount >= 200) { discount = 0.2; } @@ -139,21 +138,20 @@ public class Sale implements Serializable { /** * Returns the savings because of the discount. */ - @Transient - public double getSavings() { + @Transient + public double getSavings() { return getDiscountRate() * getAmount(); } /** * Returns the delivery cost. */ - @Transient - public double getDeliveryCost() { + @Transient + public double getDeliveryCost() { 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; @@ -163,7 +161,7 @@ public class Sale implements Serializable { * Returns the total cost of the sale, including discount and delivery cost. */ @Transient - public double getTotalCost() { + public double getTotalCost() { return getAmount() + getDeliveryCost() - getSavings(); } diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SaleValidator.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SaleValidator.java index 51cfcef5..a7731a55 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SaleValidator.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SaleValidator.java @@ -18,7 +18,7 @@ package org.springframework.webflow.samples.sellitem; import org.springframework.validation.Errors; import org.springframework.validation.Validator; -//todo remove dependency on Validator interface +// todo remove dependency on Validator interface public class SaleValidator implements Validator { public boolean supports(Class clazz) { @@ -26,10 +26,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"); diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java index 91467324..94545c27 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/SellItemFlowExecutionListener.java @@ -29,7 +29,12 @@ 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();//todo remove dependency on servlet api + HttpServletRequest request = ((ServletExternalContext) context.getExternalContext()).getRequest();// todo + // remove + // dependency + // on + // servlet + // api if (!request.isUserInRole(role)) { throw new EnterStateVetoException(context.getActiveFlow().getId(), context.getCurrentState().getId(), nextState.getId(), "State requires role '" + role diff --git a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/jpa/JpaSaleProcessor.java b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/jpa/JpaSaleProcessor.java index 1e54c3a4..82a8233b 100644 --- a/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/jpa/JpaSaleProcessor.java +++ b/spring-webflow-sandbox/src/main/java/org/springframework/webflow/samples/sellitem/jpa/JpaSaleProcessor.java @@ -6,9 +6,10 @@ import org.springframework.webflow.samples.sellitem.Sale; import javax.persistence.EntityManager; public abstract class JpaSaleProcessor implements SaleProcessor { - public void process(Sale sale) { - EntityManager entityManager = getEntityManager(); - entityManager.persist(sale); - } - protected abstract EntityManager getEntityManager(); + public void process(Sale sale) { + EntityManager entityManager = getEntityManager(); + entityManager.persist(sale); + } + + protected abstract EntityManager getEntityManager(); } diff --git a/spring-webflow/.settings/org.eclipse.jdt.core.prefs b/spring-webflow/.settings/org.eclipse.jdt.core.prefs index 065770a6..e0da9768 100644 --- a/spring-webflow/.settings/org.eclipse.jdt.core.prefs +++ b/spring-webflow/.settings/org.eclipse.jdt.core.prefs @@ -1,74 +1,336 @@ -#Wed Oct 04 14:37:01 EDT 2006 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.3 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.3 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -org.eclipse.jdt.core.compiler.doc.comment.support=enabled -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore -org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning -org.eclipse.jdt.core.compiler.problem.forbiddenReference=error -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning -org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled -org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled -org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore -org.eclipse.jdt.core.compiler.problem.nullReference=ignore -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore -org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled -org.eclipse.jdt.core.compiler.problem.unusedImport=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.3 +#Wed Aug 15 09:36:12 EDT 2007 +eclipse.preferences.version=1 +org.eclipse.jdt.core.codeComplete.argumentPrefixes= +org.eclipse.jdt.core.codeComplete.argumentSuffixes= +org.eclipse.jdt.core.codeComplete.fieldPrefixes= +org.eclipse.jdt.core.codeComplete.fieldSuffixes= +org.eclipse.jdt.core.codeComplete.localPrefixes= +org.eclipse.jdt.core.codeComplete.localSuffixes= +org.eclipse.jdt.core.codeComplete.staticFieldPrefixes= +org.eclipse.jdt.core.codeComplete.staticFieldSuffixes= +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.3 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.3 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.doc.comment.support=enabled +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning +org.eclipse.jdt.core.compiler.problem.forbiddenReference=error +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning +org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled +org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=protected +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled +org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nullReference=ignore +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning +org.eclipse.jdt.core.compiler.source=1.3 +org.eclipse.jdt.core.formatter.align_type_members_on_columns=false +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_assignment=0 +org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 +org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 +org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 +org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0 +org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 +org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 +org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 +org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 +org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_after_package=1 +org.eclipse.jdt.core.formatter.blank_lines_before_field=0 +org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 +org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 +org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1 +org.eclipse.jdt.core.formatter.blank_lines_before_method=1 +org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 +org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 +org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line +org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false +org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false +org.eclipse.jdt.core.formatter.comment.format_block_comments=true +org.eclipse.jdt.core.formatter.comment.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true +org.eclipse.jdt.core.formatter.comment.format_line_comments=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +org.eclipse.jdt.core.formatter.comment.indent_root_tags=false +org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=do not insert +org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert +org.eclipse.jdt.core.formatter.comment.line_length=120 +org.eclipse.jdt.core.formatter.compact_else_if=true +org.eclipse.jdt.core.formatter.continuation_indentation=2 +org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2 +org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true +org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true +org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true +org.eclipse.jdt.core.formatter.indent_empty_lines=false +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=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 +org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert +org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert +org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert +org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert +org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert +org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert +org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert +org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert +org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert +org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert +org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert +org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false +org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false +org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false +org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false +org.eclipse.jdt.core.formatter.lineSplit=120 +org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false +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=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 diff --git a/spring-webflow/.settings/org.eclipse.jdt.ui.prefs b/spring-webflow/.settings/org.eclipse.jdt.ui.prefs index 52be497b..d65ed0ea 100644 --- a/spring-webflow/.settings/org.eclipse.jdt.ui.prefs +++ b/spring-webflow/.settings/org.eclipse.jdt.ui.prefs @@ -1,3 +1,58 @@ -#Wed Oct 04 14:35:34 EDT 2006 -eclipse.preferences.version=1 -internal.default.compliance=user +#Wed Aug 15 09:36:12 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.exception.name=e +org.eclipse.jdt.ui.gettersetter.use.is=false +org.eclipse.jdt.ui.javadoc=false +org.eclipse.jdt.ui.keywordthis=false +org.eclipse.jdt.ui.overrideannotation=true +org.eclipse.jdt.ui.text.custom_code_templates= +sp_cleanup.add_default_serial_version_id=true +sp_cleanup.add_generated_serial_version_id=false +sp_cleanup.add_missing_annotations=true +sp_cleanup.add_missing_deprecated_annotations=true +sp_cleanup.add_missing_nls_tags=false +sp_cleanup.add_missing_override_annotations=true +sp_cleanup.add_serial_version_id=false +sp_cleanup.always_use_blocks=true +sp_cleanup.always_use_parentheses_in_expressions=false +sp_cleanup.always_use_this_for_non_static_field_access=false +sp_cleanup.always_use_this_for_non_static_method_access=false +sp_cleanup.convert_to_enhanced_for_loop=false +sp_cleanup.format_source_code=true +sp_cleanup.make_local_variable_final=false +sp_cleanup.make_parameters_final=false +sp_cleanup.make_private_fields_final=true +sp_cleanup.make_variable_declarations_final=true +sp_cleanup.never_use_blocks=false +sp_cleanup.never_use_parentheses_in_expressions=true +sp_cleanup.on_save_use_additional_actions=false +sp_cleanup.organize_imports=true +sp_cleanup.qualify_static_field_accesses_with_declaring_class=false +sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +sp_cleanup.qualify_static_member_accesses_with_declaring_class=false +sp_cleanup.qualify_static_method_accesses_with_declaring_class=false +sp_cleanup.remove_private_constructors=true +sp_cleanup.remove_trailing_whitespaces=false +sp_cleanup.remove_trailing_whitespaces_all=true +sp_cleanup.remove_trailing_whitespaces_ignore_empty=false +sp_cleanup.remove_unnecessary_casts=true +sp_cleanup.remove_unnecessary_nls_tags=false +sp_cleanup.remove_unused_imports=false +sp_cleanup.remove_unused_local_variables=false +sp_cleanup.remove_unused_private_fields=true +sp_cleanup.remove_unused_private_members=false +sp_cleanup.remove_unused_private_methods=true +sp_cleanup.remove_unused_private_types=true +sp_cleanup.sort_members=false +sp_cleanup.sort_members_all=false +sp_cleanup.use_blocks=false +sp_cleanup.use_blocks_only_for_return_and_throw=false +sp_cleanup.use_parentheses_in_expressions=false +sp_cleanup.use_this_for_non_static_field_access=false +sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true +sp_cleanup.use_this_for_non_static_method_access=false +sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java index 437b365d..0bdcf91f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractAction.java @@ -27,13 +27,11 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.support.EventFactorySupport; /** - * Base action that provides assistance commonly needed by action - * implementations. This includes: + * Base action that provides assistance commonly needed by action implementations. This includes: *

    * @@ -58,19 +56,16 @@ public abstract class AbstractAction implements Action, InitializingBean { public void afterPropertiesSet() throws Exception { try { initAction(); - } - catch (Exception ex) { + } catch (Exception ex) { throw new BeanInitializationException("Initialization of this Action failed: " + ex.getMessage(), ex); } } /** - * Action initializing callback, may be overriden by subclasses to perform - * custom initialization logic. + * Action initializing callback, may be overriden by subclasses to perform custom initialization logic. *

    - * Keep in mind that this hook will only be invoked when this action is - * deployed in a Spring application context since it uses the Spring - * {@link InitializingBean} mechanism to trigger action initialisation. + * Keep in mind that this hook will only be invoked when this action is deployed in a Spring application context + * since it uses the Spring {@link InitializingBean} mechanism to trigger action initialisation. */ protected void initAction() throws Exception { } @@ -83,8 +78,7 @@ public abstract class AbstractAction implements Action, InitializingBean { } /** - * Returns a "success" result event with the provided result object as a - * parameter. + * Returns a "success" result event with the provided result object as a parameter. * @param result the action success result */ protected Event success(Object result) { @@ -100,8 +94,7 @@ public abstract class AbstractAction implements Action, InitializingBean { /** * Returns an "error" result event caused by the provided exception. - * @param e the exception that caused the error event, to be configured as - * an event attribute + * @param e the exception that caused the error event, to be configured as an event attribute */ protected Event error(Exception e) { return getEventFactorySupport().error(this, e); @@ -131,8 +124,8 @@ public abstract class AbstractAction implements Action, InitializingBean { } /** - * Returns a result event for this action with the specified identifier. - * Typically called as part of return, for example: + * Returns a result event for this action with the specified identifier. Typically called as part of return, for + * example: * *

     	 *     protected Event doExecute(RequestContext context) {
    @@ -145,8 +138,7 @@ public abstract class AbstractAction implements Action, InitializingBean {
     	 *     }
     	 * 
    * - * Consider calling the error() or success() factory methods for returning - * common results. + * Consider calling the error() or success() factory methods for returning common results. * @param eventId the result event identifier * @return the action result event */ @@ -155,9 +147,8 @@ public abstract class AbstractAction implements Action, InitializingBean { } /** - * Returns a result event for this action with the specified identifier and - * the specified set of attributes. Typically called as part of return, for - * example: + * Returns a result event for this action with the specified identifier and the specified set of attributes. + * Typically called as part of return, for example: * *
     	 *     protected Event doExecute(RequestContext context) {
    @@ -172,8 +163,7 @@ public abstract class AbstractAction implements Action, InitializingBean {
     	 *     }
     	 * 
    * - * Consider calling the error() or success() factory methods for returning - * common results. + * Consider calling the error() or success() factory methods for returning common results. * @param eventId the result event identifier * @param resultAttributes the event attributes * @return the action result event @@ -183,8 +173,7 @@ public abstract class AbstractAction implements Action, InitializingBean { } /** - * Returns a result event for this action with the specified identifier and - * a single attribute. + * Returns a result event for this action with the specified identifier and a single attribute. * @param eventId the result id * @param resultAttributeName the attribute name * @param resultAttributeValue the attribute value @@ -203,27 +192,25 @@ public abstract class AbstractAction implements Action, InitializingBean { result = doExecute(context); if (logger.isDebugEnabled()) { if (result != null) { - logger.debug("Action '" + getActionNameForLogging() + "' completed execution; result is '" + result.getId() + "'"); - } - else { + logger.debug("Action '" + getActionNameForLogging() + "' completed execution; result is '" + + result.getId() + "'"); + } else { logger.debug("Action '" + getActionNameForLogging() + "' completed execution; result is [null]"); } } doPostExecute(context); - } - else { + } else { if (logger.isInfoEnabled()) { logger.info("Action execution disallowed; pre-execution result is '" + result.getId() + "'"); } } return result; } - + // subclassing hooks /** - * Internal helper to return the name of this action for logging - * purposes. Defaults to the short class name. + * Internal helper to return the name of this action for logging purposes. Defaults to the short class name. * @see ClassUtils#getShortName(java.lang.Class) */ protected String getActionNameForLogging() { @@ -231,48 +218,37 @@ public abstract class AbstractAction implements Action, InitializingBean { } /** - * Pre-action-execution hook, subclasses may override. If this method - * returns a non-null event, the doExecute() - * method will not be called and the returned event will be used to - * select a transition to trigger in the calling action state. If this - * method returns null, doExecute() will be - * called to obtain an action result event. + * Pre-action-execution hook, subclasses may override. If this method returns a non-null event, the + * doExecute() method will not be called and the returned event will be used to select a + * transition to trigger in the calling action state. If this method returns null, + * doExecute() will be called to obtain an action result event. *

    * This implementation just returns null. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" - * @return the non-null action result, in which case the - * doExecute() will not be called, or null if - * the doExecute() method should be called to obtain the - * action result - * @throws Exception an unrecoverable exception occured, either - * checked or unchecked + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" + * @return the non-null action result, in which case the doExecute() will not be + * called, or null if the doExecute() method should be called to obtain the action + * result + * @throws Exception an unrecoverable exception occured, either checked or unchecked */ protected Event doPreExecute(RequestContext context) throws Exception { return null; } /** - * Template hook method subclasses should override to encapsulate their - * specific action execution logic. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" + * Template hook method subclasses should override to encapsulate their specific action execution logic. + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" * @return the action result event - * @throws Exception an unrecoverable exception occured, either - * checked or unchecked + * @throws Exception an unrecoverable exception occured, either checked or unchecked */ protected abstract Event doExecute(RequestContext context) throws Exception; /** - * Post-action execution hook, subclasses may override. Will only be called - * if doExecute() was called, e.g. when doPreExecute() - * returned null. + * Post-action execution hook, subclasses may override. Will only be called if doExecute() was + * called, e.g. when doPreExecute() returned null. *

    * This implementation does nothing. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" - * @throws Exception an unrecoverable exception occured, either - * checked or unchecked + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" + * @throws Exception an unrecoverable exception occured, either checked or unchecked */ protected void doPostExecute(RequestContext context) throws Exception { } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractBeanInvokingAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractBeanInvokingAction.java index e06c6e4e..6161b484 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractBeanInvokingAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/AbstractBeanInvokingAction.java @@ -25,12 +25,11 @@ import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; /** - * Base class for actions that delegate to methods on beans (POJOs - Plain Old - * Java Objects). Acts as an adapter that adapts an {@link Object} method to the - * Spring Web Flow {@link Action} contract. + * Base class for actions that delegate to methods on beans (POJOs - Plain Old Java Objects). Acts as an adapter that + * adapts an {@link Object} method to the Spring Web Flow {@link Action} contract. *

    - * Subclasses are required to implement the {@link #getBean(RequestContext)} - * method, returning the bean on which a method should be invoked. + * Subclasses are required to implement the {@link #getBean(RequestContext)} method, returning the bean on which a + * method should be invoked. * * @see BeanInvokingActionFactory * @@ -39,21 +38,20 @@ import org.springframework.webflow.execution.RequestContext; public abstract class AbstractBeanInvokingAction extends AbstractAction { /** - * The signature of the method to invoke on the target bean, capable of - * resolving the method when used with a {@link MethodInvoker}. Required. + * The signature of the method to invoke on the target bean, capable of resolving the method when used with a + * {@link MethodInvoker}. Required. */ private MethodSignature methodSignature; /** - * The method invoker that performs the action->bean method binding, - * accepting a {@link MethodSignature} and + * The method invoker that performs the action->bean method binding, accepting a {@link MethodSignature} and * {@link #getBean(RequestContext) target bean} instance. */ private MethodInvoker methodInvoker = new MethodInvoker(); /** - * The specification (configuration) for how bean method return values - * should be exposed to an executing flow that invokes this action. + * The specification (configuration) for how bean method return values should be exposed to an executing flow that + * invokes this action. */ private ActionResultExposer methodResultExposer; @@ -79,17 +77,16 @@ public abstract class AbstractBeanInvokingAction extends AbstractAction { } /** - * Returns the configuration for how bean method return values should be - * exposed to an executing flow that invokes this action. + * Returns the configuration for how bean method return values should be exposed to an executing flow that invokes + * this action. */ public ActionResultExposer getMethodResultExposer() { return methodResultExposer; } /** - * Configures how bean method return values should be exposed to an - * executing flow that invokes this action. This is optional. By default the - * bean method return values do not get exposed to the executing flow. + * Configures how bean method return values should be exposed to an executing flow that invokes this action. This is + * optional. By default the bean method return values do not get exposed to the executing flow. */ public void setMethodResultExposer(ActionResultExposer methodResultExposer) { this.methodResultExposer = methodResultExposer; @@ -103,17 +100,15 @@ public abstract class AbstractBeanInvokingAction extends AbstractAction { } /** - * Set the bean return value->event adaption strategy. Defaults to - * {@link SuccessEventFactory}, so all bean method return values will be - * interpreted as "success". + * Set the bean return value->event adaption strategy. Defaults to {@link SuccessEventFactory}, so all bean + * method return values will be interpreted as "success". */ public void setResultEventFactory(ResultEventFactory resultEventFactory) { this.resultEventFactory = resultEventFactory; } /** - * Set the conversion service to perform type conversion of event parameters - * to method arguments as neccessary. + * Set the conversion service to perform type conversion of event parameters to method arguments as neccessary. * Defaults to {@link DefaultConversionService}. */ public void setConversionService(ConversionService conversionService) { @@ -139,8 +134,7 @@ public abstract class AbstractBeanInvokingAction extends AbstractAction { // subclassing hooks /** - * Retrieves the bean to invoke a method on. Subclasses need to implement - * this method. + * Retrieves the bean to invoke a method on. Subclasses need to implement this method. * @param context the flow execution request context * @return the bean on which to invoke methods * @throws Exception when the bean cannot be retreived diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/ActionResultExposer.java b/spring-webflow/src/main/java/org/springframework/webflow/action/ActionResultExposer.java index 8678f0cb..ebbb875e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/ActionResultExposer.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/ActionResultExposer.java @@ -23,8 +23,8 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ScopeType; /** - * Specifies how an action result value should be exposed to an executing flow. - * The return value is exposed as an attribute in a configured scope. + * Specifies how an action result value should be exposed to an executing flow. The return value is exposed as an + * attribute in a configured scope. * * @see EvaluateAction * @see AbstractBeanInvokingAction @@ -70,8 +70,7 @@ public class ActionResultExposer implements Serializable { } /** - * Expose given bean method return value in given flow execution request - * context. + * Expose given bean method return value in given flow execution request context. * @param result the return value * @param context the request context */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/AttributeMapperAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/AttributeMapperAction.java index 5a3a58b8..b70c5df8 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/AttributeMapperAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/AttributeMapperAction.java @@ -22,15 +22,12 @@ import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; /** - * Action that executes an attribute mapper to map information in the request - * context. Both the source and the target of the mapping will be the request - * context. This allows for maximum flexibility when defining attribute mapping + * Action that executes an attribute mapper to map information in the request context. Both the source and the target of + * the mapping will be the request context. This allows for maximum flexibility when defining attribute mapping * expressions (e.g. "${flowScope.someAttribute}"). *

    - * This action always returns the - * {@link org.springframework.webflow.action.AbstractAction#success() success} - * event. If something goes wrong while executing the mapping, an exception - * is thrown. + * This action always returns the {@link org.springframework.webflow.action.AbstractAction#success() success} event. If + * something goes wrong while executing the mapping, an exception is thrown. * * @see org.springframework.binding.mapping.AttributeMapper * @see org.springframework.webflow.execution.RequestContext @@ -46,8 +43,8 @@ public class AttributeMapperAction extends AbstractAction { private AttributeMapper attributeMapper; /** - * Creates a new attribute mapper action that delegates to the configured - * attribute mapper to complete the mapping process. + * Creates a new attribute mapper action that delegates to the configured attribute mapper to complete the mapping + * process. * @param attributeMapper the mapper */ public AttributeMapperAction(AttributeMapper attributeMapper) { @@ -62,9 +59,8 @@ public class AttributeMapperAction extends AbstractAction { } /** - * Returns a context containing extra data available during attribute mapping. - * The default implementation just returns null. Subclasses can - * override this if necessary. + * Returns a context containing extra data available during attribute mapping. The default implementation just + * returns null. Subclasses can override this if necessary. */ protected MappingContext getMappingContext(RequestContext context) { return null; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/BeanInvokingActionFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/action/BeanInvokingActionFactory.java index 1b992da5..296b95b2 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/BeanInvokingActionFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/BeanInvokingActionFactory.java @@ -23,14 +23,11 @@ import org.springframework.webflow.core.collection.AttributeMap; import org.springframework.webflow.execution.Action; /** - * A helper factory for {@link Action} instances that invoke methods on beans - * managed in a Spring bean factory. + * A helper factory for {@link Action} instances that invoke methods on beans managed in a Spring bean factory. *

    - * This factory encapsulates the logic required to take an arbitrary - * java.lang.Object from a Spring bean factory and adapt a method - * on it to the {@link Action} interface. If the bean you want to use is not - * managed in a Spring bean factory, consider subclassing - * {@link AbstractBeanInvokingAction} and using it directly. + * This factory encapsulates the logic required to take an arbitrary java.lang.Object from a Spring bean + * factory and adapt a method on it to the {@link Action} interface. If the bean you want to use is not managed in a + * Spring bean factory, consider subclassing {@link AbstractBeanInvokingAction} and using it directly. * * @see AbstractBeanInvokingAction * @@ -39,43 +36,36 @@ import org.springframework.webflow.execution.Action; public class BeanInvokingActionFactory { /** - * Determines which result event factory should be used for each bean - * invoking action created by this factory. + * Determines which result event factory should be used for each bean invoking action created by this factory. */ private ResultEventFactorySelector resultEventFactorySelector = new ResultEventFactorySelector(); /** - * Returns the strategy for calculating the result event factory to - * configure for each bean invoking action created by this factory. + * Returns the strategy for calculating the result event factory to configure for each bean invoking action created + * by this factory. */ public ResultEventFactorySelector getResultEventFactorySelector() { return resultEventFactorySelector; } /** - * Sets the strategy to calculate the result event factory to configure for - * each bean invoking action created by this factory. + * Sets the strategy to calculate the result event factory to configure for each bean invoking action created by + * this factory. */ public void setResultEventFactorySelector(ResultEventFactorySelector resultEventFactorySelector) { this.resultEventFactorySelector = resultEventFactorySelector; } /** - * Factory method that creates a bean invoking action, an adapter that - * adapts a method on an abitrary {@link Object} to the {@link Action} - * interface. This method is an atomic operation that returns a fully - * initialized Action. It encapsulates the selection of the action - * implementation as well as the action assembly. + * Factory method that creates a bean invoking action, an adapter that adapts a method on an abitrary {@link Object} + * to the {@link Action} interface. This method is an atomic operation that returns a fully initialized Action. It + * encapsulates the selection of the action implementation as well as the action assembly. * @param beanId the id of the bean to be adapted to an Action instance * @param beanFactory the bean factory where the bean is managed - * @param methodSignature the method to invoke on the bean when the action - * is executed (required) - * @param resultExposer the specification for what to do with the method - * return value (optional) - * @param conversionService the conversion service to be used to convert - * method parameters (optional) - * @param attributes attributes that may be used to affect the bean invoking - * action's construction + * @param methodSignature the method to invoke on the bean when the action is executed (required) + * @param resultExposer the specification for what to do with the method return value (optional) + * @param conversionService the conversion service to be used to convert method parameters (optional) + * @param attributes attributes that may be used to affect the bean invoking action's construction * @return the fully configured bean invoking action instance */ public Action createBeanInvokingAction(String beanId, BeanFactory beanFactory, MethodSignature methodSignature, diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/CompositeAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/CompositeAction.java index fdd5e1ea..5e4dea6e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/CompositeAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/CompositeAction.java @@ -29,14 +29,12 @@ import org.springframework.webflow.execution.RequestContext; /** * An action that will execute an ordered chain of other actions when executed. *

    - * The event id of the last not-null result returned by the executed actions - * will be used as the result event id of the composite action. Lacking that, - * the action will return the "success" event. + * The event id of the last not-null result returned by the executed actions will be used as the result event id of the + * composite action. Lacking that, the action will return the "success" event. *

    - * The resulting event will have an "actionResults" event attribute - * with a list of all events returned by the executed actions, including the null - * events. This allows you to relate an executed action and its result event by - * their index in the list. + * The resulting event will have an "actionResults" event attribute with a list of all events returned by the executed + * actions, including the null events. This allows you to relate an executed action and its result event by their index + * in the list. *

    * This is the classic GoF composite design pattern. * @@ -45,8 +43,8 @@ import org.springframework.webflow.execution.RequestContext; public class CompositeAction extends AbstractAction { /** - * The resulting event whill have an attribute of this name which holds a - * list of all events returned by the executed actions. ("actionResults") + * The resulting event whill have an attribute of this name which holds a list of all events returned by the + * executed actions. ("actionResults") */ public static final String ACTION_RESULTS_ATTRIBUTE_NAME = "actionResults"; @@ -85,9 +83,8 @@ public class CompositeAction extends AbstractAction { } /** - * Sets the stop on error flag. This determines whether or not execution - * should stop with the first action that returns an error event. In the - * error case, the composite action will also return the "error" event. + * Sets the stop on error flag. This determines whether or not execution should stop with the first action that + * returns an error event. In the error case, the composite action will also return the "error" event. */ public void setStopOnError(boolean stopOnError) { this.stopOnError = stopOnError; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/DefaultMultiActionMethodResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/action/DefaultMultiActionMethodResolver.java index d8ed6220..1fdcdcfc 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/DefaultMultiActionMethodResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/DefaultMultiActionMethodResolver.java @@ -19,13 +19,10 @@ import org.springframework.webflow.action.MultiAction.MethodResolver; import org.springframework.webflow.execution.RequestContext; /** - * Default method resolver used by the MultiAction class. It uses the following - * algorithm to calculate a method name: + * Default method resolver used by the MultiAction class. It uses the following algorithm to calculate a method name: *

      - *
    1. If the currently executing action has a "method" property defined, use - * the value as method name.
    2. - *
    3. Else use the name of the current state of the flow execution as a method - * name.
    4. + *
    5. If the currently executing action has a "method" property defined, use the value as method name.
    6. + *
    7. Else use the name of the current state of the flow execution as a method name.
    8. *
    * * @see org.springframework.webflow.action.MultiAction @@ -42,8 +39,7 @@ public class DefaultMultiActionMethodResolver implements MethodResolver { if (context.getCurrentState() != null) { // default to the state id method = context.getCurrentState().getId(); - } - else { + } else { throw new IllegalStateException("Unable to resolve action method; no 'method' context attribute set"); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/EvaluateAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/EvaluateAction.java index e7d8893e..0c5aee4f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/EvaluateAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/EvaluateAction.java @@ -24,8 +24,8 @@ import org.springframework.webflow.execution.RequestContext; /** * An action that evaluates an expression and optionally exposes its result. *

    - * Delegates to a helper {@link ResultEventFactorySelector} strategy to determine how - * to map the evaluation result to an action outcome {@link Event}. + * Delegates to a helper {@link ResultEventFactorySelector} strategy to determine how to map the evaluation result to an + * action outcome {@link Event}. * * @see Expression * @see ActionResultExposer @@ -46,8 +46,7 @@ public class EvaluateAction extends AbstractAction { private ActionResultExposer evaluationResultExposer; /** - * The selector for the factory that will create the action result event - * callers can respond to. + * The selector for the factory that will create the action result event callers can respond to. */ private ResultEventFactorySelector resultEventFactorySelector = new ResultEventFactorySelector(); @@ -62,8 +61,7 @@ public class EvaluateAction extends AbstractAction { /** * Create a new evaluate action. * @param expression the expression to evaluate - * @param evaluationResultExposer the strategy for how the expression result - * will be exposed to the flow + * @param evaluationResultExposer the strategy for how the expression result will be exposed to the flow */ public EvaluateAction(Expression expression, ActionResultExposer evaluationResultExposer) { Assert.notNull(expression, "The expression this action should evaluate is required"); @@ -80,8 +78,8 @@ public class EvaluateAction extends AbstractAction { } /** - * Template method subclasses may override to customize the expressin - * evaluation context. This implementation returns null. + * Template method subclasses may override to customize the expressin evaluation context. This implementation + * returns null. * @param context the request context * @return the evaluation context */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java index 6a3b70f2..fc259bf0 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/FormAction.java @@ -39,59 +39,48 @@ import org.springframework.webflow.util.DispatchMethodInvoker; import org.springframework.webflow.util.ReflectionUtils; /** - * Multi-action that implements common logic dealing with input forms. This - * class leverages the Spring Web data binding code to do binding and - * validation. + * Multi-action that implements common logic dealing with input forms. This class leverages the Spring Web data binding + * code to do binding and validation. *

    * Several action execution methods are provided: *

    *

    - * Since this is a multi-action a subclass could add any number of additional - * action execution methods, e.g. "setupReferenceData(RequestContext)", or - * "processSubmit(RequestContext)". + * Since this is a multi-action a subclass could add any number of additional action execution methods, e.g. + * "setupReferenceData(RequestContext)", or "processSubmit(RequestContext)". *

    - * Using this action, it becomes very easy to implement form preparation and - * submission logic in your flow. One way to do this follows: + * Using this action, it becomes very easy to implement form preparation and submission logic in your flow. One way to + * do this follows: *

      - *
    1. Create a view state to display the form. In a render action of that - * state, invoke {@link #setupForm(RequestContext) setupForm} to prepare the new - * form for display.
    2. + *
    3. Create a view state to display the form. In a render action of that state, invoke + * {@link #setupForm(RequestContext) setupForm} to prepare the new form for display.
    4. *
    5. On a matching "submit" transition execute an action that invokes - * {@link #bindAndValidate(RequestContext) bindAndValidate} to bind incoming - * request parameters to the form object and validate the form object.
    6. - *
    7. If there are binding or validation errors, the transition will not be - * allowed and the view state will automatically be re-entered. - *
    8. If binding and validation is successful go to an action state called - * "processSubmit" (or any other appropriate name). This will invoke an action - * method called "processSubmit" you must provide on a subclass to process form + * {@link #bindAndValidate(RequestContext) bindAndValidate} to bind incoming request parameters to the form object and + * validate the form object.
    9. + *
    10. If there are binding or validation errors, the transition will not be allowed and the view state will + * automatically be re-entered. + *
    11. If binding and validation is successful go to an action state called "processSubmit" (or any other appropriate + * name). This will invoke an action method called "processSubmit" you must provide on a subclass to process form * submission, e.g. interacting with the business logic.
    12. - *
    13. If business processing is ok, continue to a view state to display the - * success view.
    14. + *
    15. If business processing is ok, continue to a view state to display the success view.
    16. *
    *

    * Here is an example implementation of such a compact form flow: @@ -113,48 +102,39 @@ import org.springframework.webflow.util.ReflectionUtils; * * *

    - * When you need additional flexibility consider splitting the view state above - * acting as a single logical form state into multiple states. For - * example, you could have one action state handle form setup, a view state - * trigger form display, another action state handle data binding and - * validation, and another process form submission. This would be a bit more - * verbose but would also give you more control over how you respond to specific - * results of fine-grained actions that occur within the flow. + * When you need additional flexibility consider splitting the view state above acting as a single logical form state + * into multiple states. For example, you could have one action state handle form setup, a view state trigger form + * display, another action state handle data binding and validation, and another process form submission. This would be + * a bit more verbose but would also give you more control over how you respond to specific results of fine-grained + * actions that occur within the flow. *

    * Subclassing hooks: *

    *

    - * Note that this action does not provide a referenceData() hook method - * similar to that of Spring MVC's SimpleFormController. If you - * wish to expose reference data to populate form drop downs you can define a - * custom action method in your FormAction subclass that does just that. Simply - * invoke it as either a chained action as part of the setupForm state, or as a - * fine grained state definition itself. + * Note that this action does not provide a referenceData() hook method similar to that of Spring MVC's + * SimpleFormController. If you wish to expose reference data to populate form drop downs you can define + * a custom action method in your FormAction subclass that does just that. Simply invoke it as either a chained action + * as part of the setupForm state, or as a fine grained state definition itself. *

    * For example, you might create this method in your subclass: * *

      * public Event setupReferenceData(RequestContext context) throws Exception {
    - *     MutableAttributeMap requestScope = context.getRequestScope();
    - *     requestScope.put("refData", lookupService.getSupportingFormData());
    - *     return success();
    + * 	MutableAttributeMap requestScope = context.getRequestScope();
    + * 	requestScope.put("refData", lookupService.getSupportingFormData());
    + * 	return success();
      * }
      * 
    * @@ -170,23 +150,18 @@ import org.springframework.webflow.util.ReflectionUtils; * </view-state> * * - * This style of calling multiple action methods in a chain (Chain of - * Responsibility) is preferred to overridding a single action method. In - * general, action method overriding is discouraged. + * This style of calling multiple action methods in a chain (Chain of Responsibility) is preferred to overridding a + * single action method. In general, action method overriding is discouraged. *

    - * When it comes to validating submitted input data using a registered - * {@link org.springframework.validation.Validator}, this class offers the - * following options: + * When it comes to validating submitted input data using a registered {@link org.springframework.validation.Validator}, + * this class offers the following options: *

    * *

    @@ -222,42 +194,37 @@ import org.springframework.webflow.util.ReflectionUtils; * * formObjectName * formObject - * The name of the form object. The form object will be set in the - * configured scope using this name. + * The name of the form object. The form object will be set in the configured scope using this name. * * * formObjectClass * null - * The form object class for this action. An instance of this class will - * get populated and validated. Required when using a validator. + * The form object class for this action. An instance of this class will get populated and validated. Required when + * using a validator. * * * formObjectScope * {@link org.springframework.webflow.execution.ScopeType#FLOW flow} - * The scope in which the form object will be put. If put in flow scope the - * object will be cached and reused over the life of the flow, preserving - * previous values. Request scope will cause a new fresh form object instance to - * be created on each request into the flow execution. + * The scope in which the form object will be put. If put in flow scope the object will be cached and reused over + * the life of the flow, preserving previous values. Request scope will cause a new fresh form object instance to be + * created on each request into the flow execution. * * * formErrorsScope * {@link org.springframework.webflow.execution.ScopeType#FLASH flash} - * The scope in which the form object errors instance will be put. If put - * in flash scope form errors will be cached until the next user event is signaled. - * + * The scope in which the form object errors instance will be put. If put in flash scope form errors will be cached + * until the next user event is signaled. * * * propertyEditorRegistrar * null - * The strategy used to register custom property editors with the data - * binder. This is an alternative to overriding the - * {@link #registerPropertyEditors(PropertyEditorRegistry)} hook method. + * The strategy used to register custom property editors with the data binder. This is an alternative to overriding + * the {@link #registerPropertyEditors(PropertyEditorRegistry)} hook method. * * * validator * null - * The validator for this action. The validator must support the specified - * form object class. + * The validator for this action. The validator must support the specified form object class. * * * messageCodesResolver @@ -276,13 +243,11 @@ import org.springframework.webflow.util.ReflectionUtils; public class FormAction extends MultiAction implements InitializingBean { /* - * Implementation note: Uses deprecated DataBinder.getErrors() to remain - * compatible with Spring 1.2.x. + * Implementation note: Uses deprecated DataBinder.getErrors() to remain compatible with Spring 1.2.x. */ /* - * Implementation note: Introspects BindException at class init time to - * preserve 1.2.x compatability. + * Implementation note: Introspects BindException at class init time to preserve 1.2.x compatability. */ private static boolean hasPropertyEditorRegistryAccessor; @@ -297,41 +262,35 @@ public class FormAction extends MultiAction implements InitializingBean { public static final String DEFAULT_FORM_OBJECT_NAME = "formObject"; /** - * Optional attribute that identifies the method that should be invoked on - * the configured validator instance, to support piecemeal wizard page - * validation ("validatorMethod"). + * Optional attribute that identifies the method that should be invoked on the configured validator instance, to + * support piecemeal wizard page validation ("validatorMethod"). */ public static final String VALIDATOR_METHOD_ATTRIBUTE = "validatorMethod"; /** - * The name the form object should be exposed under. Default is - * {@link #DEFAULT_FORM_OBJECT_NAME}. + * The name the form object should be exposed under. Default is {@link #DEFAULT_FORM_OBJECT_NAME}. */ private String formObjectName = DEFAULT_FORM_OBJECT_NAME; /** - * The type of form object, typically an instantiable class. Required if - * {@link #createFormObject(RequestContext)} is not overidden or when - * a validator is used. + * The type of form object, typically an instantiable class. Required if {@link #createFormObject(RequestContext)} + * is not overidden or when a validator is used. */ private Class formObjectClass; /** - * The scope in which the form object should be exposed. Default is - * {@link ScopeType#FLOW}. + * The scope in which the form object should be exposed. Default is {@link ScopeType#FLOW}. */ private ScopeType formObjectScope = ScopeType.FLOW; /** - * The scope in which the form object errors holder should be exposed. - * Default is {@link ScopeType#FLASH}. + * The scope in which the form object errors holder should be exposed. Default is {@link ScopeType#FLASH}. */ private ScopeType formErrorsScope = ScopeType.FLASH; /** - * A centralized service for property editor registration, for applying type - * conversion during form object data binding. Can be used as an alternative - * to overriding {@link #registerPropertyEditors(PropertyEditorRegistry)}. + * A centralized service for property editor registration, for applying type conversion during form object data + * binding. Can be used as an alternative to overriding {@link #registerPropertyEditors(PropertyEditorRegistry)}. */ private PropertyEditorRegistrar propertyEditorRegistrar; @@ -351,18 +310,16 @@ public class FormAction extends MultiAction implements InitializingBean { private DispatchMethodInvoker validateMethodInvoker; /** - * Bean-style default constructor; creates a initially unconfigured - * FormAction instance relying on default property values. Clients invoking - * this constructor directly must set the formObjectClass property - * or override {@link #createFormObject(RequestContext)}. + * Bean-style default constructor; creates a initially unconfigured FormAction instance relying on default property + * values. Clients invoking this constructor directly must set the formObjectClass property or override + * {@link #createFormObject(RequestContext)}. * @see #setFormObjectClass(Class) */ public FormAction() { } /** - * Creates a new form action that manages instance(s) of the specified form - * object class. + * Creates a new form action that manages instance(s) of the specified form object class. * @param formObjectClass the class of the form object (must be instantiable) */ public FormAction(Class formObjectClass) { @@ -377,8 +334,8 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Set the name of the form object in the configured scope. The form object - * will be included in the configured scope under this name. + * Set the name of the form object in the configured scope. The form object will be included in the configured scope + * under this name. */ public void setFormObjectName(String formObjectName) { this.formObjectName = formObjectName; @@ -392,20 +349,17 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Set the form object class for this action. An instance of this class will - * get populated and validated. This is a required property if you register - * a validator with the form action ({@link #setValidator(Validator)})! + * Set the form object class for this action. An instance of this class will get populated and validated. This is a + * required property if you register a validator with the form action ({@link #setValidator(Validator)})! *

    - * If no form object name is set at the moment this method is called, a - * form object name will be automatically generated based on the provided - * form object class using + * If no form object name is set at the moment this method is called, a form object name will be automatically + * generated based on the provided form object class using * {@link ClassUtils#getShortNameAsProperty(java.lang.Class)}. */ public void setFormObjectClass(Class formObjectClass) { this.formObjectClass = formObjectClass; // generate a default form object name - if ((getFormObjectName() == null || getFormObjectName() == DEFAULT_FORM_OBJECT_NAME) - && formObjectClass != null) { + if ((getFormObjectName() == null || getFormObjectName() == DEFAULT_FORM_OBJECT_NAME) && formObjectClass != null) { setFormObjectName(ClassUtils.getShortNameAsProperty(formObjectClass)); } } @@ -418,8 +372,8 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Set the scope in which the form object will be placed. The default - * if not set is {@link ScopeType#FLOW flow scope}. + * Set the scope in which the form object will be placed. The default if not set is + * {@link ScopeType#FLOW flow scope}. */ public void setFormObjectScope(ScopeType scopeType) { this.formObjectScope = scopeType; @@ -433,25 +387,23 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Set the scope in which the Errors object will be placed. The default - * if not set is {@link ScopeType#FLASH flash scope}. + * Set the scope in which the Errors object will be placed. The default if not set is + * {@link ScopeType#FLASH flash scope}. */ public void setFormErrorsScope(ScopeType errorsScope) { this.formErrorsScope = errorsScope; } /** - * Get the property editor registration strategy for this action's data - * binders. + * Get the property editor registration strategy for this action's data binders. */ public PropertyEditorRegistrar getPropertyEditorRegistrar() { return propertyEditorRegistrar; } /** - * Set a property editor registration strategy for this action's data - * binders. This is an alternative to overriding the - * {@link #registerPropertyEditors(PropertyEditorRegistry)} method. + * Set a property editor registration strategy for this action's data binders. This is an alternative to overriding + * the {@link #registerPropertyEditors(PropertyEditorRegistry)} method. */ public void setPropertyEditorRegistrar(PropertyEditorRegistrar propertyEditorRegistrar) { this.propertyEditorRegistrar = propertyEditorRegistrar; @@ -465,9 +417,9 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Set the validator for this action. When setting a validator, you must also - * set the {@link #setFormObjectClass(Class) form object class}. The validator - * must support the specified form object class. + * Set the validator for this action. When setting a validator, you must also set the + * {@link #setFormObjectClass(Class) form object class}. The validator must support the specified form object + * class. */ public void setValidator(Validator validator) { this.validator = validator; @@ -481,8 +433,8 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Set the strategy to use for resolving errors into message codes. Applies - * the given strategy to all data binders used by this action. + * Set the strategy to use for resolving errors into message codes. Applies the given strategy to all data binders + * used by this action. *

    * Default is null, i.e. using the default strategy of the data binder. * @see #createBinder(RequestContext, Object) @@ -498,38 +450,31 @@ public class FormAction extends MultiAction implements InitializingBean { throw new IllegalArgumentException("Validator [" + getValidator() + "] does not support form object class [" + getFormObjectClass() + "]"); } - // signature: public void ${validateMethodName}(${formObjectClass}, Errors) - validateMethodInvoker = new DispatchMethodInvoker(getValidator(), - new Class[] { getFormObjectClass(), Errors.class }); + // signature: public void ${validateMethodName}(${formObjectClass}, Errors) + validateMethodInvoker = new DispatchMethodInvoker(getValidator(), new Class[] { getFormObjectClass(), + Errors.class }); } } // action methods /** - * Prepares a form object for display in a new form, creating it and caching - * it in the {@link #getFormObjectScope()} if necessary. Also installs - * custom property editors for formatting form object values in UI controls - * such as text fields. + * Prepares a form object for display in a new form, creating it and caching it in the {@link #getFormObjectScope()} + * if necessary. Also installs custom property editors for formatting form object values in UI controls such as text + * fields. *

    - * A new form object instance will only be created (or more generally - * acquired) with a call to {@link #createFormObject(RequestContext)}, - * if the form object does not yet exist in the configured - * {@link #getFormObjectScope() scope}. If you want to reset the form - * handling machinery, including creation or loading of a fresh form object - * instance, call {@link #resetForm(RequestContext)} instead. + * A new form object instance will only be created (or more generally acquired) with a call to + * {@link #createFormObject(RequestContext)}, if the form object does not yet exist in the configured + * {@link #getFormObjectScope() scope}. If you want to reset the form handling machinery, including creation or + * loading of a fresh form object instance, call {@link #resetForm(RequestContext)} instead. *

    - * NOTE: This action method is not designed to be overidden and might - * become final in a future version of Spring Web Flow. If - * you need to execute custom form setup logic have your flow call this - * method along with your own custom methods as part of a single action - * chain. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" + * NOTE: This action method is not designed to be overidden and might become final in a future + * version of Spring Web Flow. If you need to execute custom form setup logic have your flow call this method along + * with your own custom methods as part of a single action chain. + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" * @return "success" when binding and validation is successful - * @throws Exception an unrecoverable exception occurs, either - * checked or unchecked - * @see #createFormObject(RequestContext) + * @throws Exception an unrecoverable exception occurs, either checked or unchecked + * @see #createFormObject(RequestContext) */ public Event setupForm(RequestContext context) throws Exception { if (logger.isDebugEnabled()) { @@ -542,22 +487,17 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Bind incoming request parameters to allowed fields of the form object and - * then validate the bound form object if a validator is configured. + * Bind incoming request parameters to allowed fields of the form object and then validate the bound form object if + * a validator is configured. *

    - * NOTE: This action method is not designed to be overidden and might - * become final in a future version of Spring Web Flow. If - * you need to execute custom bind and validate logic have your flow call - * this method along with your own custom methods as part of a single action - * chain. Alternatively, override the - * {@link #doBind(RequestContext, DataBinder)} or - * {@link #doValidate(RequestContext, Object, Errors)} hooks. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" - * @return "success" when binding and validation is successful, "error" if - * there were binding and/or validation errors - * @throws Exception an unrecoverable exception occured, either - * checked or unchecked + * NOTE: This action method is not designed to be overidden and might become final in a future + * version of Spring Web Flow. If you need to execute custom bind and validate logic have your flow call this method + * along with your own custom methods as part of a single action chain. Alternatively, override the + * {@link #doBind(RequestContext, DataBinder)} or {@link #doValidate(RequestContext, Object, Errors)} hooks. + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" + * @return "success" when binding and validation is successful, "error" if there were binding and/or validation + * errors + * @throws Exception an unrecoverable exception occured, either checked or unchecked */ public Event bindAndValidate(RequestContext context) throws Exception { if (logger.isDebugEnabled()) { @@ -571,35 +511,29 @@ public class FormAction extends MultiAction implements InitializingBean { logger.debug("Executing validation"); } doValidate(context, formObject, binder.getErrors()); - } - else { + } else { if (logger.isDebugEnabled()) { if (getValidator() == null) { logger.debug("No validator is configured, no validation will occur after binding"); - } - else { + } else { logger.debug("Validation was disabled for this bindAndValidate request"); } } } - putFormErrors(context, binder.getErrors()); + putFormErrors(context, binder.getErrors()); return binder.getErrors().hasErrors() ? error() : success(); } /** * Bind incoming request parameters to allowed fields of the form object. *

    - * NOTE: This action method is not designed to be overidden and might - * become final in a future version of Spring Web Flow. If - * you need to execute custom data binding logic have your flow call this - * method along with your own custom methods as part of a single action - * chain. Alternatively, override the + * NOTE: This action method is not designed to be overidden and might become final in a future + * version of Spring Web Flow. If you need to execute custom data binding logic have your flow call this method + * along with your own custom methods as part of a single action chain. Alternatively, override the * {@link #doBind(RequestContext, DataBinder)} hook. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" * @return "success" if there are no binding errors, "error" otherwise - * @throws Exception an unrecoverable exception occured, either - * checked or unchecked + * @throws Exception an unrecoverable exception occured, either checked or unchecked */ public Event bind(RequestContext context) throws Exception { if (logger.isDebugEnabled()) { @@ -615,18 +549,14 @@ public class FormAction extends MultiAction implements InitializingBean { /** * Validate the form object by invoking the validator if configured. *

    - * NOTE: This action method is not designed to be overidden and might - * become final in a future version of Spring Web Flow. If - * you need to execute custom validation logic have your flow call this - * method along with your own custom methods as part of a single action - * chain. Alternatively, override the + * NOTE: This action method is not designed to be overidden and might become final in a future + * version of Spring Web Flow. If you need to execute custom validation logic have your flow call this method along + * with your own custom methods as part of a single action chain. Alternatively, override the * {@link #doValidate(RequestContext, Object, Errors)} hook. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" * @return "success" if there are no validation errors, "error" otherwise - * @throws Exception an unrecoverable exception occured, either - * checked or unchecked - * @see #getValidator() + * @throws Exception an unrecoverable exception occured, either checked or unchecked + * @see #getValidator() */ public Event validate(RequestContext context) throws Exception { if (getValidator() != null && validationEnabled(context)) { @@ -634,16 +564,14 @@ public class FormAction extends MultiAction implements InitializingBean { logger.debug("Executing validation"); } Object formObject = getFormObject(context); - Errors errors = getFormErrors(context); + Errors errors = getFormErrors(context); doValidate(context, formObject, errors); return errors.hasErrors() ? error() : success(); - } - else { + } else { if (logger.isDebugEnabled()) { if (getValidator() == null) { logger.debug("No validator is configured, no validation will occur"); - } - else { + } else { logger.debug("Validation was disabled for this request"); } } @@ -652,17 +580,15 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Resets the form by clearing out the form object in the specified scope - * and recreating it. + * Resets the form by clearing out the form object in the specified scope and recreating it. *

    - * NOTE: This action method is not designed to be overidden and might - * become final in a future version of Spring Web Flow. If - * you need to execute custom reset logic have your flow call this method - * along with your own custom methods as part of a single action chain. + * NOTE: This action method is not designed to be overidden and might become final in a future + * version of Spring Web Flow. If you need to execute custom reset logic have your flow call this method along with + * your own custom methods as part of a single action chain. * @param context the request context * @return "success" if the reset action completed successfully * @throws Exception if an exception occured - * @see #createFormObject(RequestContext) + * @see #createFormObject(RequestContext) */ public Event resetForm(RequestContext context) throws Exception { Object formObject = initFormObject(context); @@ -673,8 +599,7 @@ public class FormAction extends MultiAction implements InitializingBean { // internal helpers /** - * Create the new form object and put it in the configured - * {@link #getFormObjectScope() scope}. + * Create the new form object and put it in the configured {@link #getFormObjectScope() scope}. * @param context the flow execution request context * @return the new form object * @throws Exception an exception occured creating the form object @@ -700,10 +625,9 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Initialize a new form object {@link Errors errors} instance in the - * configured {@link #getFormErrorsScope() scope}. This method also - * registers any {@link PropertiesEditor property editors} used to format - * form object property values. + * Initialize a new form object {@link Errors errors} instance in the configured {@link #getFormErrorsScope() scope}. + * This method also registers any {@link PropertiesEditor property editors} used to format form object property + * values. * @param context the current flow execution request context * @param formObject the form object for which errors will be tracked */ @@ -711,7 +635,7 @@ public class FormAction extends MultiAction implements InitializingBean { if (logger.isDebugEnabled()) { logger.debug("Creating new form errors for object with name '" + getFormObjectName() + "'"); } - Errors errors = createBinder(context, formObject).getErrors(); + Errors errors = createBinder(context, formObject).getErrors(); putFormErrors(context, errors); return errors; } @@ -725,55 +649,50 @@ public class FormAction extends MultiAction implements InitializingBean { } getFormObjectAccessor(context).putFormErrors(errors, getFormErrorsScope()); } - + /** - * Make sure a valid Errors instance for given form object is exposed - * in given context. + * Make sure a valid Errors instance for given form object is exposed in given context. */ private void ensureFormErrorsExposed(RequestContext context, Object formObject) throws Exception { if (!formErrorsExposed(context)) { // initialize and expose a fresh errors instance to the flow with // editors applied initFormErrors(context, formObject); - } - else { + } else { // trying to reuse an existing errors instance if (formErrorsValid(context, formObject)) { // reapply property editors against the existing errors instance reinstallPropertyEditors(context); - } - else { + } else { // the existing errors instance seems to be invalid // initialize a new errors instance, but copy over error information if (logger.isInfoEnabled()) { - logger.info("Fixing inconsistent Errors instance: initializing a new Errors instance " + - "wrapping from object '" + formObject + "' in scope '" + getFormErrorsScope() + - "' and copying over all existing error information."); + logger.info("Fixing inconsistent Errors instance: initializing a new Errors instance " + + "wrapping from object '" + formObject + "' in scope '" + getFormErrorsScope() + + "' and copying over all existing error information."); } - Errors invalidExistingErrors = - getFormObjectAccessor(context).getFormErrors(getFormObjectName(), getFormErrorsScope()); + Errors invalidExistingErrors = getFormObjectAccessor(context).getFormErrors(getFormObjectName(), + getFormErrorsScope()); Errors newErrors = initFormErrors(context, formObject); newErrors.addAllErrors(invalidExistingErrors); } } } - /** - * Check if there is an Errors instance available in given - * context for given form object. - */ + /** + * Check if there is an Errors instance available in given context for given form object. + */ private boolean formErrorsExposed(RequestContext context) { return getFormObjectAccessor(context).getFormErrors(getFormObjectName(), getFormErrorsScope()) != null; } - + /** - * Check if the Errors instance available in given context is valid for - * given form object. + * Check if the Errors instance available in given context is valid for given form object. */ private boolean formErrorsValid(RequestContext context, Object formObject) { Errors errors = getFormObjectAccessor(context).getFormErrors(getFormObjectName(), getFormErrorsScope()); if (errors instanceof BindException) { - BindException be = (BindException)errors; + BindException be = (BindException) errors; if (be.getTarget() != formObject) { if (logger.isInfoEnabled()) { logger.info("Inconsistency detected: the Errors instance in '" + getFormErrorsScope() @@ -783,56 +702,52 @@ public class FormAction extends MultiAction implements InitializingBean { + "' of class: " + be.getTarget().getClass() + "."); } return false; - } - else { + } else { return true; } - } - else { + } else { return true; } } - + /** * Re-registers property editors against the current form errors instance. * @param context the flow execution request context */ private void reinstallPropertyEditors(RequestContext context) { - BindException errors = (BindException) - getFormObjectAccessor(context).getFormErrors(getFormObjectName(), getFormErrorsScope()); + BindException errors = (BindException) getFormObjectAccessor(context).getFormErrors(getFormObjectName(), + getFormErrorsScope()); registerPropertyEditors(context, getPropertyEditorRegistry(errors)); } - /** - * Obtain a property editor registry from given bind exception (errors - * instance). - */ + /** + * Obtain a property editor registry from given bind exception (errors instance). + */ private PropertyEditorRegistry getPropertyEditorRegistry(BindException errors) { Method accessor; try { if (hasPropertyEditorRegistryAccessor) { accessor = errors.getClass().getMethod("getPropertyEditorRegistry", null); - } - else { + } else { // only way to get at the registry in 1.2.8 or <. accessor = errors.getClass().getDeclaredMethod("getBeanWrapper", null); accessor.setAccessible(true); } - } - catch (NoSuchMethodException e) { + } catch (NoSuchMethodException e) { throw new IllegalStateException( - "Unable to resolve property editor registry accessor method as expected - this should not happen"); + "Unable to resolve property editor registry accessor method as expected - this should not happen"); } - return (PropertyEditorRegistry)ReflectionUtils.invokeMethod(accessor, errors); + return (PropertyEditorRegistry) ReflectionUtils.invokeMethod(accessor, errors); } /** - * Invoke specified validator method on the validator registered with this - * action. The validator method for piecemeal validation should have the - * following signature: + * Invoke specified validator method on the validator registered with this action. The validator method for + * piecemeal validation should have the following signature: + * *

     	 *     public void ${validateMethodName}(${formObjectClass}, Errors)
     	 * 
    + * * @param validatorMethod the name of the validator method to invoke * @param formObject the form object * @param errors possible binding errors @@ -846,156 +761,141 @@ public class FormAction extends MultiAction implements InitializingBean { getValidateMethodInvoker().invoke(validatorMethod, new Object[] { formObject, errors }); } - // accessible helpers (subclasses could override if necessary) - - /** - * Convenience method that returns the form object for this form action. If - * not found in the configured scope, a new form object will be created by a - * call to {@link #createFormObject(RequestContext)} and exposed in the - * configured {@link #getFormObjectScope() scope}. - *

    - * The returned form object will become the - * {@link FormObjectAccessor#setCurrentFormObject(Object, ScopeType) current} - * form object. - * @param context the flow execution request context - * @return the form object - * @throws Exception when an unrecoverable exception occurs - */ - protected Object getFormObject(RequestContext context) throws Exception { - FormObjectAccessor accessor = getFormObjectAccessor(context); - Object formObject = accessor.getFormObject(getFormObjectName(), getFormObjectScope()); - if (formObject == null) { - formObject = initFormObject(context); - } - else { - if (logger.isDebugEnabled()) { - logger.debug("Found existing form object with name '" + getFormObjectName() + "' of type [" - + formObject.getClass() + "] in scope " + getFormObjectScope()); - } - accessor.setCurrentFormObject(formObject, getFormObjectScope()); - } - return formObject; - } - - /** - * Convenience method that returns the form object errors for this form - * action. If not found in the configured scope, a new form object errors - * will be created, initialized, and exposed in the confgured - * {@link #getFormErrorsScope() scope}. - *

    - * Keep in mind that an Errors instance wraps a form object, so a form - * object will also be created if required - * (see {@link #getFormObject(RequestContext)}). - * @param context the flow request context - * @return the form errors - * @throws Exception when an unrecoverable exception occurs - */ - protected Errors getFormErrors(RequestContext context) throws Exception { - Object formObject = getFormObject(context); - ensureFormErrorsExposed(context, formObject); - return getFormObjectAccessor(context).getFormErrors(getFormObjectName(), getFormErrorsScope()); - } - - /** - * Create a new binder instance for the given form object and request - * context. Can be overridden to plug in custom DataBinder subclasses. - *

    - * Default implementation creates a standard WebDataBinder, and invokes - * {@link #initBinder(RequestContext, DataBinder)} and - * {@link #registerPropertyEditors(PropertyEditorRegistry)}. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" - * @param formObject the form object to bind onto - * @return the new binder instance - * @throws Exception when an unrecoverable exception occurs - * @see WebDataBinder - * @see #initBinder(RequestContext, DataBinder) - * @see #setMessageCodesResolver(MessageCodesResolver) - */ - protected DataBinder createBinder(RequestContext context, Object formObject) throws Exception { - DataBinder binder = new WebDataBinder(formObject, getFormObjectName()); - if (getMessageCodesResolver() != null) { - binder.setMessageCodesResolver(getMessageCodesResolver()); - } - initBinder(context, binder); - registerPropertyEditors(context, binder); - return binder; - } - - /** - * Bind allowed parameters in the external context request parameter map to - * the form object using given binder. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" - * @param binder the data binder to use - * @throws Exception when an unrecoverable exception occurs - */ - protected void doBind(RequestContext context, DataBinder binder) throws Exception { - if (logger.isDebugEnabled()) { - logger.debug("Binding allowed request parameters in " - + StylerUtils.style(context.getExternalContext().getRequestParameterMap()) - + " to form object with name '" + binder.getObjectName() + "', pre-bind formObject toString = " - + binder.getTarget()); - if (binder.getAllowedFields() != null && binder.getAllowedFields().length > 0) { - logger.debug("(Allowed fields are " + StylerUtils.style(binder.getAllowedFields()) + ")"); - } - else { - logger.debug("(Any field is allowed)"); - } - } - binder.bind(new MutablePropertyValues(context.getRequestParameters().asMap())); - if (logger.isDebugEnabled()) { - logger.debug("Binding completed for form object with name '" + binder.getObjectName() - + "', post-bind formObject toString = " + binder.getTarget()); - logger.debug("There are [" + binder.getErrors().getErrorCount() + "] errors, details: " - + binder.getErrors().getAllErrors()); - } - } - - /** - * Validate given form object using a registered validator. If a - * "validatorMethod" action property is specified for the currently - * executing action, the identified validator method will be invoked. When - * no such property is found, the defualt validate() method - * is invoked. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" - * @param formObject the form object - * @param errors the errors instance to record validation errors in - * @throws Exception when an unrecoverable exception occurs - */ - protected void doValidate(RequestContext context, Object formObject, Errors errors) throws Exception { - Assert.notNull(getValidator(), "The validator must not be null when attempting validation -- programmer error"); - String validatorMethodName = context.getAttributes().getString(VALIDATOR_METHOD_ATTRIBUTE); - if (StringUtils.hasText(validatorMethodName)) { - if (logger.isDebugEnabled()) { - logger.debug("Invoking validation method '" + validatorMethodName + "' on validator " + getValidator()); - } - invokeValidatorMethod(validatorMethodName, formObject, errors); - } - else { - if (logger.isDebugEnabled()) { - logger.debug("Invoking validator " + getValidator()); - } - getValidator().validate(formObject, errors); - } - if (logger.isDebugEnabled()) { - logger.debug("Validation completed for form object"); - logger.debug("There are [" + errors.getErrorCount() + "] errors, details: " + errors.getAllErrors()); - } - } + // accessible helpers (subclasses could override if necessary) /** - * Returns a dispatcher to invoke validation methods. Subclasses could - * override this to return a custom dispatcher. + * Convenience method that returns the form object for this form action. If not found in the configured scope, a new + * form object will be created by a call to {@link #createFormObject(RequestContext)} and exposed in the configured + * {@link #getFormObjectScope() scope}. + *

    + * The returned form object will become the + * {@link FormObjectAccessor#setCurrentFormObject(Object, ScopeType) current} form object. + * @param context the flow execution request context + * @return the form object + * @throws Exception when an unrecoverable exception occurs + */ + protected Object getFormObject(RequestContext context) throws Exception { + FormObjectAccessor accessor = getFormObjectAccessor(context); + Object formObject = accessor.getFormObject(getFormObjectName(), getFormObjectScope()); + if (formObject == null) { + formObject = initFormObject(context); + } else { + if (logger.isDebugEnabled()) { + logger.debug("Found existing form object with name '" + getFormObjectName() + "' of type [" + + formObject.getClass() + "] in scope " + getFormObjectScope()); + } + accessor.setCurrentFormObject(formObject, getFormObjectScope()); + } + return formObject; + } + + /** + * Convenience method that returns the form object errors for this form action. If not found in the configured + * scope, a new form object errors will be created, initialized, and exposed in the confgured + * {@link #getFormErrorsScope() scope}. + *

    + * Keep in mind that an Errors instance wraps a form object, so a form object will also be created if required (see + * {@link #getFormObject(RequestContext)}). + * @param context the flow request context + * @return the form errors + * @throws Exception when an unrecoverable exception occurs + */ + protected Errors getFormErrors(RequestContext context) throws Exception { + Object formObject = getFormObject(context); + ensureFormErrorsExposed(context, formObject); + return getFormObjectAccessor(context).getFormErrors(getFormObjectName(), getFormErrorsScope()); + } + + /** + * Create a new binder instance for the given form object and request context. Can be overridden to plug in custom + * DataBinder subclasses. + *

    + * Default implementation creates a standard WebDataBinder, and invokes + * {@link #initBinder(RequestContext, DataBinder)} and {@link #registerPropertyEditors(PropertyEditorRegistry)}. + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" + * @param formObject the form object to bind onto + * @return the new binder instance + * @throws Exception when an unrecoverable exception occurs + * @see WebDataBinder + * @see #initBinder(RequestContext, DataBinder) + * @see #setMessageCodesResolver(MessageCodesResolver) + */ + protected DataBinder createBinder(RequestContext context, Object formObject) throws Exception { + DataBinder binder = new WebDataBinder(formObject, getFormObjectName()); + if (getMessageCodesResolver() != null) { + binder.setMessageCodesResolver(getMessageCodesResolver()); + } + initBinder(context, binder); + registerPropertyEditors(context, binder); + return binder; + } + + /** + * Bind allowed parameters in the external context request parameter map to the form object using given binder. + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" + * @param binder the data binder to use + * @throws Exception when an unrecoverable exception occurs + */ + protected void doBind(RequestContext context, DataBinder binder) throws Exception { + if (logger.isDebugEnabled()) { + logger.debug("Binding allowed request parameters in " + + StylerUtils.style(context.getExternalContext().getRequestParameterMap()) + + " to form object with name '" + binder.getObjectName() + "', pre-bind formObject toString = " + + binder.getTarget()); + if (binder.getAllowedFields() != null && binder.getAllowedFields().length > 0) { + logger.debug("(Allowed fields are " + StylerUtils.style(binder.getAllowedFields()) + ")"); + } else { + logger.debug("(Any field is allowed)"); + } + } + binder.bind(new MutablePropertyValues(context.getRequestParameters().asMap())); + if (logger.isDebugEnabled()) { + logger.debug("Binding completed for form object with name '" + binder.getObjectName() + + "', post-bind formObject toString = " + binder.getTarget()); + logger.debug("There are [" + binder.getErrors().getErrorCount() + "] errors, details: " + + binder.getErrors().getAllErrors()); + } + } + + /** + * Validate given form object using a registered validator. If a "validatorMethod" action property is specified for + * the currently executing action, the identified validator method will be invoked. When no such property is found, + * the defualt validate() method is invoked. + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" + * @param formObject the form object + * @param errors the errors instance to record validation errors in + * @throws Exception when an unrecoverable exception occurs + */ + protected void doValidate(RequestContext context, Object formObject, Errors errors) throws Exception { + Assert.notNull(getValidator(), "The validator must not be null when attempting validation -- programmer error"); + String validatorMethodName = context.getAttributes().getString(VALIDATOR_METHOD_ATTRIBUTE); + if (StringUtils.hasText(validatorMethodName)) { + if (logger.isDebugEnabled()) { + logger.debug("Invoking validation method '" + validatorMethodName + "' on validator " + getValidator()); + } + invokeValidatorMethod(validatorMethodName, formObject, errors); + } else { + if (logger.isDebugEnabled()) { + logger.debug("Invoking validator " + getValidator()); + } + getValidator().validate(formObject, errors); + } + if (logger.isDebugEnabled()) { + logger.debug("Validation completed for form object"); + logger.debug("There are [" + errors.getErrorCount() + "] errors, details: " + errors.getAllErrors()); + } + } + + /** + * Returns a dispatcher to invoke validation methods. Subclasses could override this to return a custom dispatcher. */ protected DispatchMethodInvoker getValidateMethodInvoker() { return validateMethodInvoker; } /** - * Factory method that returns a new form object accessor for accessing form - * objects in the provided request context. + * Factory method that returns a new form object accessor for accessing form objects in the provided request + * context. * @param context the flow request context * @return the accessor */ @@ -1003,23 +903,21 @@ public class FormAction extends MultiAction implements InitializingBean { return new FormObjectAccessor(context); } - // common subclassing hook methods + // common subclassing hook methods /** - * Create the backing form object instance that should be managed by this - * {@link FormAction form action}. By default, will attempt to instantiate - * a new form object instance of type {@link #getFormObjectClass()} - * transiently in memory. + * Create the backing form object instance that should be managed by this {@link FormAction form action}. By + * default, will attempt to instantiate a new form object instance of type {@link #getFormObjectClass()} transiently + * in memory. *

    - * Subclasses should override if they need to load the form object from a - * specific location or resource such as a database or filesystem. + * Subclasses should override if they need to load the form object from a specific location or resource such as a + * database or filesystem. *

    - * Subclasses should override if they need to customize how a transient form - * object is assembled during creation. + * Subclasses should override if they need to customize how a transient form object is assembled during creation. * @param context the action execution context for accessing flow data * @return the form object - * @throws IllegalStateException if the {@link #getFormObjectClass()} - * property is not set and this method has not been overridden + * @throws IllegalStateException if the {@link #getFormObjectClass()} property is not set and this method has not + * been overridden * @throws Exception when an unrecoverable exception occurs */ protected Object createFormObject(RequestContext context) throws Exception { @@ -1034,17 +932,15 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Initialize a new binder instance. This hook allows customization of - * binder settings such as the {@link DataBinder#getAllowedFields() allowed fields}, - * {@link DataBinder#getRequiredFields() required fields} and - * {@link DataBinder#initDirectFieldAccess() direct field access}. Called by + * Initialize a new binder instance. This hook allows customization of binder settings such as the + * {@link DataBinder#getAllowedFields() allowed fields}, {@link DataBinder#getRequiredFields() required fields} and + * {@link DataBinder#initDirectFieldAccess() direct field access}. Called by * {@link #createBinder(RequestContext, Object)}. *

    - * Note that registration of custom property editors should be done in - * {@link #registerPropertyEditors(PropertyEditorRegistry)}, not here! This - * method will only be called when a new data binder is created. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" + * Note that registration of custom property editors should be done in + * {@link #registerPropertyEditors(PropertyEditorRegistry)}, not here! This method will only be called when a + * new data binder is created. + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" * @param binder new binder instance * @see #createBinder(RequestContext, Object) */ @@ -1052,20 +948,16 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Register custom editors to perform type conversion on fields of your form - * object during data binding and form display. This method is called on - * form errors initialization and + * Register custom editors to perform type conversion on fields of your form object during data binding and form + * display. This method is called on form errors initialization and * {@link #initBinder(RequestContext, DataBinder) data binder} initialization. *

    - * Property editors give you full control over how objects are transformed - * to and from a formatted String form for display on a user interface such - * as a HTML page. + * Property editors give you full control over how objects are transformed to and from a formatted String form for + * display on a user interface such as a HTML page. *

    - * This default implementation will call the - * {@link #registerPropertyEditors(PropertyEditorRegistry) simpler form} of - * the method not taking a RequestContext parameter. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" + * This default implementation will call the {@link #registerPropertyEditors(PropertyEditorRegistry) simpler form} + * of the method not taking a RequestContext parameter. + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" * @param registry the property editor registry to register editors in * @see #registerPropertyEditors(PropertyEditorRegistry) */ @@ -1074,18 +966,15 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Register custom editors to perform type conversion on fields of your form - * object during data binding and form display. This method is called on - * form errors initialization and + * Register custom editors to perform type conversion on fields of your form object during data binding and form + * display. This method is called on form errors initialization and * {@link #initBinder(RequestContext, DataBinder) data binder} initialization. *

    - * Property editors give you full control over how objects are transformed - * to and from a formatted String form for display on a user interface such - * as a HTML page. + * Property editors give you full control over how objects are transformed to and from a formatted String form for + * display on a user interface such as a HTML page. *

    - * This default implementation will simply call registerCustomEditors - * on the {@link #getPropertyEditorRegistrar() propertyEditorRegistrar} object - * that has been set for the action, if any. + * This default implementation will simply call registerCustomEditors on the + * {@link #getPropertyEditorRegistrar() propertyEditorRegistrar} object that has been set for the action, if any. * @param registry the property editor registry to register editors in */ protected void registerPropertyEditors(PropertyEditorRegistry registry) { @@ -1094,8 +983,7 @@ public class FormAction extends MultiAction implements InitializingBean { logger.debug("Registering custom property editors using configured registrar"); } getPropertyEditorRegistrar().registerCustomEditors(registry); - } - else { + } else { if (logger.isDebugEnabled()) { logger.debug("No property editor registrar set, no custom editors to register"); } @@ -1103,10 +991,9 @@ public class FormAction extends MultiAction implements InitializingBean { } /** - * Return whether validation should be performed given the state of the flow - * request context. Default implementation always returns true. - * @param context the request context, for accessing and setting data in - * "flow scope" or "request scope" + * Return whether validation should be performed given the state of the flow request context. Default implementation + * always returns true. + * @param context the request context, for accessing and setting data in "flow scope" or "request scope" * @return whether or not validation is enabled */ protected boolean validationEnabled(RequestContext context) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/FormObjectAccessor.java b/spring-webflow/src/main/java/org/springframework/webflow/action/FormObjectAccessor.java index e6dbbbab..2d4e2fab 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/FormObjectAccessor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/FormObjectAccessor.java @@ -21,15 +21,13 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ScopeType; /** - * Convenience helper that encapsulates logic on how to retrieve and expose form - * objects and associated errors to and from a flow execution request context. + * Convenience helper that encapsulates logic on how to retrieve and expose form objects and associated errors to and + * from a flow execution request context. *

    - * Note: The form object available under the well known attribute name - * {@link #CURRENT_FORM_OBJECT_ATTRIBUTE} will be the last ("current") form - * object set in the request context. The same is true for the associated errors - * object. This implies that special care should be taken when accessing the - * form object using this alias if there are multiple form objects available in - * the flow execution request context! + * Note: The form object available under the well known attribute name {@link #CURRENT_FORM_OBJECT_ATTRIBUTE} + * will be the last ("current") form object set in the request context. The same is true for the associated errors + * object. This implies that special care should be taken when accessing the form object using this alias if there are + * multiple form objects available in the flow execution request context! * * @see org.springframework.webflow.execution.RequestContext * @see org.springframework.validation.Errors @@ -40,15 +38,14 @@ import org.springframework.webflow.execution.ScopeType; public class FormObjectAccessor { /** - * The form object instance is aliased under this attribute name in the flow - * context by the default form setup and bind and validate actions. + * The form object instance is aliased under this attribute name in the flow context by the default form setup and + * bind and validate actions. *

    - * Note that if you would have multiple form objects in the request context, - * the last one that was used would be available using this alias! + * Note that if you would have multiple form objects in the request context, the last one that was used would be + * available using this alias! *

    - * We need to keep track of the 'current form object' using this attribute - * to be able to deal with the limitations of some clients that can only - * deal with a single form backing object, e.g. Struts when using the Struts + * We need to keep track of the 'current form object' using this attribute to be able to deal with the limitations + * of some clients that can only deal with a single form backing object, e.g. Struts when using the Struts * FlowAction. */ private static final String CURRENT_FORM_OBJECT_ATTRIBUTE = "currentFormObject"; @@ -56,9 +53,9 @@ public class FormObjectAccessor { /** * The errors prefix. */ - //use deprecated API to remain compatible with Spring 1.2.x + // use deprecated API to remain compatible with Spring 1.2.x private static final String ERRORS_PREFIX = BindException.ERROR_KEY_PREFIX; - + /** * The wrapped request context. */ @@ -79,7 +76,7 @@ public class FormObjectAccessor { public static String getCurrentFormObjectName() { return CURRENT_FORM_OBJECT_ATTRIBUTE; } - + /** * Returns the current form object errors attribute name. * @return the current form object errors attribute name @@ -89,8 +86,8 @@ public class FormObjectAccessor { } /** - * Gets the form object from the context, using the well-known attribute - * name {@link #CURRENT_FORM_OBJECT_ATTRIBUTE}. Will try all scopes. + * Gets the form object from the context, using the well-known attribute name {@link #CURRENT_FORM_OBJECT_ATTRIBUTE}. + * Will try all scopes. * @return the form object, or null if not found */ public Object getCurrentFormObject() { @@ -110,8 +107,7 @@ public class FormObjectAccessor { } /** - * Gets the form object from the context, using the well-known attribute - * name {@link #CURRENT_FORM_OBJECT_ATTRIBUTE}. + * Gets the form object from the context, using the well-known attribute name {@link #CURRENT_FORM_OBJECT_ATTRIBUTE}. * @param scopeType the scope to obtain the form object from * @return the form object, or null if not found */ @@ -120,13 +116,13 @@ public class FormObjectAccessor { } /** - * Expose given form object using the well known alias - * {@link #CURRENT_FORM_OBJECT_ATTRIBUTE} in the specified scope. + * Expose given form object using the well known alias {@link #CURRENT_FORM_OBJECT_ATTRIBUTE} in the specified + * scope. * @param formObject the form object * @param scopeType the scope in which to expose the form object */ public void setCurrentFormObject(Object formObject, ScopeType scopeType) { - //don't call setFormObject since that would cause infinite recursion! + // don't call setFormObject since that would cause infinite recursion! scopeType.getScope(context).put(getCurrentFormObjectName(), formObject); } @@ -143,8 +139,7 @@ public class FormObjectAccessor { /** * Gets the form object from the context, using the specified name. * @param formObjectName the name of the form in the context - * @param formObjectClass the class of the form object, which will be - * verified + * @param formObjectClass the class of the form object, which will be verified * @param scopeType the scope to obtain the form object from * @return the form object, or null if not found */ @@ -153,8 +148,8 @@ public class FormObjectAccessor { } /** - * Expose given form object using given name in specified scope. Given - * object will become the current form object. + * Expose given form object using given name in specified scope. Given object will become the current form + * object. * @param formObject the form object * @param formObjectName the name of the form object * @param scopeType the scope in which to expose the form object @@ -165,9 +160,8 @@ public class FormObjectAccessor { } /** - * Gets the form object Errors tracker from the context, - * using the form object name {@link #CURRENT_FORM_OBJECT_ATTRIBUTE}. This - * method will search all scopes. + * Gets the form object Errors tracker from the context, using the form object name + * {@link #CURRENT_FORM_OBJECT_ATTRIBUTE}. This method will search all scopes. * @return the form object Errors tracker, or null if not found */ public Errors getCurrentFormErrors() { @@ -187,8 +181,8 @@ public class FormObjectAccessor { } /** - * Gets the form object Errors tracker from the context, - * using the form object name {@link #CURRENT_FORM_OBJECT_ATTRIBUTE}. + * Gets the form object Errors tracker from the context, using the form object name + * {@link #CURRENT_FORM_OBJECT_ATTRIBUTE}. * @param scopeType the scope to obtain the errors from * @return the form object Errors tracker, or null if not found */ @@ -197,8 +191,8 @@ public class FormObjectAccessor { } /** - * Expose given errors instance using the well known alias - * {@link #CURRENT_FORM_OBJECT_ATTRIBUTE} in the specified scope. + * Expose given errors instance using the well known alias {@link #CURRENT_FORM_OBJECT_ATTRIBUTE} in the specified + * scope. * @param errors the errors instance * @param scopeType the scope in which to expose the errors instance */ @@ -207,20 +201,19 @@ public class FormObjectAccessor { } /** - * Gets the form object Errors tracker from the context, - * using the specified form object name. - * @param formObjectName the name of the Errors object, which will be - * prefixed with {@link BindException#ERROR_KEY_PREFIX} + * Gets the form object Errors tracker from the context, using the specified form object name. + * @param formObjectName the name of the Errors object, which will be prefixed with + * {@link BindException#ERROR_KEY_PREFIX} * @param scopeType the scope to obtain the errors from * @return the form object errors instance, or null if not found */ public Errors getFormErrors(String formObjectName, ScopeType scopeType) { - return (Errors)scopeType.getScope(context).get(ERRORS_PREFIX + formObjectName, Errors.class); + return (Errors) scopeType.getScope(context).get(ERRORS_PREFIX + formObjectName, Errors.class); } /** - * Expose given errors instance in the specified scope. Given errors - * instance will become the current form errors instance. + * Expose given errors instance in the specified scope. Given errors instance will become the current form + * errors instance. * @param errors the errors object * @param scopeType the scope to expose the errors in */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/LocalBeanInvokingAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/LocalBeanInvokingAction.java index 117d25d6..39f9c30b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/LocalBeanInvokingAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/LocalBeanInvokingAction.java @@ -22,8 +22,8 @@ import org.springframework.util.Assert; import org.springframework.webflow.execution.RequestContext; /** - * Thin action proxy that delegates to a method on an arbitrary bean. The bean - * instance is managed locally by this Action in an instance variable. + * Thin action proxy that delegates to a method on an arbitrary bean. The bean instance is managed locally by this + * Action in an instance variable. * * @author Keith Donald */ @@ -35,8 +35,8 @@ class LocalBeanInvokingAction extends AbstractBeanInvokingAction implements Seri private Object bean; /** - * Creates a bean invoking action that invokes a method on the specified bean. - * The bean may be a proxy providing a layer of indirection if necessary. + * Creates a bean invoking action that invokes a method on the specified bean. The bean may be a proxy providing a + * layer of indirection if necessary. * @param bean the bean to invoke */ public LocalBeanInvokingAction(MethodSignature methodSignature, Object bean) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/MultiAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/MultiAction.java index fe860d29..4ce9adb4 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/MultiAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/MultiAction.java @@ -21,18 +21,16 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.util.DispatchMethodInvoker; /** - * Action implementation that bundles two or more action execution methods into - * a single class. Action execution methods defined by subclasses must adhere to - * the following signature: + * Action implementation that bundles two or more action execution methods into a single class. Action execution methods + * defined by subclasses must adhere to the following signature: * *

      *     public Event ${method}(RequestContext context) throws Exception;
      * 
    * - * When this action is invoked, by default the id of the calling - * action state state is treated as the action execution method name. - * Alternatively, the execution method name may be explicitly specified as a - * attribute of the calling action state. + * When this action is invoked, by default the id of the calling action state state is treated as the + * action execution method name. Alternatively, the execution method name may be explicitly specified as a attribute of + * the calling action state. *

    * For example, the following action state definition: * @@ -46,7 +44,7 @@ import org.springframework.webflow.util.DispatchMethodInvoker; * ... when entered, executes the method: * *

    - *     public Event search(RequestContext context) throws Exception;
    + * public Event search(RequestContext context) throws Exception;
      * 
    * * Alternatively (and typically recommended), you may explictly specify the method name: @@ -59,10 +57,9 @@ import org.springframework.webflow.util.DispatchMethodInvoker; * * *

    - * A typical use of the MultiAction is to centralize all command logic for a - * flow in one place. Another common use is to centralize form setup and submit - * logic in one place, or CRUD (create/read/update/delete) operations for a - * single domain object in one place. + * A typical use of the MultiAction is to centralize all command logic for a flow in one place. Another common use is to + * centralize form setup and submit logic in one place, or CRUD (create/read/update/delete) operations for a single + * domain object in one place. * * @see MultiAction.MethodResolver * @see org.springframework.webflow.action.DefaultMultiActionMethodResolver @@ -84,8 +81,8 @@ public class MultiAction extends AbstractAction { private MethodResolver methodResolver = new DefaultMultiActionMethodResolver(); /** - * Protected default constructor; not invokable for direct MultiAction instantiation. - * Intended for use by subclasses. + * Protected default constructor; not invokable for direct MultiAction instantiation. Intended for use by + * subclasses. *

    * Sets the target to this multi action instance. * @see #setTarget(Object) @@ -95,12 +92,13 @@ public class MultiAction extends AbstractAction { } /** - * Constructs a multi action that invokes methods on the specified target - * object. Note: invokable methods on the target must conform to the multi action - * method signature: + * Constructs a multi action that invokes methods on the specified target object. Note: invokable methods on the + * target must conform to the multi action method signature: + * *

     	 *       public Event ${method}(RequestContext context) throws Exception;
     	 * 
    + * * @param target the target of this multi action's invocations */ public MultiAction(Object target) { @@ -112,7 +110,7 @@ public class MultiAction extends AbstractAction { * @param target the target */ protected final void setTarget(Object target) { - methodInvoker = new DispatchMethodInvoker(target, new Class[] { RequestContext.class } ); + methodInvoker = new DispatchMethodInvoker(target, new Class[] { RequestContext.class }); } /** @@ -123,9 +121,8 @@ public class MultiAction extends AbstractAction { } /** - * Set the strategy used to resolve action execution method names. - * Allows full control over the method resolution algorithm. - * Defaults to {@link DefaultMultiActionMethodResolver}. + * Set the strategy used to resolve action execution method names. Allows full control over the method resolution + * algorithm. Defaults to {@link DefaultMultiActionMethodResolver}. */ public void setMethodResolver(MethodResolver methodResolver) { this.methodResolver = methodResolver; @@ -135,19 +132,17 @@ public class MultiAction extends AbstractAction { String method = getMethodResolver().resolveMethod(context); Object obj = methodInvoker.invoke(method, new Object[] { context }); if (obj != null) { - Assert.isInstanceOf(Event.class, obj, - "The '" + method + "' action execution method on target object '" + - methodInvoker.getTarget() + "' did not return an Event object but '" + - obj + "' of type " + obj.getClass().getName() + " -- " + - "Programmer error; make sure the method signature conforms to " + - "'public Event ${method}(RequestContext context) throws Exception;'."); + Assert.isInstanceOf(Event.class, obj, "The '" + method + "' action execution method on target object '" + + methodInvoker.getTarget() + "' did not return an Event object but '" + obj + "' of type " + + obj.getClass().getName() + " -- " + + "Programmer error; make sure the method signature conforms to " + + "'public Event ${method}(RequestContext context) throws Exception;'."); } - return (Event)obj; + return (Event) obj; } /** - * Strategy interface used by the MultiAction to map a request context to - * the name of an action execution method. + * Strategy interface used by the MultiAction to map a request context to the name of an action execution method. * * @author Keith Donald * @author Erwin Vervaet @@ -157,8 +152,7 @@ public class MultiAction extends AbstractAction { /** * Resolve a method name from given flow execution request context. * @param context the flow execution request context - * @return the name of the method that should handle action - * execution + * @return the name of the method that should handle action execution */ public String resolveMethod(RequestContext context); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactory.java index 76a56b17..0b0bd0a5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactory.java @@ -19,8 +19,8 @@ import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; /** - * A strategy for creating an {@link Event} object from an arbitrary object - * such as an expression evaluation result or bean method return value. + * A strategy for creating an {@link Event} object from an arbitrary object such as an expression evaluation result or + * bean method return value. * * @author Keith Donald */ @@ -29,8 +29,7 @@ public interface ResultEventFactory { /** * Create an event instance from the result object. * @param source the source of the event - * @param resultObject the result object, typically the return value of a - * bean method + * @param resultObject the result object, typically the return value of a bean method * @param context a flow execution request context * @return the event */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactorySelector.java b/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactorySelector.java index 72b92d01..ca120674 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactorySelector.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/ResultEventFactorySelector.java @@ -18,8 +18,7 @@ package org.springframework.webflow.action; import java.lang.reflect.Method; /** - * Helper that selects the {@link ResultEventFactory} to use for - * a particular result object. + * Helper that selects the {@link ResultEventFactory} to use for a particular result object. * * @see EvaluateAction * @see BeanInvokingActionFactory @@ -34,14 +33,13 @@ public class ResultEventFactorySelector { private SuccessEventFactory successEventFactory = new SuccessEventFactory(); /** - * The event factory instance for mapping a result object to an event, using - * the type of the result object as the mapping criteria. + * The event factory instance for mapping a result object to an event, using the type of the result object as the + * mapping criteria. */ private ResultObjectBasedEventFactory resultObjectBasedEventFactory = new ResultObjectBasedEventFactory(); /** - * Select the appropriate result event factory for attempts to invoke the - * given method. + * Select the appropriate result event factory for attempts to invoke the given method. * @param method the method * @return the result event factory */ @@ -57,26 +55,23 @@ public class ResultEventFactorySelector { public ResultEventFactory forResult(Object result) { if (result == null) { return successEventFactory; - } - else { + } else { return forType(result.getClass()); } } - + /** - * Select the appropriate result event factory for given result type. - * This implementation returns {@link ResultObjectBasedEventFactory} if the - * type is {@link ResultObjectBasedEventFactory#isMappedValueType(Class) mapped} - * by that result event factory, otherwise {@link SuccessEventFactory} is - * returned. + * Select the appropriate result event factory for given result type. This implementation returns + * {@link ResultObjectBasedEventFactory} if the type is + * {@link ResultObjectBasedEventFactory#isMappedValueType(Class) mapped} by that result event factory, otherwise + * {@link SuccessEventFactory} is returned. * @param resultType the result type * @return the result event factory */ protected ResultEventFactory forType(Class resultType) { if (resultObjectBasedEventFactory.isMappedValueType(resultType)) { return resultObjectBasedEventFactory; - } - else { + } else { return successEventFactory; } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/ResultObjectBasedEventFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/action/ResultObjectBasedEventFactory.java index 9f6dfe81..239d0032 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/ResultObjectBasedEventFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/ResultObjectBasedEventFactory.java @@ -22,10 +22,8 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.support.EventFactorySupport; /** - * Result object-to-event adapter interface that tries to do a - * sensible conversion of the result object into a web flow event. - * It uses the following conversion table: - * + * Result object-to-event adapter interface that tries to do a sensible conversion of the result object into a web flow + * event. It uses the following conversion table:
    * * * @@ -45,14 +43,12 @@ import org.springframework.webflow.execution.support.EventFactorySupport; * * * - * + * * * * * - * + * * * * @@ -70,44 +66,37 @@ import org.springframework.webflow.execution.support.EventFactorySupport; * @author Erwin Vervaet */ public class ResultObjectBasedEventFactory extends EventFactorySupport implements ResultEventFactory { - + public Event createResultEvent(Object source, Object resultObject, RequestContext context) { if (resultObject == null) { // this handles the case where the declared result return type is mapped // by this class but the value is null return event(source, getNullEventId()); - } - else if (isBoolean(resultObject.getClass())) { - return event(source, ((Boolean)resultObject).booleanValue()); - } - else if (isLabeledEnum(resultObject.getClass())) { - String resultId = ((LabeledEnum)resultObject).getLabel(); + } else if (isBoolean(resultObject.getClass())) { + return event(source, ((Boolean) resultObject).booleanValue()); + } else if (isLabeledEnum(resultObject.getClass())) { + String resultId = ((LabeledEnum) resultObject).getLabel(); return event(source, resultId, getResultAttributeName(), resultObject); - } - else if (isJdk5Enum(resultObject.getClass())) { + } else if (isJdk5Enum(resultObject.getClass())) { String eventId = EnumNameResolver.getEnumName(resultObject); return event(source, eventId, getResultAttributeName(), resultObject); - } - else if (isString(resultObject.getClass())) { - return event(source, (String)resultObject); - } - else if (isEvent(resultObject.getClass())) { - return (Event)resultObject; - } - else { - throw new IllegalArgumentException("Cannot deal with result object '" + resultObject + - "' of type '" + resultObject.getClass() + "'"); + } else if (isString(resultObject.getClass())) { + return event(source, (String) resultObject); + } else if (isEvent(resultObject.getClass())) { + return (Event) resultObject; + } else { + throw new IllegalArgumentException("Cannot deal with result object '" + resultObject + "' of type '" + + resultObject.getClass() + "'"); } } /** - * Check whether or not given type is mapped to a corresponding - * event using special mapping rules. + * Check whether or not given type is mapped to a corresponding event using special mapping rules. */ public boolean isMappedValueType(Class type) { return isBoolean(type) || isLabeledEnum(type) || isJdk5Enum(type) || isString(type) || isEvent(type); } - + // internal helpers to determine the 'type' of a class private boolean isBoolean(Class type) { @@ -121,8 +110,7 @@ public class ResultObjectBasedEventFactory extends EventFactorySupport implement private boolean isJdk5Enum(Class type) { if (JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_15) { return type.isEnum(); - } - else { + } else { return false; } } @@ -130,18 +118,17 @@ public class ResultObjectBasedEventFactory extends EventFactorySupport implement private boolean isString(Class type) { return String.class.equals(type); } - + private boolean isEvent(Class type) { return Event.class.isAssignableFrom(type); } /** - * Simple helper class with Java 5 specific code factored out to keep - * the containing class JDK 1.3 compatible. + * Simple helper class with Java 5 specific code factored out to keep the containing class JDK 1.3 compatible. */ private static class EnumNameResolver { public static String getEnumName(Object enumValue) { - return ((java.lang.Enum)enumValue).name(); + return ((java.lang.Enum) enumValue).name(); } } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/SetAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/SetAction.java index 3a0038df..02e50fb3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/SetAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/SetAction.java @@ -25,8 +25,7 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ScopeType; /** - * An action that sets an attribute in a {@link ScopeType scope} when executed. - * Always returns the "success" event. + * An action that sets an attribute in a {@link ScopeType scope} when executed. Always returns the "success" event. * * @author Keith Donald */ @@ -43,7 +42,7 @@ public class SetAction extends AbstractAction { private ScopeType scope; /** - * The expression for resolving the scoped attribute value. + * The expression for resolving the scoped attribute value. */ private Expression valueExpression; @@ -71,8 +70,8 @@ public class SetAction extends AbstractAction { } /** - * Template method subclasses may override to customize the expression - * evaluation context. This implementation returns null. + * Template method subclasses may override to customize the expression evaluation context. This implementation + * returns null. * @param context the request context * @return the evaluation context */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/SuccessEventFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/action/SuccessEventFactory.java index d90dd826..62159d01 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/SuccessEventFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/SuccessEventFactory.java @@ -20,13 +20,12 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.support.EventFactorySupport; /** - * Default implementation of the resultObject-to-event mapping interface. - * Always returns the "success" event. + * Default implementation of the resultObject-to-event mapping interface. Always returns the "success" event. * * @author Keith Donald */ public class SuccessEventFactory extends EventFactorySupport implements ResultEventFactory { - + public Event createResultEvent(Object source, Object resultObject, RequestContext context) { return success(source, resultObject); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/action/portlet/SetPortletModeAction.java b/spring-webflow/src/main/java/org/springframework/webflow/action/portlet/SetPortletModeAction.java index d69dad82..04b379e4 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/action/portlet/SetPortletModeAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/action/portlet/SetPortletModeAction.java @@ -26,16 +26,14 @@ import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; /** - * Action implementation that changes a PortletResponse mode. The action only - * generates the - * {@link org.springframework.webflow.action.AbstractAction#success()} event. - * All error cases result in an exception being thrown. + * Action implementation that changes a PortletResponse mode. The action only generates the + * {@link org.springframework.webflow.action.AbstractAction#success()} event. All error cases result in an exception + * being thrown. *

    - * This class is usefull when you want to change the current PortletMode before - * entering a specific state, e.g. it can be the first state in a subflow. + * This class is usefull when you want to change the current PortletMode before entering a specific state, e.g. it can + * be the first state in a subflow. *

    - * Note: if you can, change the PortletMode using Portlet URLs (PortletURL class - * or portlet TAG). + * Note: if you can, change the PortletMode using Portlet URLs (PortletURL class or portlet TAG). * * @author J.Enrique Ruiz * @author Cesar Ordinana @@ -44,8 +42,7 @@ import org.springframework.webflow.execution.RequestContext; public class SetPortletModeAction extends AbstractAction { /** - * The portlet mode to set can be specified in an action state action - * attribute with this name ("portletMode"). + * The portlet mode to set can be specified in an action state action attribute with this name ("portletMode"). */ public static final String PORTLET_MODE_ATTRIBUTE = "portletMode"; @@ -71,29 +68,25 @@ public class SetPortletModeAction extends AbstractAction { /** * Sets the PortletMode. - * @param context the action execution context, for accessing and setting - * data in "flow scope" or "request scope" + * @param context the action execution context, for accessing and setting data in "flow scope" or "request scope" * @return the action result event - * @throws Exception an unrecoverable exception occured, either - * checked or unchecked + * @throws Exception an unrecoverable exception occured, either checked or unchecked */ protected Event doExecute(RequestContext context) throws Exception { Assert.isInstanceOf(PortletExternalContext.class, context.getExternalContext(), "'" + ClassUtils.getShortName(this.getClass()) + "' can only work with 'PortletExternalContext': "); - PortletExternalContext portletContext = (PortletExternalContext)context.getExternalContext(); + PortletExternalContext portletContext = (PortletExternalContext) context.getExternalContext(); if (portletContext.getResponse() instanceof ActionResponse) { - PortletMode mode = - (PortletMode)context.getAttributes().get(PORTLET_MODE_ATTRIBUTE, PortletMode.class, getPortletMode()); - ((ActionResponse)portletContext.getResponse()).setPortletMode(mode); + PortletMode mode = (PortletMode) context.getAttributes().get(PORTLET_MODE_ATTRIBUTE, PortletMode.class, + getPortletMode()); + ((ActionResponse) portletContext.getResponse()).setPortletMode(mode); return success(); - } - else { + } else { // portlet mode and the window state can be changed through // ActionResponse only, if this is not the case, it means that this // action has been invoked directly in a RenderRequest - throw new IllegalStateException( - "SetPortletModeAction can only be invoked within a Action request -- " + - "make sure you are not invoking it in a RenderRequest"); + throw new IllegalStateException("SetPortletModeAction can only be invoked within a Action request -- " + + "make sure you are not invoking it in a RenderRequest"); } } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutionAttributesBeanDefinitionParser.java b/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutionAttributesBeanDefinitionParser.java index aa704a71..541e76be 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutionAttributesBeanDefinitionParser.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutionAttributesBeanDefinitionParser.java @@ -36,7 +36,7 @@ import org.w3c.dom.Element; * @author Ben Hale */ class ExecutionAttributesBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { - + // elements and attributes private static final String ATTRIBUTE_ELEMENT = "attribute"; @@ -68,7 +68,7 @@ class ExecutionAttributesBeanDefinitionParser extends AbstractSingleBeanDefiniti */ private void putAttributes(Map attributeMap, List attributeElements) { for (Iterator i = attributeElements.iterator(); i.hasNext();) { - Element attributeElement = (Element)i.next(); + Element attributeElement = (Element) i.next(); String type = attributeElement.getAttribute(TYPE_ATTRIBUTE); Object value; if (StringUtils.hasText(type)) { @@ -81,17 +81,15 @@ class ExecutionAttributesBeanDefinitionParser extends AbstractSingleBeanDefiniti } /** - * Add all non-generic (special) attributes defined in given element - * to given map. + * Add all non-generic (special) attributes defined in given element to given map. */ private void putSpecialAttributes(Map attributeMap, Element element) { - putAlwaysRedirectOnPauseAttribute(attributeMap, - DomUtils.getChildElementByTagName(element, ApplicationViewSelector.ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE)); + putAlwaysRedirectOnPauseAttribute(attributeMap, DomUtils.getChildElementByTagName(element, + ApplicationViewSelector.ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE)); } /** - * Parse the "alwaysRedirectOnPause" attribute from given element and - * add it to given map. + * Parse the "alwaysRedirectOnPause" attribute from given element and add it to given map. */ private void putAlwaysRedirectOnPauseAttribute(Map attributeMap, Element element) { if (element != null) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutionListenersBeanDefinitionParser.java b/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutionListenersBeanDefinitionParser.java index 16515dde..e81094ae 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutionListenersBeanDefinitionParser.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutionListenersBeanDefinitionParser.java @@ -29,21 +29,20 @@ import org.springframework.webflow.execution.factory.ConditionalFlowExecutionLis import org.w3c.dom.Element; /** - * {@link BeanDefinitionParser} for the <execution-listeners> - * tag. + * {@link BeanDefinitionParser} for the <execution-listeners> tag. * * @author Ben Hale */ class ExecutionListenersBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { - + // elements and attributes - - private static final String LISTENER_ELEMENT= "listener"; + + private static final String LISTENER_ELEMENT = "listener"; // properties private static final String LISTENERS_PROPERTY = "listeners"; - + private static final String CRITERIA_ATTRIBUTE = "criteria"; private static final String REF_ATTRIBUTE = "ref"; @@ -60,13 +59,13 @@ class ExecutionListenersBeanDefinitionParser extends AbstractSingleBeanDefinitio /** * Creates a map of listeners with their associated criteria. * @param listeners the list of listener elements from the bean definition - * @return a map containing keys that are references to given listeners - * and values of string that represent the criteria + * @return a map containing keys that are references to given listeners and values of string that represent the + * criteria */ private Map getListenersWithCriteria(List listeners) { Map listenersWithCriteria = new ManagedMap(listeners.size()); for (Iterator i = listeners.iterator(); i.hasNext();) { - Element listenerElement = (Element)i.next(); + Element listenerElement = (Element) i.next(); RuntimeBeanReference ref = new RuntimeBeanReference(listenerElement.getAttribute(REF_ATTRIBUTE)); String criteria = listenerElement.getAttribute(CRITERIA_ATTRIBUTE); listenersWithCriteria.put(ref, criteria); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutorBeanDefinitionParser.java b/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutorBeanDefinitionParser.java index 478d0dc8..6e32a8c9 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutorBeanDefinitionParser.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/ExecutorBeanDefinitionParser.java @@ -33,48 +33,46 @@ import org.w3c.dom.Element; class ExecutorBeanDefinitionParser extends AbstractBeanDefinitionParser { // elements and attributes - + private static final String CONVERSATION_MANAGER_REF_ATTRIBUTE = "conversation-manager-ref"; - + private static final String EXECUTION_ATTRIBUTES_ELEMENT = "execution-attributes"; private static final String EXECUTION_LISTENERS_ELEMENT = "execution-listeners"; - + private static final String MAX_CONTINUATIONS_ATTRIBUTE = "max-continuations"; - + private static final String MAX_CONVERSATIONS_ATTRIBUTE = "max-conversations"; private static final String REGISTRY_REF_ATTRIBUTE = "registry-ref"; - + private static final String REPOSITORY_ELEMENT = "repository"; private static final String REPOSITORY_TYPE_ATTRIBUTE = "repository-type"; - + private static final String TYPE_ATTRIBUTE = "type"; // properties private static final String CONVERSATION_MANAGER_PROPERTY = "conversationManager"; - + private static final String DEFINITION_LOCATOR_PROPERTY = "definitionLocator"; private static final String EXECUTION_ATTRIBUTES_PROPERTY = "executionAttributes"; private static final String EXECUTION_LISTENER_LOADER_PROPERTY = "executionListenerLoader"; - + private static final String MAX_CONTINUATIONS_PROPERTY = "maxContinuations"; - + private static final String MAX_CONVERSATIONS_PROPERTY = "maxConversations"; private static final String REPOSITORY_TYPE_PROPERTY = "repositoryType"; - protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { BeanDefinitionBuilder definitionBuilder = BeanDefinitionBuilder .rootBeanDefinition(FlowExecutorFactoryBean.class); definitionBuilder.setSource(parserContext.extractSource(element)); - definitionBuilder.addPropertyReference(DEFINITION_LOCATOR_PROPERTY, - getRegistryRef(element, parserContext)); + definitionBuilder.addPropertyReference(DEFINITION_LOCATOR_PROPERTY, getRegistryRef(element, parserContext)); addExecutionAttributes(element, parserContext, definitionBuilder); addExecutionListenerLoader(element, parserContext, definitionBuilder); configureRepository(element, definitionBuilder, parserContext); @@ -82,29 +80,27 @@ class ExecutorBeanDefinitionParser extends AbstractBeanDefinitionParser { } /** - * Configures a repository based on the repository-type attribute - * or a repository tag. + * Configures a repository based on the repository-type attribute or a repository tag. * @param element the root element to extract repository configuration from * @param definitionBuilder the builder * @param parserContext the parserContext */ - private void configureRepository(Element element, BeanDefinitionBuilder definitionBuilder, + private void configureRepository(Element element, BeanDefinitionBuilder definitionBuilder, ParserContext parserContext) { Element repositoryElement = DomUtils.getChildElementByTagName(element, REPOSITORY_ELEMENT); String repositoryTypeAttribute = getRepositoryType(element); if (repositoryElement != null) { if (StringUtils.hasText(repositoryTypeAttribute)) { parserContext.getReaderContext().error( - "The 'repositoryType' attribute of the 'executor' element must " + - "not have a value if there is a 'repository' element", element); + "The 'repositoryType' attribute of the 'executor' element must " + + "not have a value if there is a 'repository' element", element); } definitionBuilder.addPropertyValue(REPOSITORY_TYPE_PROPERTY, getType(repositoryElement)); configureContinuations(repositoryElement, definitionBuilder, parserContext); configureConversationManager(repositoryElement, definitionBuilder, parserContext); - } - else if (StringUtils.hasText(repositoryTypeAttribute)) { + } else if (StringUtils.hasText(repositoryTypeAttribute)) { definitionBuilder.addPropertyValue(REPOSITORY_TYPE_PROPERTY, repositoryTypeAttribute); - } + } } /** @@ -119,8 +115,8 @@ class ExecutorBeanDefinitionParser extends AbstractBeanDefinitionParser { if (StringUtils.hasText(maxContinuations)) { if (!getType(repositoryElement).equals("CONTINUATION")) { parserContext.getReaderContext().error( - "The 'max-continuations' attribute of the 'repository' element must not " + - "have a value if the 'type' attribute is not 'continuation'", repositoryElement); + "The 'max-continuations' attribute of the 'repository' element must not " + + "have a value if the 'type' attribute is not 'continuation'", repositoryElement); } definitionBuilder.addPropertyValue(MAX_CONTINUATIONS_PROPERTY, maxContinuations); } @@ -132,24 +128,23 @@ class ExecutorBeanDefinitionParser extends AbstractBeanDefinitionParser { * @param definitionBuilder the builder * @param parserContext the parserContext */ - private void configureConversationManager(Element repositoryElement, BeanDefinitionBuilder definitionBuilder, + private void configureConversationManager(Element repositoryElement, BeanDefinitionBuilder definitionBuilder, ParserContext parserContext) { String conversationManagerRef = getConversationManagerRef(repositoryElement); String maxConversations = getMaxConversations(repositoryElement); if (StringUtils.hasText(conversationManagerRef)) { - if(StringUtils.hasText(maxConversations)) { + if (StringUtils.hasText(maxConversations)) { parserContext.getReaderContext().error( - "The 'max-conversations' attribute of the 'repository' element must not " + - "have a value if there is a value for the 'conversation-manager-ref' attribute", + "The 'max-conversations' attribute of the 'repository' element must not " + + "have a value if there is a value for the 'conversation-manager-ref' attribute", repositoryElement); } definitionBuilder.addPropertyReference(CONVERSATION_MANAGER_PROPERTY, conversationManagerRef); - } - else if (StringUtils.hasText(maxConversations)) { + } else if (StringUtils.hasText(maxConversations)) { definitionBuilder.addPropertyValue(MAX_CONVERSATIONS_PROPERTY, maxConversations); - } + } } - + /** * Returns the name of the registry detailed in the bean definition. * @param element the element to extract the registry name from @@ -166,25 +161,23 @@ class ExecutorBeanDefinitionParser extends AbstractBeanDefinitionParser { } /** - * Returns the name of the repository type enum field detailed in the bean - * definition. + * Returns the name of the repository type enum field detailed in the bean definition. * @param element the element to extract the repository type from * @return the type of the repository */ private String getRepositoryType(Element element) { return element.getAttribute(REPOSITORY_TYPE_ATTRIBUTE).toUpperCase(); } - + /** - * Returns the name of the repository type enum field detailed in the bean - * definition. + * Returns the name of the repository type enum field detailed in the bean definition. * @param element the element to extract the repository type from * @return the type of the repository */ private String getType(Element element) { return element.getAttribute(TYPE_ATTRIBUTE).toUpperCase(); } - + /** * Returns the maximum number of continuations detailed in the bean definition. * @param element the element to extract the max continuations from @@ -193,7 +186,7 @@ class ExecutorBeanDefinitionParser extends AbstractBeanDefinitionParser { private String getMaxContinuations(Element element) { return element.getAttribute(MAX_CONTINUATIONS_ATTRIBUTE); } - + /** * Returns the maximum number of conversations detailed in the bean definition. * @param element the element to extract the max conversations from @@ -202,7 +195,7 @@ class ExecutorBeanDefinitionParser extends AbstractBeanDefinitionParser { private String getMaxConversations(Element element) { return element.getAttribute(MAX_CONVERSATIONS_ATTRIBUTE); } - + /** * Returns the name of the conversation manager detailed in the bean definition. * @param element the element to extract the conversation manager name from diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorFactoryBean.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorFactoryBean.java index 72c6c569..679f3c09 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorFactoryBean.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowExecutorFactoryBean.java @@ -45,30 +45,26 @@ import org.springframework.webflow.executor.FlowExecutor; import org.springframework.webflow.executor.FlowExecutorImpl; /** - * The default flow executor factory implementation. As a FactoryBean, - * this class has been designed for use as a Spring managed bean. + * The default flow executor factory implementation. As a FactoryBean, this class has been designed for + * use as a Spring managed bean. *

    - * This factory encapsulates the construction and assembly of a - * {@link FlowExecutor}, including the provision of its + * This factory encapsulates the construction and assembly of a {@link FlowExecutor}, including the provision of its * {@link FlowExecutionRepository} strategy. *

    - * The {@link #setDefinitionLocator(FlowDefinitionLocator) definition locator} - * property is required, all other properties are optional. + * The {@link #setDefinitionLocator(FlowDefinitionLocator) definition locator} property is required, all other + * properties are optional. *

    - * This class has been designed with subclassing in mind. If you want to do advanced - * Spring Web Flow customization, e.g. using a custom - * {@link org.springframework.webflow.executor.FlowExecutor} implementation, - * consider subclassing this class and overriding one or more of the provided - * hook methods. - * + * This class has been designed with subclassing in mind. If you want to do advanced Spring Web Flow customization, e.g. + * using a custom {@link org.springframework.webflow.executor.FlowExecutor} implementation, consider subclassing this + * class and overriding one or more of the provided hook methods. + * * @author Keith Donald * @author Erwin Vervaet */ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { /** - * The locator the executor will use to access flow definitions registered - * in a central registry. Required. + * The locator the executor will use to access flow definitions registered in a central registry. Required. */ private FlowDefinitionLocator definitionLocator; @@ -83,8 +79,8 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { private FlowExecutionListenerLoader executionListenerLoader; /** - * The conversation manager to be used by the flow execution repository to - * store state associated with conversations driven by Spring Web Flow. + * The conversation manager to be used by the flow execution repository to store state associated with conversations + * driven by Spring Web Flow. */ private ConversationManager conversationManager; @@ -94,21 +90,20 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { private Integer maxConversations; /** - * The type of execution repository to configure with executors created by - * this factory. Optional. Will fallback to default value if not set. + * The type of execution repository to configure with executors created by this factory. Optional. Will fallback to + * default value if not set. */ private RepositoryType repositoryType; /** - * The maximum number of allowed continuations for a single conversation. - * Only used when the repository type is {@link RepositoryType#CONTINUATION}. + * The maximum number of allowed continuations for a single conversation. Only used when the repository type is + * {@link RepositoryType#CONTINUATION}. */ private Integer maxContinuations; /** - * A custom attribute mapper to use for mapping attributes of an - * {@link ExternalContext} to a new {@link FlowExecution} during the - * {@link FlowExecutor#launch(String, ExternalContext) launch flow} operation. + * A custom attribute mapper to use for mapping attributes of an {@link ExternalContext} to a new + * {@link FlowExecution} during the {@link FlowExecutor#launch(String, ExternalContext) launch flow} operation. */ private AttributeMapper inputMapper; @@ -123,8 +118,8 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { private FlowSystemDefaults defaults = new FlowSystemDefaults(); /** - * Sets the flow definition locator that will locate flow definitions needed - * for execution. Typically also a {@link FlowDefinitionRegistry}. Required. + * Sets the flow definition locator that will locate flow definitions needed for execution. Typically also a + * {@link FlowDefinitionRegistry}. Required. * @param definitionLocator the flow definition locator (registry) */ public void setDefinitionLocator(FlowDefinitionLocator definitionLocator) { @@ -132,13 +127,11 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { } /** - * Sets the system attributes that apply to flow executions launched by the - * executor created by this factory. Execution attributes may affect flow - * execution behavior. + * Sets the system attributes that apply to flow executions launched by the executor created by this factory. + * Execution attributes may affect flow execution behavior. *

    - * Note: this method simply accepts a generic java.util.Map - * to allow for easy configuration by Spring. The map entries should consist - * of non-null String keys with object values. + * Note: this method simply accepts a generic java.util.Map to allow for easy configuration by + * Spring. The map entries should consist of non-null String keys with object values. * @param executionAttributes the flow execution system attributes */ public void setExecutionAttributes(Map executionAttributes) { @@ -146,8 +139,8 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { } /** - * Convenience setter that sets a single listener that always applies to flow - * executions launched by the executor created by this factory. + * Convenience setter that sets a single listener that always applies to flow executions launched by the executor + * created by this factory. * @param executionListener the flow execution listener */ public void setExecutionListener(FlowExecutionListener executionListener) { @@ -155,8 +148,8 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { } /** - * Convenience setter that sets a list of listeners that always apply to - * flow executions launched by the executor created by this factory. + * Convenience setter that sets a list of listeners that always apply to flow executions launched by the executor + * created by this factory. * @param executionListeners the flow execution listeners */ public void setExecutionListeners(FlowExecutionListener[] executionListeners) { @@ -164,19 +157,17 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { } /** - * Sets the strategy for loading the listeners that will observe executions - * of a flow definition. Allows full control over what listeners should - * apply to executions of a flow definition launched by the executor created - * by this factory. + * Sets the strategy for loading the listeners that will observe executions of a flow definition. Allows full + * control over what listeners should apply to executions of a flow definition launched by the executor created by + * this factory. */ public void setExecutionListenerLoader(FlowExecutionListenerLoader executionListenerLoader) { this.executionListenerLoader = executionListenerLoader; } /** - * Sets the type of flow execution repository that should be configured for - * the flow executors created by this factory. This factory encapsulates the - * construction of the repository implementation corresponding to the + * Sets the type of flow execution repository that should be configured for the flow executors created by this + * factory. This factory encapsulates the construction of the repository implementation corresponding to the * provided type. * @param repositoryType the flow execution repository type */ @@ -185,9 +176,8 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { } /** - * Set the maximum number of continuation snapshots allowed for a single - * conversation when using the {@link RepositoryType#CONTINUATION continuation} - * flow execution repository. + * Set the maximum number of continuation snapshots allowed for a single conversation when using the + * {@link RepositoryType#CONTINUATION continuation} flow execution repository. * @see ContinuationFlowExecutionRepository#setMaxContinuations(int) * @since 1.0.1 */ @@ -196,11 +186,9 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { } /** - * Returns the configured maximum number of continuation snapshots allowed - * for a single conversation when using the + * Returns the configured maximum number of continuation snapshots allowed for a single conversation when using the * {@link RepositoryType#CONTINUATION continuation} flow execution repository. - * @return the configured value or null if the user did not explicitly - * specify a value and wants to use the default + * @return the configured value or null if the user did not explicitly specify a value and wants to use the default * @since 1.0.1 */ protected Integer getMaxContinuations() { @@ -208,24 +196,23 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { } /** - * Sets the strategy for managing conversations that should be configured - * for flow executors created by this factory. + * Sets the strategy for managing conversations that should be configured for flow executors created by this + * factory. *

    - * The conversation manager is used by the flow execution repository - * subsystem to begin and end new conversations that store execution state. + * The conversation manager is used by the flow execution repository subsystem to begin and end new conversations + * that store execution state. *

    - * By default, a {@link SessionBindingConversationManager} is used. Do not - * use {@link #setMaxConversations(int)} when using this method. + * By default, a {@link SessionBindingConversationManager} is used. Do not use {@link #setMaxConversations(int)} + * when using this method. */ public void setConversationManager(ConversationManager conversationManager) { this.conversationManager = conversationManager; } /** - * Set the maximum number of allowed concurrent conversations in the session. This - * is a convenience setter to allow easy configuration of the maxConversations - * property of the default {@link SessionBindingConversationManager}. Do not use - * this when using {@link #setConversationManager(ConversationManager)}. + * Set the maximum number of allowed concurrent conversations in the session. This is a convenience setter to allow + * easy configuration of the maxConversations property of the default {@link SessionBindingConversationManager}. Do + * not use this when using {@link #setConversationManager(ConversationManager)}. * @see SessionBindingConversationManager#setMaxConversations(int) * @since 1.0.1 */ @@ -234,12 +221,10 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { } /** - * Returns the configured maximum number of allowed concurrent conversations - * in the session. Will only be used when using the default conversation manager, - * e.g. when no explicit conversation manager has been configured using + * Returns the configured maximum number of allowed concurrent conversations in the session. Will only be used when + * using the default conversation manager, e.g. when no explicit conversation manager has been configured using * {@link #setConversationManager(ConversationManager)}. - * @return the configured value or null if the user did not explicitly - * specify a value and wants to use the default + * @return the configured value or null if the user did not explicitly specify a value and wants to use the default * @since 1.0.1 */ protected Integer getMaxConversations() { @@ -247,12 +232,11 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { } /** - * Set the service responsible for mapping attributes of an - * {@link ExternalContext} to a new {@link FlowExecution} during the - * {@link FlowExecutor#launch(String, ExternalContext) launch flow} operation. + * Set the service responsible for mapping attributes of an {@link ExternalContext} to a new {@link FlowExecution} + * during the {@link FlowExecutor#launch(String, ExternalContext) launch flow} operation. *

    - * This is optional. If not set, a default implementation will be used - * that simply exposes all request parameters as flow execution input attributes. + * This is optional. If not set, a default implementation will be used that simply exposes all request parameters as + * flow execution input attributes. * @since 1.0.4 */ public void setInputMapper(AttributeMapper inputMapper) { @@ -280,36 +264,34 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { public void afterPropertiesSet() throws Exception { Assert.notNull(definitionLocator, "The flow definition locator is required"); - // apply defaults - executionAttributes = defaults.applyExecutionAttributes(executionAttributes); - repositoryType = defaults.applyIfNecessary(repositoryType); + // apply defaults + executionAttributes = defaults.applyExecutionAttributes(executionAttributes); + repositoryType = defaults.applyIfNecessary(repositoryType); - // pass all available parameters to the hook methods so that they - // can participate in the construction process + // pass all available parameters to the hook methods so that they + // can participate in the construction process - // a factory for flow executions - FlowExecutionFactory executionFactory = - createFlowExecutionFactory(executionAttributes, executionListenerLoader); + // a factory for flow executions + FlowExecutionFactory executionFactory = createFlowExecutionFactory(executionAttributes, executionListenerLoader); - // a strategy to restore deserialized flow executions - FlowExecutionStateRestorer executionStateRestorer = - createFlowExecutionStateRestorer(definitionLocator, executionAttributes, executionListenerLoader); + // a strategy to restore deserialized flow executions + FlowExecutionStateRestorer executionStateRestorer = createFlowExecutionStateRestorer(definitionLocator, + executionAttributes, executionListenerLoader); - // a repository to store flow executions - FlowExecutionRepository executionRepository = - createExecutionRepository(repositoryType, executionStateRestorer, conversationManager); + // a repository to store flow executions + FlowExecutionRepository executionRepository = createExecutionRepository(repositoryType, executionStateRestorer, + conversationManager); - // combine all pieces of the puzzle to get an operational flow executor - flowExecutor = createFlowExecutor(definitionLocator, executionFactory, executionRepository); + // combine all pieces of the puzzle to get an operational flow executor + flowExecutor = createFlowExecutor(definitionLocator, executionFactory, executionRepository); } // subclassing hook methods /** - * Create the conversation manager to be used in the default case, e.g. when no - * explicit conversation manager has been configured using - * {@link #setConversationManager(ConversationManager)}. This implementation - * return a {@link SessionBindingConversationManager}. + * Create the conversation manager to be used in the default case, e.g. when no explicit conversation manager has + * been configured using {@link #setConversationManager(ConversationManager)}. This implementation return a + * {@link SessionBindingConversationManager}. * @return the default conversation manager */ protected ConversationManager createDefaultConversationManager() { @@ -320,71 +302,63 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { return conversationManager; } - /** - * Create the flow execution factory to be used by the executor produced by this - * factory bean. Configure the execution factory appropriately. Subclasses may - * override if they which to use a custom execution factory, e.g. to use a custom - * FlowExecution implementation. - * @param executionAttributes execution attributes to apply to created executions - * @param executionListenerLoader decides which listeners to apply to created executions - * @return a new flow execution factory instance - */ - protected FlowExecutionFactory createFlowExecutionFactory( - AttributeMap executionAttributes, FlowExecutionListenerLoader executionListenerLoader) { - FlowExecutionImplFactory executionFactory = new FlowExecutionImplFactory(); - executionFactory.setExecutionAttributes(executionAttributes); - if (executionListenerLoader != null) { - executionFactory.setExecutionListenerLoader(executionListenerLoader); - } - return executionFactory; - } - - /** - * Create the flow execution state restorer to be used by the executor produced by - * this factory bean. Configure the state restorer appropriately. Subclasses may - * override if they which to use a custom state restorer implementation. - * @param definitionLocator the definition locator to use - * @param executionAttributes execution attributes to apply to restored executions - * @param executionListenerLoader decides which listeners should apply to restored - * flow executions - * @return a new state restorer instance - */ - protected FlowExecutionStateRestorer createFlowExecutionStateRestorer( - FlowDefinitionLocator definitionLocator, AttributeMap executionAttributes, - FlowExecutionListenerLoader executionListenerLoader) { - FlowExecutionImplStateRestorer executionStateRestorer = new FlowExecutionImplStateRestorer(definitionLocator); - executionStateRestorer.setExecutionAttributes(executionAttributes); - if (executionListenerLoader != null) { - executionStateRestorer.setExecutionListenerLoader(executionListenerLoader); - } - return executionStateRestorer; - } + /** + * Create the flow execution factory to be used by the executor produced by this factory bean. Configure the + * execution factory appropriately. Subclasses may override if they which to use a custom execution factory, e.g. to + * use a custom FlowExecution implementation. + * @param executionAttributes execution attributes to apply to created executions + * @param executionListenerLoader decides which listeners to apply to created executions + * @return a new flow execution factory instance + */ + protected FlowExecutionFactory createFlowExecutionFactory(AttributeMap executionAttributes, + FlowExecutionListenerLoader executionListenerLoader) { + FlowExecutionImplFactory executionFactory = new FlowExecutionImplFactory(); + executionFactory.setExecutionAttributes(executionAttributes); + if (executionListenerLoader != null) { + executionFactory.setExecutionListenerLoader(executionListenerLoader); + } + return executionFactory; + } /** - * Factory method for creating the flow execution repository for saving and - * loading executing flows. Subclasses may override to customize the - * repository implementation used. - * @param repositoryType a hint indicating what type of repository to create - * @param executionStateRestorer the execution state restorer strategy to be used by - * the repository - * @param conversationManager the conversation manager specified by the user, - * could be null in which case the default conversation manager should be used + * Create the flow execution state restorer to be used by the executor produced by this factory bean. Configure the + * state restorer appropriately. Subclasses may override if they which to use a custom state restorer + * implementation. + * @param definitionLocator the definition locator to use + * @param executionAttributes execution attributes to apply to restored executions + * @param executionListenerLoader decides which listeners should apply to restored flow executions + * @return a new state restorer instance + */ + protected FlowExecutionStateRestorer createFlowExecutionStateRestorer(FlowDefinitionLocator definitionLocator, + AttributeMap executionAttributes, FlowExecutionListenerLoader executionListenerLoader) { + FlowExecutionImplStateRestorer executionStateRestorer = new FlowExecutionImplStateRestorer(definitionLocator); + executionStateRestorer.setExecutionAttributes(executionAttributes); + if (executionListenerLoader != null) { + executionStateRestorer.setExecutionListenerLoader(executionListenerLoader); + } + return executionStateRestorer; + } + + /** + * Factory method for creating the flow execution repository for saving and loading executing flows. Subclasses may + * override to customize the repository implementation used. + * @param repositoryType a hint indicating what type of repository to create + * @param executionStateRestorer the execution state restorer strategy to be used by the repository + * @param conversationManager the conversation manager specified by the user, could be null in which case the + * default conversation manager should be used * @return a new flow execution repository instance */ - protected FlowExecutionRepository createExecutionRepository( - RepositoryType repositoryType, FlowExecutionStateRestorer executionStateRestorer, - ConversationManager conversationManager) { + protected FlowExecutionRepository createExecutionRepository(RepositoryType repositoryType, + FlowExecutionStateRestorer executionStateRestorer, ConversationManager conversationManager) { if (repositoryType == RepositoryType.CLIENT) { if (conversationManager == null) { // use the default no-op conversation manager return new ClientContinuationFlowExecutionRepository(executionStateRestorer); - } - else { + } else { // use the conversation manager specified by the user return new ClientContinuationFlowExecutionRepository(executionStateRestorer, conversationManager); } - } - else { + } else { // determine the conversation manager to use ConversationManager conversationManagerToUse = conversationManager; if (conversationManagerToUse == null) { @@ -393,47 +367,41 @@ public class FlowExecutorFactoryBean implements FactoryBean, InitializingBean { if (repositoryType == RepositoryType.SIMPLE) { return new SimpleFlowExecutionRepository(executionStateRestorer, conversationManagerToUse); - } - else if (repositoryType == RepositoryType.CONTINUATION) { - ContinuationFlowExecutionRepository repository = - new ContinuationFlowExecutionRepository(executionStateRestorer, conversationManagerToUse); + } else if (repositoryType == RepositoryType.CONTINUATION) { + ContinuationFlowExecutionRepository repository = new ContinuationFlowExecutionRepository( + executionStateRestorer, conversationManagerToUse); if (getMaxContinuations() != null) { repository.setMaxContinuations(getMaxContinuations().intValue()); } return repository; - } - else if (repositoryType == RepositoryType.SINGLEKEY) { - SimpleFlowExecutionRepository repository = new SimpleFlowExecutionRepository( - executionStateRestorer, conversationManagerToUse); + } else if (repositoryType == RepositoryType.SINGLEKEY) { + SimpleFlowExecutionRepository repository = new SimpleFlowExecutionRepository(executionStateRestorer, + conversationManagerToUse); repository.setAlwaysGenerateNewNextKey(false); return repository; - } - else { + } else { throw new IllegalStateException("Cannot create execution repository - unsupported repository type " + repositoryType); } } } - /** - * Create the flow executor instance created by this factory bean and configure - * it appropriately. Subclasses may override if they which to use a custom executor - * implementation. - * @param definitionLocator the definition locator to use - * @param executionFactory the execution factory to use - * @param executionRepository the execution repository to use - * @return a new flow executor instance - */ - protected FlowExecutor createFlowExecutor( - FlowDefinitionLocator definitionLocator, FlowExecutionFactory executionFactory, - FlowExecutionRepository executionRepository) { - FlowExecutorImpl flowExecutor = - new FlowExecutorImpl(definitionLocator, executionFactory, executionRepository); - if (getInputMapper() != null) { - flowExecutor.setInputMapper(inputMapper); - } - return flowExecutor; - } + /** + * Create the flow executor instance created by this factory bean and configure it appropriately. Subclasses may + * override if they which to use a custom executor implementation. + * @param definitionLocator the definition locator to use + * @param executionFactory the execution factory to use + * @param executionRepository the execution repository to use + * @return a new flow executor instance + */ + protected FlowExecutor createFlowExecutor(FlowDefinitionLocator definitionLocator, + FlowExecutionFactory executionFactory, FlowExecutionRepository executionRepository) { + FlowExecutorImpl flowExecutor = new FlowExecutorImpl(definitionLocator, executionFactory, executionRepository); + if (getInputMapper() != null) { + flowExecutor.setInputMapper(inputMapper); + } + return flowExecutor; + } // implementing FactoryBean diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowSystemDefaults.java b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowSystemDefaults.java index 79b4723e..cdea8900 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/FlowSystemDefaults.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/FlowSystemDefaults.java @@ -23,9 +23,8 @@ import org.springframework.webflow.core.collection.MutableAttributeMap; import org.springframework.webflow.engine.support.ApplicationViewSelector; /** - * Encapsulates overall flow system configuration defaults. Allows for - * centralized application of, and if necessary, overridding of system-wide - * default values. + * Encapsulates overall flow system configuration defaults. Allows for centralized application of, and if necessary, + * overridding of system-wide default values. * * @author Keith Donald */ @@ -42,8 +41,7 @@ public class FlowSystemDefaults implements Serializable { private RepositoryType repositoryType = RepositoryType.CONTINUATION; /** - * Overrides the alwaysRedirectOnPause execution attribute default. Defaults - * to "true". + * Overrides the alwaysRedirectOnPause execution attribute default. Defaults to "true". * @param alwaysRedirectOnPause the new default value * @see ApplicationViewSelector#ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE */ @@ -60,9 +58,8 @@ public class FlowSystemDefaults implements Serializable { } /** - * Applies default execution attributes if necessary. Defaults will only - * apply in the case where the user did not configure a value, or explicitly - * requested the 'default' value. + * Applies default execution attributes if necessary. Defaults will only apply in the case where the user did not + * configure a value, or explicitly requested the 'default' value. * @param executionAttributes the user-configured execution attribute map * @return the map with defaults applied as appropriate */ @@ -71,23 +68,21 @@ public class FlowSystemDefaults implements Serializable { executionAttributes = new LocalAttributeMap(1, 1); } if (!executionAttributes.contains(ApplicationViewSelector.ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE)) { - executionAttributes.put(ApplicationViewSelector.ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE, - new Boolean(alwaysRedirectOnPause)); + executionAttributes.put(ApplicationViewSelector.ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE, new Boolean( + alwaysRedirectOnPause)); } return executionAttributes; } /** * Applies the default repository type if requested by the user. - * @param selectedType the selected repository type (may be null if no - * selection was made) + * @param selectedType the selected repository type (may be null if no selection was made) * @return the repository type, with the default applied if necessary */ public RepositoryType applyIfNecessary(RepositoryType selectedType) { if (selectedType == null) { return repositoryType; - } - else { + } else { return selectedType; } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/RegistryBeanDefinitionParser.java b/spring-webflow/src/main/java/org/springframework/webflow/config/RegistryBeanDefinitionParser.java index db986d68..2437efc6 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/RegistryBeanDefinitionParser.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/RegistryBeanDefinitionParser.java @@ -33,7 +33,7 @@ import org.w3c.dom.Element; * @author Ben Hale */ class RegistryBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { - + // elements and attributes private static final String LOCATION_ELEMENT = "location"; @@ -60,7 +60,7 @@ class RegistryBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { private List getLocations(List locationElements) { List locations = new ArrayList(locationElements.size()); for (Iterator i = locationElements.iterator(); i.hasNext();) { - Element locationElement = (Element)i.next(); + Element locationElement = (Element) i.next(); String path = locationElement.getAttribute(PATH_ATTRIBUTE); if (StringUtils.hasText(path)) { locations.add(path); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/RepositoryType.java b/spring-webflow/src/main/java/org/springframework/webflow/config/RepositoryType.java index d3cfb191..7d86ce4d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/RepositoryType.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/RepositoryType.java @@ -53,7 +53,7 @@ public class RepositoryType extends StaticLabeledEnum { * @see SimpleFlowExecutionRepository#setAlwaysGenerateNewNextKey(boolean) */ public static final RepositoryType SINGLEKEY = new RepositoryType(3, "Single Key"); - + /** * Private constructor because this is a typesafe enum! */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandler.java index bf184761..83dc1609 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandler.java @@ -21,17 +21,13 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport; /** * NamespaceHandler for the webflow-config namespace. *

    - * Provides {@link BeanDefinitionParser bean definition parsers} for the - * <executor> and <registry> tags. An - * executor tag can include an execution-listeners - * tag and a registry tag can include location - * tags. + * Provides {@link BeanDefinitionParser bean definition parsers} for the <executor> and + * <registry> tags. An executor tag can include an execution-listeners + * tag and a registry tag can include location tags. *

    - * Using the executor tag you can configure a - * {@link FlowExecutorFactoryBean} that creates a - * {@link org.springframework.webflow.executor.FlowExecutor}. The - * executor tag allows you to specify the repository type and a - * reference to a registry. + * Using the executor tag you can configure a {@link FlowExecutorFactoryBean} that creates a + * {@link org.springframework.webflow.executor.FlowExecutor}. The executor tag allows you to specify the + * repository type and a reference to a registry. * *

      *       <flow:executor id="registry" registry-ref="registry" repository-type="continuation" >
    @@ -45,9 +41,8 @@ import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
      * 
      * 

    * Using the registry tag you can configure an - * {@link org.springframework.webflow.engine.builder.xml.XmlFlowRegistryFactoryBean} - * to create a registry for use by any number of executors. The - * registry tag supports in-line flow definition locations. + * {@link org.springframework.webflow.engine.builder.xml.XmlFlowRegistryFactoryBean} to create a registry for use by any + * number of executors. The registry tag supports in-line flow definition locations. * *

      *       <flow:registry id="registry">
    diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContext.java b/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContext.java
    index cf77f507..2131385d 100644
    --- a/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContext.java
    +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContext.java
    @@ -20,18 +20,15 @@ import org.springframework.webflow.core.collection.ParameterMap;
     import org.springframework.webflow.core.collection.SharedAttributeMap;
     
     /**
    - * A facade that provides normalized access to an external system that has
    - * interacted with Spring Web Flow.
    + * A facade that provides normalized access to an external system that has interacted with Spring Web Flow.
      * 

    - * This context object provides a normalized interface for internal web flow - * artifacts to use to reason on and manipulate the state of an external actor - * calling into SWF to execute flows. It represents the context about a single, - * external client request to manipulate a flow execution. + * This context object provides a normalized interface for internal web flow artifacts to use to reason on and + * manipulate the state of an external actor calling into SWF to execute flows. It represents the context about a + * single, external client request to manipulate a flow execution. *

    - * The design of this interface was inspired by JSF's own ExternalContext - * abstraction and shares the same name for consistency. If a particular - * external client type does not support all methods defined by this interface, - * they can just be implemented as returning an empty map or null. + * The design of this interface was inspired by JSF's own ExternalContext abstraction and shares the same name for + * consistency. If a particular external client type does not support all methods defined by this interface, they can + * just be implemented as returning an empty map or null. * * @author Keith Donald * @author Erwin Vervaet @@ -45,8 +42,7 @@ public interface ExternalContext { public String getContextPath(); /** - * Returns the path (or identifier) of the dispatcher within the - * application that dispatched this request. + * Returns the path (or identifier) of the dispatcher within the application that dispatched this request. * @return the dispatcher path (e.g. "/dispatcher") */ public String getDispatcherPath(); @@ -58,46 +54,40 @@ public interface ExternalContext { public String getRequestPathInfo(); /** - * Provides access to the parameters associated with the user request that - * led to SWF being called. This map is expected to be immutable and cannot - * be changed. + * Provides access to the parameters associated with the user request that led to SWF being called. This map is + * expected to be immutable and cannot be changed. * @return the immutable request parameter map */ public ParameterMap getRequestParameterMap(); /** - * Provides access to the external request attribute map, providing a - * storage for data local to the current user request and accessible to both - * internal and external SWF artifacts. + * Provides access to the external request attribute map, providing a storage for data local to the current user + * request and accessible to both internal and external SWF artifacts. * @return the mutable request attribute map */ public MutableAttributeMap getRequestMap(); /** - * Provides access to the external session map, providing a storage for data - * local to the current user session and accessible to both internal and - * external SWF artifacts. + * Provides access to the external session map, providing a storage for data local to the current user session and + * accessible to both internal and external SWF artifacts. * @return the mutable session attribute map */ public SharedAttributeMap getSessionMap(); /** - * Provides access to the global external session map, providing a storage for data - * globally accross the user session and accessible to both internal and - * external SWF artifacts. + * Provides access to the global external session map, providing a storage for data globally accross the + * user session and accessible to both internal and external SWF artifacts. *

    - * Note: most external context implementations do not distinguish between the concept of a - * "local" user session scope and a "global" session scope. The Portlet world does, but - * not the Servlet for example. In those cases calling this method returns the same - * map as calling {@link #getSessionMap()}. + * Note: most external context implementations do not distinguish between the concept of a "local" user session + * scope and a "global" session scope. The Portlet world does, but not the Servlet for example. In those cases + * calling this method returns the same map as calling {@link #getSessionMap()}. * @return the mutable global session attribute map */ public SharedAttributeMap getGlobalSessionMap(); - + /** - * Provides access to the external application map, providing a storage for - * data local to the current user application and accessible to both - * internal and external SWF artifacts. + * Provides access to the external application map, providing a storage for data local to the current user + * application and accessible to both internal and external SWF artifacts. * @return the mutable application attribute map */ public SharedAttributeMap getApplicationMap(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContextHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContextHolder.java index 51af9f55..a7136ead 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContextHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/ExternalContextHolder.java @@ -18,16 +18,14 @@ package org.springframework.webflow.context; import org.springframework.util.Assert; /** - * Simple holder class that associates an {@link ExternalContext} instance with - * the current thread. The ExternalContext will not be inherited by any child - * threads spawned by the current thread. + * Simple holder class that associates an {@link ExternalContext} instance with the current thread. The ExternalContext + * will not be inherited by any child threads spawned by the current thread. *

    - * Used as a central holder for the current ExternalContext in Spring Web Flow, - * wherever necessary. Often used by artifacts needing access to the current - * application session. - * + * Used as a central holder for the current ExternalContext in Spring Web Flow, wherever necessary. Often used by + * artifacts needing access to the current application session. + * * @see ExternalContext - * + * * @author Keith Donald */ public final class ExternalContextHolder { @@ -36,8 +34,7 @@ public final class ExternalContextHolder { /** * Associate the given ExternalContext with the current thread. - * @param externalContext the current ExternalContext, or null - * to reset the thread-bound context + * @param externalContext the current ExternalContext, or null to reset the thread-bound context */ public static void setExternalContext(ExternalContext externalContext) { externalContextHolder.set(externalContext); @@ -46,11 +43,11 @@ public final class ExternalContextHolder { /** * Return the ExternalContext associated with the current thread, if any. * @return the current ExternalContext - * @throws IllegalStateException if no ExternalContext is bound to this thread + * @throws IllegalStateException if no ExternalContext is bound to this thread */ public static ExternalContext getExternalContext() { Assert.state(externalContextHolder.get() != null, "No external context is bound to this thread"); - return (ExternalContext)externalContextHolder.get(); + return (ExternalContext) externalContextHolder.get(); } // not instantiable diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletContextMap.java b/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletContextMap.java index 0c393afb..07ec43ab 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletContextMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletContextMap.java @@ -24,8 +24,7 @@ import org.springframework.binding.collection.StringKeyedMapAdapter; import org.springframework.webflow.core.collection.CollectionUtils; /** - * A shared map backed by the Portlet context for accessing application scoped - * attributes. + * A shared map backed by the Portlet context for accessing application scoped attributes. * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletExternalContext.java b/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletExternalContext.java index fc6a689f..706730f5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletExternalContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletExternalContext.java @@ -32,8 +32,7 @@ import org.springframework.webflow.core.collection.ParameterMap; import org.springframework.webflow.core.collection.SharedAttributeMap; /** - * Provides contextual information about a JSR-168 Portlet environment that has - * called into Spring Web Flow. + * Provides contextual information about a JSR-168 Portlet environment that has called into Spring Web Flow. * * @author Keith Donald */ @@ -53,7 +52,7 @@ public class PortletExternalContext implements ExternalContext { * The response. */ private PortletResponse response; - + /** * An accessor for the portlet request parameter map. */ @@ -78,7 +77,7 @@ public class PortletExternalContext implements ExternalContext { * An accessor for the portlet context application map. */ private SharedAttributeMap applicationMap; - + /** * An accessor for the portlet user info map. */ @@ -97,9 +96,10 @@ public class PortletExternalContext implements ExternalContext { this.requestParameterMap = new LocalParameterMap(new PortletRequestParameterMap(request)); this.requestMap = new LocalAttributeMap(new PortletRequestMap(request)); this.sessionMap = new LocalSharedAttributeMap(new PortletSessionMap(request, PortletSession.PORTLET_SCOPE)); - this.globalSessionMap = new LocalSharedAttributeMap(new PortletSessionMap(request, PortletSession.APPLICATION_SCOPE)); + this.globalSessionMap = new LocalSharedAttributeMap(new PortletSessionMap(request, + PortletSession.APPLICATION_SCOPE)); this.applicationMap = new LocalSharedAttributeMap(new PortletContextMap(context)); - Map userInfo = (Map)request.getAttribute(PortletRequest.USER_INFO); + Map userInfo = (Map) request.getAttribute(PortletRequest.USER_INFO); this.userInfoMap = userInfo != null ? new LocalAttributeMap(userInfo) : null; } @@ -124,7 +124,7 @@ public class PortletExternalContext implements ExternalContext { public MutableAttributeMap getRequestMap() { return requestMap; } - + public SharedAttributeMap getSessionMap() { return sessionMap; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletRequestParameterMap.java b/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletRequestParameterMap.java index 33f14463..f93a7e15 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletRequestParameterMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletRequestParameterMap.java @@ -25,8 +25,7 @@ import org.springframework.web.portlet.multipart.MultipartActionRequest; import org.springframework.webflow.core.collection.CollectionUtils; /** - * Map backed by the Portlet request parameter map for accessing request local - * portlet parameters. + * Map backed by the Portlet request parameter map for accessing request local portlet parameters. * * @author Keith Donald */ @@ -46,7 +45,7 @@ public class PortletRequestParameterMap extends StringKeyedMapAdapter { protected Object getAttribute(String key) { if (request instanceof MultipartActionRequest) { - MultipartActionRequest multipartRequest = (MultipartActionRequest)request; + MultipartActionRequest multipartRequest = (MultipartActionRequest) request; Object data = multipartRequest.getFileMap().get(key); if (data != null) { return data; @@ -72,13 +71,12 @@ public class PortletRequestParameterMap extends StringKeyedMapAdapter { protected Iterator getAttributeNames() { if (request instanceof MultipartActionRequest) { - MultipartActionRequest multipartRequest = (MultipartActionRequest)request; + MultipartActionRequest multipartRequest = (MultipartActionRequest) request; CompositeIterator iterator = new CompositeIterator(); iterator.add(multipartRequest.getFileMap().keySet().iterator()); iterator.add(CollectionUtils.toIterator(request.getParameterNames())); return iterator; - } - else { + } else { return CollectionUtils.toIterator(request.getParameterNames()); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletSessionMap.java b/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletSessionMap.java index 1f136d36..83b2a953 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletSessionMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/portlet/PortletSessionMap.java @@ -28,8 +28,7 @@ import org.springframework.webflow.core.collection.AttributeMapBindingListener; import org.springframework.webflow.core.collection.CollectionUtils; /** - * Shared map backed by the Portlet session for accessing session scoped - * attributes in a Portlet environment. + * Shared map backed by the Portlet session for accessing session scoped attributes in a Portlet environment. * * @author Keith Donald */ @@ -41,16 +40,14 @@ public class PortletSessionMap extends StringKeyedMapAdapter implements SharedMa private PortletRequest request; /** - * The scope to access in the session, either APPLICATION (global) or - * PORTLET. + * The scope to access in the session, either APPLICATION (global) or PORTLET. */ private int scope; /** * Create a new map wrapping the session associated with given request. * @param request the current portlet request - * @param scope the scope to access in the session, either - * {@link PortletSession#APPLICATION_SCOPE} (global) or + * @param scope the scope to access in the session, either {@link PortletSession#APPLICATION_SCOPE} (global) or * {@link PortletSession#PORTLET_SCOPE} */ public PortletSessionMap(PortletRequest request, int scope) { @@ -59,8 +56,7 @@ public class PortletSessionMap extends StringKeyedMapAdapter implements SharedMa } /** - * Return the portlet session associated with the wrapped request, or null - * if no such session exits. + * Return the portlet session associated with the wrapped request, or null if no such session exits. */ private PortletSession getSession() { return request.getPortletSession(false); @@ -74,7 +70,7 @@ public class PortletSessionMap extends StringKeyedMapAdapter implements SharedMa Object value = session.getAttribute(key, scope); if (value instanceof HttpSessionMapBindingListener) { // unwrap - return ((HttpSessionMapBindingListener)value).getListener(); + return ((HttpSessionMapBindingListener) value).getListener(); } else { return value; } @@ -84,9 +80,9 @@ public class PortletSessionMap extends StringKeyedMapAdapter implements SharedMa PortletSession session = request.getPortletSession(true); if (value instanceof AttributeMapBindingListener) { // wrap - session.setAttribute(key, new HttpSessionMapBindingListener((AttributeMapBindingListener)value, this), scope); - } - else { + session.setAttribute(key, new HttpSessionMapBindingListener((AttributeMapBindingListener) value, this), + scope); + } else { session.setAttribute(key, value, scope); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletContextMap.java b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletContextMap.java index 04d3d606..2d19be98 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletContextMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletContextMap.java @@ -24,8 +24,7 @@ import org.springframework.binding.collection.StringKeyedMapAdapter; import org.springframework.webflow.core.collection.CollectionUtils; /** - * Map backed by the Servlet context for accessing application scoped - * attributes. + * Map backed by the Servlet context for accessing application scoped attributes. * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletRequestMap.java b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletRequestMap.java index 6ff03753..51c5d0af 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletRequestMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletRequestMap.java @@ -23,8 +23,7 @@ import org.springframework.binding.collection.StringKeyedMapAdapter; import org.springframework.webflow.core.collection.CollectionUtils; /** - * Map backed by the Servlet HTTP request attribute map for accessing request - * local attributes. + * Map backed by the Servlet HTTP request attribute map for accessing request local attributes. * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletRequestParameterMap.java b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletRequestParameterMap.java index a7aec844..574c3e41 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletRequestParameterMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpServletRequestParameterMap.java @@ -25,9 +25,8 @@ import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.webflow.core.collection.CollectionUtils; /** - * Map backed by the Servlet HTTP request parameter map for accessing request - * parameters. Also provides support for multi-part requests, providing - * transparent access to the request "fileMap" as a request parameter entry. + * Map backed by the Servlet HTTP request parameter map for accessing request parameters. Also provides support for + * multi-part requests, providing transparent access to the request "fileMap" as a request parameter entry. * * @author Keith Donald */ @@ -47,7 +46,7 @@ public class HttpServletRequestParameterMap extends StringKeyedMapAdapter { protected Object getAttribute(String key) { if (request instanceof MultipartHttpServletRequest) { - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request; + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; Object data = multipartRequest.getFileMap().get(key); if (data != null) { return data; @@ -73,13 +72,12 @@ public class HttpServletRequestParameterMap extends StringKeyedMapAdapter { protected Iterator getAttributeNames() { if (request instanceof MultipartHttpServletRequest) { - MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request; + MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; CompositeIterator iterator = new CompositeIterator(); iterator.add(multipartRequest.getFileMap().keySet().iterator()); iterator.add(CollectionUtils.toIterator(request.getParameterNames())); return iterator; - } - else { + } else { return CollectionUtils.toIterator(request.getParameterNames()); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpSessionMap.java b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpSessionMap.java index 7da88051..0a61bc4f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpSessionMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpSessionMap.java @@ -27,8 +27,7 @@ import org.springframework.webflow.core.collection.AttributeMapBindingListener; import org.springframework.webflow.core.collection.CollectionUtils; /** - * A Shared Map backed by the Servlet HTTP session, for accessing session scoped - * attributes. + * A Shared Map backed by the Servlet HTTP session, for accessing session scoped attributes. * * @author Keith Donald */ @@ -47,8 +46,7 @@ public class HttpSessionMap extends StringKeyedMapAdapter implements SharedMap { } /** - * Internal helper to get the HTTP session associated with the wrapped - * request, or null if there is no such session. + * Internal helper to get the HTTP session associated with the wrapped request, or null if there is no such session. *

    * Note that this method will not force session creation. */ @@ -64,7 +62,7 @@ public class HttpSessionMap extends StringKeyedMapAdapter implements SharedMap { Object value = session.getAttribute(key); if (value instanceof HttpSessionMapBindingListener) { // unwrap - return ((HttpSessionMapBindingListener)value).getListener(); + return ((HttpSessionMapBindingListener) value).getListener(); } else { return value; } @@ -75,10 +73,8 @@ public class HttpSessionMap extends StringKeyedMapAdapter implements SharedMap { HttpSession session = request.getSession(true); if (value instanceof AttributeMapBindingListener) { // wrap - session.setAttribute(key, - new HttpSessionMapBindingListener((AttributeMapBindingListener)value, this)); - } - else { + session.setAttribute(key, new HttpSessionMapBindingListener((AttributeMapBindingListener) value, this)); + } else { session.setAttribute(key, value); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpSessionMapBindingListener.java b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpSessionMapBindingListener.java index cc728466..a873915b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpSessionMapBindingListener.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/context/servlet/HttpSessionMapBindingListener.java @@ -25,9 +25,8 @@ import org.springframework.webflow.core.collection.AttributeMapBindingListener; import org.springframework.webflow.core.collection.LocalAttributeMap; /** - * Helper class that adapts a generic {@link AttributeMapBindingListener} to a - * HTTP specific {@link HttpSessionBindingListener}. Calls will be forwarded to - * the wrapped listener. + * Helper class that adapts a generic {@link AttributeMapBindingListener} to a HTTP specific + * {@link HttpSessionBindingListener}. Calls will be forwarded to the wrapped listener. * * @author Keith Donald */ @@ -70,8 +69,7 @@ public class HttpSessionMapBindingListener implements HttpSessionBindingListener } /** - * Create a attribute map binding event for given HTTP session binding - * event. + * Create a attribute map binding event for given HTTP session binding event. */ private AttributeMapBindingEvent getContextBindingEvent(HttpSessionBindingEvent event) { return new AttributeMapBindingEvent(new LocalAttributeMap(sessionMap), event.getName(), listener); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/Conversation.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/Conversation.java index 20c1de28..5a795cfe 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/Conversation.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/Conversation.java @@ -16,18 +16,15 @@ package org.springframework.webflow.conversation; /** - * A service interface for working with state associated with a single logical - * user interaction called a "conversation" in the scope of a single request. - * Conversation objects are not thread safe and should not be shared among - * multiple threads. + * A service interface for working with state associated with a single logical user interaction called a "conversation" + * in the scope of a single request. Conversation objects are not thread safe and should not be shared among multiple + * threads. *

    - * A conversation provides a "task" context that is begun and eventually ends. - * Between the beginning and the end attributes can be placed in and read from a - * conversation's context. + * A conversation provides a "task" context that is begun and eventually ends. Between the beginning and the end + * attributes can be placed in and read from a conversation's context. *

    - * A conversation needs to be {@link #lock() locked} to obtain exclusive - * access to it before it can be manipulated. Once manipulation is finished, you need to - * {@link #unlock() unlock} the conversation. So code interacting with a + * A conversation needs to be {@link #lock() locked} to obtain exclusive access to it before it can be manipulated. Once + * manipulation is finished, you need to {@link #unlock() unlock} the conversation. So code interacting with a * conversation always looks like this: * *

    @@ -43,10 +40,8 @@ package org.springframework.webflow.conversation;
      * 
    * *

    - * Note that the attributes associated with a conversation are not - * "conversation scope" as defined for a flow execution. They can be - * any attributes, possibly technical in nature, associated with the - * conversation. + * Note that the attributes associated with a conversation are not "conversation scope" as defined for a flow execution. + * They can be any attributes, possibly technical in nature, associated with the conversation. * * @author Keith Donald * @author Erwin Vervaet @@ -54,52 +49,47 @@ package org.springframework.webflow.conversation; public interface Conversation { /** - * Returns the unique id assigned to this conversation. This id remains the - * same throughout the life of the conversation. This method can be safely - * called without owning the lock of this conversation. + * Returns the unique id assigned to this conversation. This id remains the same throughout the life of the + * conversation. This method can be safely called without owning the lock of this conversation. * @return the conversation id */ public ConversationId getId(); /** - * Lock this conversation. May block until the lock is available, if someone - * else has acquired the lock. + * Lock this conversation. May block until the lock is available, if someone else has acquired the lock. */ public void lock(); /** - * Returns the conversation attribute with the specified name. - * You need to aquire the lock on this conversation before calling this method. + * Returns the conversation attribute with the specified name. You need to aquire the lock on this conversation + * before calling this method. * @param name the attribute name * @return the attribute value */ public Object getAttribute(Object name); /** - * Puts a conversation attribute into this context. - * You need to aquire the lock on this conversation before calling this method. + * Puts a conversation attribute into this context. You need to aquire the lock on this conversation before calling + * this method. * @param name the attribute name * @param value the attribute value */ public void putAttribute(Object name, Object value); /** - * Removes a conversation attribute. - * You need to aquire the lock on this conversation before calling this method. + * Removes a conversation attribute. You need to aquire the lock on this conversation before calling this method. * @param name the attribute name */ public void removeAttribute(Object name); /** - * Ends this conversation. This method should only be called once to - * terminate the conversation and cleanup any allocated resources. - * You need to aquire the lock on this conversation before calling this method. + * Ends this conversation. This method should only be called once to terminate the conversation and cleanup any + * allocated resources. You need to aquire the lock on this conversation before calling this method. */ public void end(); /** - * Unlock this conversation, making it available to others for - * manipulation. + * Unlock this conversation, making it available to others for manipulation. */ public void unlock(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationId.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationId.java index 028d1179..67845e19 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationId.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationId.java @@ -18,8 +18,7 @@ package org.springframework.webflow.conversation; import java.io.Serializable; /** - * An id that uniquely identifies a conversation managed by a - * {@link ConversationManager}. + * An id that uniquely identifies a conversation managed by a {@link ConversationManager}. * * @author Ben Hale * @author Keith Donald @@ -27,8 +26,7 @@ import java.io.Serializable; public abstract class ConversationId implements Serializable { /** - * Subclasses should override toString to return a parseable string form of - * the key. + * Subclasses should override toString to return a parseable string form of the key. * @see java.lang.Object#toString() * @see ConversationManager#parseConversationId(String) */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationManager.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationManager.java index cfbe28c4..0b7deb2d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationManager.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationManager.java @@ -16,8 +16,7 @@ package org.springframework.webflow.conversation; /** - * A service for managing conversations. This interface is the entry point into - * the conversation subsystem. + * A service for managing conversations. This interface is the entry point into the conversation subsystem. * * @author Keith Donald * @author Erwin Vervaet @@ -35,12 +34,11 @@ public interface ConversationManager { /** * Get the conversation with the provided id. *

    - * Implementors should take care to manage conversation identity correctly. - * Although it is not strictly required to return the same (==) Conversation - * object every time this method is called with a particular conversation - * id in a single execution thread, callers will expect to recieve an object - * that allows them to manipulate the identified conversation. In other words, - * the following is legal ConversationManager client code: + * Implementors should take care to manage conversation identity correctly. Although it is not strictly required to + * return the same (==) Conversation object every time this method is called with a particular conversation id in a + * single execution thread, callers will expect to recieve an object that allows them to manipulate the identified + * conversation. In other words, the following is legal ConversationManager client code: + * *

     	 * 	ConversationManager manager = ...;
     	 * 	ConversationId id = ...;
    @@ -50,13 +48,14 @@ public interface ConversationManager {
     	 *  	Conversation localReference = manager.getConversation(id);
     	 *  	// no need to lock since conversation 'id' is already locked
     	 *  	// even though possibly conv != localReference
    -	 *  	localReference.putAttribute("foo", "bar");
    -	 *  	Object foo = conv.getAttribute("foo");
    +	 *  	localReference.putAttribute("foo", "bar");
    +	 *  	Object foo = conv.getAttribute("foo");
     	 * 	}
     	 * 	finally {
     	 * 		conv.unlock();
     	 * 	}
     	 * 
    + * * @param id the conversation id * @return the conversation * @throws NoSuchConversationException the id provided was invalid @@ -64,8 +63,8 @@ public interface ConversationManager { public Conversation getConversation(ConversationId id) throws ConversationException; /** - * Parse the string-encoded conversationId into its object form. - * Essentially, the reverse of {@link ConversationId#toString()}. + * Parse the string-encoded conversationId into its object form. Essentially, the reverse of + * {@link ConversationId#toString()}. * @param encodedId the encoded id * @return the parsed conversation id * @throws ConversationException an exception occured parsing the id diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationParameters.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationParameters.java index b5c77f3a..189dc9bd 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationParameters.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/ConversationParameters.java @@ -20,8 +20,7 @@ import java.io.Serializable; import org.springframework.core.style.ToStringCreator; /** - * Simple parameter object for clumping together input needed to begin a new - * conversation. + * Simple parameter object for clumping together input needed to begin a new conversation. * * @author Keith Donald */ @@ -77,7 +76,7 @@ public class ConversationParameters implements Serializable { public String getDescription() { return description; } - + public String toString() { return new ToStringCreator(this).append("name", name).toString(); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/NoSuchConversationException.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/NoSuchConversationException.java index 7fd96a61..0698d314 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/NoSuchConversationException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/NoSuchConversationException.java @@ -16,9 +16,8 @@ package org.springframework.webflow.conversation; /** - * Thrown when no logical conversation exists with the specified - * conversationId. This might occur if the conversation ended, - * expired, or was otherwise invalidated, but a client view still references it. + * Thrown when no logical conversation exists with the specified conversationId. This might occur if the + * conversation ended, expired, or was otherwise invalidated, but a client view still references it. * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ContainedConversation.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ContainedConversation.java index a071d0e4..e1d31ee1 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ContainedConversation.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ContainedConversation.java @@ -30,8 +30,7 @@ import org.springframework.webflow.conversation.ConversationId; import org.springframework.webflow.core.collection.SharedAttributeMap; /** - * Internal {@link Conversation} implementation used by the conversation - * container. + * Internal {@link Conversation} implementation used by the conversation container. *

    * This is an internal helper class of the {@link SessionBindingConversationManager}. * @@ -68,7 +67,7 @@ class ContainedConversation implements Conversation, Serializable { public void lock() { if (logger.isDebugEnabled()) { logger.debug("Locking conversation " + id); - } + } lock.lock(); } @@ -79,21 +78,21 @@ class ContainedConversation implements Conversation, Serializable { public void putAttribute(Object name, Object value) { if (logger.isDebugEnabled()) { logger.debug("Putting conversation attribute '" + name + "' with value " + value); - } + } attributes.put(name, value); } public void removeAttribute(Object name) { if (logger.isDebugEnabled()) { logger.debug("Removing conversation attribute '" + name + "'"); - } + } attributes.remove(name); } public void end() { if (logger.isDebugEnabled()) { logger.debug("Ending conversation " + id); - } + } container.removeConversation(getId()); } @@ -102,7 +101,7 @@ class ContainedConversation implements Conversation, Serializable { logger.debug("Unlocking conversation " + id); } lock.unlock(); - + // re-bind the conversation container in the session // this is required to make session replication work correctly in // a clustered environment @@ -124,7 +123,7 @@ class ContainedConversation implements Conversation, Serializable { if (!(obj instanceof ContainedConversation)) { return false; } - return id.equals(((ContainedConversation)obj).id); + return id.equals(((ContainedConversation) obj).id); } public int hashCode() { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationContainer.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationContainer.java index 85a586a0..f69ccbea 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationContainer.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationContainer.java @@ -26,22 +26,20 @@ import org.springframework.webflow.conversation.ConversationParameters; import org.springframework.webflow.conversation.NoSuchConversationException; /** - * Container for conversations that is stored in the session. When the - * session expires this container will go with it, implicitly expiring all - * contained conversations. + * Container for conversations that is stored in the session. When the session expires this container will go with it, + * implicitly expiring all contained conversations. *

    * This is an internal helper class of the {@link SessionBindingConversationManager}. * * @author Erwin Vervaet */ class ConversationContainer implements Serializable { - + /** - * Maximum number of conversations in this container. -1 for - * unlimited. + * Maximum number of conversations in this container. -1 for unlimited. */ private int maxConversations; - + /** * The key of this conversation container in the session. */ @@ -54,8 +52,7 @@ class ConversationContainer implements Serializable { /** * Create a new conversation container. - * @param maxConversations the maximum number of allowed concurrent - * conversations, -1 for unlimited + * @param maxConversations the maximum number of allowed concurrent conversations, -1 for unlimited * @param sessionKey the key of this conversation container in the session */ public ConversationContainer(int maxConversations, String sessionKey) { @@ -63,26 +60,23 @@ class ConversationContainer implements Serializable { this.sessionKey = sessionKey; this.conversations = new ArrayList(); } - + /** - * Returns the key of this conversation container in the session. - * For package level use only. + * Returns the key of this conversation container in the session. For package level use only. */ String getSessionKey() { return sessionKey; } - + /** - * Returns the current size of the conversation container: the number - * of conversations contained within it. + * Returns the current size of the conversation container: the number of conversations contained within it. */ public int size() { return conversations.size(); } /** - * Create a new conversation based on given parameters and add it to the - * container. + * Create a new conversation based on given parameters and add it to the container. * @param id the unique id of the conversation * @param parameters descriptive parameters * @return the created conversation @@ -92,7 +86,7 @@ class ConversationContainer implements Serializable { conversations.add(conversation); if (maxExceeded()) { // end oldest conversation - ((Conversation)conversations.get(0)).end(); + ((Conversation) conversations.get(0)).end(); } return conversation; } @@ -101,12 +95,11 @@ class ConversationContainer implements Serializable { * Return the identified conversation. * @param id the id to lookup * @return the conversation - * @throws NoSuchConversationException if the conversation cannot be - * found + * @throws NoSuchConversationException if the conversation cannot be found */ public synchronized Conversation getConversation(ConversationId id) throws NoSuchConversationException { for (Iterator it = conversations.iterator(); it.hasNext();) { - ContainedConversation conversation = (ContainedConversation)it.next(); + ContainedConversation conversation = (ContainedConversation) it.next(); if (conversation.getId().equals(id)) { return conversation; } @@ -119,7 +112,7 @@ class ConversationContainer implements Serializable { */ public synchronized void removeConversation(ConversationId id) { for (Iterator it = conversations.iterator(); it.hasNext();) { - ContainedConversation conversation = (ContainedConversation)it.next(); + ContainedConversation conversation = (ContainedConversation) it.next(); if (conversation.getId().equals(id)) { it.remove(); break; @@ -128,8 +121,7 @@ class ConversationContainer implements Serializable { } /** - * Has the maximum number of allowed concurrent conversations in the - * session been exceeded? + * Has the maximum number of allowed concurrent conversations in the session been exceeded? */ private boolean maxExceeded() { return maxConversations > 0 && conversations.size() > maxConversations; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLock.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLock.java index 988018c6..f941304d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLock.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLock.java @@ -16,15 +16,14 @@ package org.springframework.webflow.conversation.impl; /** - * A normalized interface for conversation locks, used to obtain exclusive - * access to a conversation. + * A normalized interface for conversation locks, used to obtain exclusive access to a conversation. * * @author Keith Donald */ public interface ConversationLock { - + /** - * Acquire the conversation lock. + * Acquire the conversation lock. */ public void lock(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLockFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLockFactory.java index 815e2889..65f9cb97 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLockFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/ConversationLockFactory.java @@ -20,8 +20,7 @@ import org.apache.commons.logging.LogFactory; import org.springframework.core.JdkVersion; /** - * Simple utility class for creating conversation lock instances based on the - * current execution environment. + * Simple utility class for creating conversation lock instances based on the current execution environment. * * @author Keith Donald * @author Rob Harrop @@ -36,25 +35,21 @@ public class ConversationLockFactory { try { Class.forName("EDU.oswego.cs.dl.util.concurrent.ReentrantLock"); utilConcurrentPresent = true; - } - catch (ClassNotFoundException ex) { + } catch (ClassNotFoundException ex) { utilConcurrentPresent = false; } } /** - * When running on Java 1.5+, returns a jdk5 concurrent lock. When running on older JDKs with - * the 'util.concurrent' package available, returns a util concurrent lock. - * In all other cases a "no-op" lock is returned. + * When running on Java 1.5+, returns a jdk5 concurrent lock. When running on older JDKs with the 'util.concurrent' + * package available, returns a util concurrent lock. In all other cases a "no-op" lock is returned. */ public static ConversationLock createLock() { if (JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_15) { return new JdkConcurrentConversationLock(); - } - else if (utilConcurrentPresent) { + } else if (utilConcurrentPresent) { return new UtilConcurrentConversationLock(); - } - else { + } else { logger.warn("Unable to enable conversation locking. Switch to Java 5 or above, " + "or put the 'util.concurrent' package on the classpath " + "to enable locking in your environment."); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/JdkConcurrentConversationLock.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/JdkConcurrentConversationLock.java index 1f64a20c..02d0ae25 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/JdkConcurrentConversationLock.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/JdkConcurrentConversationLock.java @@ -20,8 +20,8 @@ import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; /** - * A conversation lock that relies on a {@link ReentrantLock} within Java 5's - * util.concurrent.locks package. + * A conversation lock that relies on a {@link ReentrantLock} within Java 5's util.concurrent.locks + * package. * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/NoOpConversationLock.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/NoOpConversationLock.java index 0ed18fa5..73159b0a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/NoOpConversationLock.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/NoOpConversationLock.java @@ -19,8 +19,8 @@ import java.io.ObjectStreamException; import java.io.Serializable; /** - * A singleton lock that doesn't do anything. For use when conversations don't - * require or choose not to implement locking. + * A singleton lock that doesn't do anything. For use when conversations don't require or choose not to implement + * locking. * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SessionBindingConversationManager.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SessionBindingConversationManager.java index a756f199..73b65fa9 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SessionBindingConversationManager.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SessionBindingConversationManager.java @@ -29,17 +29,14 @@ import org.springframework.webflow.util.RandomGuidUidGenerator; import org.springframework.webflow.util.UidGenerator; /** - * Simple implementation of a conversation manager that stores conversations in - * the session attribute map. + * Simple implementation of a conversation manager that stores conversations in the session attribute map. *

    - * Using the {@link #setMaxConversations(int) maxConversations} property, you can - * limit the number of concurrently active conversations allowed in a single - * session. If the maximum is exceeded, the conversation manager will automatically - * end the oldest conversation. The default is 5, which should be fine for most - * situations. Set it to -1 for no limit. Setting maxConversations to 1 allows - * easy resource cleanup in situations where there should only be one active - * conversation per session. - * + * Using the {@link #setMaxConversations(int) maxConversations} property, you can limit the number of concurrently + * active conversations allowed in a single session. If the maximum is exceeded, the conversation manager will + * automatically end the oldest conversation. The default is 5, which should be fine for most situations. Set it to -1 + * for no limit. Setting maxConversations to 1 allows easy resource cleanup in situations where there should only be one + * active conversation per session. + * * @author Erwin Vervaet */ public class SessionBindingConversationManager implements ConversationManager { @@ -47,8 +44,8 @@ public class SessionBindingConversationManager implements ConversationManager { private static final Log logger = LogFactory.getLog(SessionBindingConversationManager.class); /** - * Generate a unique key for the session attribute holding the conversation - * container managed by this conversation manager. + * Generate a unique key for the session attribute holding the conversation container managed by this conversation + * manager. */ private final String sessionKey = "webflow.conversation.container." + new RandomGuid().toString(); @@ -58,15 +55,13 @@ public class SessionBindingConversationManager implements ConversationManager { private UidGenerator conversationIdGenerator = new RandomGuidUidGenerator(); /** - * The maximum number of active conversations allowed in a session. - * The default is 5. This is high enough for most practical situations and low enough - * to avoid excessive resource usage or easy denial of service attacks. + * The maximum number of active conversations allowed in a session. The default is 5. This is high enough for most + * practical situations and low enough to avoid excessive resource usage or easy denial of service attacks. */ private int maxConversations = 5; /** - * Returns the used generator for conversation ids. Defaults to - * {@link RandomGuidUidGenerator}. + * Returns the used generator for conversation ids. Defaults to {@link RandomGuidUidGenerator}. * @since 1.0.1 */ public UidGenerator getConversationIdGenerator() { @@ -81,8 +76,7 @@ public class SessionBindingConversationManager implements ConversationManager { } /** - * Returns the maximum number of allowed concurrent conversations. The - * default is 5. + * Returns the maximum number of allowed concurrent conversations. The default is 5. * @since 1.0.1 */ public int getMaxConversations() { @@ -90,16 +84,15 @@ public class SessionBindingConversationManager implements ConversationManager { } /** - * Set the maximum number of allowed concurrent conversations. Set to -1 for - * no limit. The default is 5. + * Set the maximum number of allowed concurrent conversations. Set to -1 for no limit. The default is 5. */ public void setMaxConversations(int maxConversations) { this.maxConversations = maxConversations; } /** - * Returns the key this conversation manager uses to store conversation - * data in the session. The key is unique for this conversation manager instance. + * Returns the key this conversation manager uses to store conversation data in the session. The key is unique for + * this conversation manager instance. * @return the session key */ public String getSessionKey() { @@ -109,8 +102,8 @@ public class SessionBindingConversationManager implements ConversationManager { public Conversation beginConversation(ConversationParameters conversationParameters) throws ConversationException { ConversationId conversationId = new SimpleConversationId(conversationIdGenerator.generateUid()); if (logger.isDebugEnabled()) { - logger.debug("Beginning conversation " + conversationParameters + - "; unique conversation id = " + conversationId); + logger.debug("Beginning conversation " + conversationParameters + "; unique conversation id = " + + conversationId); } return getConversationContainer().createAndAddConversation(conversationId, conversationParameters); } @@ -129,14 +122,13 @@ public class SessionBindingConversationManager implements ConversationManager { // internal helpers /** - * Obtain the conversation container from the session. Create a new empty - * container and add it to the session if no existing container can be - * found. + * Obtain the conversation container from the session. Create a new empty container and add it to the session if no + * existing container can be found. */ private ConversationContainer getConversationContainer() { SharedAttributeMap sessionMap = ExternalContextHolder.getExternalContext().getSessionMap(); synchronized (sessionMap.getMutex()) { - ConversationContainer container = (ConversationContainer)sessionMap.get(sessionKey); + ConversationContainer container = (ConversationContainer) sessionMap.get(sessionKey); if (container == null) { container = new ConversationContainer(maxConversations, sessionKey); sessionMap.put(sessionKey, container); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SimpleConversationId.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SimpleConversationId.java index 00911696..14be4030 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SimpleConversationId.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/SimpleConversationId.java @@ -21,8 +21,7 @@ import org.springframework.webflow.conversation.ConversationId; import org.springframework.webflow.conversation.ConversationManager; /** - * An id that uniquely identifies a conversation managed by a - * {@link ConversationManager}. + * An id that uniquely identifies a conversation managed by a {@link ConversationManager}. *

    * This key consists of a unique string that is typically a GUID. * @@ -47,7 +46,7 @@ public class SimpleConversationId extends ConversationId { if (!(o instanceof SimpleConversationId)) { return false; } - return id.equals(((SimpleConversationId)o).id); + return id.equals(((SimpleConversationId) o).id); } public int hashCode() { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/UtilConcurrentConversationLock.java b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/UtilConcurrentConversationLock.java index 9e437a66..f3cc985c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/UtilConcurrentConversationLock.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/conversation/impl/UtilConcurrentConversationLock.java @@ -15,16 +15,15 @@ */ package org.springframework.webflow.conversation.impl; - import org.springframework.core.NestedRuntimeException; import EDU.oswego.cs.dl.util.concurrent.ReentrantLock; /** - * A conversation lock that relies on a {@link ReentrantLock} within Doug Lea's - * util.concurrent - * package. For use on JDK 1.3 and 1.4. - * + * A conversation lock that relies on a {@link ReentrantLock} within Doug Lea's util.concurrent package. + * For use on JDK 1.3 and 1.4. + * * @author Keith Donald * @author Rob Harrop */ @@ -42,8 +41,7 @@ class UtilConcurrentConversationLock implements ConversationLock { public void lock() { try { lock.acquire(); - } - catch (InterruptedException e) { + } catch (InterruptedException e) { throw new SystemInterruptedException("Unable to acquire lock.", e); } } @@ -54,11 +52,10 @@ class UtilConcurrentConversationLock implements ConversationLock { public void unlock() { lock.release(); } - + /** - * Exception indicating that some {@link Thread} was - * {@link Thread#interrupt() interrupted} during processing and as - * such processing was halted. + * Exception indicating that some {@link Thread} was {@link Thread#interrupt() interrupted} during + * processing and as such processing was halted. *

    * Only used to wrap the checked {@link InterruptedException java.lang.InterruptedException}. */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/DefaultExpressionParserFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/core/DefaultExpressionParserFactory.java index 2623fc04..f142d024 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/DefaultExpressionParserFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/DefaultExpressionParserFactory.java @@ -24,7 +24,8 @@ import org.springframework.binding.expression.SettableExpression; * Static helper factory that creates instances of the default expression parser used by Spring Web Flow when requested. * Marked final with a private constructor to prevent subclassing. *

    - * The default is an OGNL based expression parser. Also asserts that OGNL is in the classpath the first time the parser is used. + * The default is an OGNL based expression parser. Also asserts that OGNL is in the classpath the first time the parser + * is used. * * @author Keith Donald * @author Erwin Vervaet @@ -83,14 +84,12 @@ public final class DefaultExpressionParserFactory { try { Class.forName("ognl.Ognl"); return new WebFlowOgnlExpressionParser(); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new IllegalStateException( "Unable to load the default expression parser: OGNL could not be found in the classpath. " + "Please add OGNL 2.x to your classpath or set the default ExpressionParser instance to something that is in the classpath. " + "Details: " + e.getMessage()); - } - catch (NoClassDefFoundError e) { + } catch (NoClassDefFoundError e) { throw new IllegalStateException( "Unable to construct the default expression parser: ognl.Ognl could not be instantiated. " + "Please add OGNL 2.x to your classpath or set the default ExpressionParser instance to something that is in the classpath. " diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/FlowException.java b/spring-webflow/src/main/java/org/springframework/webflow/core/FlowException.java index 8a36e545..f5141198 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/FlowException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/FlowException.java @@ -18,8 +18,8 @@ package org.springframework.webflow.core; import org.springframework.core.NestedRuntimeException; /** - * Root class for exceptions thrown by the Spring Web Flow system. All other - * exceptions within the system should be assignable to this class. + * Root class for exceptions thrown by the Spring Web Flow system. All other exceptions within the system should be + * assignable to this class. * * @author Keith Donald * @author Erwin Vervaet diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/WebFlowOgnlExpressionParser.java b/spring-webflow/src/main/java/org/springframework/webflow/core/WebFlowOgnlExpressionParser.java index 87a7c926..b45fac44 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/WebFlowOgnlExpressionParser.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/WebFlowOgnlExpressionParser.java @@ -25,8 +25,7 @@ import org.springframework.binding.expression.support.OgnlExpressionParser; import org.springframework.webflow.core.collection.MutableAttributeMap; /** - * An extension of {@link OgnlExpressionParser} that registers web flow specific - * property accessors. + * An extension of {@link OgnlExpressionParser} that registers web flow specific property accessors. * * @author Keith Donald */ @@ -47,7 +46,7 @@ class WebFlowOgnlExpressionParser extends OgnlExpressionParser { */ private static class MapAdaptablePropertyAccessor implements PropertyAccessor { public Object getProperty(Map context, Object target, Object name) throws OgnlException { - return ((MapAdaptable)target).asMap().get(name); + return ((MapAdaptable) target).asMap().get(name); } public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException { @@ -63,7 +62,7 @@ class WebFlowOgnlExpressionParser extends OgnlExpressionParser { */ private static class MutableAttributeMapPropertyAccessor extends MapAdaptablePropertyAccessor { public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException { - ((MutableAttributeMap)target).put((String)name, value); + ((MutableAttributeMap) target).put((String) name, value); } } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMap.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMap.java index ac776b1d..17a3bd9a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMap.java @@ -22,16 +22,15 @@ import org.springframework.binding.collection.MapAdaptable; /** * An immutable interface for accessing attributes in a backing map with string keys. *

    - * Implementations can optionally support {@link AttributeMapBindingListener listeners} - * that will be notified when they're bound in or unbound from the map. + * Implementations can optionally support {@link AttributeMapBindingListener listeners} that will be notified when + * they're bound in or unbound from the map. * * @author Keith Donald */ public interface AttributeMap extends MapAdaptable { /** - * Get an attribute value out of this map, returning null if - * not found. + * Get an attribute value out of this map, returning null if not found. * @param attributeName the attribute name * @return the attribute value */ @@ -57,13 +56,11 @@ public interface AttributeMap extends MapAdaptable { public boolean contains(String attributeName); /** - * Does the attribute with the provided name exist in this map and is its - * value of the specified required type? + * Does the attribute with the provided name exist in this map and is its value of the specified required type? * @param attributeName the attribute name * @param requiredType the required class of the attribute value * @return true if so, false otherwise - * @throws IllegalArgumentException when the value is not of the required - * type + * @throws IllegalArgumentException when the value is not of the required type */ public boolean contains(String attributeName, Class requiredType) throws IllegalArgumentException; @@ -71,8 +68,7 @@ public interface AttributeMap extends MapAdaptable { * Get an attribute value, returning the default value if no value is found. * @param attributeName the name of the attribute * @param defaultValue the default value - * @return the attribute value, falling back to the default if no such - * attribute exists + * @return the attribute value, falling back to the default if no such attribute exists */ public Object get(String attributeName, Object defaultValue); @@ -81,26 +77,22 @@ public interface AttributeMap extends MapAdaptable { * @param attributeName the name of the attribute * @param requiredType the required type of the attribute value * @return the attribute value, or null if not found - * @throws IllegalArgumentException when the value is not of the required - * type + * @throws IllegalArgumentException when the value is not of the required type */ public Object get(String attributeName, Class requiredType) throws IllegalArgumentException; /** - * Get an attribute value, asserting the value is of the required type and - * returning the default value if not found. + * Get an attribute value, asserting the value is of the required type and returning the default value if not found. * @param attributeName the name of the attribute * @param requiredType the value required type * @param defaultValue the default value * @return the attribute value, or the default if not found - * @throws IllegalArgumentException when the value (if found) is not of the - * required type + * @throws IllegalArgumentException when the value (if found) is not of the required type */ public Object get(String attributeName, Class requiredType, Object defaultValue) throws IllegalStateException; /** - * Get the value of a required attribute, throwing an exception of no - * attribute is found. + * Get the value of a required attribute, throwing an exception of no attribute is found. * @param attributeName the name of the attribute * @return the attribute value * @throws IllegalArgumentException when the attribute is not found @@ -108,44 +100,37 @@ public interface AttributeMap extends MapAdaptable { public Object getRequired(String attributeName) throws IllegalArgumentException; /** - * Get the value of a required attribute and make sure it is of the required - * type. + * Get the value of a required attribute and make sure it is of the required type. * @param attributeName name of the attribute to get * @param requiredType the required type of the attribute value * @return the attribute value - * @throws IllegalArgumentException when the attribute is not found or not - * of the required type + * @throws IllegalArgumentException when the attribute is not found or not of the required type */ public Object getRequired(String attributeName, Class requiredType) throws IllegalArgumentException; /** - * Returns a string attribute value in the map, returning null - * if no value was found. + * Returns a string attribute value in the map, returning null if no value was found. * @param attributeName the attribute name * @return the string attribute value - * @throws IllegalArgumentException if the attribute is present but not a - * string + * @throws IllegalArgumentException if the attribute is present but not a string */ public String getString(String attributeName) throws IllegalArgumentException; /** - * Returns a string attribute value in the map, returning the default value - * if no value was found. + * Returns a string attribute value in the map, returning the default value if no value was found. * @param attributeName the attribute name * @param defaultValue the default * @return the string attribute value - * @throws IllegalArgumentException if the attribute is present but not a - * string + * @throws IllegalArgumentException if the attribute is present but not a string */ public String getString(String attributeName, String defaultValue) throws IllegalArgumentException; /** - * Returns a string attribute value in the map, throwing an exception if the - * attribute is not present and of the correct type. + * Returns a string attribute value in the map, throwing an exception if the attribute is not present and of the + * correct type. * @param attributeName the attribute name * @return the string attribute value - * @throws IllegalArgumentException if the attribute is not present or - * present but not a string + * @throws IllegalArgumentException if the attribute is not present or present but not a string */ public String getRequiredString(String attributeName) throws IllegalArgumentException; @@ -153,194 +138,169 @@ public interface AttributeMap extends MapAdaptable { * Returns a collection attribute value in the map. * @param attributeName the attribute name * @return the collection attribute value - * @throws IllegalArgumentException if the attribute is present but not a - * collection + * @throws IllegalArgumentException if the attribute is present but not a collection */ public Collection getCollection(String attributeName) throws IllegalArgumentException; /** - * Returns a collection attribute value in the map and make sure it is of - * the required type. + * Returns a collection attribute value in the map and make sure it is of the required type. * @param attributeName the attribute name * @param requiredType the required type of the attribute value * @return the collection attribute value - * @throws IllegalArgumentException if the attribute is present but not a - * collection of the required type + * @throws IllegalArgumentException if the attribute is present but not a collection of the required type */ public Collection getCollection(String attributeName, Class requiredType) throws IllegalArgumentException; /** - * Returns a collection attribute value in the map, throwing an exception if - * the attribute is not present or not a collection. + * Returns a collection attribute value in the map, throwing an exception if the attribute is not present or not a + * collection. * @param attributeName the attribute name * @return the collection attribute value - * @throws IllegalArgumentException if the attribute is not present or is - * present but not a collection + * @throws IllegalArgumentException if the attribute is not present or is present but not a collection */ public Collection getRequiredCollection(String attributeName) throws IllegalArgumentException; /** - * Returns a collection attribute value in the map, throwing an exception if - * the attribute is not present or not a collection of the required type. + * Returns a collection attribute value in the map, throwing an exception if the attribute is not present or not a + * collection of the required type. * @param attributeName the attribute name * @param requiredType the required collection type * @return the collection attribute value - * @throws IllegalArgumentException if the attribute is not present or is - * present but not a collection of the required type + * @throws IllegalArgumentException if the attribute is not present or is present but not a collection of the + * required type */ public Collection getRequiredCollection(String attributeName, Class requiredType) throws IllegalArgumentException; /** - * Returns an array attribute value in the map and makes sure it is of the - * required type. + * Returns an array attribute value in the map and makes sure it is of the required type. * @param attributeName the attribute name * @param requiredType the required type of the attribute value * @return the array attribute value - * @throws IllegalArgumentException if the attribute is present but not an - * array of the required type + * @throws IllegalArgumentException if the attribute is present but not an array of the required type */ public Object[] getArray(String attributeName, Class requiredType) throws IllegalArgumentException; /** - * Returns an array attribute value in the map, throwing an exception if the - * attribute is not present or not an array of the required type. + * Returns an array attribute value in the map, throwing an exception if the attribute is not present or not an + * array of the required type. * @param attributeName the attribute name * @param requiredType the required array type * @return the collection attribute value - * @throws IllegalArgumentException if the attribute is not present or is - * present but not a array of the required type + * @throws IllegalArgumentException if the attribute is not present or is present but not a array of the required + * type */ public Object[] getRequiredArray(String attributeName, Class requiredType) throws IllegalArgumentException; /** - * Returns a number attribute value in the map that is of the specified - * type, returning null if no value was found. + * Returns a number attribute value in the map that is of the specified type, returning null if no + * value was found. * @param attributeName the attribute name * @param requiredType the required number type * @return the number attribute value - * @throws IllegalArgumentException if the attribute is present but not a - * number of the required type + * @throws IllegalArgumentException if the attribute is present but not a number of the required type */ public Number getNumber(String attributeName, Class requiredType) throws IllegalArgumentException; /** - * Returns a number attribute value in the map of the specified type, - * returning the default value if no value was found. + * Returns a number attribute value in the map of the specified type, returning the default value if no value was + * found. * @param attributeName the attribute name * @param defaultValue the default * @return the number attribute value - * @throws IllegalArgumentException if the attribute is present but not a - * number of the required type + * @throws IllegalArgumentException if the attribute is present but not a number of the required type */ public Number getNumber(String attributeName, Class requiredType, Number defaultValue) throws IllegalArgumentException; /** - * Returns a number attribute value in the map, throwing an exception if the - * attribute is not present and of the correct type. + * Returns a number attribute value in the map, throwing an exception if the attribute is not present and of the + * correct type. * @param attributeName the attribute name * @return the number attribute value - * @throws IllegalArgumentException if the attribute is not present or - * present but not a number of the required type + * @throws IllegalArgumentException if the attribute is not present or present but not a number of the required type */ public Number getRequiredNumber(String attributeName, Class requiredType) throws IllegalArgumentException; /** - * Returns an integer attribute value in the map, returning - * null if no value was found. + * Returns an integer attribute value in the map, returning null if no value was found. * @param attributeName the attribute name * @return the integer attribute value - * @throws IllegalArgumentException if the attribute is present but not an - * integer + * @throws IllegalArgumentException if the attribute is present but not an integer */ public Integer getInteger(String attributeName) throws IllegalArgumentException; /** - * Returns an integer attribute value in the map, returning the default - * value if no value was found. + * Returns an integer attribute value in the map, returning the default value if no value was found. * @param attributeName the attribute name * @param defaultValue the default * @return the integer attribute value - * @throws IllegalArgumentException if the attribute is present but not an - * integer + * @throws IllegalArgumentException if the attribute is present but not an integer */ public Integer getInteger(String attributeName, Integer defaultValue) throws IllegalArgumentException; /** - * Returns an integer attribute value in the map, throwing an exception if - * the attribute is not present and of the correct type. + * Returns an integer attribute value in the map, throwing an exception if the attribute is not present and of the + * correct type. * @param attributeName the attribute name * @return the integer attribute value - * @throws IllegalArgumentException if the attribute is not present or - * present but not an integer + * @throws IllegalArgumentException if the attribute is not present or present but not an integer */ public Integer getRequiredInteger(String attributeName) throws IllegalArgumentException; /** - * Returns a long attribute value in the map, returning null - * if no value was found. + * Returns a long attribute value in the map, returning null if no value was found. * @param attributeName the attribute name * @return the long attribute value - * @throws IllegalArgumentException if the attribute is present but not a - * long + * @throws IllegalArgumentException if the attribute is present but not a long */ public Long getLong(String attributeName) throws IllegalArgumentException; /** - * Returns a long attribute value in the map, returning the default value if - * no value was found. + * Returns a long attribute value in the map, returning the default value if no value was found. * @param attributeName the attribute name * @param defaultValue the default * @return the long attribute value - * @throws IllegalArgumentException if the attribute is present but not a - * long + * @throws IllegalArgumentException if the attribute is present but not a long */ public Long getLong(String attributeName, Long defaultValue) throws IllegalArgumentException; /** - * Returns a long attribute value in the map, throwing an exception if the - * attribute is not present and of the correct type. + * Returns a long attribute value in the map, throwing an exception if the attribute is not present and of the + * correct type. * @param attributeName the attribute name * @return the long attribute value - * @throws IllegalArgumentException if the attribute is not present or - * present but not a long + * @throws IllegalArgumentException if the attribute is not present or present but not a long */ public Long getRequiredLong(String attributeName) throws IllegalArgumentException; /** - * Returns a boolean attribute value in the map, returning null - * if no value was found. + * Returns a boolean attribute value in the map, returning null if no value was found. * @param attributeName the attribute name * @return the long attribute value - * @throws IllegalArgumentException if the attribute is present but not a - * boolean + * @throws IllegalArgumentException if the attribute is present but not a boolean */ public Boolean getBoolean(String attributeName) throws IllegalArgumentException; /** - * Returns a boolean attribute value in the map, returning the default value - * if no value was found. + * Returns a boolean attribute value in the map, returning the default value if no value was found. * @param attributeName the attribute name * @param defaultValue the default * @return the boolean attribute value - * @throws IllegalArgumentException if the attribute is present but not a - * boolean + * @throws IllegalArgumentException if the attribute is present but not a boolean */ public Boolean getBoolean(String attributeName, Boolean defaultValue) throws IllegalArgumentException; /** - * Returns a boolean attribute value in the map, throwing an exception if - * the attribute is not present and of the correct type. + * Returns a boolean attribute value in the map, throwing an exception if the attribute is not present and of the + * correct type. * @param attributeName the attribute name * @return the boolean attribute value - * @throws IllegalArgumentException if the attribute is not present or - * present but is not a boolean + * @throws IllegalArgumentException if the attribute is not present or present but is not a boolean */ public Boolean getRequiredBoolean(String attributeName) throws IllegalArgumentException; /** - * Returns a new attribute map containing the union of this map with the - * provided map. + * Returns a new attribute map containing the union of this map with the provided map. * @param attributes the map to combine with this map * @return a new, combined map */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMapBindingEvent.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMapBindingEvent.java index 4e1175fa..5bf4422e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMapBindingEvent.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMapBindingEvent.java @@ -18,8 +18,7 @@ package org.springframework.webflow.core.collection; import java.util.EventObject; /** - * Holder for information about the binding or unbinding event in an - * {@link AttributeMap}. + * Holder for information about the binding or unbinding event in an {@link AttributeMap}. * * @see AttributeMapBindingListener * @@ -32,8 +31,7 @@ public class AttributeMapBindingEvent extends EventObject { private Object attributeValue; /** - * Creates an event for map binding that contains information about the - * event. + * Creates an event for map binding that contains information about the event. * @param source the source map that this attribute was bound in * @param attributeName the name that this attribute was bound with * @param attributeValue the attribute diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMapBindingListener.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMapBindingListener.java index 4db1868f..4805a46c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMapBindingListener.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/AttributeMapBindingListener.java @@ -16,11 +16,9 @@ package org.springframework.webflow.core.collection; /** - * Causes an object to be notified when it is bound or unbound from - * an {@link AttributeMap}. + * Causes an object to be notified when it is bound or unbound from an {@link AttributeMap}. *

    - * Note that this is an optional feature and not all {@link AttributeMap} - * implementations support it. + * Note that this is an optional feature and not all {@link AttributeMap} implementations support it. * * @see AttributeMap * @@ -29,15 +27,13 @@ package org.springframework.webflow.core.collection; public interface AttributeMapBindingListener { /** - * Called when the implementing instance is bound into an - * AttributeMap. + * Called when the implementing instance is bound into an AttributeMap. * @param event information about the binding event */ void valueBound(AttributeMapBindingEvent event); /** - * Called when the implementing instance is unbound from an - * AttributeMap. + * Called when the implementing instance is unbound from an AttributeMap. * @param event information about the unbinding event */ void valueUnbound(AttributeMapBindingEvent event); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/CollectionUtils.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/CollectionUtils.java index f2c7eadf..f92f6fd8 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/CollectionUtils.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/CollectionUtils.java @@ -22,8 +22,7 @@ import java.util.Iterator; import java.util.List; /** - * A utility class for working with attribute and parameter collections used by - * Spring Web FLow. + * A utility class for working with attribute and parameter collections used by Spring Web FLow. * * @author Keith Donald * @author Erwin Vervaet @@ -56,8 +55,7 @@ public class CollectionUtils { } /** - * Factory method that returns a unmodifiable attribute map with a single - * entry. + * Factory method that returns a unmodifiable attribute map with a single entry. * @param attributeName the attribute name * @param attributeValue the attribute value * @return the unmodifiable map with a single element @@ -67,9 +65,8 @@ public class CollectionUtils { } /** - * Add all given objects to given target list. No duplicates will be added. - * The contains() method of the given target list will be used to determine - * whether or not an object is already in the list. + * Add all given objects to given target list. No duplicates will be added. The contains() method of the given + * target list will be used to determine whether or not an object is already in the list. * @param target the collection to which to objects will be added * @param objects the objects to add * @return whether or not the target collection changed @@ -77,8 +74,7 @@ public class CollectionUtils { public static boolean addAllNoDuplicates(List target, Object[] objects) { if (objects == null || objects.length == 0) { return false; - } - else { + } else { boolean changed = false; for (int i = 0; i < objects.length; i++) { if (!target.contains(objects[i])) { @@ -89,7 +85,7 @@ public class CollectionUtils { return changed; } } - + /** * Iterator iterating over no elements (hasNext() always returns false). */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalAttributeMap.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalAttributeMap.java index a3142051..ed84008d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalAttributeMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalAttributeMap.java @@ -40,8 +40,7 @@ public class LocalAttributeMap implements MutableAttributeMap, Serializable { private Map attributes; /** - * A helper for accessing attributes. Marked transient and restored on - * deserialization. + * A helper for accessing attributes. Marked transient and restored on deserialization. */ private transient MapAccessor attributeAccessor; @@ -54,8 +53,8 @@ public class LocalAttributeMap implements MutableAttributeMap, Serializable { /** * Creates a new attribute map, initially empty. - * @param size the initial size - * @param loadFactor the load factor + * @param size the initial size + * @param loadFactor the load factor */ public LocalAttributeMap(int size, int loadFactor) { initAttributes(createTargetMap(size, loadFactor)); @@ -211,8 +210,7 @@ public class LocalAttributeMap implements MutableAttributeMap, Serializable { public AttributeMap union(AttributeMap attributes) { if (attributes == null) { return new LocalAttributeMap(getMapInternal()); - } - else { + } else { Map map = createTargetMap(); map.putAll(getMapInternal()); map.putAll(attributes.asMap()); @@ -270,8 +268,7 @@ public class LocalAttributeMap implements MutableAttributeMap, Serializable { // helpers /** - * Factory method that returns the target map storing the data in this - * attribute map. + * Factory method that returns the target map storing the data in this attribute map. * @return the target map */ protected Map createTargetMap() { @@ -279,8 +276,7 @@ public class LocalAttributeMap implements MutableAttributeMap, Serializable { } /** - * Factory method that returns the target map storing the data in this - * attribute map. + * Factory method that returns the target map storing the data in this attribute map. * @param size the initial size of the map * @param loadFactor the load factor * @return the target map @@ -293,7 +289,7 @@ public class LocalAttributeMap implements MutableAttributeMap, Serializable { if (!(o instanceof LocalAttributeMap)) { return false; } - LocalAttributeMap other = (LocalAttributeMap)o; + LocalAttributeMap other = (LocalAttributeMap) o; return getMapInternal().equals(other.getMapInternal()); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalParameterMap.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalParameterMap.java index 9259c01b..2e71c80c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalParameterMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalParameterMap.java @@ -35,9 +35,8 @@ import org.springframework.util.Assert; import org.springframework.web.multipart.MultipartFile; /** - * An immutable parameter map storing String-keyed, String-valued parameters - * in a backing {@link Map} implementation. This base provides convenient - * operations for accessing parameters in a typed-manner. + * An immutable parameter map storing String-keyed, String-valued parameters in a backing {@link Map} implementation. + * This base provides convenient operations for accessing parameters in a typed-manner. * * @author Keith Donald */ @@ -49,23 +48,20 @@ public class LocalParameterMap implements ParameterMap, Serializable { private Map parameters; /** - * A helper for accessing parameters. Marked transient and restored on - * deserialization. + * A helper for accessing parameters. Marked transient and restored on deserialization. */ private transient MapAccessor parameterAccessor; /** - * A helper for converting string parameter values. Marked transient and - * restored on deserialization. + * A helper for converting string parameter values. Marked transient and restored on deserialization. */ private transient ConversionService conversionService; /** * Creates a new parameter map from the provided map. *

    - * It is expected that the contents of the backing map adhere to the - * parameter map contract; that is, map entries have string keys, string - * values, and remain unmodifiable. + * It is expected that the contents of the backing map adhere to the parameter map contract; that is, map entries + * have string keys, string values, and remain unmodifiable. * @param parameters the contents of this parameter map */ public LocalParameterMap(Map parameters) { @@ -75,12 +71,10 @@ public class LocalParameterMap implements ParameterMap, Serializable { /** * Creates a new parameter map from the provided map. *

    - * It is expected that the contents of the backing map adhere to the - * parameter map contract; that is, map entries have string keys, string - * values, and remain unmodifiable. + * It is expected that the contents of the backing map adhere to the parameter map contract; that is, map entries + * have string keys, string values, and remain unmodifiable. * @param parameters the contents of this parameter map - * @param conversionService a helper for performing type conversion of map - * entry values + * @param conversionService a helper for performing type conversion of map entry values */ public LocalParameterMap(Map parameters, ConversionService conversionService) { initParameters(parameters); @@ -91,7 +85,7 @@ public class LocalParameterMap implements ParameterMap, Serializable { if (!(o instanceof LocalParameterMap)) { return false; } - LocalParameterMap other = (LocalParameterMap)o; + LocalParameterMap other = (LocalParameterMap) o; return parameters.equals(other.parameters); } @@ -116,7 +110,7 @@ public class LocalParameterMap implements ParameterMap, Serializable { } public String get(String parameterName) { - return get(parameterName, (String)null); + return get(parameterName, (String) null); } public String get(String parameterName, String defaultValue) { @@ -126,20 +120,18 @@ public class LocalParameterMap implements ParameterMap, Serializable { Object value = parameters.get(parameterName); if (value.getClass().isArray()) { parameterAccessor.assertKeyValueInstanceOf(parameterName, value, String[].class); - String[] array = (String[])value; + String[] array = (String[]) value; if (array.length == 0) { return null; - } - else { - Object first = ((String[])value)[0]; + } else { + Object first = ((String[]) value)[0]; parameterAccessor.assertKeyValueInstanceOf(parameterName, first, String.class); - return (String)first; + return (String) first; } - } - else { + } else { parameterAccessor.assertKeyValueInstanceOf(parameterName, value, String.class); - return (String)value; + return (String) value; } } @@ -150,11 +142,10 @@ public class LocalParameterMap implements ParameterMap, Serializable { Object value = parameters.get(parameterName); if (value.getClass().isArray()) { parameterAccessor.assertKeyValueInstanceOf(parameterName, value, String[].class); - return (String[])value; - } - else { + return (String[]) value; + } else { parameterAccessor.assertKeyValueInstanceOf(parameterName, value, String.class); - return new String[] { (String)value }; + return new String[] { (String) value }; } } @@ -198,62 +189,62 @@ public class LocalParameterMap implements ParameterMap, Serializable { public Number getNumber(String parameterName, Class targetType) throws ConversionException { assertAssignableTo(Number.class, targetType); - return (Number)get(parameterName, targetType); + return (Number) get(parameterName, targetType); } public Number getNumber(String parameterName, Class targetType, Number defaultValue) throws ConversionException { assertAssignableTo(Number.class, targetType); - return (Number)get(parameterName, targetType, defaultValue); + return (Number) get(parameterName, targetType, defaultValue); } public Number getRequiredNumber(String parameterName, Class targetType) throws IllegalArgumentException, ConversionException { assertAssignableTo(Number.class, targetType); - return (Number)getRequired(parameterName, targetType); + return (Number) getRequired(parameterName, targetType); } public Integer getInteger(String parameterName) throws ConversionException { - return (Integer)get(parameterName, Integer.class); + return (Integer) get(parameterName, Integer.class); } public Integer getInteger(String parameterName, Integer defaultValue) throws ConversionException { - return (Integer)get(parameterName, Integer.class, defaultValue); + return (Integer) get(parameterName, Integer.class, defaultValue); } public Integer getRequiredInteger(String parameterName) throws IllegalArgumentException, ConversionException { - return (Integer)getRequired(parameterName, Integer.class); + return (Integer) getRequired(parameterName, Integer.class); } public Long getLong(String parameterName) throws ConversionException { - return (Long)get(parameterName, Long.class); + return (Long) get(parameterName, Long.class); } public Long getLong(String parameterName, Long defaultValue) throws ConversionException { - return (Long)get(parameterName, Long.class, defaultValue); + return (Long) get(parameterName, Long.class, defaultValue); } public Long getRequiredLong(String parameterName) throws IllegalArgumentException, ConversionException { - return (Long)getRequired(parameterName, Long.class); + return (Long) getRequired(parameterName, Long.class); } public Boolean getBoolean(String parameterName) throws ConversionException { - return (Boolean)get(parameterName, Boolean.class); + return (Boolean) get(parameterName, Boolean.class); } public Boolean getBoolean(String parameterName, Boolean defaultValue) throws ConversionException { - return (Boolean)get(parameterName, Boolean.class, defaultValue); + return (Boolean) get(parameterName, Boolean.class, defaultValue); } public Boolean getRequiredBoolean(String parameterName) throws IllegalArgumentException, ConversionException { - return (Boolean)getRequired(parameterName, Boolean.class); + return (Boolean) getRequired(parameterName, Boolean.class); } public MultipartFile getMultipartFile(String parameterName) { - return (MultipartFile)parameterAccessor.get(parameterName, MultipartFile.class); + return (MultipartFile) parameterAccessor.get(parameterName, MultipartFile.class); } public MultipartFile getRequiredMultipartFile(String parameterName) throws IllegalArgumentException { - return (MultipartFile)parameterAccessor.getRequired(parameterName, MultipartFile.class); + return (MultipartFile) parameterAccessor.getRequired(parameterName, MultipartFile.class); } public AttributeMap asAttributeMap() { @@ -286,8 +277,7 @@ public class LocalParameterMap implements ParameterMap, Serializable { } /** - * Convert given array of String parameters to specified target type and - * return the resulting array. + * Convert given array of String parameters to specified target type and return the resulting array. */ private Object[] convert(String[] parameters, Class targetElementType) throws ConversionException { List list = new ArrayList(parameters.length); @@ -295,7 +285,7 @@ public class LocalParameterMap implements ParameterMap, Serializable { for (int i = 0; i < parameters.length; i++) { list.add(converter.execute(parameters[i])); } - return list.toArray((Object[])Array.newInstance(targetElementType, parameters.length)); + return list.toArray((Object[]) Array.newInstance(targetElementType, parameters.length)); } /** diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalSharedAttributeMap.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalSharedAttributeMap.java index 46f898cb..74989b90 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalSharedAttributeMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/LocalSharedAttributeMap.java @@ -18,11 +18,10 @@ package org.springframework.webflow.core.collection; import org.springframework.binding.collection.SharedMap; /** - * An attribute map that exposes a mutex that application code can synchronize - * on. This class wraps another shared map in an attribute map. + * An attribute map that exposes a mutex that application code can synchronize on. This class wraps another shared map + * in an attribute map. *

    - * The mutex can be used to serialize concurrent access to the shared map's - * contents by multiple threads. + * The mutex can be used to serialize concurrent access to the shared map's contents by multiple threads. * * @author Keith Donald */ @@ -39,11 +38,11 @@ public class LocalSharedAttributeMap extends LocalAttributeMap implements Shared public Object getMutex() { return getSharedMap().getMutex(); } - + /** * Returns the wrapped shared map. */ protected SharedMap getSharedMap() { - return (SharedMap)getMapInternal(); + return (SharedMap) getMapInternal(); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/MutableAttributeMap.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/MutableAttributeMap.java index 88449567..f0c111b0 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/MutableAttributeMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/MutableAttributeMap.java @@ -16,11 +16,10 @@ package org.springframework.webflow.core.collection; /** - * An interface for accessing and modifying attributes in a backing map with - * string keys. + * An interface for accessing and modifying attributes in a backing map with string keys. *

    - * Implementations can optionally support {@link AttributeMapBindingListener listeners} - * that will be notified when they're bound in or unbound from the map. + * Implementations can optionally support {@link AttributeMapBindingListener listeners} that will be notified when + * they're bound in or unbound from the map. * * @author Keith Donald */ @@ -29,15 +28,13 @@ public interface MutableAttributeMap extends AttributeMap { /** * Put the attribute into this map. *

    - * If the attribute value is an {@link AttributeMapBindingListener} this map - * will publish {@link AttributeMapBindingEvent binding events} such as on - * "bind" and "unbind" if supported. + * If the attribute value is an {@link AttributeMapBindingListener} this map will publish + * {@link AttributeMapBindingEvent binding events} such as on "bind" and "unbind" if supported. *

    * Note: not all MutableAttributeMap implementations support this. * @param attributeName the attribute name * @param attributeValue the attribute value - * @return the previous value of the attribute, or null of there - * was no previous value + * @return the previous value of the attribute, or null of there was no previous value */ public Object put(String attributeName, Object attributeValue); @@ -51,8 +48,8 @@ public interface MutableAttributeMap extends AttributeMap { /** * Remove an attribute from this map. * @param attributeName the name of the attribute to remove - * @return previous value associated with specified attribute name, or - * null if there was no mapping for the name + * @return previous value associated with specified attribute name, or null if there was no mapping for + * the name */ public Object remove(String attributeName); @@ -63,8 +60,7 @@ public interface MutableAttributeMap extends AttributeMap { public MutableAttributeMap clear(); /** - * Replace the contents of this attribute map with the contents of the - * provided collection. + * Replace the contents of this attribute map with the contents of the provided collection. * @param attributes the attribute collection * @return this, to support call chaining */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/ParameterMap.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/ParameterMap.java index 7d57728d..00b83559 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/ParameterMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/ParameterMap.java @@ -20,12 +20,11 @@ import org.springframework.binding.convert.ConversionException; import org.springframework.web.multipart.MultipartFile; /** - * An interface for accessing parameters in a backing map. Parameters are - * immutable and have string keys and string values. + * An interface for accessing parameters in a backing map. Parameters are immutable and have string keys and string + * values. *

    - * The accessor methods offered by this class taking a target type argument - * only need to support conversions to well know types like String, Number subclasses, - * Boolean and so on. + * The accessor methods offered by this class taking a target type argument only need to support conversions to well + * know types like String, Number subclasses, Boolean and so on. * * @author Keith Donald */ @@ -51,8 +50,7 @@ public interface ParameterMap extends MapAdaptable { public boolean contains(String parameterName); /** - * Get a parameter value, returning null if no value is - * found. + * Get a parameter value, returning null if no value is found. * @param parameterName the parameter name * @return the parameter value */ @@ -67,17 +65,16 @@ public interface ParameterMap extends MapAdaptable { public String get(String parameterName, String defaultValue); /** - * Get a multi-valued parameter value, returning null if no - * value is found. If the parameter is single valued an array with a single - * element is returned. + * Get a multi-valued parameter value, returning null if no value is found. If the parameter is + * single valued an array with a single element is returned. * @param parameterName the parameter name * @return the parameter value array */ public String[] getArray(String parameterName); /** - * Get a multi-valued parameter value, converting each value to the target - * type or returning null if no value is found. + * Get a multi-valued parameter value, converting each value to the target type or returning null if + * no value is found. * @param parameterName the parameter name * @param targetElementType the target type of the array's elements * @return the converterd parameter value array @@ -86,8 +83,7 @@ public interface ParameterMap extends MapAdaptable { public Object[] getArray(String parameterName, Class targetElementType) throws ConversionException; /** - * Get a parameter value, converting it from String to the - * target type. + * Get a parameter value, converting it from String to the target type. * @param parameterName the name of the parameter * @param targetType the target type of the parameter value * @return the converted parameter value, or null if not found @@ -96,8 +92,8 @@ public interface ParameterMap extends MapAdaptable { public Object get(String parameterName, Class targetType) throws ConversionException; /** - * Get a parameter value, converting it from String to the - * target type or returning the defaultValue if not found. + * Get a parameter value, converting it from String to the target type or returning the defaultValue + * if not found. * @param parameterName name of the parameter to get * @param targetType the target type of the parameter value * @param defaultValue the default value @@ -123,8 +119,7 @@ public interface ParameterMap extends MapAdaptable { public String[] getRequiredArray(String parameterName) throws IllegalArgumentException; /** - * Get a required multi-valued parameter value, converting each value to the - * target type. + * Get a required multi-valued parameter value, converting each value to the target type. * @param parameterName the name of the parameter * @return the parameter value * @throws IllegalArgumentException when the parameter is not found @@ -145,8 +140,8 @@ public interface ParameterMap extends MapAdaptable { ConversionException; /** - * Returns a number parameter value in the map that is of the specified - * type, returning null if no value was found. + * Returns a number parameter value in the map that is of the specified type, returning null if no + * value was found. * @param parameterName the parameter name * @param targetType the target number type * @return the number parameter value @@ -155,8 +150,8 @@ public interface ParameterMap extends MapAdaptable { public Number getNumber(String parameterName, Class targetType) throws ConversionException; /** - * Returns a number parameter value in the map of the specified type, - * returning the defaultValue if no value was found. + * Returns a number parameter value in the map of the specified type, returning the defaultValue if no value was + * found. * @param parameterName the parameter name * @param defaultValue the default * @return the number parameter value @@ -165,8 +160,8 @@ public interface ParameterMap extends MapAdaptable { public Number getNumber(String parameterName, Class targetType, Number defaultValue) throws ConversionException; /** - * Returns a number parameter value in the map, throwing an exception if the - * parameter is not present or could not be converted. + * Returns a number parameter value in the map, throwing an exception if the parameter is not present or could not + * be converted. * @param parameterName the parameter name * @return the number parameter value * @throws IllegalArgumentException if the parameter is not present @@ -176,8 +171,7 @@ public interface ParameterMap extends MapAdaptable { ConversionException; /** - * Returns an integer parameter value in the map, returning - * null if no value was found. + * Returns an integer parameter value in the map, returning null if no value was found. * @param parameterName the parameter name * @return the integer parameter value * @throws ConversionException when the value could not be converted @@ -185,8 +179,7 @@ public interface ParameterMap extends MapAdaptable { public Integer getInteger(String parameterName) throws ConversionException; /** - * Returns an integer parameter value in the map, returning the defaultValue - * if no value was found. + * Returns an integer parameter value in the map, returning the defaultValue if no value was found. * @param parameterName the parameter name * @param defaultValue the default * @return the integer parameter value @@ -195,8 +188,8 @@ public interface ParameterMap extends MapAdaptable { public Integer getInteger(String parameterName, Integer defaultValue) throws ConversionException; /** - * Returns an integer parameter value in the map, throwing an exception if - * the parameter is not present or could not be converted. + * Returns an integer parameter value in the map, throwing an exception if the parameter is not present or could not + * be converted. * @param parameterName the parameter name * @return the integer parameter value * @throws IllegalArgumentException if the parameter is not present @@ -205,8 +198,7 @@ public interface ParameterMap extends MapAdaptable { public Integer getRequiredInteger(String parameterName) throws IllegalArgumentException, ConversionException; /** - * Returns a long parameter value in the map, returning null - * if no value was found. + * Returns a long parameter value in the map, returning null if no value was found. * @param parameterName the parameter name * @return the long parameter value * @throws ConversionException when the value could not be converted @@ -214,8 +206,7 @@ public interface ParameterMap extends MapAdaptable { public Long getLong(String parameterName) throws ConversionException; /** - * Returns a long parameter value in the map, returning the defaultValue if - * no value was found. + * Returns a long parameter value in the map, returning the defaultValue if no value was found. * @param parameterName the parameter name * @param defaultValue the default * @return the long parameter value @@ -224,8 +215,8 @@ public interface ParameterMap extends MapAdaptable { public Long getLong(String parameterName, Long defaultValue) throws ConversionException; /** - * Returns a long parameter value in the map, throwing an exception if the - * parameter is not present or could not be converted. + * Returns a long parameter value in the map, throwing an exception if the parameter is not present or could not be + * converted. * @param parameterName the parameter name * @return the long parameter value * @throws IllegalArgumentException if the parameter is not present @@ -234,8 +225,7 @@ public interface ParameterMap extends MapAdaptable { public Long getRequiredLong(String parameterName) throws IllegalArgumentException, ConversionException; /** - * Returns a boolean parameter value in the map, returning null - * if no value was found. + * Returns a boolean parameter value in the map, returning null if no value was found. * @param parameterName the parameter name * @return the long parameter value * @throws ConversionException when the value could not be converted @@ -243,8 +233,7 @@ public interface ParameterMap extends MapAdaptable { public Boolean getBoolean(String parameterName) throws ConversionException; /** - * Returns a boolean parameter value in the map, returning the defaultValue - * if no value was found. + * Returns a boolean parameter value in the map, returning the defaultValue if no value was found. * @param parameterName the parameter name * @param defaultValue the default * @return the boolean parameter value @@ -253,8 +242,8 @@ public interface ParameterMap extends MapAdaptable { public Boolean getBoolean(String parameterName, Boolean defaultValue) throws ConversionException; /** - * Returns a boolean parameter value in the map, throwing an exception if - * the parameter is not present or could not be converted. + * Returns a boolean parameter value in the map, throwing an exception if the parameter is not present or could not + * be converted. * @param parameterName the parameter name * @return the boolean parameter value * @throws IllegalArgumentException if the parameter is not present @@ -263,8 +252,7 @@ public interface ParameterMap extends MapAdaptable { public Boolean getRequiredBoolean(String parameterName) throws IllegalArgumentException, ConversionException; /** - * Get a multi-part file parameter value, returning null if - * no value is found. + * Get a multi-part file parameter value, returning null if no value is found. * @param parameterName the parameter name * @return the multipart file */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/SharedAttributeMap.java b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/SharedAttributeMap.java index b1b2be1e..b957e8ae 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/core/collection/SharedAttributeMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/core/collection/SharedAttributeMap.java @@ -16,16 +16,14 @@ package org.springframework.webflow.core.collection; /** - * An interface to be implemented by mutable attribute maps accessed by - * multiple threads that need to be synchronized. + * An interface to be implemented by mutable attribute maps accessed by multiple threads that need to be synchronized. * * @author Keith Donald */ public interface SharedAttributeMap extends MutableAttributeMap { /** - * Returns the shared map's mutex, which may be synchronized on to block - * access to the map by other threads. + * Returns the shared map's mutex, which may be synchronized on to block access to the map by other threads. */ public Object getMutex(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/Annotated.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/Annotated.java index d8dc5563..dcb74f1c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/Annotated.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/Annotated.java @@ -18,8 +18,7 @@ package org.springframework.webflow.definition; import org.springframework.webflow.core.collection.AttributeMap; /** - * An interface to be implemented by objects that are annotated with attributes - * they wish to expose to clients. + * An interface to be implemented by objects that are annotated with attributes they wish to expose to clients. * * @author Keith Donald * @author Erwin Vervaet @@ -27,8 +26,7 @@ import org.springframework.webflow.core.collection.AttributeMap; public interface Annotated { /** - * Returns a short summary of this object, suitable for display as - * an icon caption or tool tip. + * Returns a short summary of this object, suitable for display as an icon caption or tool tip. * @return the caption */ public String getCaption(); @@ -40,9 +38,8 @@ public interface Annotated { public String getDescription(); /** - * Returns an immutable attribute map containing the attributes annotating - * this object. These attributes provide descriptive characteristics or - * properties that may affect object behavior. + * Returns an immutable attribute map containing the attributes annotating this object. These attributes provide + * descriptive characteristics or properties that may affect object behavior. * @return the attribute map */ public AttributeMap getAttributes(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/FlowDefinition.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/FlowDefinition.java index 6e5baae8..6fddd2c1 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/FlowDefinition.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/FlowDefinition.java @@ -16,29 +16,23 @@ package org.springframework.webflow.definition; /** - * The definition of a flow, a program that when executed carries out the - * orchestration of a task on behalf of a single client. + * The definition of a flow, a program that when executed carries out the orchestration of a task on behalf of a single + * client. *

    - * A flow definition is a reusable, self-contained controller module that - * defines a blue print for an executable user task. Flows typically orchestrate - * controlled navigations or dialogs within web applications to guide users - * through fulfillment of a business process/goal that takes place over a series - * of steps, modeled as states. + * A flow definition is a reusable, self-contained controller module that defines a blue print for an executable user + * task. Flows typically orchestrate controlled navigations or dialogs within web applications to guide users through + * fulfillment of a business process/goal that takes place over a series of steps, modeled as states. *

    - * Structurally a flow definition is composed of a set of states. A - * {@link StateDefinition state} is a point in a flow where a behavior is - * executed; for example, showing a view, executing an action, spawning a - * subflow, or terminating the flow. Different types of states execute different - * behaviors in a polymorphic fashion. Most states are - * {@link TransitionableStateDefinition transitionable states}, meaning they - * can respond to events by taking the flow from one state to another. + * Structurally a flow definition is composed of a set of states. A {@link StateDefinition state} is a point in a flow + * where a behavior is executed; for example, showing a view, executing an action, spawning a subflow, or terminating + * the flow. Different types of states execute different behaviors in a polymorphic fashion. Most states are + * {@link TransitionableStateDefinition transitionable states}, meaning they can respond to events by taking the flow + * from one state to another. *

    - * Each flow has exactly one {@link #getStartState() start state} which defines - * the starting point of the program. + * Each flow has exactly one {@link #getStartState() start state} which defines the starting point of the program. *

    - * This interface exposes the flow's identifier, states, and other definitional - * attributes. It is suitable for introspection by tools as well as user-code at - * flow execution time. + * This interface exposes the flow's identifier, states, and other definitional attributes. It is suitable for + * introspection by tools as well as user-code at flow execution time. *

    * Flow definitions may be annotated with attributes. * diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/StateDefinition.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/StateDefinition.java index 5c1d364a..286d600f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/StateDefinition.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/StateDefinition.java @@ -16,11 +16,10 @@ package org.springframework.webflow.definition; /** - * A step within a {@link FlowDefinition flow definition} where behavior is - * executed. + * A step within a {@link FlowDefinition flow definition} where behavior is executed. *

    - * States have identifiers that are local to their containing flow definitions. - * They may also be annotated with attributes. + * States have identifiers that are local to their containing flow definitions. They may also be annotated with + * attributes. * * @author Keith Donald * @author Erwin Vervaet @@ -32,10 +31,9 @@ public interface StateDefinition extends Annotated { * @return the owning flow definition */ public FlowDefinition getOwner(); - + /** - * Returns this state's identifier, locally unique to is containing flow - * definition. + * Returns this state's identifier, locally unique to is containing flow definition. * @return the state identifier */ public String getId(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionDefinition.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionDefinition.java index b37d6bd4..80c98799 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionDefinition.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionDefinition.java @@ -24,17 +24,15 @@ package org.springframework.webflow.definition; public interface TransitionDefinition extends Annotated { /** - * The identifier of this transition. This id value should be unique among - * all other transitions in a set. + * The identifier of this transition. This id value should be unique among all other transitions in a set. * @return the transition identifier */ public String getId(); /** - * Returns an identification of the target state of this transition. - * This could be an actual static state id or something more dynamic, - * like a string representation of an expression evaluating the target - * state id at flow execution time. + * Returns an identification of the target state of this transition. This could be an actual static state id or + * something more dynamic, like a string representation of an expression evaluating the target state id at flow + * execution time. * @return the target state identifier */ public String getTargetStateId(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionableStateDefinition.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionableStateDefinition.java index 794e5e37..c5075fc6 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionableStateDefinition.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/TransitionableStateDefinition.java @@ -22,7 +22,7 @@ package org.springframework.webflow.definition; * @author Erwin Vervaet */ public interface TransitionableStateDefinition extends StateDefinition { - + /** * Returns the available transitions out of this state. * @return the available state transitions diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/AbstractFlowDefinitionRegistryFactoryBean.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/AbstractFlowDefinitionRegistryFactoryBean.java index 1d6c7cbc..f4435e40 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/AbstractFlowDefinitionRegistryFactoryBean.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/AbstractFlowDefinitionRegistryFactoryBean.java @@ -19,10 +19,9 @@ import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.InitializingBean; /** - * A base class for factory beans that create populated flow definition registries. - * Subclasses should override the {@link #doPopulate(FlowDefinitionRegistry)} method - * to perform the registry population logic, typically delegating to a - * {@link FlowDefinitionRegistrar} strategy to perform the population. + * A base class for factory beans that create populated flow definition registries. Subclasses should override the + * {@link #doPopulate(FlowDefinitionRegistry)} method to perform the registry population logic, typically delegating to + * a {@link FlowDefinitionRegistrar} strategy to perform the population. * * @author Keith Donald */ @@ -34,11 +33,9 @@ public abstract class AbstractFlowDefinitionRegistryFactoryBean implements Facto private FlowDefinitionRegistry registry = createFlowDefinitionRegistry(); /** - * Sets the parent registry of the registry constructed by this factory - * bean. + * Sets the parent registry of the registry constructed by this factory bean. *

    - * A child registry will delegate to its parent if it cannot fulfill a - * request to locate a flow definition itself. + * A child registry will delegate to its parent if it cannot fulfill a request to locate a flow definition itself. * @param parent the parent flow definition registry */ public void setParent(FlowDefinitionRegistry parent) { @@ -53,7 +50,7 @@ public abstract class AbstractFlowDefinitionRegistryFactoryBean implements Facto } // implementing FactoryBean - + public Class getObjectType() { return FlowDefinitionRegistry.class; } @@ -75,26 +72,22 @@ public abstract class AbstractFlowDefinitionRegistryFactoryBean implements Facto } // subclassing hooks - + /** - * Create the flow definition registry to be populated in - * {@link #doPopulate(FlowDefinitionRegistry)}. Subclasses can override - * this method if they want to use a custom flow definition registry - * implementation. + * Create the flow definition registry to be populated in {@link #doPopulate(FlowDefinitionRegistry)}. Subclasses + * can override this method if they want to use a custom flow definition registry implementation. */ protected FlowDefinitionRegistry createFlowDefinitionRegistry() { return new FlowDefinitionRegistryImpl(); } - + /** - * Template method subclasses may override to perform factory bean initialization - * logic before registry population. Will be called before - * {@link #doPopulate(FlowDefinitionRegistry)}. The default implementation - * is empty. + * Template method subclasses may override to perform factory bean initialization logic before registry population. + * Will be called before {@link #doPopulate(FlowDefinitionRegistry)}. The default implementation is empty. */ protected void init() { } - + /** * Template method subclasses must override to perform registry population. * @param registry the flow definition registry to populate diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/ExternalizedFlowDefinitionRegistrar.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/ExternalizedFlowDefinitionRegistrar.java index f2f8b486..8397d189 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/ExternalizedFlowDefinitionRegistrar.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/ExternalizedFlowDefinitionRegistrar.java @@ -24,26 +24,21 @@ import org.springframework.core.io.Resource; import org.springframework.core.style.ToStringCreator; /** - * A flow definition registrar that populates a flow definition registry from - * flow definitions defined within externalized resources. Encapsulates - * registration behavior common to all externalized registrars and is not tied - * to a specific flow definition format (e.g. xml). + * A flow definition registrar that populates a flow definition registry from flow definitions defined within + * externalized resources. Encapsulates registration behavior common to all externalized registrars and is not tied to a + * specific flow definition format (e.g. xml). *

    - * Concrete subclasses are expected to derive from this class to provide - * knowledge about a particular kind of definition format by implementing the - * abstract template methods in this class. + * Concrete subclasses are expected to derive from this class to provide knowledge about a particular kind of definition + * format by implementing the abstract template methods in this class. *

    - * By default, when configuring the {@link #setLocations(Resource[]) locations} - * property, flow definitions at those locations will be assigned a registry - * identifier equal to the filename of the underlying definition resource, minus - * the filename extension. For example, a XML-based flow definition defined in - * the file "flow1.xml" will be identified as "flow1" when registered in a - * registry. + * By default, when configuring the {@link #setLocations(Resource[]) locations} property, flow definitions at those + * locations will be assigned a registry identifier equal to the filename of the underlying definition resource, minus + * the filename extension. For example, a XML-based flow definition defined in the file "flow1.xml" will be identified + * as "flow1" when registered in a registry. *

    - * For full control over the assignment of flow identifiers and flow properties, - * configure formal - * {@link org.springframework.webflow.definition.registry.FlowDefinitionResource} - * instances using the {@link #setResources(FlowDefinitionResource[] resources)} property. + * For full control over the assignment of flow identifiers and flow properties, configure formal + * {@link org.springframework.webflow.definition.registry.FlowDefinitionResource} instances using the + * {@link #setResources(FlowDefinitionResource[] resources)} property. * * @see org.springframework.webflow.definition.registry.FlowDefinitionResource * @see org.springframework.webflow.definition.registry.FlowDefinitionRegistry @@ -53,23 +48,19 @@ import org.springframework.core.style.ToStringCreator; public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinitionRegistrar { /** - * File locations of externalized flow definition resources to load. - * A set of {@link Resource}} objects. + * File locations of externalized flow definition resources to load. A set of {@link Resource}} objects. */ private Set locations = new HashSet(); /** - * A set of formal externalized flow definitions to load. - * A set of {@link FlowDefinitionResource} objects. + * A set of formal externalized flow definitions to load. A set of {@link FlowDefinitionResource} objects. */ private Set resources = new HashSet(); /** - * Sets the locations (file paths) pointing to externalized flow - * definitions. + * Sets the locations (file paths) pointing to externalized flow definitions. *

    - * Flows registered from this set will be automatically assigned an id based - * on the filename of the flow resource. + * Flows registered from this set will be automatically assigned an id based on the filename of the flow resource. * @param locations the resource locations */ public void setLocations(Resource[] locations) { @@ -77,11 +68,10 @@ public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinit } /** - * Sets the formal set of externalized flow definitions this registrar will - * register. + * Sets the formal set of externalized flow definitions this registrar will register. *

    - * Use this method when you want full control over the assigned flow id and - * the set of properties applied to the externalized flow resources. + * Use this method when you want full control over the assigned flow id and the set of properties applied to the + * externalized flow resources. * @param resources the externalized flow definition specifications */ public void setResources(FlowDefinitionResource[] resources) { @@ -91,8 +81,8 @@ public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinit /** * Adds a flow location pointing to an externalized flow resource. *

    - * The flow registered from this location will automatically assigned an id - * based on the filename of the flow resource. + * The flow registered from this location will automatically assigned an id based on the filename of the flow + * resource. * @param location the definition location */ public boolean addLocation(Resource location) { @@ -102,8 +92,8 @@ public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinit /** * Adds the flow locations pointing to externalized flow resources. *

    - * The flow registered from this location will automatically assigned an id - * based on the filename of the flow resource. + * The flow registered from this location will automatically assigned an id based on the filename of the flow + * resource. * @param locations the definition locations */ public boolean addLocations(Resource[] locations) { @@ -114,11 +104,10 @@ public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinit } /** - * Adds an externalized flow definition specification pointing to an - * externalized flow resource. + * Adds an externalized flow definition specification pointing to an externalized flow resource. *

    - * Use this method when you want full control over the assigned flow id and - * the set of properties applied to the externalized flow resource. + * Use this method when you want full control over the assigned flow id and the set of properties applied to the + * externalized flow resource. * @param resource the definition the definition resource */ public boolean addResource(FlowDefinitionResource resource) { @@ -126,11 +115,10 @@ public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinit } /** - * Adds the externalized flow definitions pointing to externalized flow - * resources. + * Adds the externalized flow definitions pointing to externalized flow resources. *

    - * Use this method when you want full control over the assigned flow id and - * the set of properties applied to the externalized flow resources. + * Use this method when you want full control over the assigned flow id and the set of properties applied to the + * externalized flow resources. * @param resources the definitions */ public boolean addResources(FlowDefinitionResource[] resources) { @@ -144,7 +132,7 @@ public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinit processLocations(registry); processResources(registry); } - + // internal helpers /** @@ -154,7 +142,7 @@ public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinit private void processLocations(FlowDefinitionRegistry registry) { Iterator it = locations.iterator(); while (it.hasNext()) { - Resource location = (Resource)it.next(); + Resource location = (Resource) it.next(); if (isFlowDefinitionResource(location)) { FlowDefinitionResource resource = createFlowDefinitionResource(location); register(resource, registry); @@ -169,16 +157,14 @@ public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinit private void processResources(FlowDefinitionRegistry registry) { Iterator it = resources.iterator(); while (it.hasNext()) { - FlowDefinitionResource resource = (FlowDefinitionResource)it.next(); + FlowDefinitionResource resource = (FlowDefinitionResource) it.next(); register(resource, registry); } } /** - * Helper method to register the flow built from an externalized resource in - * the registry. - * @param resource representation of the externalized flow definition - * resource + * Helper method to register the flow built from an externalized resource in the registry. + * @param resource representation of the externalized flow definition resource * @param registry the flow registry to register the flow in */ protected final void register(FlowDefinitionResource resource, FlowDefinitionRegistry registry) { @@ -186,12 +172,10 @@ public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinit } // subclassing hooks - + /** - * Template method that calculates if the given file resource is actually a - * flow definition resource. Resources that aren't flow definitions will be - * ignored. Subclasses may override; this implementation simply returns - * true. + * Template method that calculates if the given file resource is actually a flow definition resource. Resources that + * aren't flow definitions will be ignored. Subclasses may override; this implementation simply returns true. * @param resource the underlying resource * @return true if yes, false otherwise */ @@ -200,8 +184,7 @@ public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinit } /** - * Factory method that creates a flow definition from an externalized - * resource location. + * Factory method that creates a flow definition from an externalized resource location. * @param location the location of the resource * @return the externalized flow definition pointer */ @@ -210,8 +193,8 @@ public abstract class ExternalizedFlowDefinitionRegistrar implements FlowDefinit } /** - * Template factory method subclasses must override to return the holder for - * the flow definition to be registered loaded from the specified resource. + * Template factory method subclasses must override to return the holder for the flow definition to be registered + * loaded from the specified resource. * @param resource the externalized resource * @return the flow definition holder */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionConstructionException.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionConstructionException.java index 1f04d2b0..6bd4ff14 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionConstructionException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionConstructionException.java @@ -18,19 +18,18 @@ package org.springframework.webflow.definition.registry; import org.springframework.webflow.core.FlowException; /** - * Thrown when a flow definition was found during a lookup operation - * but could not be constructed. + * Thrown when a flow definition was found during a lookup operation but could not be constructed. * * @author Keith Donald * @author Erwin Vervaet */ public abstract class FlowDefinitionConstructionException extends FlowException { - + /** * The id of the flow that could not be constructed. */ private String flowId; - + /** * Creates an exception indicating a flow definition could not be constructed. * @param flowId the flow id @@ -40,7 +39,7 @@ public abstract class FlowDefinitionConstructionException extends FlowException super("An exception occured constructing the flow with id '" + flowId + "'", cause); this.flowId = flowId; } - + /** * Returns the id of the flow definition that could not be constructed. * @return the flow id diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionHolder.java index 06d11bdf..4af564cc 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionHolder.java @@ -18,8 +18,8 @@ package org.springframework.webflow.definition.registry; import org.springframework.webflow.definition.FlowDefinition; /** - * A holder holding a reference to a Flow definition. Provides a layer of - * indirection, enabling things like "hot-reloadable" flow definitions. + * A holder holding a reference to a Flow definition. Provides a layer of indirection, enabling things like + * "hot-reloadable" flow definitions. * * @see FlowDefinitionRegistry#registerFlowDefinition(FlowDefinitionHolder) * @@ -28,27 +28,23 @@ import org.springframework.webflow.definition.FlowDefinition; public interface FlowDefinitionHolder { /** - * Returns the id of the flow definition held by this holder. - * This is a lightweight method callers may call to obtain the id of - * the flow without triggering full flow definition assembly (which may be - * an expensive operation). + * Returns the id of the flow definition held by this holder. This is a lightweight method + * callers may call to obtain the id of the flow without triggering full flow definition assembly (which may be an + * expensive operation). */ public String getFlowDefinitionId(); /** - * Returns the flow definition held by this holder. Calling this method the - * first time may trigger flow assembly (which may be expensive). - * @throws FlowDefinitionConstructionException if there is a problem constructing - * the target flow definition + * Returns the flow definition held by this holder. Calling this method the first time may trigger flow assembly + * (which may be expensive). + * @throws FlowDefinitionConstructionException if there is a problem constructing the target flow definition */ public FlowDefinition getFlowDefinition() throws FlowDefinitionConstructionException; /** - * Refresh the flow definition held by this holder. Calling this method - * typically triggers flow reassembly, which may include a refresh from an - * externalized resource such as a file. - * @throws FlowDefinitionConstructionException if there is a problem constructing - * the target flow definition + * Refresh the flow definition held by this holder. Calling this method typically triggers flow reassembly, which + * may include a refresh from an externalized resource such as a file. + * @throws FlowDefinitionConstructionException if there is a problem constructing the target flow definition */ public void refresh() throws FlowDefinitionConstructionException; } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionLocator.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionLocator.java index ccefa49f..6e730080 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionLocator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionLocator.java @@ -18,11 +18,10 @@ package org.springframework.webflow.definition.registry; import org.springframework.webflow.definition.FlowDefinition; /** - * A runtime service locator interface for retrieving flow definitions by - * id. + * A runtime service locator interface for retrieving flow definitions by id. *

    - * Flow locators are needed by flow executors at runtime to retrieve - * fully-configured flow definitions to support launching new flow executions. + * Flow locators are needed by flow executors at runtime to retrieve fully-configured flow definitions to support + * launching new flow executions. * * @author Keith Donald * @author Erwin Vervaet @@ -33,11 +32,9 @@ public interface FlowDefinitionLocator { * Lookup the flow definition with the specified id. * @param id the flow definition id * @return the flow definition - * @throws NoSuchFlowDefinitionException when the flow definition with the - * specified id does not exist - * @throws FlowDefinitionConstructionException if there is a problem constructing - * the identified flow definition + * @throws NoSuchFlowDefinitionException when the flow definition with the specified id does not exist + * @throws FlowDefinitionConstructionException if there is a problem constructing the identified flow definition */ - public FlowDefinition getFlowDefinition(String id) - throws NoSuchFlowDefinitionException, FlowDefinitionConstructionException; + public FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException, + FlowDefinitionConstructionException; } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistrar.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistrar.java index 7247fdeb..ac0841e4 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistrar.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistrar.java @@ -16,12 +16,10 @@ package org.springframework.webflow.definition.registry; /** - * A strategy to use to populate a flow definition registry with one or more flow - * definitions. + * A strategy to use to populate a flow definition registry with one or more flow definitions. *

    - * Flow definition registrars encapsulate the knowledge about the source of a set of flow - * definition resources and the behavior necessary to add those resources to a - * flow definition registry. + * Flow definition registrars encapsulate the knowledge about the source of a set of flow definition resources and the + * behavior necessary to add those resources to a flow definition registry. *

    * The typical usage pattern is as follows: *

      @@ -30,9 +28,8 @@ package org.springframework.webflow.definition.registry; * {@link #registerFlowDefinitions(FlowDefinitionRegistry)}. *
    *

    - * This design where various registrars populate a generic registry was - * inspired by Spring's GenericApplicationContext, which can use any number of - * BeanDefinitionReaders to drive context population. + * This design where various registrars populate a generic registry was inspired by Spring's GenericApplicationContext, + * which can use any number of BeanDefinitionReaders to drive context population. * * @see FlowDefinitionRegistry * @@ -41,8 +38,7 @@ package org.springframework.webflow.definition.registry; public interface FlowDefinitionRegistrar { /** - * Register flow definition resources managed by this registrar in the - * registry provided. + * Register flow definition resources managed by this registrar in the registry provided. * @param registry the registry to register flow definitions in */ public void registerFlowDefinitions(FlowDefinitionRegistry registry); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistry.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistry.java index e8fadf9e..901d2b4c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistry.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistry.java @@ -18,41 +18,37 @@ package org.springframework.webflow.definition.registry; import org.springframework.webflow.definition.FlowDefinition; /** - * A container of flow definitions. Extends the {@link FlowDefinitionRegistryMBean} - * management interface exposing registry monitoring and management operations. - * Also extends {@link FlowDefinitionLocator} for accessing registered Flow - * definitions for execution at runtime. + * A container of flow definitions. Extends the {@link FlowDefinitionRegistryMBean} management interface exposing + * registry monitoring and management operations. Also extends {@link FlowDefinitionLocator} for accessing registered + * Flow definitions for execution at runtime. *

    - * Flow definition registries can be configured with a "parent" registry to provide a hook - * into a larger flow definition registry hierarchy. + * Flow definition registries can be configured with a "parent" registry to provide a hook into a larger flow definition + * registry hierarchy. * * @author Keith Donald */ public interface FlowDefinitionRegistry extends FlowDefinitionLocator, FlowDefinitionRegistryMBean { /** - * Sets this registry's parent registry. When asked by a client to locate a - * flow definition this registry will query it's parent if it cannot - * fullfill the lookup request itself. + * Sets this registry's parent registry. When asked by a client to locate a flow definition this registry will query + * it's parent if it cannot fullfill the lookup request itself. * @param parent the parent flow definition registry, may be null */ public void setParent(FlowDefinitionRegistry parent); /** - * Return all flow definitions registered in this registry. Note that this - * will trigger flow assemply for all registered flow definitions (which may - * be expensive). + * Return all flow definitions registered in this registry. Note that this will trigger flow assemply for all + * registered flow definitions (which may be expensive). * @return the flow definitions - * @throws FlowDefinitionConstructionException if there is a problem constructing - * one of the registered flow definitions + * @throws FlowDefinitionConstructionException if there is a problem constructing one of the registered flow + * definitions */ public FlowDefinition[] getFlowDefinitions() throws FlowDefinitionConstructionException; /** - * Register a flow definition in this registry. Registers a "holder", not - * the Flow definition itself. This allows the actual Flow definition to be - * loaded lazily only when needed, and also rebuilt at runtime when its - * underlying resource changes without redeploy. + * Register a flow definition in this registry. Registers a "holder", not the Flow definition itself. This allows + * the actual Flow definition to be loaded lazily only when needed, and also rebuilt at runtime when its underlying + * resource changes without redeploy. * @param flowHolder a holder holding the flow definition to register */ public void registerFlowDefinition(FlowDefinitionHolder flowHolder); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImpl.java index b718a81e..710a6ba4 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImpl.java @@ -29,15 +29,14 @@ import org.springframework.webflow.definition.FlowDefinition; /** * A generic registry implementation for housing one or more flow definitions. *

    - * This registry may be refreshed at runtime to "hot reload" refreshable flow - * definitions. Note that the refresh will only reload already registered - * flow definitions but will not detect any new flow definitions or remove - * flow definitions that no longer exist. + * This registry may be refreshed at runtime to "hot reload" refreshable flow definitions. Note that the refresh will + * only reload already registered flow definitions but will not detect any new flow definitions or remove flow + * definitions that no longer exist. * * @author Keith Donald */ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { - + private static final Log logger = LogFactory.getLog(FlowDefinitionRegistryImpl.class); /** @@ -49,11 +48,11 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { * An optional parent flow definition registry. */ private FlowDefinitionRegistry parent; - + // implementing FlowDefinitionRegistryMBean public String[] getFlowDefinitionIds() { - return (String[])flowDefinitions.keySet().toArray(new String[flowDefinitions.size()]); + return (String[]) flowDefinitions.keySet().toArray(new String[flowDefinitions.size()]); } public int getFlowDefinitionCount() { @@ -76,9 +75,9 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { LinkedList needsReindexing = new LinkedList(); Iterator it = flowDefinitions.entrySet().iterator(); while (it.hasNext()) { - Map.Entry entry = (Map.Entry)it.next(); - String key = (String)entry.getKey(); - FlowDefinitionHolder holder = (FlowDefinitionHolder)entry.getValue(); + Map.Entry entry = (Map.Entry) it.next(); + String key = (String) entry.getKey(); + FlowDefinitionHolder holder = (FlowDefinitionHolder) entry.getValue(); holder.refresh(); if (!holder.getFlowDefinitionId().equals(key)) { needsReindexing.add(new Indexed(key, holder)); @@ -86,17 +85,15 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { } it = needsReindexing.iterator(); while (it.hasNext()) { - Indexed indexed = (Indexed)it.next(); + Indexed indexed = (Indexed) it.next(); reindex(indexed.holder, indexed.key); } - } - finally { + } finally { Thread.currentThread().setContextClassLoader(loader); } } - public void refresh(String flowId) - throws NoSuchFlowDefinitionException, FlowDefinitionConstructionException { + public void refresh(String flowId) throws NoSuchFlowDefinitionException, FlowDefinitionConstructionException { if (logger.isDebugEnabled()) { logger.debug("Refreshing flow with id '" + flowId + "'"); } @@ -109,16 +106,15 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { if (!holder.getFlowDefinitionId().equals(flowId)) { reindex(holder, flowId); } - } - finally { + } finally { Thread.currentThread().setContextClassLoader(loader); } } - + // implementing FlowDefinitionLocator - - public FlowDefinition getFlowDefinition(String id) - throws NoSuchFlowDefinitionException, FlowDefinitionConstructionException { + + public FlowDefinition getFlowDefinition(String id) throws NoSuchFlowDefinitionException, + FlowDefinitionConstructionException { Assert.hasText(id, "Unable to load a flow definition: no flow id was provided. Please provide a valid flow identifier."); if (logger.isDebugEnabled()) { @@ -126,8 +122,7 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { } try { return getFlowDefinitionHolder(id).getFlowDefinition(); - } - catch (NoSuchFlowDefinitionException e) { + } catch (NoSuchFlowDefinitionException e) { if (parent != null) { // try parent return parent.getFlowDefinition(id); @@ -135,22 +130,22 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { throw e; } } - + // implementing FlowDefinitionRegistry - + public void setParent(FlowDefinitionRegistry parent) { if (logger.isDebugEnabled()) { logger.debug("Setting parent flow definition registry to '" + parent + "'"); } this.parent = parent; } - + public FlowDefinition[] getFlowDefinitions() throws FlowDefinitionConstructionException { FlowDefinition[] flows = new FlowDefinition[flowDefinitions.size()]; Iterator it = flowDefinitions.values().iterator(); int i = 0; while (it.hasNext()) { - FlowDefinitionHolder holder = (FlowDefinitionHolder)it.next(); + FlowDefinitionHolder holder = (FlowDefinitionHolder) it.next(); flows[i] = holder.getFlowDefinition(); i++; } @@ -166,8 +161,8 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { } /** - * Remove identified flow definition from this registry. If the given - * id is not known in this registry, nothing will happen. + * Remove identified flow definition from this registry. If the given id is not known in this registry, nothing will + * happen. * @param id the flow definition id */ public void removeFlowDefinition(String id) { @@ -177,7 +172,7 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { } flowDefinitions.remove(id); } - + // internal helpers /** @@ -200,11 +195,10 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { } /** - * Returns the identified flow definition holder. Throws an exception - * if it cannot be found. + * Returns the identified flow definition holder. Throws an exception if it cannot be found. */ private FlowDefinitionHolder getFlowDefinitionHolder(String id) throws NoSuchFlowDefinitionException { - FlowDefinitionHolder flowHolder = (FlowDefinitionHolder)flowDefinitions.get(id); + FlowDefinitionHolder flowHolder = (FlowDefinitionHolder) flowDefinitions.get(id); if (flowHolder == null) { throw new NoSuchFlowDefinitionException(id, getFlowDefinitionIds()); } @@ -212,13 +206,13 @@ public class FlowDefinitionRegistryImpl implements FlowDefinitionRegistry { } /** - * Simple value object that holds the key for an indexed flow definition - * holder in this registry. Used to support reindexing on a refresh. + * Simple value object that holds the key for an indexed flow definition holder in this registry. Used to support + * reindexing on a refresh. * * @author Keith Donald */ private static class Indexed { - + private String key; private FlowDefinitionHolder holder; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryMBean.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryMBean.java index 085dda94..6b16c4ec 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryMBean.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryMBean.java @@ -16,13 +16,12 @@ package org.springframework.webflow.definition.registry; /** - * A management interface for managing flow definition registries at runtime. - * Provides the ability to query the size and state of the registry, as well as - * refresh registered flow definitions at runtime. + * A management interface for managing flow definition registries at runtime. Provides the ability to query the size and + * state of the registry, as well as refresh registered flow definitions at runtime. *

    - * Flow registries that implement this interface may be exposed for management - * over the JMX protocol. The following is an example of using Spring's JMX - * MBeanExporter to export a flow registry to an MBeanServer: + * Flow registries that implement this interface may be exposed for management over the JMX protocol. The following is + * an example of using Spring's JMX MBeanExporter to export a flow registry to an MBeanServer: + * *

      *     <!-- Creates the registry of flow definitions for this application -->
      *     <bean name="flowRegistry" class="org.springframework.webflow...XmlFlowRegistryFactoryBean">
    @@ -44,8 +43,9 @@ package org.springframework.webflow.definition.registry;
      *         </property>
      *     </bean>
      * 
    - * With the above configuration, you may then use any JMX client (such as Sun's - * jConsole which ships with JDK 1.5) to refresh flow definitions at runtime. + * + * With the above configuration, you may then use any JMX client (such as Sun's jConsole which ships with JDK 1.5) to + * refresh flow definitions at runtime. * * @author Keith Donald */ @@ -64,28 +64,24 @@ public interface FlowDefinitionRegistryMBean { public int getFlowDefinitionCount(); /** - * Queries this registry to determine if a specific flow is contained within - * it. + * Queries this registry to determine if a specific flow is contained within it. * @param id the flow definition id - * @return true if a flow definition is contained in this registry with the - * id provided + * @return true if a flow definition is contained in this registry with the id provided */ public boolean containsFlowDefinition(String id); /** - * Refresh this flow definition registry, reloading all Flow definitions - * from their externalized representations. + * Refresh this flow definition registry, reloading all Flow definitions from their externalized representations. */ public void refresh() throws FlowDefinitionConstructionException; /** - * Refresh the Flow definition in this registry with the id - * provided, reloading it from it's externalized representation. + * Refresh the Flow definition in this registry with the id provided, reloading it from it's + * externalized representation. * @param flowDefinitionId the id of the flow definition to refresh - * @throws NoSuchFlowDefinitionException if a flow with the id provided is not - * stored in this registry + * @throws NoSuchFlowDefinitionException if a flow with the id provided is not stored in this registry */ - public void refresh(String flowDefinitionId) - throws NoSuchFlowDefinitionException, FlowDefinitionConstructionException; + public void refresh(String flowDefinitionId) throws NoSuchFlowDefinitionException, + FlowDefinitionConstructionException; } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionResource.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionResource.java index 9047a721..de74b185 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionResource.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/FlowDefinitionResource.java @@ -24,9 +24,8 @@ import org.springframework.webflow.core.collection.AttributeMap; import org.springframework.webflow.core.collection.CollectionUtils; /** - * A pointer to an externalized flow definition resource. Adds assigned - * identification information about the resource including the flow id and - * attributes. + * A pointer to an externalized flow definition resource. Adds assigned identification information about the resource + * including the flow id and attributes. * * @see ExternalizedFlowDefinitionRegistrar * @@ -50,17 +49,17 @@ public class FlowDefinitionResource implements Serializable { private Resource location; /** - * Creates a new externalized flow definition resource. The flow id assigned will be - * the same name as the externalized resource's filename, excluding the extension. + * Creates a new externalized flow definition resource. The flow id assigned will be the same name as the + * externalized resource's filename, excluding the extension. * @param location the flow resource location */ public FlowDefinitionResource(Resource location) { init(conventionalFlowId(location), location, null); } - + /** - * Creates a new externalized flow definition resource. The flow id assigned will be - * the same name as the externalized resource's filename, excluding the extension. + * Creates a new externalized flow definition resource. The flow id assigned will be the same name as the + * externalized resource's filename, excluding the extension. * @param location the flow resource location * @param attributes flow definition attributes to be assigned */ @@ -112,14 +111,14 @@ public class FlowDefinitionResource implements Serializable { if (!(o instanceof FlowDefinitionResource)) { return false; } - FlowDefinitionResource other = (FlowDefinitionResource)o; + FlowDefinitionResource other = (FlowDefinitionResource) o; return id.equals(other.id) && location.equals(other.location); } public int hashCode() { return id.hashCode() + location.hashCode(); } - + // internal helpers /** @@ -132,17 +131,16 @@ public class FlowDefinitionResource implements Serializable { this.location = location; if (attributes != null) { this.attributes = attributes; - } - else { + } else { this.attributes = CollectionUtils.EMPTY_ATTRIBUTE_MAP; } } - + // public utilities /** - * Returns the flow id assigned to the flow definition contained in given resource. - * By convention this will be the filename of the resource, excluding extension. + * Returns the flow id assigned to the flow definition contained in given resource. By convention this will be the + * filename of the resource, excluding extension. * @see FlowDefinitionResource#FlowDefinitionResource(Resource) * @see FlowDefinitionResource#FlowDefinitionResource(Resource, AttributeMap) * @since 1.0.1 @@ -152,8 +150,7 @@ public class FlowDefinitionResource implements Serializable { int extensionIndex = fileName.lastIndexOf('.'); if (extensionIndex != -1) { return fileName.substring(0, extensionIndex); - } - else { + } else { return fileName; } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/NoSuchFlowDefinitionException.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/NoSuchFlowDefinitionException.java index 58e5c864..6eff6036 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/NoSuchFlowDefinitionException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/NoSuchFlowDefinitionException.java @@ -19,8 +19,7 @@ import org.springframework.core.style.StylerUtils; import org.springframework.webflow.core.FlowException; /** - * Thrown when no flow definition was found during a lookup operation by a flow - * locator. + * Thrown when no flow definition was found during a lookup operation by a flow locator. * * @author Keith Donald * @author Erwin Vervaet @@ -35,8 +34,7 @@ public class NoSuchFlowDefinitionException extends FlowException { /** * Creates an exception indicating a flow definition could not be found. * @param flowId the flow id - * @param availableFlowIds all flow ids available to the locator generating - * this exception + * @param availableFlowIds all flow ids available to the locator generating this exception */ public NoSuchFlowDefinitionException(String flowId, String[] availableFlowIds) { super("No such flow definition with id '" + flowId + "' found; the flows available are: " diff --git a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/StaticFlowDefinitionHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/StaticFlowDefinitionHolder.java index 3728ace4..d26dea95 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/StaticFlowDefinitionHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/definition/registry/StaticFlowDefinitionHolder.java @@ -18,8 +18,7 @@ package org.springframework.webflow.definition.registry; import org.springframework.webflow.definition.FlowDefinition; /** - * A simple flow definition holder that just holds a constant singleton - * reference to a flow definition. + * A simple flow definition holder that just holds a constant singleton reference to a flow definition. * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutionException.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutionException.java index 25d9cf64..1083c3de 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutionException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutionException.java @@ -20,9 +20,8 @@ import org.springframework.webflow.execution.Action; import org.springframework.webflow.execution.FlowExecutionException; /** - * Thrown if an unhandled exception occurs when an action is executed. Typically - * wraps another exception noting the root cause failure. The root cause may be - * checked or unchecked. + * Thrown if an unhandled exception occurs when an action is executed. Typically wraps another exception noting the root + * cause failure. The root cause may be checked or unchecked. * * @see org.springframework.webflow.execution.Action * @see org.springframework.webflow.engine.ActionState @@ -40,8 +39,8 @@ public class ActionExecutionException extends FlowExecutionException { * @param executionAttributes action execution properties that may have contributed to this failure * @param cause the underlying cause */ - public ActionExecutionException(String flowId, String stateId, Action action, - AttributeMap executionAttributes, Throwable cause) { + public ActionExecutionException(String flowId, String stateId, Action action, AttributeMap executionAttributes, + Throwable cause) { super(flowId, stateId, "Exception thrown executing " + action + " in state '" + stateId + "' of flow '" + flowId + "' -- action execution attributes were '" + executionAttributes + "'", cause); } @@ -55,8 +54,8 @@ public class ActionExecutionException extends FlowExecutionException { * @param message a descriptive message * @param cause the underlying cause */ - public ActionExecutionException(String flowId, String stateId, Action action, - AttributeMap executionAttributes, String message, Throwable cause) { + public ActionExecutionException(String flowId, String stateId, Action action, AttributeMap executionAttributes, + String message, Throwable cause) { super(flowId, stateId, message, cause); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutor.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutor.java index 5744c7cb..50d67bbd 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionExecutor.java @@ -22,9 +22,8 @@ import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; /** - * A simple static helper that performs action execution that encapsulates - * common logging and exception handling logic. This is an internal helper class - * that is not normally used by application code. + * A simple static helper that performs action execution that encapsulates common logging and exception handling logic. + * This is an internal helper class that is not normally used by application code. * * @author Keith Donald * @author Erwin Vervaet @@ -44,26 +43,23 @@ public class ActionExecutor { * @param action the action to execute * @param context the flow execution request context * @return result of action execution - * @throws ActionExecutionException if the action threw an exception while - * executing, the orginal exception is available as the cause if this exception + * @throws ActionExecutionException if the action threw an exception while executing, the orginal exception is + * available as the cause if this exception */ public static Event execute(Action action, RequestContext context) throws ActionExecutionException { try { if (logger.isDebugEnabled()) { if (context.getCurrentState() == null) { logger.debug("Executing start " + action + " for flow '" + context.getActiveFlow().getId() + "'"); - } - else { + } else { logger.debug("Executing " + action + " in state '" + context.getCurrentState().getId() + "' of flow '" + context.getActiveFlow().getId() + "'"); } } return action.execute(context); - } - catch (ActionExecutionException e) { + } catch (ActionExecutionException e) { throw e; - } - catch (Exception e) { + } catch (Exception e) { // wrap the exception as an ActionExecutionException throw new ActionExecutionException(context.getActiveFlow().getId(), context.getCurrentState() != null ? context.getCurrentState().getId() : null, action, context diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionList.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionList.java index 0d284cbf..eef8205c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionList.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionList.java @@ -25,8 +25,7 @@ import org.springframework.webflow.execution.Action; import org.springframework.webflow.execution.RequestContext; /** - * An ordered, typed list of actions, mainly for use internally by flow artifacts - * that can execute groups of actions. + * An ordered, typed list of actions, mainly for use internally by flow artifacts that can execute groups of actions. * * @see Flow#getStartActionList() * @see Flow#getEndActionList() @@ -47,8 +46,7 @@ public class ActionList { /** * Add an action to this list. * @param action the action to add - * @return true if this list's contents changed as a result of the add - * operation + * @return true if this list's contents changed as a result of the add operation */ public boolean add(Action action) { return actions.add(action); @@ -57,8 +55,7 @@ public class ActionList { /** * Add a collection of actions to this list. * @param actions the actions to add - * @return true if this list's contents changed as a result of the add - * operation + * @return true if this list's contents changed as a result of the add operation */ public boolean addAll(Action[] actions) { if (actions == null) { @@ -79,8 +76,7 @@ public class ActionList { /** * Remove the action instance from this list. * @param action the action to add - * @return true if this list's contents changed as a result of the remove - * operation + * @return true if this list's contents changed as a result of the remove operation */ public boolean remove(Action action) { return actions.remove(action); @@ -100,21 +96,19 @@ public class ActionList { * @return the action the action */ public Action get(int index) throws IndexOutOfBoundsException { - return (Action)actions.get(index); + return (Action) actions.get(index); } /** - * Returns the action in this list at the provided index, exposing it as an - * annotated action. This allows clients to access specific properties about - * a target action instance if they exist. + * Returns the action in this list at the provided index, exposing it as an annotated action. This allows clients to + * access specific properties about a target action instance if they exist. * @return the action, as an annotated action */ public AnnotatedAction getAnnotated(int index) throws IndexOutOfBoundsException { Action action = get(index); if (action instanceof AnnotatedAction) { - return (AnnotatedAction)action; - } - else { + return (AnnotatedAction) action; + } else { // wrap the action; no annotations will be available return new AnnotatedAction(action); } @@ -132,13 +126,12 @@ public class ActionList { * @return the action list, as a typed array */ public Action[] toArray() { - return (Action[])actions.toArray(new Action[actions.size()]); + return (Action[]) actions.toArray(new Action[actions.size()]); } /** - * Returns the list of actions in this list as a typed annotated action - * array. This is a convenience method allowing clients to access properties - * about an action if they exist. + * Returns the list of actions in this list as a typed annotated action array. This is a convenience method allowing + * clients to access properties about an action if they exist. * @return the annotated action list, as a typed array */ public AnnotatedAction[] toAnnotatedArray() { @@ -150,14 +143,14 @@ public class ActionList { } /** - * Executes the actions contained within this action list. Simply iterates - * over each action and calls execute. Action result events are ignored. + * Executes the actions contained within this action list. Simply iterates over each action and calls execute. + * Action result events are ignored. * @param context the action execution request context */ public void execute(RequestContext context) { Iterator it = actions.iterator(); while (it.hasNext()) { - ActionExecutor.execute((Action)it.next(), context); + ActionExecutor.execute((Action) it.next(), context); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionState.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionState.java index f0bbd2d2..fb6985f7 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionState.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/ActionState.java @@ -26,24 +26,18 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * A transitionable state that executes one or more actions when entered. When - * the action(s) are executed this state responds to their result(s) to decide - * what state to transition to next. + * A transitionable state that executes one or more actions when entered. When the action(s) are executed this state + * responds to their result(s) to decide what state to transition to next. *

    - * If more than one action is configured they are executed in an ordered chain - * until one returns a result event that matches a state transition out of - * this state. This is a form of the Chain of Responsibility (CoR) pattern. + * If more than one action is configured they are executed in an ordered chain until one returns a result event that + * matches a state transition out of this state. This is a form of the Chain of Responsibility (CoR) pattern. *

    - * The result of an action's execution is typically the criteria for a - * transition out of this state. Additional information in the current - * {@link RequestContext} may also be tested as part of custom transitional - * criteria, allowing for sophisticated transition expressions that reason on - * contextual state. + * The result of an action's execution is typically the criteria for a transition out of this state. Additional + * information in the current {@link RequestContext} may also be tested as part of custom transitional criteria, + * allowing for sophisticated transition expressions that reason on contextual state. *

    - * Each action executed by this action state may be provisioned with a set of - * arbitrary execution properties. These properties are made available to the - * action at execution time and may be used to influence action execution - * behavior. + * Each action executed by this action state may be provisioned with a set of arbitrary execution properties. These + * properties are made available to the action at execution time and may be used to influence action execution behavior. *

    * Common action execution properties include: *

    @@ -52,17 +46,13 @@ import org.springframework.webflow.execution.ViewSelection; *

    * * - * + * When the 'setupForm' state above is entered, the 'setup' action will execute, followed by the 'referenceData' action. + * After 'referenceData' execution, the flow will then respond to the 'referenceData.success' event by transitioning to + * the 'displayForm' state. The 'setup.success' event that was signaled by the 'setup' action will effectively be + * ignored. * * * + * Argument ${expressions} are evaluated against the current RequestContext, allowing for data stored in + * flow scope or request scope to be passed as arguments to the POJO. In addition, POJO return values may be exposed to + * the flow automatically. See the bean invoking action type hierarchy for more information. * *
    Result object typeEvent id
    {@link org.springframework.core.enums.LabeledEnum}{@link org.springframework.core.enums.LabeledEnum#getLabel()}The result object will included in the event as an attribute - * named "result".The result object will included in the event as an attribute named "result".
    {@link java.lang.Enum}{@link java.lang.Enum#name()}The result object will included in the event as an attribute - * named "result".The result object will included in the event as an attribute named "result".
    {@link java.lang.String}Description
    nameThe 'name' property is used as a qualifier for an action's result event, - * and is typically used to allow the flow to respond to a specific action's - * outcome within a larger action chain. For example, if an action named - * myAction returns a success result, a transition - * that matches on event myAction.success will be searched, and - * if found, executed. If this action is not assigned a name a transition for - * the base success event will be searched and if found, - * executed.
    - * This is useful in situations where you want to execute actions in an ordered - * chain as part of one action state, and wish to transition on the result of - * the last one in the chain. For example: + *
    The 'name' property is used as a qualifier for an action's result event, and is typically used to allow the flow + * to respond to a specific action's outcome within a larger action chain. For example, if an action named + * myAction returns a success result, a transition that matches on event + * myAction.success will be searched, and if found, executed. If this action is not assigned a name a + * transition for the base success event will be searched and if found, executed.
    + * This is useful in situations where you want to execute actions in an ordered chain as part of one action state, and + * wish to transition on the result of the last one in the chain. For example: * *
      *     <action-state id="setupForm"> 
    @@ -72,36 +62,29 @@ import org.springframework.webflow.execution.ViewSelection;
      *     </action-state>
      * 
    * - * When the 'setupForm' state above is entered, the 'setup' action will execute, - * followed by the 'referenceData' action. After 'referenceData' execution, the - * flow will then respond to the 'referenceData.success' event by transitioning - * to the 'displayForm' state. The 'setup.success' event that was signaled by - * the 'setup' action will effectively be ignored.
    methodThe 'method' property is the name of a target method on a - * {@link org.springframework.webflow.action.MultiAction} to - * execute. In the MultiAction scenario the named method must have the signature - * public Event ${method}(RequestContext) throws Exception. - * As an example of this scenario, a method property with value setupForm - * would bind to a method on a MultiAction instance with the signature: - * public Event setupForm(RequestContext context).
    - * As an alternative to a MultiAction method binding, this action state may - * excute a - * {@link org.springframework.webflow.action.AbstractBeanInvokingAction bean invoking action} - * that invokes a method on a POJO (Plain Old Java Object). If the method - * signature accepts arguments those arguments may be specified by using the + * {@link org.springframework.webflow.action.MultiAction} to execute. In the MultiAction scenario the + * named method must have the signature public Event ${method}(RequestContext) throws Exception. As an + * example of this scenario, a method property with value setupForm would bind to a method on a + * MultiAction instance with the signature: public Event setupForm(RequestContext context).
    + * As an alternative to a MultiAction method binding, this action state may excute a + * {@link org.springframework.webflow.action.AbstractBeanInvokingAction bean invoking action} that invokes a method on a + * POJO (Plain Old Java Object). If the method signature accepts arguments those arguments may be specified by using the * format: * *
      *      methodName(${arg1}, ${arg2}, ...)
      * 
    * - * Argument ${expressions} are evaluated against the current - * RequestContext, allowing for data stored in flow scope or - * request scope to be passed as arguments to the POJO. In addition, POJO return - * values may be exposed to the flow automatically. See the bean invoking action - * type hierarchy for more information.
    * @@ -123,8 +106,7 @@ public class ActionState extends TransitionableState { * Creates a new action state. * @param flow the owning flow * @param id the state identifier (must be unique to the flow) - * @throws IllegalArgumentException when this state cannot be added to given flow, - * e.g. beasue the id is not unique + * @throws IllegalArgumentException when this state cannot be added to given flow, e.g. beasue the id is not unique * @see #getActionList() */ public ActionState(Flow flow, String id) throws IllegalArgumentException { @@ -132,8 +114,7 @@ public class ActionState extends TransitionableState { } /** - * Returns the list of actions executable by this action state. The - * returned list is mutable. + * Returns the list of actions executable by this action state. The returned list is mutable. * @return the state action list */ public ActionList getActionList() { @@ -141,13 +122,10 @@ public class ActionState extends TransitionableState { } /* - * Overrides getRequiredTransition(RequestContext) to throw a local - * NoMatchingActionResultTransitionException if a transition on the - * occurence of an action result event cannot be matched. Used to facilitate - * an action invocation chain. - *

    Note that we cannot catch NoMatchingTransitionException since that could lead to unwanted - * situations where we're catching an exception that's generated by another - * state, e.g. because of a configuration error! + * Overrides getRequiredTransition(RequestContext) to throw a local NoMatchingActionResultTransitionException if a + * transition on the occurence of an action result event cannot be matched. Used to facilitate an action invocation + * chain.

    Note that we cannot catch NoMatchingTransitionException since that could lead to unwanted situations + * where we're catching an exception that's generated by another state, e.g. because of a configuration error! */ public Transition getRequiredTransition(RequestContext context) throws NoMatchingTransitionException { Transition transition = getTransitionSet().getTransition(context); @@ -158,17 +136,15 @@ public class ActionState extends TransitionableState { } /** - * Specialization of State's doEnter template method that - * executes behaviour specific to this state type in polymorphic fashion. + * Specialization of State's doEnter template method that executes behaviour specific to this state + * type in polymorphic fashion. *

    - * This implementation iterates over each configured Action - * instance and executes it. Execution continues until an - * Action returns a result event that matches a transition in - * this request context, or the set of all actions is exhausted. - * @param context the control context for the currently executing flow, used - * by this state to manipulate the flow execution - * @return a view selection signaling that control should be returned to the - * client and a view rendered + * This implementation iterates over each configured Action instance and executes it. Execution + * continues until an Action returns a result event that matches a transition in this request + * context, or the set of all actions is exhausted. + * @param context the control context for the currently executing flow, used by this state to manipulate the flow + * execution + * @return a view selection signaling that control should be returned to the client and a view rendered * @throws FlowExecutionException if an exception occurs in this state */ protected ViewSelection doEnter(RequestControlContext context) throws FlowExecutionException { @@ -176,15 +152,14 @@ public class ActionState extends TransitionableState { String[] eventIds = new String[actionList.size()]; Iterator it = actionList.iterator(); while (it.hasNext()) { - Action action = (Action)it.next(); + Action action = (Action) it.next(); Event event = ActionExecutor.execute(action, context); if (event != null) { eventIds[executionCount] = event.getId(); try { // will check both local state transitions and global transitions return context.signalEvent(event); - } - catch (NoMatchingActionResultTransitionException e) { + } catch (NoMatchingActionResultTransitionException e) { if (logger.isDebugEnabled()) { logger.debug("Action execution [" + (executionCount + 1) @@ -195,14 +170,14 @@ public class ActionState extends TransitionableState { : ": action list exhausted")); } } - } - else { + } else { if (logger.isDebugEnabled()) { - logger.debug("Action execution [" - + (executionCount + 1) - + "] returned a [null] event" - + (it.hasNext() ? ": proceeding to the next action in the list" - : ": action list exhausted")); + logger + .debug("Action execution [" + + (executionCount + 1) + + "] returned a [null] event" + + (it.hasNext() ? ": proceeding to the next action in the list" + : ": action list exhausted")); } eventIds[executionCount] = null; } @@ -211,17 +186,16 @@ public class ActionState extends TransitionableState { if (executionCount > 0) { throw new NoMatchingTransitionException(getFlow().getId(), getId(), context.getLastEvent(), "No transition was matched on the event(s) signaled by the [" + executionCount - + "] action(s) that executed in this action state '" + getId() + "' of flow '" - + getFlow().getId() + "'; transitions must be defined to handle action result outcomes -- " - + "possible flow configuration error? Note: the eventIds signaled were: '" - + StylerUtils.style(eventIds) - + "', while the supported set of transitional criteria for this action state is '" - + StylerUtils.style(getTransitionSet().getTransitionCriterias()) + "'"); - } - else { + + "] action(s) that executed in this action state '" + getId() + "' of flow '" + + getFlow().getId() + "'; transitions must be defined to handle action result outcomes -- " + + "possible flow configuration error? Note: the eventIds signaled were: '" + + StylerUtils.style(eventIds) + + "', while the supported set of transitional criteria for this action state is '" + + StylerUtils.style(getTransitionSet().getTransitionCriterias()) + "'"); + } else { throw new IllegalStateException( "No actions were executed, thus I cannot execute any state transition " - + "-- programmer configuration error; make sure you add at least one action to this state's action list"); + + "-- programmer configuration error; make sure you add at least one action to this state's action list"); } } @@ -231,8 +205,8 @@ public class ActionState extends TransitionableState { } /** - * Local "no transition found" exception used to report that an action - * result could not be mapped to a state transition. + * Local "no transition found" exception used to report that an action result could not be mapped to a state + * transition. * * @author Keith Donald * @author Erwin Vervaet diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedAction.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedAction.java index 05114abf..df15acd4 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedAction.java @@ -24,14 +24,12 @@ import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; /** - * An action proxy/decorator that stores arbitrary properties about a target - * Action implementation for use within a specific Action - * execution context, for example an ActionState definition, a + * An action proxy/decorator that stores arbitrary properties about a target Action implementation for + * use within a specific Action execution context, for example an ActionState definition, a * TransitionCriteria definition, or in a test environment. *

    - * An annotated action is an action that wraps another action (referred to as - * the target action), setting up the target action's execution attributes - * before invoking {@link Action#execute}. + * An annotated action is an action that wraps another action (referred to as the target action), setting up the + * target action's execution attributes before invoking {@link Action#execute}. * * @author Keith Donald * @author Erwin Vervaet @@ -43,9 +41,8 @@ public class AnnotatedAction extends AnnotatedObject implements Action { /** * The action name attribute ("name"). *

    - * The name attribute is often used as a qualifier for an action's result - * event, and is typically used to allow the flow to respond to a specific - * action's outcome within a larger action execution chain. + * The name attribute is often used as a qualifier for an action's result event, and is typically used to allow the + * flow to respond to a specific action's outcome within a larger action execution chain. * @see ActionState */ public static final String NAME_ATTRIBUTE = "name"; @@ -53,9 +50,8 @@ public class AnnotatedAction extends AnnotatedObject implements Action { /** * The action execution method attribute ("method"). *

    - * The method property is a hint about what method should be invoked; for - * example, the name of a specific target method on a - * {@link org.springframework.webflow.action.MultiAction multi action}. + * The method property is a hint about what method should be invoked; for example, the name of a specific target + * method on a {@link org.springframework.webflow.action.MultiAction multi action}. * @see ActionState */ public static final String METHOD_ATTRIBUTE = "method"; @@ -66,8 +62,7 @@ public class AnnotatedAction extends AnnotatedObject implements Action { private Action targetAction; /** - * Creates a new annotated action object for the specified action. No - * contextual properties are provided. + * Creates a new annotated action object for the specified action. No contextual properties are provided. * @param targetAction the action */ public AnnotatedAction(Action targetAction) { @@ -91,8 +86,8 @@ public class AnnotatedAction extends AnnotatedObject implements Action { } /** - * Returns the name of a named action, or null if the action - * is unnamed. Used when mapping action result events to transitions. + * Returns the name of a named action, or null if the action is unnamed. Used when mapping action + * result events to transitions. * @see #isNamed() * @see #postProcessResult(Event) */ @@ -101,8 +96,7 @@ public class AnnotatedAction extends AnnotatedObject implements Action { } /** - * Sets the name of a named action. This is optional and can be - * null. + * Sets the name of a named action. This is optional and can be null. * @param name the action name */ public void setName(String name) { @@ -117,24 +111,22 @@ public class AnnotatedAction extends AnnotatedObject implements Action { public boolean isNamed() { return StringUtils.hasText(getName()); } - + /** - * Returns the name of the action method to invoke when the target action is - * executed. + * Returns the name of the action method to invoke when the target action is executed. */ public String getMethod() { return getAttributeMap().getString(METHOD_ATTRIBUTE); } /** - * Sets the name of the action method to invoke when the target action is - * executed. + * Sets the name of the action method to invoke when the target action is executed. * @param method the action method name */ public void setMethod(String method) { getAttributeMap().put(METHOD_ATTRIBUTE, method); } - + /** * Set an attribute on this annotated object. * @param attributeName the name of the attribute to set @@ -145,7 +137,7 @@ public class AnnotatedAction extends AnnotatedObject implements Action { public AnnotatedAction putAttribute(String attributeName, Object attributeValue) { getAttributeMap().put(attributeName, attributeValue); return this; - } + } public Event execute(RequestContext context) throws Exception { AttributeMap originalAttributes = getAttributeMap(); @@ -153,19 +145,17 @@ public class AnnotatedAction extends AnnotatedObject implements Action { context.setAttributes(getAttributeMap()); Event result = getTargetAction().execute(context); return postProcessResult(result); - } - finally { + } finally { // restore original attributes context.setAttributes(originalAttributes); } } /** - * Get the event id to be used as grounds for a transition in the containing - * state, based on given result returned from action execution. + * Get the event id to be used as grounds for a transition in the containing state, based on given result returned + * from action execution. *

    - * If the wrapped action is named, the name will be used as a qualifier for - * the event (e.g. "myAction.success"). + * If the wrapped action is named, the name will be used as a qualifier for the event (e.g. "myAction.success"). * @param resultEvent the action result event */ protected Event postProcessResult(Event resultEvent) { @@ -181,7 +171,7 @@ public class AnnotatedAction extends AnnotatedObject implements Action { } public String toString() { - return new ToStringCreator(this).append("targetAction", getTargetAction()) - .append("attributes", getAttributeMap()).toString(); + return new ToStringCreator(this).append("targetAction", getTargetAction()).append("attributes", + getAttributeMap()).toString(); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedObject.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedObject.java index e526bb17..2ecde296 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedObject.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/AnnotatedObject.java @@ -21,9 +21,8 @@ import org.springframework.webflow.core.collection.MutableAttributeMap; import org.springframework.webflow.definition.Annotated; /** - * A base class for all objects in the web flow system that support annotation - * using arbitrary properties. Mainly used to ensure consistent configuration of - * properties for all annotated objects. + * A base class for all objects in the web flow system that support annotation using arbitrary properties. Mainly used + * to ensure consistent configuration of properties for all annotated objects. * * @author Erwin Vervaet * @author Keith Donald @@ -31,26 +30,24 @@ import org.springframework.webflow.definition.Annotated; public abstract class AnnotatedObject implements Annotated { /** - * The caption property name ("caption"). A caption is also known as a - * "short description" and may be used in a GUI tooltip. + * The caption property name ("caption"). A caption is also known as a "short description" and may be used in a GUI + * tooltip. */ public static final String CAPTION_PROPERTY = "caption"; /** - * The long description property name ("description"). A description - * provides additional, free-form detail about this object and might be - * shown in a GUI text area. + * The long description property name ("description"). A description provides additional, free-form detail about + * this object and might be shown in a GUI text area. */ public static final String DESCRIPTION_PROPERTY = "description"; /** - * Additional properties further describing this object. The properties set - * in this map may be arbitrary. + * Additional properties further describing this object. The properties set in this map may be arbitrary. */ private LocalAttributeMap attributes = new LocalAttributeMap(); // implementing Annotated - + public String getCaption() { return attributes.getString(CAPTION_PROPERTY); } @@ -62,9 +59,9 @@ public abstract class AnnotatedObject implements Annotated { public AttributeMap getAttributes() { return attributes; } - + // mutators - + /** * Sets the short description (suitable for display in a tooltip). * @param caption the caption @@ -82,8 +79,7 @@ public abstract class AnnotatedObject implements Annotated { } /** - * Returns the mutable attribute map for this annotated object. May be used - * to set attributes after construction. + * Returns the mutable attribute map for this annotated object. May be used to set attributes after construction. */ public MutableAttributeMap getAttributeMap() { return attributes; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/DecisionState.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/DecisionState.java index 775e4ae7..494956fb 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/DecisionState.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/DecisionState.java @@ -20,12 +20,10 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * A simple transitionable state that when entered will execute the first - * transition whose matching criteria evaluates to true in the - * {@link RequestContext context} of the current request. + * A simple transitionable state that when entered will execute the first transition whose matching criteria evaluates + * to true in the {@link RequestContext context} of the current request. *

    - * A decision state is a convenient, simple way to encapsulate reusable state - * transition logic in one place. + * A decision state is a convenient, simple way to encapsulate reusable state transition logic in one place. * * @author Keith Donald */ @@ -35,23 +33,21 @@ public class DecisionState extends TransitionableState { * Creates a new decision state. * @param flow the owning flow * @param stateId the state identifier (must be unique to the flow) - * @throws IllegalArgumentException when this state cannot be added to given - * flow, e.g. because the id is not unique + * @throws IllegalArgumentException when this state cannot be added to given flow, e.g. because the id is not unique */ public DecisionState(Flow flow, String stateId) throws IllegalArgumentException { super(flow, stateId); } /** - * Specialization of State's doEnter template method that - * executes behaviour specific to this state type in polymorphic fashion. + * Specialization of State's doEnter template method that executes behaviour specific to this state + * type in polymorphic fashion. *

    - * Simply looks up the first transition that matches the state of the - * context and executes it. - * @param context the control context for the currently executing flow, used - * by this state to manipulate the flow execution - * @return a view selection containing model and view information needed to - * render the results of the state execution + * Simply looks up the first transition that matches the state of the context and executes it. + * @param context the control context for the currently executing flow, used by this state to manipulate the flow + * execution + * @return a view selection containing model and view information needed to render the results of the state + * execution * @throws FlowExecutionException if an exception occurs in this state */ protected ViewSelection doEnter(RequestControlContext context) throws FlowExecutionException { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/EndState.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/EndState.java index 8a7f35ed..064f7b60 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/EndState.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/EndState.java @@ -26,28 +26,23 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * A state that ends a flow when entered. More specifically, this state ends the - * active flow session of the active flow execution associated with the current - * request context. + * A state that ends a flow when entered. More specifically, this state ends the active flow session of the active flow + * execution associated with the current request context. *

    - * If the ended session is the "root flow session" the entire flow execution - * ends, signaling the end of a logical conversation. + * If the ended session is the "root flow session" the entire flow execution ends, signaling the end of a logical + * conversation. *

    - * If the terminated session was acting as a subflow the flow execution - * continues and control is returned to the parent flow session. In that case, - * this state returns an ending result event the resuming parent flow is - * expected to respond to. + * If the terminated session was acting as a subflow the flow execution continues and control is returned to the parent + * flow session. In that case, this state returns an ending result event the resuming parent flow is expected to respond + * to. *

    - * An end state may optionally be configured with the name of a view to render - * when entered. This view will be rendered if the end state terminates the - * entire flow execution as a kind of flow ending "confirmation page". + * An end state may optionally be configured with the name of a view to render when entered. This view will be rendered + * if the end state terminates the entire flow execution as a kind of flow ending "confirmation page". *

    - * Note: if no viewName property is specified and this - * end state terminates the entire flow execution it is expected that some - * action has already written the response (or else a blank response will - * result). On the other hand, if no viewName is specified and - * this end state relinquishes control back to a parent flow, view selection - * responsibility falls on the parent flow. + * Note: if no viewName property is specified and this end state terminates the entire flow + * execution it is expected that some action has already written the response (or else a blank response will result). On + * the other hand, if no viewName is specified and this end state relinquishes control back to a + * parent flow, view selection responsibility falls on the parent flow. * * @see org.springframework.webflow.engine.ViewSelector * @see org.springframework.webflow.engine.SubflowState @@ -59,14 +54,12 @@ import org.springframework.webflow.execution.ViewSelection; public class EndState extends State { /** - * The optional view selector that will select a view to render if this end - * state terminates a root flow session. + * The optional view selector that will select a view to render if this end state terminates a root flow session. */ private ViewSelector viewSelector = NullViewSelector.INSTANCE; /** - * Attribute mapper for mapping output attributes exposed by this end state - * when it is entered. + * Attribute mapper for mapping output attributes exposed by this end state when it is entered. */ private AttributeMapper outputMapper; @@ -74,8 +67,7 @@ public class EndState extends State { * Create a new end state with no associated view. * @param flow the owning flow * @param id the state identifier (must be unique to the flow) - * @throws IllegalArgumentException when this state cannot be added to given - * flow, e.g. because the id is not unique + * @throws IllegalArgumentException when this state cannot be added to given flow, e.g. because the id is not unique * @see State#State(Flow, String) * @see #setViewSelector(ViewSelector) * @see #setOutputMapper(AttributeMapper) @@ -85,16 +77,14 @@ public class EndState extends State { } /** - * Returns the strategy used to select the view to render in this end state - * if it terminates a root flow. + * Returns the strategy used to select the view to render in this end state if it terminates a root flow. */ public ViewSelector getViewSelector() { return viewSelector; } /** - * Sets the strategy used to select the view to render when this end state - * is entered and terminates a root flow. + * Sets the strategy used to select the view to render when this end state is entered and terminates a root flow. */ public void setViewSelector(ViewSelector viewSelector) { Assert.notNull(viewSelector, "The view selector is required"); @@ -102,33 +92,29 @@ public class EndState extends State { } /** - * Returns the configured attribute mapper for mapping output attributes - * exposed by this end state when it is entered. + * Returns the configured attribute mapper for mapping output attributes exposed by this end state when it is + * entered. */ public AttributeMapper getOutputMapper() { return outputMapper; } /** - * Sets the attribute mapper to use for mapping output attributes exposed by - * this end state when it is entered. + * Sets the attribute mapper to use for mapping output attributes exposed by this end state when it is entered. */ public void setOutputMapper(AttributeMapper outputMapper) { this.outputMapper = outputMapper; } /** - * Specialization of State's doEnter template method that - * executes behaviour specific to this state type in polymorphic fashion. + * Specialization of State's doEnter template method that executes behaviour specific to this state + * type in polymorphic fashion. *

    - * This implementation pops the top (active) flow session off the execution - * stack, ending it, and resumes control in the parent flow (if neccessary). - * If the ended session is the root flow, a {@link ViewSelection} is - * returned. - * @param context the control context for the currently executing flow, used - * by this state to manipulate the flow execution - * @return a view selection signaling that control should be returned to the - * client and a view rendered + * This implementation pops the top (active) flow session off the execution stack, ending it, and resumes control in + * the parent flow (if neccessary). If the ended session is the root flow, a {@link ViewSelection} is returned. + * @param context the control context for the currently executing flow, used by this state to manipulate the flow + * execution + * @return a view selection signaling that control should be returned to the client and a view rendered * @throws FlowExecutionException if an exception occurs in this state */ protected ViewSelection doEnter(RequestControlContext context) throws FlowExecutionException { @@ -138,8 +124,7 @@ public class EndState extends State { ViewSelection selectedView = viewSelector.makeEntrySelection(context); context.endActiveFlowSession(createSessionOutput(context)); return selectedView; - } - else { + } else { // there is a parent flow that will resume (this flow is a subflow) LocalAttributeMap sessionOutput = createSessionOutput(context); context.endActiveFlowSession(sessionOutput); @@ -148,9 +133,8 @@ public class EndState extends State { } /** - * Returns the subflow output map. This will invoke the output mapper (if any) - * to map data available in the flow execution request context into a newly - * created empty map. + * Returns the subflow output map. This will invoke the output mapper (if any) to map data available in the flow + * execution request context into a newly created empty map. */ protected LocalAttributeMap createSessionOutput(RequestContext context) { LocalAttributeMap outputMap = new LocalAttributeMap(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/Flow.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/Flow.java index 6e5e1639..df1a989f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/Flow.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/Flow.java @@ -34,70 +34,53 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * A single flow definition. A Flow definition is a reusable, self-contained - * controller module that provides the blue print for a user dialog or - * conversation. Flows typically orchestrate controlled navigations within web - * applications to guide users through fulfillment of a business process/goal - * that takes place over a series of steps, modeled as states. + * A single flow definition. A Flow definition is a reusable, self-contained controller module that provides the blue + * print for a user dialog or conversation. Flows typically orchestrate controlled navigations within web applications + * to guide users through fulfillment of a business process/goal that takes place over a series of steps, modeled as + * states. *

    - * A simple Flow definition could do nothing more than execute an action and - * display a view all in one request. A more elaborate Flow definition may be - * long-lived and execute across a series of requests, invoking many possible - * paths, actions, and subflows. + * A simple Flow definition could do nothing more than execute an action and display a view all in one request. A more + * elaborate Flow definition may be long-lived and execute across a series of requests, invoking many possible paths, + * actions, and subflows. *

    - * Especially in Intranet applications there are often "controlled navigations" - * where the user is not free to do what he or she wants but must follow the - * guidelines provided by the system to complete a process that is transactional - * in nature (the quinessential example would be a 'checkout' flow of a shopping - * cart application). This is a typical use case appropriate to model as a flow. + * Especially in Intranet applications there are often "controlled navigations" where the user is not free to do what he + * or she wants but must follow the guidelines provided by the system to complete a process that is transactional in + * nature (the quinessential example would be a 'checkout' flow of a shopping cart application). This is a typical use + * case appropriate to model as a flow. *

    - * Structurally a Flow is composed of a set of states. A {@link State} is a - * point in a flow where a behavior is executed; for example, showing a view, - * executing an action, spawning a subflow, or terminating the flow. Different + * Structurally a Flow is composed of a set of states. A {@link State} is a point in a flow where a behavior is + * executed; for example, showing a view, executing an action, spawning a subflow, or terminating the flow. Different * types of states execute different behaviors in a polymorphic fashion. *

    - * Each {@link TransitionableState} type has one or more transitions that when - * executed move a flow to another state. These transitions define the supported - * paths through the flow. + * Each {@link TransitionableState} type has one or more transitions that when executed move a flow to another state. + * These transitions define the supported paths through the flow. *

    - * A state transition is triggered by the occurence of an event. An event is - * something that happens the flow should respond to, for example a user input - * event like ("submit") or an action execution result event like ("success"). - * When an event occurs in a state of a Flow that event drives a state - * transition that decides what to do next. + * A state transition is triggered by the occurence of an event. An event is something that happens the flow should + * respond to, for example a user input event like ("submit") or an action execution result event like ("success"). When + * an event occurs in a state of a Flow that event drives a state transition that decides what to do next. *

    - * Each Flow has exactly one start state. A start state is simply a marker - * noting the state executions of this Flow definition should start in. The - * first state added to the flow will become the start state by default. + * Each Flow has exactly one start state. A start state is simply a marker noting the state executions of this Flow + * definition should start in. The first state added to the flow will become the start state by default. *

    - * Flow definitions may have one or more flow exception handlers. A - * {@link FlowExecutionExceptionHandler} can execute custom behavior in response - * to a specific exception (or set of exceptions) that occur in a state of one - * of this flow's executions. + * Flow definitions may have one or more flow exception handlers. A {@link FlowExecutionExceptionHandler} can execute + * custom behavior in response to a specific exception (or set of exceptions) that occur in a state of one of this + * flow's executions. *

    - * Instances of this class are typically built by - * {@link org.springframework.webflow.engine.builder.FlowBuilder} + * Instances of this class are typically built by {@link org.springframework.webflow.engine.builder.FlowBuilder} * implementations but may also be directly instantiated. *

    - * This class and the rest of the Spring Web Flow (SWF) engine have been designed - * with minimal dependencies on other libraries. Spring Web Flow is usable in a - * standalone fashion (as well as in the context of other frameworks like Spring - * MVC, Struts, or JSF, for example). The engine system is fully usable outside an - * HTTP servlet environment, for example in portlets, tests, or standalone - * applications. One of the major architectural benefits of Spring Web Flow is - * the ability to design reusable, high-level controller modules that may be - * executed in any environment. + * This class and the rest of the Spring Web Flow (SWF) engine have been designed with minimal dependencies on other + * libraries. Spring Web Flow is usable in a standalone fashion (as well as in the context of other frameworks like + * Spring MVC, Struts, or JSF, for example). The engine system is fully usable outside an HTTP servlet environment, for + * example in portlets, tests, or standalone applications. One of the major architectural benefits of Spring Web Flow is + * the ability to design reusable, high-level controller modules that may be executed in any environment. *

    - * Note: flows are singleton definition objects so they should be thread-safe. - * You can think a flow definition as analagous somewhat to a Java class, - * defining all the behavior of an application module. The core behaviors - * {@link #start(RequestControlContext, MutableAttributeMap) start}, - * {@link #onEvent(RequestControlContext) on event}, and - * {@link #end(RequestControlContext, MutableAttributeMap) end} each accept a - * {@link RequestContext request context} that allows for this flow to access - * execution state in a thread safe manner. A flow execution is what models a - * running instance of this flow definition, somewhat analgous to a java object - * that is an instance of a class. + * Note: flows are singleton definition objects so they should be thread-safe. You can think a flow definition as + * analagous somewhat to a Java class, defining all the behavior of an application module. The core behaviors + * {@link #start(RequestControlContext, MutableAttributeMap) start}, {@link #onEvent(RequestControlContext) on event}, + * and {@link #end(RequestControlContext, MutableAttributeMap) end} each accept a {@link RequestContext request context} + * that allows for this flow to access execution state in a thread safe manner. A flow execution is what models a + * running instance of this flow definition, somewhat analgous to a java object that is an instance of a class. * * @see org.springframework.webflow.engine.State * @see org.springframework.webflow.engine.TransitionableState @@ -121,8 +104,7 @@ public class Flow extends AnnotatedObject implements FlowDefinition { protected final Log logger = LogFactory.getLog(getClass()); /** - * An assigned flow identifier uniquely identifying this flow among all - * other flows. + * An assigned flow identifier uniquely identifying this flow among all other flows. */ private String id; @@ -149,9 +131,8 @@ public class Flow extends AnnotatedObject implements FlowDefinition { /** * The list of actions to execute when this flow starts. *

    - * Start actions should execute with care as during startup a flow session - * has not yet fully initialized and some properties like its "currentState" - * have not yet been set. + * Start actions should execute with care as during startup a flow session has not yet fully initialized and some + * properties like its "currentState" have not yet been set. */ private ActionList startActionList = new ActionList(); @@ -181,8 +162,7 @@ public class Flow extends AnnotatedObject implements FlowDefinition { private Set inlineFlows = CollectionFactory.createLinkedSetIfPossible(3); /** - * Construct a new flow definition with the given id. The id should be - * unique among all flows. + * Construct a new flow definition with the given id. The id should be unique among all flows. * @param id the flow identifier */ public Flow(String id) { @@ -216,13 +196,11 @@ public class Flow extends AnnotatedObject implements FlowDefinition { } /** - * Add given state definition to this flow definition. Marked protected, as - * this method is to be called by the (privileged) state definition classes - * themselves during state construction as part of a FlowBuilder invocation. + * Add given state definition to this flow definition. Marked protected, as this method is to be called by the + * (privileged) state definition classes themselves during state construction as part of a FlowBuilder invocation. * @param state the state to add - * @throws IllegalArgumentException when the state cannot be added to the - * flow; for instance if another state shares the same id as the one - * provided or if given state already belongs to another flow + * @throws IllegalArgumentException when the state cannot be added to the flow; for instance if another state shares + * the same id as the one provided or if given state already belongs to another flow */ protected void add(State state) throws IllegalArgumentException { if (this != state.getFlow() && state.getFlow() != null) { @@ -257,32 +235,28 @@ public class Flow extends AnnotatedObject implements FlowDefinition { public boolean containsState(String stateId) { Iterator it = states.iterator(); while (it.hasNext()) { - State state = (State)it.next(); + State state = (State) it.next(); if (state.getId().equals(stateId)) { return true; } } return false; } - + /** - * Set the start state for this flow to the state with the provided - * stateId; a state must exist by the provided - * stateId. + * Set the start state for this flow to the state with the provided stateId; a state must exist by + * the provided stateId. * @param stateId the id of the new start state - * @throws IllegalArgumentException when no state exists with the id you - * provided + * @throws IllegalArgumentException when no state exists with the id you provided */ public void setStartState(String stateId) throws IllegalArgumentException { setStartState(getStateInstance(stateId)); } /** - * Set the start state for this flow to the state provided; any state may be - * the start state. + * Set the start state for this flow to the state provided; any state may be the start state. * @param state the new start state - * @throws IllegalArgumentException given state has not been added to this - * flow + * @throws IllegalArgumentException given state has not been added to this flow */ public void setStartState(State state) throws IllegalArgumentException { if (!states.contains(state)) { @@ -296,16 +270,15 @@ public class Flow extends AnnotatedObject implements FlowDefinition { * @param stateId id of the state to look up * @return the transitionable state * @throws IllegalArgumentException if the identified state cannot be found - * @throws ClassCastException when the identified state is not - * transitionable + * @throws ClassCastException when the identified state is not transitionable */ - public TransitionableState getTransitionableState(String stateId) - throws IllegalArgumentException, ClassCastException { + public TransitionableState getTransitionableState(String stateId) throws IllegalArgumentException, + ClassCastException { State state = getStateInstance(stateId); if (state != null && !(state instanceof TransitionableState)) { throw new ClassCastException("The state '" + stateId + "' of flow '" + getId() + "' must be transitionable"); } - return (TransitionableState)state; + return (TransitionableState) state; } /** @@ -320,7 +293,7 @@ public class Flow extends AnnotatedObject implements FlowDefinition { } Iterator it = states.iterator(); while (it.hasNext()) { - State state = (State)it.next(); + State state = (State) it.next(); if (state.getId().equals(stateId)) { return state; } @@ -330,9 +303,8 @@ public class Flow extends AnnotatedObject implements FlowDefinition { } /** - * Convenience accessor that returns an ordered array of the String - * ids for the state definitions associated with this flow - * definition. + * Convenience accessor that returns an ordered array of the String ids for the state definitions + * associated with this flow definition. * @return the state ids */ public String[] getStateIds() { @@ -340,7 +312,7 @@ public class Flow extends AnnotatedObject implements FlowDefinition { int i = 0; Iterator it = states.iterator(); while (it.hasNext()) { - stateIds[i++] = ((State)it.next()).getId(); + stateIds[i++] = ((State) it.next()).getId(); } return stateIds; } @@ -365,12 +337,12 @@ public class Flow extends AnnotatedObject implements FlowDefinition { addVariable(variables[i]); } } - + /** * Returns the flow variables. */ public FlowVariable[] getVariables() { - return (FlowVariable[])variables.toArray(new FlowVariable[variables.size()]); + return (FlowVariable[]) variables.toArray(new FlowVariable[variables.size()]); } /** @@ -390,8 +362,8 @@ public class Flow extends AnnotatedObject implements FlowDefinition { } /** - * Returns the list of actions executed by this flow when an execution of - * the flow starts. The returned list is mutable. + * Returns the list of actions executed by this flow when an execution of the flow starts. The returned list + * is mutable. * @return the start action list */ public ActionList getStartActionList() { @@ -399,8 +371,8 @@ public class Flow extends AnnotatedObject implements FlowDefinition { } /** - * Returns the list of actions executed by this flow when an execution of - * the flow ends. The returned list is mutable. + * Returns the list of actions executed by this flow when an execution of the flow ends. The returned list + * is mutable. * @return the end action list */ public ActionList getEndActionList() { @@ -424,13 +396,10 @@ public class Flow extends AnnotatedObject implements FlowDefinition { } /** - * Returns the set of exception handlers, allowing manipulation of how - * exceptions are handled when thrown during flow execution. Exception - * handlers are invoked when an exception occurs at execution time - * and can execute custom exception handling logic as well as select an - * error view to display. Exception handlers attached at the flow - * level have an opportunity to handle exceptions that aren't handled at the - * state level. + * Returns the set of exception handlers, allowing manipulation of how exceptions are handled when thrown during + * flow execution. Exception handlers are invoked when an exception occurs at execution time and can execute custom + * exception handling logic as well as select an error view to display. Exception handlers attached at the flow + * level have an opportunity to handle exceptions that aren't handled at the state level. * @return the exception handler set */ public FlowExecutionExceptionHandlerSet getExceptionHandlerSet() { @@ -454,7 +423,7 @@ public class Flow extends AnnotatedObject implements FlowDefinition { int i = 0; Iterator it = inlineFlows.iterator(); while (it.hasNext()) { - flowIds[i++] = ((Flow)it.next()).getId(); + flowIds[i++] = ((Flow) it.next()).getId(); } return flowIds; } @@ -464,7 +433,7 @@ public class Flow extends AnnotatedObject implements FlowDefinition { * @return the list of inline flows */ public Flow[] getInlineFlows() { - return (Flow[])inlineFlows.toArray(new Flow[inlineFlows.size()]); + return (Flow[]) inlineFlows.toArray(new Flow[inlineFlows.size()]); } /** @@ -478,16 +447,14 @@ public class Flow extends AnnotatedObject implements FlowDefinition { /** * Tests if this flow contains an in-line flow with the specified id. * @param id the inline flow id - * @return true if this flow contains a inline flow with that id, false - * otherwise + * @return true if this flow contains a inline flow with that id, false otherwise */ public boolean containsInlineFlow(String id) { return getInlineFlow(id) != null; } /** - * Returns the inline flow with the provided id, or null if - * no such inline flow exists. + * Returns the inline flow with the provided id, or null if no such inline flow exists. * @param id the inline flow id * @return the inline flow * @throws IllegalArgumentException when an invalid flow id is provided @@ -499,7 +466,7 @@ public class Flow extends AnnotatedObject implements FlowDefinition { } Iterator it = inlineFlows.iterator(); while (it.hasNext()) { - Flow flow = (Flow)it.next(); + Flow flow = (Flow) it.next(); if (flow.getId().equals(id)) { return flow; } @@ -508,21 +475,21 @@ public class Flow extends AnnotatedObject implements FlowDefinition { } /** - * Returns the set of transitions eligible for execution by this flow if no - * state-level transition is matched. The returned set is mutable. + * Returns the set of transitions eligible for execution by this flow if no state-level transition is matched. The + * returned set is mutable. * @return the global transition set */ public TransitionSet getGlobalTransitionSet() { return globalTransitionSet; } - + // id based equality public boolean equals(Object o) { if (!(o instanceof Flow)) { return false; } - Flow other = (Flow)o; + Flow other = (Flow) o; return id.equals(other.id); } @@ -533,14 +500,11 @@ public class Flow extends AnnotatedObject implements FlowDefinition { // behavioral code, could be overridden in subclasses /** - * Start a new session for this flow in its start state. This boils down to - * the following: + * Start a new session for this flow in its start state. This boils down to the following: *

      - *
    1. Create (setup) all registered flow variables ({@link #addVariable(FlowVariable)}) - * in flow scope.
    2. - *
    3. Map provided input data into the flow execution control context. - * Typically data will be mapped into flow scope using the registered input - * mapper ({@link #setInputMapper(AttributeMapper)}).
    4. + *
    5. Create (setup) all registered flow variables ({@link #addVariable(FlowVariable)}) in flow scope.
    6. + *
    7. Map provided input data into the flow execution control context. Typically data will be mapped into flow + * scope using the registered input mapper ({@link #setInputMapper(AttributeMapper)}).
    8. *
    9. Execute all registered start actions ({@link #getStartActionList()}).
    10. *
    11. Enter the configured start state ({@link #setStartState(State)})
    12. *
    @@ -558,26 +522,22 @@ public class Flow extends AnnotatedObject implements FlowDefinition { } /** - * Inform this flow definition that an event was signaled in the current - * state of an active flow execution. The signaled event is the last event - * available in given request context ({@link RequestContext#getLastEvent()}). + * Inform this flow definition that an event was signaled in the current state of an active flow execution. The + * signaled event is the last event available in given request context ({@link RequestContext#getLastEvent()}). * @param context the flow execution control context * @return the selected view - * @throws FlowExecutionException when an exception occurs processing the - * event + * @throws FlowExecutionException when an exception occurs processing the event */ public ViewSelection onEvent(RequestControlContext context) throws FlowExecutionException { TransitionableState currentState = getCurrentTransitionableState(context); try { return currentState.onEvent(context); - } - catch (NoMatchingTransitionException e) { + } catch (NoMatchingTransitionException e) { // try the flow level transition set for a match Transition transition = globalTransitionSet.getTransition(context); if (transition != null) { return transition.execute(currentState, context); - } - else { + } else { // no matching global transition => let the original exception // propagate throw e; @@ -586,17 +546,15 @@ public class Flow extends AnnotatedObject implements FlowDefinition { } /** - * Inform this flow definition that an execution session of itself has - * ended. As a result, the flow will do the following: + * Inform this flow definition that an execution session of itself has ended. As a result, the flow will do the + * following: *
      *
    1. Execute all registered end actions ({@link #getEndActionList()}).
    2. - *
    3. Map data available in the flow execution control context into - * provided output map using a registered output mapper - * ({@link #setOutputMapper(AttributeMapper)}).
    4. + *
    5. Map data available in the flow execution control context into provided output map using a registered output + * mapper ({@link #setOutputMapper(AttributeMapper)}).
    6. *
    * @param context the flow execution control context - * @param output initial output produced by the session that is eligible for - * modification by this method + * @param output initial output produced by the session that is eligible for modification by this method * @throws FlowExecutionException when an exception occurs ending this flow */ public void end(RequestControlContext context, MutableAttributeMap output) throws FlowExecutionException { @@ -610,8 +568,8 @@ public class Flow extends AnnotatedObject implements FlowDefinition { * Handle an exception that occured during an execution of this flow. * @param exception the exception that occured * @param context the flow execution control context - * @return the selected error view, or null if no handler - * matched or returned a non-null view selection + * @return the selected error view, or null if no handler matched or returned a non-null view + * selection */ public ViewSelection handleException(FlowExecutionException exception, RequestControlContext context) throws FlowExecutionException { @@ -626,7 +584,7 @@ public class Flow extends AnnotatedObject implements FlowDefinition { private void createVariables(RequestContext context) { Iterator it = variables.iterator(); while (it.hasNext()) { - FlowVariable variable = (FlowVariable)it.next(); + FlowVariable variable = (FlowVariable) it.next(); if (logger.isDebugEnabled()) { logger.debug("Creating " + variable); } @@ -638,12 +596,12 @@ public class Flow extends AnnotatedObject implements FlowDefinition { * Returns the current state and makes sure it is transitionable. */ private TransitionableState getCurrentTransitionableState(RequestControlContext context) { - State currentState = (State)context.getCurrentState(); + State currentState = (State) context.getCurrentState(); if (!(currentState instanceof TransitionableState)) { throw new IllegalStateException("You can only signal events in transitionable states, and state " + context.getCurrentState() + " is not transitionable - programmer error"); } - return (TransitionableState)currentState; + return (TransitionableState) currentState; } public String toString() { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowAttributeMapper.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowAttributeMapper.java index 956c16c4..c1f2ca52 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowAttributeMapper.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowAttributeMapper.java @@ -20,14 +20,12 @@ import org.springframework.webflow.core.collection.MutableAttributeMap; import org.springframework.webflow.execution.RequestContext; /** - * A service interface that maps attributes between two flows. Used by the - * subflow state to map attributes between a parent flow and its sub flow. + * A service interface that maps attributes between two flows. Used by the subflow state to map attributes between a + * parent flow and its sub flow. *

    - * An attribute mapper may map attributes of a parent flow down to a child flow - * as input when the child is spawned as a subflow. In addition, a - * mapper may map output attributes of a subflow into a resuming parent flow as - * output when the child session ends and control is returned to the - * parent flow. + * An attribute mapper may map attributes of a parent flow down to a child flow as input when the child is + * spawned as a subflow. In addition, a mapper may map output attributes of a subflow into a resuming parent flow as + * output when the child session ends and control is returned to the parent flow. *

    * For example, say you have the following parent flow session: *

    @@ -40,13 +38,11 @@ import org.springframework.webflow.execution.RequestContext; * * *

    - * For the "Parent Flow Session" above, there are 3 attributes in flow scope - * ("attribute1", "attribute2" and "attribute3", respectively). Any of these - * three attributes may be mapped as input down to child subflows when those - * subflows are spawned. An implementation of this interface performs the actual - * mapping, encapsulating knowledge of which attributes should be - * mapped, and how they will be mapped (for example, will the same - * attribute names be used between flows or not?). + * For the "Parent Flow Session" above, there are 3 attributes in flow scope ("attribute1", "attribute2" and + * "attribute3", respectively). Any of these three attributes may be mapped as input down to child subflows when those + * subflows are spawned. An implementation of this interface performs the actual mapping, encapsulating knowledge of + * which attributes should be mapped, and how they will be mapped (for example, will the same attribute + * names be used between flows or not?). *

    * For example: *

    @@ -59,30 +55,23 @@ import org.springframework.webflow.execution.RequestContext; * * *

    - * The above example "Flow Attribute Mapper" specifies - * inputMappings that define which parent attributes to map as - * input to the child. In this case, two attributes in flow scope of the parent - * are mapped, "attribute1" and "attribute3". "attribute1" is mapped with the - * name "attribute1" (given the same name in both flows), while "attribute3" is - * mapped to "attribute4", given a different name that is local to the child - * flow. + * The above example "Flow Attribute Mapper" specifies inputMappings that define which parent attributes + * to map as input to the child. In this case, two attributes in flow scope of the parent are mapped, "attribute1" and + * "attribute3". "attribute1" is mapped with the name "attribute1" (given the same name in both flows), while + * "attribute3" is mapped to "attribute4", given a different name that is local to the child flow. *

    - * Likewise, when a child flow ends the outputMappings define - * which output attributes to map into the parent. In this case the subflow - * output attribute "attribute4" will be mapped up to the parent as "attribute3", - * updating the value of "attribute3" in the parent's flow scope. Note: only - * output attributes exposed by the end state of the ending subflow are eligible - * for mapping. + * Likewise, when a child flow ends the outputMappings define which output attributes to map into the + * parent. In this case the subflow output attribute "attribute4" will be mapped up to the parent as "attribute3", + * updating the value of "attribute3" in the parent's flow scope. Note: only output attributes exposed by the end state + * of the ending subflow are eligible for mapping. *

    * A FlowAttributeMapper is typically implemented using 2 distinct - * {@link org.springframework.binding.mapping.AttributeMapper} implementations: - * one responsible for input mapping and one taking care of output mapping. + * {@link org.springframework.binding.mapping.AttributeMapper} implementations: one responsible for input mapping and + * one taking care of output mapping. *

    - * Note: because FlowAttributeMappers are singletons, take care not to store - * and/or modify caller-specific state in a unsafe manner. The - * FlowAttributeMapper methods run in an independently executing thread on each - * invocation so make sure you deal only with local data or internal, - * thread-safe services. + * Note: because FlowAttributeMappers are singletons, take care not to store and/or modify caller-specific state in a + * unsafe manner. The FlowAttributeMapper methods run in an independently executing thread on each invocation so make + * sure you deal only with local data or internal, thread-safe services. * * @see org.springframework.webflow.engine.SubflowState * @see org.springframework.binding.mapping.AttributeMapper @@ -93,25 +82,21 @@ import org.springframework.webflow.execution.RequestContext; public interface FlowAttributeMapper { /** - * Create a map of attributes that should be passed as input to a - * spawning flow. + * Create a map of attributes that should be passed as input to a spawning flow. *

    - * Attributes set in the map returned by this method are availale - * as input to the subflow when its session is spawned. - * @param context the current request execution context, which gives access - * to the parent flow scope, the request scope, any event parameters, etcetera - * @return a map of attributes (name=value pairs) to pass as input to the - * spawning subflow + * Attributes set in the map returned by this method are availale as input to the subflow when its session is + * spawned. + * @param context the current request execution context, which gives access to the parent flow scope, the request + * scope, any event parameters, etcetera + * @return a map of attributes (name=value pairs) to pass as input to the spawning subflow */ public MutableAttributeMap createFlowInput(RequestContext context); /** - * Map output attributes of an ended flow to a resuming parent flow session. - * This maps the output of the child as new input to the resuming - * parent, typically adding data to flow scope. + * Map output attributes of an ended flow to a resuming parent flow session. This maps the output of the + * child as new input to the resuming parent, typically adding data to flow scope. * @param flowOutput the output attributes exposed by the ended subflow - * @param context the current request execution context, which gives access - * to the parent flow scope + * @param context the current request execution context, which gives access to the parent flow scope */ public void mapFlowOutput(AttributeMap flowOutput, RequestContext context); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java index b573340e..d2e3d04e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandler.java @@ -19,8 +19,7 @@ import org.springframework.webflow.execution.FlowExecutionException; import org.springframework.webflow.execution.ViewSelection; /** - * A strategy for handling an exception that occurs at runtime during the - * execution of a flow definition. + * A strategy for handling an exception that occurs at runtime during the execution of a flow definition. * * @author Keith Donald */ @@ -34,13 +33,12 @@ public interface FlowExecutionExceptionHandler { public boolean handles(FlowExecutionException exception); /** - * Handle the exception in the context of the current request, optionally - * making an error view selection that should be rendered. + * Handle the exception in the context of the current request, optionally making an error view selection that should + * be rendered. * @param exception the exception that occured * @param context the execution control context for this request - * @return the selected error view that should be displayed (may be null if - * the handler chooses not to select a view, in which case other exception - * handlers may be given a chance to handle the exception) + * @return the selected error view that should be displayed (may be null if the handler chooses not to select a + * view, in which case other exception handlers may be given a chance to handle the exception) */ public ViewSelection handle(FlowExecutionException exception, RequestControlContext context); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandlerSet.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandlerSet.java index d6cd9923..ade664ec 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandlerSet.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowExecutionExceptionHandlerSet.java @@ -25,8 +25,8 @@ import org.springframework.webflow.execution.FlowExecutionException; import org.springframework.webflow.execution.ViewSelection; /** - * A typed set of state exception handlers, mainly for use internally by - * artifacts that can apply state exception handling logic. + * A typed set of state exception handlers, mainly for use internally by artifacts that can apply state exception + * handling logic. * * @see FlowExecutionExceptionHandler * @see Flow#getExceptionHandlerSet() @@ -44,8 +44,7 @@ public class FlowExecutionExceptionHandlerSet { /** * Add a state exception handler to this set. * @param exceptionHandler the exception handler to add - * @return true if this set's contents changed as a result of the add - * operation + * @return true if this set's contents changed as a result of the add operation */ public boolean add(FlowExecutionExceptionHandler exceptionHandler) { if (contains(exceptionHandler)) { @@ -57,8 +56,7 @@ public class FlowExecutionExceptionHandlerSet { /** * Add a collection of state exception handler instances to this set. * @param exceptionHandlers the exception handlers to add - * @return true if this set's contents changed as a result of the add - * operation + * @return true if this set's contents changed as a result of the add operation */ public boolean addAll(FlowExecutionExceptionHandler[] exceptionHandlers) { return CollectionUtils.addAllNoDuplicates(this.exceptionHandlers, exceptionHandlers); @@ -67,8 +65,7 @@ public class FlowExecutionExceptionHandlerSet { /** * Tests if this state exception handler is in this set. * @param exceptionHandler the exception handler - * @return true if the state exception handler is contained in this set, - * false otherwise + * @return true if the state exception handler is contained in this set, false otherwise */ public boolean contains(FlowExecutionExceptionHandler exceptionHandler) { return exceptionHandlers.contains(exceptionHandler); @@ -77,8 +74,7 @@ public class FlowExecutionExceptionHandlerSet { /** * Remove the exception handler instance from this set. * @param exceptionHandler the exception handler to add - * @return true if this set's contents changed as a result of the remove - * operation + * @return true if this set's contents changed as a result of the remove operation */ public boolean remove(FlowExecutionExceptionHandler exceptionHandler) { return exceptionHandlers.remove(exceptionHandler); @@ -97,25 +93,24 @@ public class FlowExecutionExceptionHandlerSet { * @return the exception handler list, as a typed array */ public FlowExecutionExceptionHandler[] toArray() { - return (FlowExecutionExceptionHandler[])exceptionHandlers.toArray(new FlowExecutionExceptionHandler[exceptionHandlers.size()]); + return (FlowExecutionExceptionHandler[]) exceptionHandlers + .toArray(new FlowExecutionExceptionHandler[exceptionHandlers.size()]); } /** - * Handle an exception that occured during the context of the current flow - * execution request. + * Handle an exception that occured during the context of the current flow execution request. *

    - * This implementation iterates over the ordered set of exception handler - * objects, delegating to each handler in the set until one handles the - * exception that occured and selects a non-null error view. + * This implementation iterates over the ordered set of exception handler objects, delegating to each handler in the + * set until one handles the exception that occured and selects a non-null error view. * @param exception the exception that occured * @param context the flow execution control context - * @return the selected error view, or null if no handler - * matched or returned a non-null view selection + * @return the selected error view, or null if no handler matched or returned a non-null view + * selection */ public ViewSelection handleException(FlowExecutionException exception, RequestControlContext context) { Iterator it = exceptionHandlers.iterator(); while (it.hasNext()) { - FlowExecutionExceptionHandler handler = (FlowExecutionExceptionHandler)it.next(); + FlowExecutionExceptionHandler handler = (FlowExecutionExceptionHandler) it.next(); if (handler.handles(exception)) { ViewSelection result = handler.handle(exception, context); if (result != null) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowVariable.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowVariable.java index 7b975296..caa73e24 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowVariable.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/FlowVariable.java @@ -23,9 +23,8 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ScopeType; /** - * A value object that defines a specification for a flow variable. Encapsulates - * information about the variable and the behavior necessary to create a new - * variable instance in a flow execution scope. + * A value object that defines a specification for a flow variable. Encapsulates information about the variable and the + * behavior necessary to create a new variable instance in a flow execution scope. * * @author Keith Donald */ @@ -66,14 +65,14 @@ public abstract class FlowVariable extends AnnotatedObject implements Serializab public ScopeType getScope() { return scope; } - + // name and scope based equality public boolean equals(Object o) { if (!(o instanceof FlowVariable)) { return false; } - FlowVariable other = (FlowVariable)o; + FlowVariable other = (FlowVariable) o; return name.equals(other.name) && scope.equals(other.scope); } @@ -90,9 +89,8 @@ public abstract class FlowVariable extends AnnotatedObject implements Serializab } /** - * Hook method that needs to be implemented by subclasses to calculate the - * value of this flow variable based on the information available in the - * request context. + * Hook method that needs to be implemented by subclasses to calculate the value of this flow variable based on the + * information available in the request context. * @param context the flow execution request context * @return the flow variable value */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/NoMatchingTransitionException.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/NoMatchingTransitionException.java index 5c7a22e3..8c84a68b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/NoMatchingTransitionException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/NoMatchingTransitionException.java @@ -19,11 +19,9 @@ import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.FlowExecutionException; /** - * Thrown when no transition can be matched given the occurence of an event in - * the context of a flow execution request. + * Thrown when no transition can be matched given the occurence of an event in the context of a flow execution request. *

    - * Typically this happens because there is no "handler" transition for the last - * event that occured. + * Typically this happens because there is no "handler" transition for the last event that occured. * * @author Keith Donald * @author Erwin Vervaet @@ -39,8 +37,7 @@ public class NoMatchingTransitionException extends FlowExecutionException { * Create a new no matching transition exception. * @param flowId the current flow * @param stateId the state that could not be transitioned out of - * @param event the event that occured that could not be matched to a - * transition + * @param event the event that occured that could not be matched to a transition * @param message the message */ public NoMatchingTransitionException(String flowId, String stateId, Event event, String message) { @@ -52,8 +49,7 @@ public class NoMatchingTransitionException extends FlowExecutionException { * Create a new no matching transition exception. * @param flowId the current flow * @param stateId the state that could not be transitioned out of - * @param event the event that occured that could not be matched to a - * transition + * @param event the event that occured that could not be matched to a transition * @param message the message * @param cause the underlying cause */ @@ -63,8 +59,7 @@ public class NoMatchingTransitionException extends FlowExecutionException { } /** - * Returns the event for the current request that did not trigger any - * supported transition. + * Returns the event for the current request that did not trigger any supported transition. */ public Event getEvent() { return event; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/NullViewSelector.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/NullViewSelector.java index 2b9005ad..f0b8095b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/NullViewSelector.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/NullViewSelector.java @@ -31,12 +31,12 @@ import org.springframework.webflow.execution.ViewSelection; public final class NullViewSelector implements ViewSelector, Serializable { /* - * Implementation note: not located in webflow.execution.support package to - * avoid a cyclic dependency between webflow.execution and webflow.execution.support. + * Implementation note: not located in webflow.execution.support package to avoid a cyclic dependency between + * webflow.execution and webflow.execution.support. */ /** - * The shared singleton {@link NullViewSelector} instance. + * The shared singleton {@link NullViewSelector} instance. */ public static final ViewSelector INSTANCE = new NullViewSelector(); @@ -62,5 +62,5 @@ public final class NullViewSelector implements ViewSelector, Serializable { private Object readResolve() throws ObjectStreamException { return INSTANCE; } - + } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java index b6718d31..3f7339b4 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/RequestControlContext.java @@ -24,22 +24,17 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * Mutable control interface used to manipulate an ongoing flow execution in the - * context of one client request. Primarily used internally by the various flow - * artifacts when they are invoked. + * Mutable control interface used to manipulate an ongoing flow execution in the context of one client request. + * Primarily used internally by the various flow artifacts when they are invoked. *

    - * This interface acts as a facade for core definition constructs such as the - * central Flow and State classes, abstracting - * away details about the runtime execution machine defined in the - * {@link org.springframework.webflow.engine.impl execution engine implementation} - * package. + * This interface acts as a facade for core definition constructs such as the central Flow and + * State classes, abstracting away details about the runtime execution machine defined in the + * {@link org.springframework.webflow.engine.impl execution engine implementation} package. *

    - * Note this type is not the same as the {@link FlowExecutionContext}. Objects - * of this type are request specific: they provide a control interface - * for manipulating exactly one flow execution locally from exactly one request. - * A FlowExecutionContext provides information about a single - * flow execution (conversation), and it's scope is not local to a specific - * request (or thread). + * Note this type is not the same as the {@link FlowExecutionContext}. Objects of this type are request specific: + * they provide a control interface for manipulating exactly one flow execution locally from exactly one request. A + * FlowExecutionContext provides information about a single flow execution (conversation), and it's scope + * is not local to a specific request (or thread). * * @see org.springframework.webflow.engine.Flow * @see org.springframework.webflow.engine.State @@ -52,74 +47,62 @@ import org.springframework.webflow.execution.ViewSelection; public interface RequestControlContext extends RequestContext { /** - * Record the last event signaled in the executing flow. This method will be - * called as part of signaling an event in a flow to indicate the - * 'lastEvent' that was signaled. + * Record the last event signaled in the executing flow. This method will be called as part of signaling an event in + * a flow to indicate the 'lastEvent' that was signaled. * @param lastEvent the last event signaled * @see Flow#onEvent(RequestControlContext) */ public void setLastEvent(Event lastEvent); /** - * Record the last transition that executed in the executing flow. This - * method will be called as part of executing a transition from one state to - * another. + * Record the last transition that executed in the executing flow. This method will be called as part of executing a + * transition from one state to another. * @param lastTransition the last transition that executed * @see Transition#execute(State, RequestControlContext) */ public void setLastTransition(Transition lastTransition); /** - * Record the current state that has entered in the executing flow. This - * method will be called as part of entering a new state by the State type - * itself. + * Record the current state that has entered in the executing flow. This method will be called as part of entering a + * new state by the State type itself. * @param state the current state * @see State#enter(RequestControlContext) */ public void setCurrentState(State state); /** - * Spawn a new flow session and activate it in the currently executing flow. - * Also transitions the spawned flow to its start state. This method should - * be called by clients that wish to spawn new flows, such as subflow - * states. + * Spawn a new flow session and activate it in the currently executing flow. Also transitions the spawned flow to + * its start state. This method should be called by clients that wish to spawn new flows, such as subflow states. *

    - * This will start a new flow session in the current flow execution, which - * is already active. - * @param flow the flow to start, its start() method will be - * called - * @param input initial contents of the newly created flow session (may be - * null, e.g. empty) - * @return the selected starting view, which returns control to the client - * and requests that a view be rendered with model data - * @throws FlowExecutionException if an exception was thrown within a state - * of the flow during execution of this start operation + * This will start a new flow session in the current flow execution, which is already active. + * @param flow the flow to start, its start() method will be called + * @param input initial contents of the newly created flow session (may be null, e.g. empty) + * @return the selected starting view, which returns control to the client and requests that a view be rendered with + * model data + * @throws FlowExecutionException if an exception was thrown within a state of the flow during execution of this + * start operation * @see Flow#start(RequestControlContext, MutableAttributeMap) */ public ViewSelection start(Flow flow, MutableAttributeMap input) throws FlowExecutionException; /** - * Signals the occurence of an event in the current state of this flow - * execution request context. This method should be called by clients that - * report internal event occurences, such as action states. The - * onEvent() method of the flow involved in the flow - * execution will be called. + * Signals the occurence of an event in the current state of this flow execution request context. This method should + * be called by clients that report internal event occurences, such as action states. The onEvent() + * method of the flow involved in the flow execution will be called. * @param event the event that occured - * @return the next selected view, which returns control to the client and - * requests that a view be rendered with model data - * @throws FlowExecutionException if an exception was thrown within a state - * of the flow during execution of this signalEvent operation + * @return the next selected view, which returns control to the client and requests that a view be rendered with + * model data + * @throws FlowExecutionException if an exception was thrown within a state of the flow during execution of this + * signalEvent operation * @see Flow#onEvent(RequestControlContext) */ public ViewSelection signalEvent(Event event) throws FlowExecutionException; /** - * End the active flow session of the current flow execution. This method - * should be called by clients that terminate flows, such as end states. The - * end() method of the flow involved in the flow execution - * will be called. - * @param output output produced by the session that is eligible for mapping - * by a resuming parent flow + * End the active flow session of the current flow execution. This method should be called by clients that terminate + * flows, such as end states. The end() method of the flow involved in the flow execution will be + * called. + * @param output output produced by the session that is eligible for mapping by a resuming parent flow * @return the ended session * @throws IllegalStateException when the flow execution is not active * @see Flow#end(RequestControlContext, MutableAttributeMap) @@ -127,8 +110,8 @@ public interface RequestControlContext extends RequestContext { public FlowSession endActiveFlowSession(MutableAttributeMap output) throws IllegalStateException; /** - * Execute this transition out of the current source state. Allows for - * privileged execution of an arbitrary transition. + * Execute this transition out of the current source state. Allows for privileged execution of an arbitrary + * transition. * @param transition the transition * @return a new view selection * @see Transition#execute(State, RequestControlContext) diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/State.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/State.java index 1131c941..e075b8e3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/State.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/State.java @@ -25,18 +25,15 @@ import org.springframework.webflow.execution.FlowExecutionException; import org.springframework.webflow.execution.ViewSelection; /** - * A point in a flow where something happens. What happens is determined by a - * state's type. Standard types of states include action states, view states, - * subflow states, and end states. + * A point in a flow where something happens. What happens is determined by a state's type. Standard types of states + * include action states, view states, subflow states, and end states. *

    - * Each state is associated with exactly one owning flow definition. - * Specializations of this class capture all the configuration information - * needed for a specific kind of state. + * Each state is associated with exactly one owning flow definition. Specializations of this class capture all the + * configuration information needed for a specific kind of state. *

    - * Subclasses should implement the doEnter method to execute the - * processing that should occur when this state is entered, acting on its - * configuration information. The ability to plugin custom state types that - * execute different behaviour polymorphically is the classic GoF state pattern. + * Subclasses should implement the doEnter method to execute the processing that should occur when this + * state is entered, acting on its configuration information. The ability to plugin custom state types that execute + * different behaviour polymorphically is the classic GoF state pattern. *

    * Equality: Two states are equal if they have the same id and are part of the same flow. * @@ -78,13 +75,12 @@ public abstract class State extends AnnotatedObject implements StateDefinition { private FlowExecutionExceptionHandlerSet exceptionHandlerSet = new FlowExecutionExceptionHandlerSet(); /** - * Creates a state for the provided flow identified by the - * provided id. The id must be locally unique to the owning - * flow. The state will be automatically added to the flow. + * Creates a state for the provided flow identified by the provided id. The id must + * be locally unique to the owning flow. The state will be automatically added to the flow. * @param flow the owning flow * @param id the state identifier (must be unique to the flow) - * @throws IllegalArgumentException if this state cannot be added to the - * flow, for instance when the provided id is not unique in the owning flow + * @throws IllegalArgumentException if this state cannot be added to the flow, for instance when the provided id is + * not unique in the owning flow * @see #getEntryActionList() * @see #getExceptionHandlerSet() */ @@ -98,13 +94,13 @@ public abstract class State extends AnnotatedObject implements StateDefinition { public FlowDefinition getOwner() { return flow; } - + public String getId() { return id; } - + // implementation specific - + /** * Returns the owning flow. */ @@ -114,8 +110,7 @@ public abstract class State extends AnnotatedObject implements StateDefinition { /** * Set the owning flow. - * @throws IllegalArgumentException if this state cannot be added to the - * flow + * @throws IllegalArgumentException if this state cannot be added to the flow */ private void setFlow(Flow flow) throws IllegalArgumentException { Assert.hasText(getId(), "The id of the state should be set before adding the state to a flow"); @@ -134,8 +129,7 @@ public abstract class State extends AnnotatedObject implements StateDefinition { } /** - * Returns the list of actions executed by this state when it is entered. - * The returned list is mutable. + * Returns the list of actions executed by this state when it is entered. The returned list is mutable. * @return the state entry action list */ public ActionList getEntryActionList() { @@ -143,12 +137,11 @@ public abstract class State extends AnnotatedObject implements StateDefinition { } /** - * Returns a mutable set of exception handlers, allowing manipulation of how - * exceptions are handled when thrown within this state. + * Returns a mutable set of exception handlers, allowing manipulation of how exceptions are handled when thrown + * within this state. *

    - * Exception handlers are invoked when an exception occurs when this state - * is entered, and can execute custom exception handling logic as well as - * select an error view to display. + * Exception handlers are invoked when an exception occurs when this state is entered, and can execute custom + * exception handling logic as well as select an error view to display. * @return the state exception handler set */ public FlowExecutionExceptionHandlerSet getExceptionHandlerSet() { @@ -156,39 +149,37 @@ public abstract class State extends AnnotatedObject implements StateDefinition { } /** - * Returns a flag indicating if this state is the start state of its owning - * flow. + * Returns a flag indicating if this state is the start state of its owning flow. * @return true if the flow is the start state, false otherwise */ public boolean isStartState() { return flow.getStartState() == this; } - + // id and flow based equality public boolean equals(Object o) { if (!(o instanceof State)) { return false; } - State other = (State)o; + State other = (State) o; return id.equals(other.id) && flow.equals(other.flow); } - + public int hashCode() { return id.hashCode() + flow.hashCode(); } - + // behavioral methods - + /** - * Enter this state in the provided flow control context. This - * implementation just calls the - * {@link #doEnter(RequestControlContext)} hook method, which should - * be implemented by subclasses, after executing the entry actions. - * @param context the control context for the currently executing flow, used - * by this state to manipulate the flow execution - * @return a view selection containing model and view information needed to - * render the results of the state processing + * Enter this state in the provided flow control context. This implementation just calls the + * {@link #doEnter(RequestControlContext)} hook method, which should be implemented by subclasses, after executing + * the entry actions. + * @param context the control context for the currently executing flow, used by this state to manipulate the flow + * execution + * @return a view selection containing model and view information needed to render the results of the state + * processing * @throws FlowExecutionException if an exception occurs in this state */ public final ViewSelection enter(RequestControlContext context) throws FlowExecutionException { @@ -201,24 +192,22 @@ public abstract class State extends AnnotatedObject implements StateDefinition { } /** - * Hook method to execute custom behaviour as a result of entering this - * state. By implementing this method subclasses specialize the behaviour of - * the state. - * @param context the control context for the currently executing flow, used - * by this state to manipulate the flow execution - * @return a view selection containing model and view information needed to - * render the results of the state processing + * Hook method to execute custom behaviour as a result of entering this state. By implementing this method + * subclasses specialize the behaviour of the state. + * @param context the control context for the currently executing flow, used by this state to manipulate the flow + * execution + * @return a view selection containing model and view information needed to render the results of the state + * processing * @throws FlowExecutionException if an exception occurs in this state */ protected abstract ViewSelection doEnter(RequestControlContext context) throws FlowExecutionException; /** - * Handle an exception that occured in this state during the context of the - * current flow execution request. + * Handle an exception that occured in this state during the context of the current flow execution request. * @param exception the exception that occured * @param context the flow execution control context - * @return the selected error view, or null if no handler - * matched or returned a non-null view selection + * @return the selected error view, or null if no handler matched or returned a non-null view + * selection */ public ViewSelection handleException(FlowExecutionException exception, RequestControlContext context) { return getExceptionHandlerSet().handleException(exception, context); @@ -233,8 +222,8 @@ public abstract class State extends AnnotatedObject implements StateDefinition { } /** - * Subclasses may override this hook method to stringify their internal - * state. This default implementation does nothing. + * Subclasses may override this hook method to stringify their internal state. This default implementation does + * nothing. * @param creator the toString creator, to stringify properties */ protected void appendToString(ToStringCreator creator) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowState.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowState.java index 0e1f6826..154f05bb 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowState.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/SubflowState.java @@ -24,17 +24,13 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * A transitionable state that spawns a subflow when executed. When the subflow - * this state spawns ends, the ending result is used as grounds for a state - * transition out of this state. + * A transitionable state that spawns a subflow when executed. When the subflow this state spawns ends, the ending + * result is used as grounds for a state transition out of this state. *

    - * A subflow state may be configured to map input data from its flow -- acting - * as the parent flow -- down to the subflow when the subflow is spawned. In - * addition, output data produced by the subflow may be mapped up to the parent - * flow when the subflow ends and the parent flow resumes. See the - * {@link FlowAttributeMapper} interface definition for more information on how - * to do this. The logic for ending a subflow is located in the {@link EndState} - * implementation. + * A subflow state may be configured to map input data from its flow -- acting as the parent flow -- down to the subflow + * when the subflow is spawned. In addition, output data produced by the subflow may be mapped up to the parent flow + * when the subflow ends and the parent flow resumes. See the {@link FlowAttributeMapper} interface definition for more + * information on how to do this. The logic for ending a subflow is located in the {@link EndState} implementation. * * @see org.springframework.webflow.engine.FlowAttributeMapper * @see org.springframework.webflow.engine.EndState @@ -50,8 +46,7 @@ public class SubflowState extends TransitionableState { private Flow subflow; /** - * The attribute mapper that should map attributes from the parent flow down - * to the spawned subflow and visa versa. + * The attribute mapper that should map attributes from the parent flow down to the spawned subflow and visa versa. */ private FlowAttributeMapper attributeMapper; @@ -60,8 +55,7 @@ public class SubflowState extends TransitionableState { * @param flow the owning flow * @param id the state identifier (must be unique to the flow) * @param subflow the subflow to spawn - * @throws IllegalArgumentException when this state cannot be added to given - * flow, e.g. because the id is not unique + * @throws IllegalArgumentException when this state cannot be added to given flow, e.g. because the id is not unique * @see #setAttributeMapper(FlowAttributeMapper) */ public SubflowState(Flow flow, String id, Flow subflow) throws IllegalArgumentException { @@ -86,31 +80,29 @@ public class SubflowState extends TransitionableState { } /** - * Returns the attribute mapper used to map data between the parent and child - * flow, or null if no mapping is needed. + * Returns the attribute mapper used to map data between the parent and child flow, or null if no mapping is needed. */ public FlowAttributeMapper getAttributeMapper() { return attributeMapper; } /** - * Set the attribute mapper used to map model data between the parent and - * child flow. Can be null if no mapping is needed. + * Set the attribute mapper used to map model data between the parent and child flow. Can be null if no mapping is + * needed. */ public void setAttributeMapper(FlowAttributeMapper attributeMapper) { this.attributeMapper = attributeMapper; } /** - * Specialization of State's doEnter template method that - * executes behaviour specific to this state type in polymorphic fashion. + * Specialization of State's doEnter template method that executes behaviour specific to this state + * type in polymorphic fashion. *

    - * Entering this state, creates the subflow input map and spawns the subflow - * in the current flow execution. - * @param context the control context for the currently executing flow, used - * by this state to manipulate the flow execution - * @return a view selection containing model and view information needed to - * render the results of the state execution + * Entering this state, creates the subflow input map and spawns the subflow in the current flow execution. + * @param context the control context for the currently executing flow, used by this state to manipulate the flow + * execution + * @return a view selection containing model and view information needed to render the results of the state + * execution * @throws FlowExecutionException if an exception occurs in this state */ protected ViewSelection doEnter(RequestControlContext context) throws FlowExecutionException { @@ -121,8 +113,8 @@ public class SubflowState extends TransitionableState { } /** - * Create the input data map for the spawned subflow session. The returned - * map will be passed to {@link Flow#start(RequestControlContext, MutableAttributeMap)}. + * Create the input data map for the spawned subflow session. The returned map will be passed to + * {@link Flow#start(RequestControlContext, MutableAttributeMap)}. */ protected MutableAttributeMap createSubflowInput(RequestContext context) { if (getAttributeMapper() != null) { @@ -131,20 +123,19 @@ public class SubflowState extends TransitionableState { + "down to the spawned subflow for access within the subflow"); } return getAttributeMapper().createFlowInput(context); - } - else { + } else { if (logger.isDebugEnabled()) { logger.debug("No attribute mapper configured for this subflow state '" + getId() - + "' -- As a result, no attributes will be passed to the spawned subflow '" - + subflow.getId() + "'"); + + "' -- As a result, no attributes will be passed to the spawned subflow '" + subflow.getId() + + "'"); } return null; } } /** - * Called on completion of the subflow to handle the subflow result event as - * determined by the end state reached by the subflow. + * Called on completion of the subflow to handle the subflow result event as determined by the end state reached by + * the subflow. */ public ViewSelection onEvent(RequestControlContext context) { mapSubflowOutput(context.getLastEvent().getAttributes(), context); @@ -152,21 +143,22 @@ public class SubflowState extends TransitionableState { } /** - * Map the output data produced by the subflow back into the request context - * (typically flow scope). + * Map the output data produced by the subflow back into the request context (typically flow scope). */ private void mapSubflowOutput(AttributeMap subflowOutput, RequestContext context) { if (getAttributeMapper() != null) { if (logger.isDebugEnabled()) { - logger.debug("Messaging the configured attribute mapper to map subflow result attributes to the " - + "resuming parent flow -- It will have access to attributes passed up by the completed subflow"); + logger + .debug("Messaging the configured attribute mapper to map subflow result attributes to the " + + "resuming parent flow -- It will have access to attributes passed up by the completed subflow"); } attributeMapper.mapFlowOutput(subflowOutput, context); - } - else { + } else { if (logger.isDebugEnabled()) { - logger.debug("No attribute mapper is configured for the resuming subflow state '" + getId() - + "' -- As a result, no attributes of the ending flow will be passed to the resuming parent flow"); + logger + .debug("No attribute mapper is configured for the resuming subflow state '" + + getId() + + "' -- As a result, no attributes of the ending flow will be passed to the resuming parent flow"); } } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/TargetStateResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/TargetStateResolver.java index 189f8020..ce28ebe2 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/TargetStateResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/TargetStateResolver.java @@ -18,17 +18,16 @@ package org.springframework.webflow.engine; import org.springframework.webflow.execution.RequestContext; /** - * A strategy for calculating the target state of a transition. This facilitates - * dynamic transition target state resolution that takes into account runtime - * contextual information. + * A strategy for calculating the target state of a transition. This facilitates dynamic transition target state + * resolution that takes into account runtime contextual information. * * @author Keith Donald */ public interface TargetStateResolver { /** - * Resolve the target state of the transition from the source state in the - * current request context. Should never return null. + * Resolve the target state of the transition from the source state in the current request context. Should never + * return null. * @param transition the transition * @param sourceState the source state of the transition, could be null * @param context the current request context diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/Transition.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/Transition.java index 71622f1c..74534610 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/Transition.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/Transition.java @@ -26,32 +26,24 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * A path from one {@link TransitionableState state} to another - * {@link State state}. + * A path from one {@link TransitionableState state} to another {@link State state}. *

    - * When executed a transition takes a flow execution from its current state, - * called the source state, to another state, called the target - * state. A transition may become eligible for execution on the occurence - * of an {@link Event} from within a transitionable source state. + * When executed a transition takes a flow execution from its current state, called the source state, to another + * state, called the target state. A transition may become eligible for execution on the occurence of an + * {@link Event} from within a transitionable source state. *

    - * When an event occurs within this transition's source - * TransitionableState the determination of the eligibility of - * this transition is made by a TransitionCriteria object called - * the matching criteria. If the matching criteria returns - * true this transition is marked eligible for execution for that - * event. + * When an event occurs within this transition's source TransitionableState the determination of the + * eligibility of this transition is made by a TransitionCriteria object called the matching criteria. + * If the matching criteria returns true this transition is marked eligible for execution for that event. *

    - * Determination as to whether an eligible transition should be allowed to - * execute is made by a TransitionCriteria object called the - * execution criteria. If the execution criteria test fails this - * transition will roll back and reenter its source state. If the - * execution criteria test succeeds this transition will execute and take the - * flow to the transition's target state. + * Determination as to whether an eligible transition should be allowed to execute is made by a + * TransitionCriteria object called the execution criteria. If the execution criteria test fails + * this transition will roll back and reenter its source state. If the execution criteria test succeeds this + * transition will execute and take the flow to the transition's target state. *

    - * The target state of this transition is typically specified at configuration - * time in a static manner. If the target state of this transition needs to be - * calculated in a dynamic fashion at runtime configure a {@link TargetStateResolver} - * that supports such calculations. + * The target state of this transition is typically specified at configuration time in a static manner. If the target + * state of this transition needs to be calculated in a dynamic fashion at runtime configure a + * {@link TargetStateResolver} that supports such calculations. * * @see TransitionableState * @see TransitionCriteria @@ -68,29 +60,26 @@ public class Transition extends AnnotatedObject implements TransitionDefinition protected final Log logger = LogFactory.getLog(Transition.class); /** - * The criteria that determine whether or not this transition matches as - * eligible for execution when an event occurs in the source state. + * The criteria that determine whether or not this transition matches as eligible for execution when an event occurs + * in the source state. */ private TransitionCriteria matchingCriteria; /** - * The criteria that determine whether or not this transition, once matched, - * should complete execution or should roll back. + * The criteria that determine whether or not this transition, once matched, should complete execution or should + * roll back. */ private TransitionCriteria executionCriteria = WildcardTransitionCriteria.INSTANCE; /** - * The resolver responsible for calculating the target state of this - * transition. + * The resolver responsible for calculating the target state of this transition. */ private TargetStateResolver targetStateResolver; /** - * Create a new transition that always matches and always executes, - * transitioning to the target state calculated by the provided - * targetStateResolver. - * @param targetStateResolver the resolver of the target state of this - * transition + * Create a new transition that always matches and always executes, transitioning to the target state calculated by + * the provided targetStateResolver. + * @param targetStateResolver the resolver of the target state of this transition * @see #setMatchingCriteria(TransitionCriteria) * @see #setExecutionCriteria(TransitionCriteria) */ @@ -99,12 +88,10 @@ public class Transition extends AnnotatedObject implements TransitionDefinition } /** - * Create a new transition that matches on the specified criteria, - * transitioning to the target state calculated by the provided - * targetStateResolver. + * Create a new transition that matches on the specified criteria, transitioning to the target state calculated by + * the provided targetStateResolver. * @param matchingCriteria the criteria for matching this transition - * @param targetStateResolver the resolver of the target state of this - * transition + * @param targetStateResolver the resolver of the target state of this transition * @see #setExecutionCriteria(TransitionCriteria) */ public Transition(TransitionCriteria matchingCriteria, TargetStateResolver targetStateResolver) { @@ -123,8 +110,7 @@ public class Transition extends AnnotatedObject implements TransitionDefinition } /** - * Returns the criteria that determine whether or not this transition - * matches as eligible for execution. + * Returns the criteria that determine whether or not this transition matches as eligible for execution. * @return the transition matching criteria */ public TransitionCriteria getMatchingCriteria() { @@ -132,8 +118,7 @@ public class Transition extends AnnotatedObject implements TransitionDefinition } /** - * Set the criteria that determine whether or not this transition matches as - * eligible for execution. + * Set the criteria that determine whether or not this transition matches as eligible for execution. * @param matchingCriteria the transition matching criteria */ public void setMatchingCriteria(TransitionCriteria matchingCriteria) { @@ -142,8 +127,8 @@ public class Transition extends AnnotatedObject implements TransitionDefinition } /** - * Returns the criteria that determine whether or not this transition, once - * matched, should complete execution or should roll back. + * Returns the criteria that determine whether or not this transition, once matched, should complete execution or + * should roll back. * @return the transition execution criteria */ public TransitionCriteria getExecutionCriteria() { @@ -151,8 +136,8 @@ public class Transition extends AnnotatedObject implements TransitionDefinition } /** - * Set the criteria that determine whether or not this transition, once - * matched, should complete execution or should roll back. + * Set the criteria that determine whether or not this transition, once matched, should complete execution or should + * roll back. * @param executionCriteria the transition execution criteria */ public void setExecutionCriteria(TransitionCriteria executionCriteria) { @@ -168,8 +153,8 @@ public class Transition extends AnnotatedObject implements TransitionDefinition } /** - * Set this transition's target state resolver, to calculate what state to - * transition to when this transition is executed. + * Set this transition's target state resolver, to calculate what state to transition to when this transition is + * executed. * @param targetStateResolver the target state resolver */ public void setTargetStateResolver(TargetStateResolver targetStateResolver) { @@ -178,8 +163,8 @@ public class Transition extends AnnotatedObject implements TransitionDefinition } /** - * Checks if this transition is elligible for execution given the state of - * the provided flow execution request context. + * Checks if this transition is elligible for execution given the state of the provided flow execution request + * context. * @param context the flow execution request context * @return true if this transition should execute, false otherwise */ @@ -188,22 +173,21 @@ public class Transition extends AnnotatedObject implements TransitionDefinition } /** - * Checks if this transition can complete its execution or should be rolled - * back, given the state of the flow execution request context. + * Checks if this transition can complete its execution or should be rolled back, given the state of the flow + * execution request context. * @param context the flow execution request context - * @return true if this transition can complete execution, false if it - * should roll back + * @return true if this transition can complete execution, false if it should roll back */ public boolean canExecute(RequestContext context) { return executionCriteria.test(context); } /** - * Execute this state transition. Will only be called if the - * {@link #matches(RequestContext)} method returns true for given context. + * Execute this state transition. Will only be called if the {@link #matches(RequestContext)} method returns true + * for given context. * @param context the flow execution control context - * @return a view selection containing model and view information needed to - * render the results of the transition execution + * @return a view selection containing model and view information needed to render the results of the transition + * execution * @throws FlowExecutionException when transition execution fails */ public ViewSelection execute(State sourceState, RequestControlContext context) throws FlowExecutionException { @@ -215,10 +199,9 @@ public class Transition extends AnnotatedObject implements TransitionDefinition } if (sourceState instanceof TransitionableState) { // make exit call back on transitionable state - ((TransitionableState)sourceState).exit(context); + ((TransitionableState) sourceState).exit(context); } - } - else { + } else { if (logger.isDebugEnabled()) { logger.debug("Executing " + this); } @@ -227,15 +210,12 @@ public class Transition extends AnnotatedObject implements TransitionDefinition context.setLastTransition(this); // enter the target state (note: any exceptions are propagated) selectedView = targetState.enter(context); - } - else { + } else { if (sourceState != null && sourceState instanceof TransitionableState) { // 'roll back' and re-enter the transitionable source state - selectedView = ((TransitionableState)sourceState).reenter(context); - } - else { - throw new IllegalStateException( - "Execution of '" + this + "' was blocked by '" + getExecutionCriteria() + selectedView = ((TransitionableState) sourceState).reenter(context); + } else { + throw new IllegalStateException("Execution of '" + this + "' was blocked by '" + getExecutionCriteria() + "', " + "; however, no source state is set at runtime. " + "This is an illegal situation: check your flow definition."); } @@ -244,8 +224,7 @@ public class Transition extends AnnotatedObject implements TransitionDefinition if (context.getFlowExecutionContext().isActive()) { logger.debug("Completed execution of " + this + ", as a result the new state is '" + context.getCurrentState().getId() + "' in flow '" + context.getActiveFlow().getId() + "'"); - } - else { + } else { logger.debug("Completed execution of " + this + ", as a result the flow execution has ended"); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionCriteria.java index 67fb7d33..676d9d1c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionCriteria.java @@ -18,8 +18,8 @@ package org.springframework.webflow.engine; import org.springframework.webflow.execution.RequestContext; /** - * Strategy interface encapsulating criteria that determine whether - * or not a transition should execute given a flow execution request context. + * Strategy interface encapsulating criteria that determine whether or not a transition should execute given a flow + * execution request context. * * @see org.springframework.webflow.engine.Transition * @see org.springframework.webflow.execution.RequestContext @@ -30,8 +30,7 @@ import org.springframework.webflow.execution.RequestContext; public interface TransitionCriteria { /** - * Check if the transition should fire based on the given flow execution - * request context. + * Check if the transition should fire based on the given flow execution request context. * @param context the flow execution request context * @return true if the transition should fire, false otherwise */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionSet.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionSet.java index d64eef9d..458bad82 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionSet.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionSet.java @@ -24,8 +24,7 @@ import org.springframework.webflow.core.collection.CollectionUtils; import org.springframework.webflow.execution.RequestContext; /** - * A typed set of transitions for use internally by artifacts that can - * apply transition execution logic. + * A typed set of transitions for use internally by artifacts that can apply transition execution logic. * * @see TransitionableState#getTransitionSet() * @see Flow#getGlobalTransitionSet() @@ -42,8 +41,7 @@ public class TransitionSet { /** * Add a transition to this set. * @param transition the transition to add - * @return true if this set's contents changed as a result of the add - * operation + * @return true if this set's contents changed as a result of the add operation */ public boolean add(Transition transition) { if (contains(transition)) { @@ -55,8 +53,7 @@ public class TransitionSet { /** * Add a collection of transition instances to this set. * @param transitions the transitions to add - * @return true if this set's contents changed as a result of the add - * operation + * @return true if this set's contents changed as a result of the add operation */ public boolean addAll(Transition[] transitions) { return CollectionUtils.addAllNoDuplicates(this.transitions, transitions); @@ -74,8 +71,7 @@ public class TransitionSet { /** * Remove the transition instance from this set. * @param transition the transition to remove - * @return true if this list's contents changed as a result of the remove - * operation + * @return true if this list's contents changed as a result of the remove operation */ public boolean remove(Transition transition) { return transitions.remove(transition); @@ -94,12 +90,11 @@ public class TransitionSet { * @return the transition set as a typed array */ public Transition[] toArray() { - return (Transition[])transitions.toArray(new Transition[transitions.size()]); + return (Transition[]) transitions.toArray(new Transition[transitions.size()]); } /** - * Returns a list of the supported transitional criteria used to match - * transitions in this state. + * Returns a list of the supported transitional criteria used to match transitions in this state. * @return the list of transitional criteria */ public TransitionCriteria[] getTransitionCriterias() { @@ -107,21 +102,20 @@ public class TransitionSet { int i = 0; Iterator it = transitions.iterator(); while (it.hasNext()) { - criterias[i++] = ((Transition)it.next()).getMatchingCriteria(); + criterias[i++] = ((Transition) it.next()).getMatchingCriteria(); } return criterias; } /** - * Gets a transition for given flow execution request context. The first - * matching transition will be returned. + * Gets a transition for given flow execution request context. The first matching transition will be returned. * @param context a flow execution context * @return the transition, or null if no transition matches */ public Transition getTransition(RequestContext context) { Iterator it = transitions.iterator(); while (it.hasNext()) { - Transition transition = (Transition)it.next(); + Transition transition = (Transition) it.next(); if (transition.matches(context)) { return transition; } @@ -130,8 +124,7 @@ public class TransitionSet { } /** - * Returns whether or not this list has a transition that will fire for - * given flow execution request context. + * Returns whether or not this list has a transition that will fire for given flow execution request context. * @param context a flow execution context */ public boolean hasMatchingTransition(RequestContext context) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionableState.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionableState.java index dcf3374d..8b01286f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionableState.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/TransitionableState.java @@ -23,8 +23,7 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * Abstract superclass for states that can execute a transition in response to - * an event. + * Abstract superclass for states that can execute a transition in response to an event. * * @see org.springframework.webflow.engine.Transition * @see org.springframework.webflow.engine.TransitionCriteria @@ -48,8 +47,8 @@ public abstract class TransitionableState extends State implements Transitionabl * Create a new transitionable state. * @param flow the owning flow * @param id the state identifier (must be unique to the flow) - * @throws IllegalArgumentException when this state cannot be added to given - * flow, for instance when the id is not unique + * @throws IllegalArgumentException when this state cannot be added to given flow, for instance when the id is not + * unique * @see State#State(Flow, String) * @see #getTransitionSet() */ @@ -58,7 +57,7 @@ public abstract class TransitionableState extends State implements Transitionabl } // implementing TranstionableStateDefinition - + public TransitionDefinition[] getTransitions() { return getTransitionSet().toArray(); } @@ -71,10 +70,9 @@ public abstract class TransitionableState extends State implements Transitionabl } /** - * Get a transition in this state for given flow execution request context. - * Throws and exception when there is no corresponding transition. - * @throws NoMatchingTransitionException when a matching transition cannot - * be found + * Get a transition in this state for given flow execution request context. Throws and exception when there is no + * corresponding transition. + * @throws NoMatchingTransitionException when a matching transition cannot be found */ public Transition getRequiredTransition(RequestContext context) throws NoMatchingTransitionException { Transition transition = getTransitionSet().getTransition(context); @@ -89,8 +87,7 @@ public abstract class TransitionableState extends State implements Transitionabl } /** - * Returns the list of actions executed by this state when it is exited. - * The returned list is mutable. + * Returns the list of actions executed by this state when it is exited. The returned list is mutable. * @return the state exit action list */ public ActionList getExitActionList() { @@ -100,37 +97,32 @@ public abstract class TransitionableState extends State implements Transitionabl // behavioral methods /** - * Inform this state definition that an event was signaled in it. The - * signaled event is the last event available in given request context - * ({@link RequestContext#getLastEvent()}). + * Inform this state definition that an event was signaled in it. The signaled event is the last event available in + * given request context ({@link RequestContext#getLastEvent()}). * @param context the flow execution control context * @return the selected view - * @throws NoMatchingTransitionException when a matching transition cannot - * be found + * @throws NoMatchingTransitionException when a matching transition cannot be found */ public ViewSelection onEvent(RequestControlContext context) throws NoMatchingTransitionException { return getRequiredTransition(context).execute(this, context); } /** - * Re-enter this state. This is typically called when a transition out of - * this state is selected, but transition execution rolls back and as a - * result the flow reenters the source state. + * Re-enter this state. This is typically called when a transition out of this state is selected, but transition + * execution rolls back and as a result the flow reenters the source state. *

    * By default, this just calls enter(). - * @param context the flow control context in an executing flow (a client - * instance of a flow) - * @return a view selection containing model and view information needed to - * render the results of the state processing + * @param context the flow control context in an executing flow (a client instance of a flow) + * @return a view selection containing model and view information needed to render the results of the state + * processing */ public ViewSelection reenter(RequestControlContext context) { return enter(context); } /** - * Exit this state. This is typically called when a transition takes the - * flow out of this state into another state. By default just executes any - * registered exit actions. + * Exit this state. This is typically called when a transition takes the flow out of this state into another state. + * By default just executes any registered exit actions. * @param context the flow control context */ public void exit(RequestControlContext context) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewSelector.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewSelector.java index dc313cd2..20823526 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewSelector.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewSelector.java @@ -19,17 +19,14 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * Factory that produces a new, configured {@link ViewSelection} object on each - * invocation, taking into account the information in the provided flow - * execution request context. + * Factory that produces a new, configured {@link ViewSelection} object on each invocation, taking into account the + * information in the provided flow execution request context. *

    - * Note: this class is a runtime factory. Instances are used at flow execution - * time by objects like the {@link ViewState} to produce new - * {@link ViewSelection view selections}. + * Note: this class is a runtime factory. Instances are used at flow execution time by objects like the + * {@link ViewState} to produce new {@link ViewSelection view selections}. *

    - * This class allows for easy insertion of dynamic view selection logic, for - * instance, letting you determine the view to render or the available model - * data for rendering based on contextual information. + * This class allows for easy insertion of dynamic view selection logic, for instance, letting you determine the view to + * render or the available model data for rendering based on contextual information. * * @see org.springframework.webflow.execution.ViewSelection * @see org.springframework.webflow.engine.ViewState @@ -41,30 +38,29 @@ import org.springframework.webflow.execution.ViewSelection; public interface ViewSelector { /** - * Will the primary selection returned by 'makeEntrySelection' for the given - * request context be renderable in this request? + * Will the primary selection returned by 'makeEntrySelection' for the given request context be renderable in this + * request? *

    - * "Renderable" view selections typically can have 'render-actions' execute - * before they are created. An example would be an ApplicationView that - * forwards to a view template like a JSP. "Non-renderable" view selections - * are things like a flow execution redirect--no render actually occurs, but - * only a redirect--rendering happens on the new redirect request. + * "Renderable" view selections typically can have 'render-actions' execute before they are created. An example + * would be an ApplicationView that forwards to a view template like a JSP. "Non-renderable" view selections are + * things like a flow execution redirect--no render actually occurs, but only a redirect--rendering happens on the + * new redirect request. * @param context the current request context of the executing flow * @return true if yes, false otherwise */ public boolean isEntrySelectionRenderable(RequestContext context); /** - * Make a new "entry" view selection for the given request context. Called - * when a view-state, end-state, or other interactive state type is entered. + * Make a new "entry" view selection for the given request context. Called when a view-state, end-state, or other + * interactive state type is entered. * @param context the current request context of the executing flow * @return the entry view selection */ public ViewSelection makeEntrySelection(RequestContext context); /** - * Reconstitute a renderable view selection for the given request context to - * support a ViewState 'refresh' operation. + * Reconstitute a renderable view selection for the given request context to support a ViewState 'refresh' + * operation. * @param context the current request context of the executing flow * @return the view selection */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java index d09bcd1a..f3671660 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/ViewState.java @@ -22,11 +22,10 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * A view state is a state that issues a response to the user, for - * example, for soliciting form input. + * A view state is a state that issues a response to the user, for example, for soliciting form input. *

    - * To accomplish this, a ViewState makes a {@link ViewSelection}, - * which contains the necessary information to issue a suitable response. + * To accomplish this, a ViewState makes a {@link ViewSelection}, which contains the necessary + * information to issue a suitable response. * * @see org.springframework.webflow.engine.ViewSelector * @@ -49,16 +48,14 @@ public class ViewState extends TransitionableState { * Create a new view state. * @param flow the owning flow * @param id the state identifier (must be unique to the flow) - * @throws IllegalArgumentException when this state cannot be added to given - * flow, e.g. because the id is not unique + * @throws IllegalArgumentException when this state cannot be added to given flow, e.g. because the id is not unique */ public ViewState(Flow flow, String id) throws IllegalArgumentException { super(flow, id); } /** - * Returns the strategy used to select the view to render in this view - * state. + * Returns the strategy used to select the view to render in this view state. */ public ViewSelector getViewSelector() { return viewSelector; @@ -73,8 +70,7 @@ public class ViewState extends TransitionableState { } /** - * Returns the list of actions executable by this view state on entry and on - * refresh. The returned list is mutable. + * Returns the list of actions executable by this view state on entry and on refresh. The returned list is mutable. * @return the state action list */ public ActionList getRenderActionList() { @@ -82,14 +78,13 @@ public class ViewState extends TransitionableState { } /** - * Specialization of State's doEnter template method that - * executes behavior specific to this state type in polymorphic fashion. + * Specialization of State's doEnter template method that executes behavior specific to this state + * type in polymorphic fashion. *

    - * Returns a view selection indicating a response to issue. The view - * selection typically contains all the data necessary to issue the - * response. - * @param context the control context for the currently executing flow, used - * by this state to manipulate the flow execution + * Returns a view selection indicating a response to issue. The view selection typically contains all the data + * necessary to issue the response. + * @param context the control context for the currently executing flow, used by this state to manipulate the flow + * execution * @return a view selection serving as a response instruction * @throws FlowExecutionException if an exception occurs in this state */ @@ -102,10 +97,9 @@ public class ViewState extends TransitionableState { } /** - * Request that the current view selection be reconstituted to support - * reissuing the response. This is an idempotent operation that may be - * safely called any number of times on a paused execution, used primarily - * to support a flow execution redirect. + * Request that the current view selection be reconstituted to support reissuing the response. This is an idempotent + * operation that may be safely called any number of times on a paused execution, used primarily to support a flow + * execution redirect. * @param context the request context * @return the view selection * @throws FlowExecutionException if an exception occurs in this state diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/WildcardTransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/WildcardTransitionCriteria.java index c78c1297..c13a2135 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/WildcardTransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/WildcardTransitionCriteria.java @@ -26,15 +26,14 @@ import org.springframework.webflow.execution.RequestContext; * @author Keith Donald */ public class WildcardTransitionCriteria implements TransitionCriteria, Serializable { - + /* - * Implementation note: not located in webflow.execution.support package to - * avoid a cyclic dependency between webflow.execution and webflow.execution.support. + * Implementation note: not located in webflow.execution.support package to avoid a cyclic dependency between + * webflow.execution and webflow.execution.support. */ /** - * Event id value ("*") that will cause the transition to match on any - * event. + * Event id value ("*") that will cause the transition to match on any event. */ public static final String WILDCARD_EVENT_ID = "*"; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilder.java index b4ef5079..b90cb51e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilder.java @@ -44,13 +44,11 @@ import org.springframework.webflow.execution.ScopeType; import org.springframework.webflow.execution.support.EventFactorySupport; /** - * Base class for flow builders that programmatically build flows in Java - * configuration code. + * Base class for flow builders that programmatically build flows in Java configuration code. *

    - * To give you an example of what a simple Java-based web flow builder - * definition might look like, the following example defines the 'dynamic' web - * flow roughly equivalent to the work flow statically implemented in Spring - * MVC's simple form controller: + * To give you an example of what a simple Java-based web flow builder definition might look like, the following example + * defines the 'dynamic' web flow roughly equivalent to the work flow statically implemented in Spring MVC's simple form + * controller: * *

      * public class CustomerDetailFlowBuilder extends AbstractFlowBuilder {
    @@ -71,72 +69,56 @@ import org.springframework.webflow.execution.support.EventFactorySupport;
      * }
      * 
    * - * What this Java-based FlowBuilder implementation does is add four states to a - * flow. These include a "get" ActionState (the start state), a - * ViewState state, a "bind and validate" + * What this Java-based FlowBuilder implementation does is add four states to a flow. These include a "get" + * ActionState (the start state), a ViewState state, a "bind and validate" * ActionState, and an end marker state (EndState). *

    - * The first state, an action state, will be assigned the indentifier - * getDetails. This action state will automatically be - * configured with the following defaults: + * The first state, an action state, will be assigned the indentifier getDetails. This action state will + * automatically be configured with the following defaults: *

      - *
    1. The action instance with id customerAction. This is the - * Action implementation that will execute when this state is - * entered. In this example, that Action will go out to the DB, - * load the Customer, and put it in the Flow's request context. - *
    2. A success transition to a default view state, called - * displayDetails. This means when the Action - * returns a success result event (aka outcome), the + *
    3. The action instance with id customerAction. This is the Action implementation + * that will execute when this state is entered. In this example, that Action will go out to the DB, load + * the Customer, and put it in the Flow's request context. + *
    4. A success transition to a default view state, called displayDetails. This means + * when the Action returns a success result event (aka outcome), the * displayDetails state will be entered. - *
    5. It will act as the start state for this flow (by default, the first - * state added to a flow during the build process is treated as the start - * state). + *
    6. It will act as the start state for this flow (by default, the first state added to a flow during the build + * process is treated as the start state). *
    *

    - * The second state, a view state, will be identified as - * displayDetails. This view state will automatically be - * configured with the following defaults: + * The second state, a view state, will be identified as displayDetails. This view state will + * automatically be configured with the following defaults: *

      - *
    1. A view name called customerDetails. This is the logical - * name of a view resource. This logical view name gets mapped to a physical - * view resource (jsp, etc.) by the calling front controller (via a Spring view + *
    2. A view name called customerDetails. This is the logical name of a view resource. This logical + * view name gets mapped to a physical view resource (jsp, etc.) by the calling front controller (via a Spring view * resolver, or a Struts action forward, for example). - *
    3. A submit transition to a bind and validate action state, - * indentified by the default id bindAndValidate. This means - * when a submit event is signaled by the view (for example, on a - * submit button click), the bindAndValidate action state will be entered and - * the bindAndValidate method of the - * customerAction Action implementation will be - * executed. + *
    4. A submit transition to a bind and validate action state, indentified by the default id + * bindAndValidate. This means when a submit event is signaled by the view (for example, + * on a submit button click), the bindAndValidate action state will be entered and the bindAndValidate + * method of the customerAction Action implementation will be executed. *
    *

    - * The third state, an action state, will be indentified as - * bindAndValidate. This action state will automatically be - * configured with the following defaults: + * The third state, an action state, will be indentified as bindAndValidate. This action state will + * automatically be configured with the following defaults: *

      - *
    1. An action bean named customerAction -- this is the name - * of the Action implementation exported in the application - * context that will execute when this state is entered. In this example, the - * Action has a "bindAndValidate" method that will bind form - * input in the HTTP request to a backing Customer form object, validate it, and - * update the DB. - *
    2. A success transition to a default end state, called - * finish. This means if the Action returns a - * success result, the finish end state will be + *
    3. An action bean named customerAction -- this is the name of the Action + * implementation exported in the application context that will execute when this state is entered. In this example, the + * Action has a "bindAndValidate" method that will bind form input in the HTTP request to a backing + * Customer form object, validate it, and update the DB. + *
    4. A success transition to a default end state, called finish. This means if the + * Action returns a success result, the finish end state will be * transitioned to and the flow will terminate. - *
    5. An error transition back to the form view. This means if - * the Action returns an error event, the + *
    6. An error transition back to the form view. This means if the Action returns an + * error event, the * displayDetails view state will be transitioned back to. *
    *

    - * The fourth and last state, an end state, will be indentified with the default - * end state id finish. This end state is a marker that signals - * the end of the flow. When entered, the flow session terminates, and if this - * flow is acting as a root flow in the current flow execution, any - * flow-allocated resources will be cleaned up. An end state can optionally be - * configured with a logical view name to forward to when entered. It will also - * trigger a state transition in a resuming parent flow if this flow was - * participating as a spawned 'subflow' within a suspended parent flow. + * The fourth and last state, an end state, will be indentified with the default end state id finish. + * This end state is a marker that signals the end of the flow. When entered, the flow session terminates, and if this + * flow is acting as a root flow in the current flow execution, any flow-allocated resources will be cleaned up. An end + * state can optionally be configured with a logical view name to forward to when entered. It will also trigger a state + * transition in a resuming parent flow if this flow was participating as a spawned 'subflow' within a suspended parent + * flow. * * @author Keith Donald * @author Erwin Vervaet @@ -144,8 +126,7 @@ import org.springframework.webflow.execution.support.EventFactorySupport; public abstract class AbstractFlowBuilder extends BaseFlowBuilder { /** - * A helper for creating commonly used event identifiers that drive - * transitions created by this builder. + * A helper for creating commonly used event identifiers that drive transitions created by this builder. */ private EventFactorySupport eventFactorySupport = new EventFactorySupport(); @@ -157,26 +138,25 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Create an instance of an abstract flow builder, using the specified - * locator to obtain needed flow services at build time. - * @param flowServiceLocator the locator for services needed by this builder - * to build its Flow + * Create an instance of an abstract flow builder, using the specified locator to obtain needed flow services at + * build time. + * @param flowServiceLocator the locator for services needed by this builder to build its Flow */ protected AbstractFlowBuilder(FlowServiceLocator flowServiceLocator) { super(flowServiceLocator); } /** - * Returns the configured event factory support helper for creating commonly - * used event identifiers that drive transitions created by this builder. + * Returns the configured event factory support helper for creating commonly used event identifiers that drive + * transitions created by this builder. */ public EventFactorySupport getEventFactorySupport() { return eventFactorySupport; } /** - * Sets the event factory support helper to use to create commonly used - * event identifiers that drive transitions created by this builder. + * Sets the event factory support helper to use to create commonly used event identifiers that drive transitions + * created by this builder. */ public void setEventFactorySupport(EventFactorySupport eventFactorySupport) { this.eventFactorySupport = eventFactorySupport; @@ -188,19 +168,17 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Hook subclasses may override to provide additional properties for the - * flow built by this builder. Returns a empty collection by default. - * @return additional properties describing the flow being built, should not - * return null + * Hook subclasses may override to provide additional properties for the flow built by this builder. Returns a empty + * collection by default. + * @return additional properties describing the flow being built, should not return null */ protected AttributeMap flowAttributes() { return CollectionUtils.EMPTY_ATTRIBUTE_MAP; } - + /** - * Hook method subclasses can override to initialize the flow builder. - * Will be called by {@link #init(String, AttributeMap)} after - * creating the initial Flow object. As a consequence, {@link #getFlow()} + * Hook method subclasses can override to initialize the flow builder. Will be called by + * {@link #init(String, AttributeMap)} after creating the initial Flow object. As a consequence, {@link #getFlow()} * can be called to retrieve the Flow object under construction. */ protected void initBuilder() { @@ -236,8 +214,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * Adds a view state to the flow built by this builder. * @param stateId the state identifier * @param viewName the string-encoded view selector - * @param renderAction the action to execute on state entry and refresh; may - * be null + * @param renderAction the action to execute on state entry and refresh; may be null * @param transition the sole transition (path) out of this state * @return the fully constructed view state instance */ @@ -250,8 +227,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * Adds a view state to the flow built by this builder. * @param stateId the state identifier * @param viewName the string-encoded view selector - * @param renderAction the action to execute on state entry and refresh; may - * be null + * @param renderAction the action to execute on state entry and refresh; may be null * @param transitions the transitions (paths) out of this state * @return the fully constructed view state instance */ @@ -264,15 +240,12 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * Adds a view state to the flow built by this builder. * @param stateId the state identifier * @param entryActions the actions to execute when the state is entered - * @param viewSelector the view selector that will make the view selection - * when the state is entered - * @param renderActions any 'render actions' to execute on state entry and - * refresh; may be null + * @param viewSelector the view selector that will make the view selection when the state is entered + * @param renderActions any 'render actions' to execute on state entry and refresh; may be null * @param transitions the transitions (path) out of this state * @param exceptionHandlers any exception handlers to attach to the state * @param exitActions the actions to execute when the state exits - * @param attributes attributes to assign to the state that may be used to - * affect state construction and execution + * @param attributes attributes to assign to the state that may be used to affect state construction and execution * @return the fully constructed view state instance */ protected State addViewState(String stateId, Action[] entryActions, ViewSelector viewSelector, @@ -313,8 +286,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * @param stateId the state identifier * @param action the single action to execute when the state is entered * @param transition the single transition (path) out of this state - * @param exceptionHandler the exception handler to handle exceptions thrown - * by the action + * @param exceptionHandler the exception handler to handle exceptions thrown by the action * @return the fully constructed action state instance */ protected State addActionState(String stateId, Action action, Transition transition, @@ -327,14 +299,11 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * Adds an action state to the flow built by this builder. * @param stateId the state identifier * @param entryActions any generic entry actions to add to the state - * @param actions the actions to execute in a chain when the state is - * entered + * @param actions the actions to execute in a chain when the state is entered * @param transitions the transitions (paths) out of this state - * @param exceptionHandlers the exception handlers to handle exceptions - * thrown by the actions + * @param exceptionHandlers the exception handlers to handle exceptions thrown by the actions * @param exitActions the exit actions to execute when the state exits - * @param attributes attributes to assign to the state that may be used to - * affect state construction and execution + * @param attributes attributes to assign to the state that may be used to affect state construction and execution * @return the fully constructed action state instance */ protected State addActionState(String stateId, Action[] entryActions, Action[] actions, Transition[] transitions, @@ -365,8 +334,8 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { */ protected State addDecisionState(String stateId, TransitionCriteria decisionCriteria, String trueStateId, String falseStateId) { - Transition thenTransition = getFlowArtifactFactory() - .createTransition(to(trueStateId), decisionCriteria, null, null); + Transition thenTransition = getFlowArtifactFactory().createTransition(to(trueStateId), decisionCriteria, null, + null); Transition elseTransition = getFlowArtifactFactory().createTransition(to(falseStateId), null, null, null); return getFlowArtifactFactory().createDecisionState(stateId, getFlow(), null, new Transition[] { thenTransition, elseTransition }, null, null, null); @@ -377,11 +346,9 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * @param stateId the state identifier * @param entryActions the entry actions to execute when the state enters * @param transitions the transitions (paths) out of this state - * @param exceptionHandlers the exception handlers to handle exceptions - * thrown by the state + * @param exceptionHandlers the exception handlers to handle exceptions thrown by the state * @param exitActions the exit actions to execute when the state exits - * @param attributes attributes to assign to the state that may be used to - * affect state construction and execution + * @param attributes attributes to assign to the state that may be used to affect state construction and execution * @return the fully constructed decision state instance */ protected State addDecisionState(String stateId, Action[] entryActions, Transition[] transitions, @@ -396,8 +363,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * Adds a subflow state to the flow built by this builder. * @param stateId the state identifier * @param subflow the flow that will act as the subflow - * @param attributeMapper the mapper to map subflow input and output - * attributes + * @param attributeMapper the mapper to map subflow input and output attributes * @param transition the single transition (path) out of the state * @return the fully constructed subflow state instance */ @@ -411,8 +377,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * Adds a subflow state to the flow built by this builder. * @param stateId the state identifier * @param subflow the flow that will act as the subflow - * @param attributeMapper the mapper to map subflow input and output - * attributes + * @param attributeMapper the mapper to map subflow input and output attributes * @param transitions the transitions (paths) out of the state * @return the fully constructed subflow state instance */ @@ -427,14 +392,11 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * @param stateId the state identifier * @param entryActions the entry actions to execute when the state enters * @param subflow the flow that will act as the subflow - * @param attributeMapper the mapper to map subflow input and output - * attributes + * @param attributeMapper the mapper to map subflow input and output attributes * @param transitions the transitions (paths) out of this state - * @param exceptionHandlers the exception handlers to handle exceptions - * thrown by the state + * @param exceptionHandlers the exception handlers to handle exceptions thrown by the state * @param exitActions the exit actions to execute when the state exits - * @param attributes attributes to assign to the state that may be used to - * affect state construction and execution + * @param attributes attributes to assign to the state that may be used to affect state construction and execution * @return the fully constructed subflow state instance */ protected State addSubflowState(String stateId, Action[] entryActions, Flow subflow, @@ -462,34 +424,30 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * @return the fully constructed end state instance */ protected State addEndState(String stateId, String viewName) { - return getFlowArtifactFactory().createEndState(stateId, getFlow(), null, viewSelector(viewName), null, - null, null); + return getFlowArtifactFactory().createEndState(stateId, getFlow(), null, viewSelector(viewName), null, null, + null); } /** * Adds an end state to the flow built by this builder. * @param stateId the state identifier * @param viewName the string-encoded view selector - * @param outputMapper the output mapper to map output attributes for the - * end state (a flow outcome) + * @param outputMapper the output mapper to map output attributes for the end state (a flow outcome) * @return the fully constructed end state instance */ protected State addEndState(String stateId, String viewName, AttributeMapper outputMapper) { - return getFlowArtifactFactory().createEndState(stateId, getFlow(), null, viewSelector(viewName), - outputMapper, null, null); + return getFlowArtifactFactory().createEndState(stateId, getFlow(), null, viewSelector(viewName), outputMapper, + null, null); } /** * Adds an end state to the flow built by this builder. * @param stateId the state identifier * @param entryActions the actions to execute when the state is entered - * @param viewSelector the view selector that will make the view selection - * when the state is entered - * @param outputMapper the output mapper to map output attributes for the - * end state (a flow outcome) + * @param viewSelector the view selector that will make the view selection when the state is entered + * @param outputMapper the output mapper to map output attributes for the end state (a flow outcome) * @param exceptionHandlers any exception handlers to attach to the state - * @param attributes attributes to assign to the state that may be used to - * affect state construction and execution + * @param attributes attributes to assign to the state that may be used to affect state construction and execution * @return the fully constructed end state instance */ protected State addEndState(String stateId, Action[] entryActions, ViewSelector viewSelector, @@ -501,19 +459,17 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { // helpers to create misc. flow artifacts /** - * Factory method that creates a view selector from an encoded - * view name. See {@link TextToViewSelector} for information on the - * conversion rules. + * Factory method that creates a view selector from an encoded view name. See {@link TextToViewSelector} for + * information on the conversion rules. * @param viewName the encoded view selector * @return the view selector */ public ViewSelector viewSelector(String viewName) { - return (ViewSelector)fromStringTo(ViewSelector.class).execute(viewName); + return (ViewSelector) fromStringTo(ViewSelector.class).execute(viewName); } /** - * Resolves the action with the specified id. Simply looks the action up by - * id and returns it. + * Resolves the action with the specified id. Simply looks the action up by id and returns it. * @param id the action id * @return the action * @throws FlowArtifactLookupException the action could not be resolved @@ -523,10 +479,9 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates a bean invoking action that invokes the method identified by the - * signature on the bean associated with the action identifier. - * @param beanId the id identifying an arbitrary - * java.lang.Object to be used as an action + * Creates a bean invoking action that invokes the method identified by the signature on the bean associated with + * the action identifier. + * @param beanId the id identifying an arbitrary java.lang.Object to be used as an action * @param methodSignature the signature of the method to invoke on the POJO * @return the adapted bean invoking action * @throws FlowArtifactLookupException the action could not be resolved @@ -538,10 +493,9 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates a bean invoking action that invokes the method identified by the - * signature on the bean associated with the action identifier. - * @param beanId the id identifying an arbitrary - * java.lang.Object to be used as an action + * Creates a bean invoking action that invokes the method identified by the signature on the bean associated with + * the action identifier. + * @param beanId the id identifying an arbitrary java.lang.Object to be used as an action * @param methodSignature the signature of the method to invoke on the POJO * @return the adapted bean invoking action * @throws FlowArtifactLookupException the action could not be resolved @@ -578,7 +532,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { protected Expression expression(String expressionString) { return getFlowServiceLocator().getExpressionParser().parseExpression(expressionString); } - + /** * Parses the expression string into a settable {@link Expression} object. * @param expressionString the expression string, e.g. flowScope.order.number @@ -590,18 +544,19 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Convert the encoded method signature string to a {@link MethodSignature} - * object. Method signatures are used to match methods on POJO services to - * invoke on a {@link AbstractBeanInvokingAction bean invoking action}. + * Convert the encoded method signature string to a {@link MethodSignature} object. Method signatures are used to + * match methods on POJO services to invoke on a {@link AbstractBeanInvokingAction bean invoking action}. *

    * Encoded method signature format: * * Method without arguments: + * *

     	 *       ${methodName}
     	 * 
    * * Method with arguments: + * *
     	 *       ${methodName}(${arg1}, ${arg2}, ${arg n})
     	 * 
    @@ -611,13 +566,12 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * @see #action(String, MethodSignature, ActionResultExposer) */ protected MethodSignature method(String method) { - return (MethodSignature)fromStringTo(MethodSignature.class).execute(method); + return (MethodSignature) fromStringTo(MethodSignature.class).execute(method); } /** - * Factory method for a {@link ActionResultExposer result exposer}. A - * result exposer is used to expose an action result such as a method return - * value or expression evaluation result to the calling flow. + * Factory method for a {@link ActionResultExposer result exposer}. A result exposer is used to expose an action + * result such as a method return value or expression evaluation result to the calling flow. * @param resultName the result name * @return the result exposer * @see #action(String, MethodSignature, ActionResultExposer) @@ -627,9 +581,8 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Factory method for a {@link ActionResultExposer result exposer}. A - * result exposer is used to expose an action result such as a method return - * value or expression evaluation result to the calling flow. + * Factory method for a {@link ActionResultExposer result exposer}. A result exposer is used to expose an action + * result such as a method return value or expression evaluation result to the calling flow. * @param resultName the result name * @param resultScope the scope of the result * @return the result exposer @@ -638,43 +591,38 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { protected ActionResultExposer result(String resultName, ScopeType resultScope) { return new ActionResultExposer(resultName, resultScope); } - + /** - * Wrap given action in an {@link AnnotatedAction}} to be able - * to annotate it with attributes. + * Wrap given action in an {@link AnnotatedAction}} to be able to annotate it with attributes. * @param action the action to annotate * @return the wrapped action * @since 1.0.4 */ protected AnnotatedAction annotate(Action action) { if (action instanceof AnnotatedAction) { - return (AnnotatedAction)action; - } - else { + return (AnnotatedAction) action; + } else { return new AnnotatedAction(action); } } /** - * Creates an annotated action decorator that instructs the specified method - * be invoked on the multi action when it is executed. Use this when working - * with MultiActions to specify the method on the MultiAction to invoke for - * a particular usage scenario. Use the {@link #method(String)} factory - * method when working with + * Creates an annotated action decorator that instructs the specified method be invoked on the multi action when it + * is executed. Use this when working with MultiActions to specify the method on the MultiAction to invoke for a + * particular usage scenario. Use the {@link #method(String)} factory method when working with * {@link AbstractBeanInvokingAction bean invoking actions}. * @param methodName the name of the method on the multi action instance * @param multiAction the multi action - * @return the annotated action that when invoked sets up a context property - * used by the multi action to instruct it with what method to invoke + * @return the annotated action that when invoked sets up a context property used by the multi action to instruct it + * with what method to invoke * @since 1.0.4 */ protected AnnotatedAction invoke(String methodName, Action multiAction) { AnnotatedAction annotatedAction; if (multiAction instanceof AnnotatedAction) { // already wrapped in an AnnotatedAction - annotatedAction = (AnnotatedAction)multiAction; - } - else { + annotatedAction = (AnnotatedAction) multiAction; + } else { annotatedAction = new AnnotatedAction(multiAction); } annotatedAction.setMethod(methodName); @@ -682,24 +630,21 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates an annotated action decorator that instructs the specified method - * be invoked on the multi action when it is executed. Use this when working - * with MultiActions to specify the method on the MultiAction to invoke for - * a particular usage scenario. Use the {@link #method(String)} factory - * method when working with + * Creates an annotated action decorator that instructs the specified method be invoked on the multi action when it + * is executed. Use this when working with MultiActions to specify the method on the MultiAction to invoke for a + * particular usage scenario. Use the {@link #method(String)} factory method when working with * {@link AbstractBeanInvokingAction bean invoking actions}. * @param methodName the name of the method on the multi action instance * @param multiAction the multi action - * @return the annotated action that when invoked sets up a context property - * used by the multi action to instruct it with what method to invoke + * @return the annotated action that when invoked sets up a context property used by the multi action to instruct it + * with what method to invoke */ protected AnnotatedAction invoke(String methodName, MultiAction multiAction) throws FlowArtifactLookupException { - return invoke(methodName, (Action)multiAction); + return invoke(methodName, (Action) multiAction); } - + /** - * Creates an annotated action decorator that makes the given action - * an named action. + * Creates an annotated action decorator that makes the given action an named action. * @param name the action name * @param action the action to name * @return the annotated named action @@ -708,9 +653,8 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { AnnotatedAction annotatedAction; if (action instanceof AnnotatedAction) { // already wrapped in an AnnotatedAction - annotatedAction = (AnnotatedAction)action; - } - else { + annotatedAction = (AnnotatedAction) action; + } else { annotatedAction = new AnnotatedAction(action); } annotatedAction.setName(name); @@ -718,27 +662,23 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Request that the attribute mapper with the specified name be used to map - * attributes between a parent flow and a spawning subflow when the subflow - * state being constructed is entered. - * @param id the id of the attribute mapper that will map attributes between - * the flow built by this builder and the subflow + * Request that the attribute mapper with the specified name be used to map attributes between a parent flow and a + * spawning subflow when the subflow state being constructed is entered. + * @param id the id of the attribute mapper that will map attributes between the flow built by this builder and the + * subflow * @return the attribute mapper - * @throws FlowArtifactLookupException no FlowAttributeMapper implementation - * was exported with the specified id + * @throws FlowArtifactLookupException no FlowAttributeMapper implementation was exported with the specified id */ protected FlowAttributeMapper attributeMapper(String id) throws FlowArtifactLookupException { return getFlowServiceLocator().getAttributeMapper(id); } /** - * Request that the Flow with the specified flowId be spawned - * as a subflow when the subflow state being built is entered. Simply - * resolves the subflow definition by id and returns it; throwing a - * fail-fast exception if it does not exist. + * Request that the Flow with the specified flowId be spawned as a subflow when the subflow state + * being built is entered. Simply resolves the subflow definition by id and returns it; throwing a fail-fast + * exception if it does not exist. * @param id the flow definition id - * @return the flow to be used as a subflow, this should be passed to a - * addSubflowState call + * @return the flow to be used as a subflow, this should be passed to a addSubflowState call * @throws FlowArtifactLookupException when the flow cannot be resolved */ protected Flow flow(String id) throws FlowArtifactLookupException { @@ -746,15 +686,15 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates a transition criteria that is used to match a Transition. The - * criteria is based on the provided expression string. - * @param transitionCriteriaExpression the transition criteria expression, - * typically simply a static event identifier (e.g. "submit") + * Creates a transition criteria that is used to match a Transition. The criteria is based on the provided + * expression string. + * @param transitionCriteriaExpression the transition criteria expression, typically simply a static event + * identifier (e.g. "submit") * @return the transition criteria * @see TextToTransitionCriteria */ protected TransitionCriteria on(String transitionCriteriaExpression) { - return (TransitionCriteria)fromStringTo(TransitionCriteria.class).execute(transitionCriteriaExpression); + return (TransitionCriteria) fromStringTo(TransitionCriteria.class).execute(transitionCriteriaExpression); } /** @@ -764,13 +704,12 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { * @see TextToTargetStateResolver */ protected TargetStateResolver to(String targetStateIdExpression) { - return (TargetStateResolver)fromStringTo(TargetStateResolver.class).execute(targetStateIdExpression); + return (TargetStateResolver) fromStringTo(TargetStateResolver.class).execute(targetStateIdExpression); } /** * Creates a new transition. - * @param matchingCriteria the criteria that determines when the transition - * matches + * @param matchingCriteria the criteria that determines when the transition matches * @param targetStateResolver the resolver of the transition's target state * @return the transition */ @@ -780,43 +719,37 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { /** * Creates a new transition. - * @param matchingCriteria the criteria that determines when the transition - * matches + * @param matchingCriteria the criteria that determines when the transition matches * @param targetStateResolver the resolver of the transition's target state - * @param executionCriteria the criteria that determines if a matched - * transition is allowed to execute + * @param executionCriteria the criteria that determines if a matched transition is allowed to execute * @return the transition */ protected Transition transition(TransitionCriteria matchingCriteria, TargetStateResolver targetStateResolver, TransitionCriteria executionCriteria) { - return getFlowArtifactFactory().createTransition(targetStateResolver, matchingCriteria, executionCriteria, null); + return getFlowArtifactFactory() + .createTransition(targetStateResolver, matchingCriteria, executionCriteria, null); } /** * Creates a new transition. - * @param matchingCriteria the criteria that determines when the transition - * matches + * @param matchingCriteria the criteria that determines when the transition matches * @param targetStateResolver the resolver of the transition's target state - * @param executionCriteria the criteria that determines if a matched - * transition is allowed to execute + * @param executionCriteria the criteria that determines if a matched transition is allowed to execute * @param attributes transition attributes * @return the transition */ protected Transition transition(TransitionCriteria matchingCriteria, TargetStateResolver targetStateResolver, TransitionCriteria executionCriteria, AttributeMap attributes) { - return getFlowArtifactFactory() - .createTransition(targetStateResolver, matchingCriteria, executionCriteria, attributes); + return getFlowArtifactFactory().createTransition(targetStateResolver, matchingCriteria, executionCriteria, + attributes); } /** - * Creates a TransitionCriteria that will execute the - * specified action when the Transition is executed but before the - * transition's target state is entered. + * Creates a TransitionCriteria that will execute the specified action when the Transition is + * executed but before the transition's target state is entered. *

    - * This criteria will only allow the Transition to complete execution if the - * Action completes successfully. - * @param action the action to execute after a transition is matched but - * before it transitions to its target state + * This criteria will only allow the Transition to complete execution if the Action completes successfully. + * @param action the action to execute after a transition is matched but before it transitions to its target state * @return the transition execution criteria */ protected TransitionCriteria ifReturnedSuccess(Action action) { @@ -824,8 +757,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the success event id. "Success" indicates that an - * action completed successfuly. + * Creates the success event id. "Success" indicates that an action completed successfuly. * @return the event id */ protected String success() { @@ -833,8 +765,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the error event id. "Error" indicates that an - * action completed with an error status. + * Creates the error event id. "Error" indicates that an action completed with an error status. * @return the event id */ protected String error() { @@ -842,8 +773,8 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the submit event id. "Submit" indicates the user - * submitted a request (form) for processing. + * Creates the submit event id. "Submit" indicates the user submitted a request (form) for + * processing. * @return the event id */ protected String submit() { @@ -851,8 +782,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the back event id. "Back" indicates the user wants - * to go to the previous step in the flow. + * Creates the back event id. "Back" indicates the user wants to go to the previous step in the flow. * @return the event id */ protected String back() { @@ -860,8 +790,8 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the cancel event id. "Cancel" indicates the flow - * was aborted because the user changed their mind. + * Creates the cancel event id. "Cancel" indicates the flow was aborted because the user changed + * their mind. * @return the event id */ protected String cancel() { @@ -869,8 +799,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the finish event id. "Finish" indicates the flow - * has finished processing. + * Creates the finish event id. "Finish" indicates the flow has finished processing. * @return the event id */ protected String finish() { @@ -878,8 +807,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the select event id. "Select" indicates an object - * was selected for processing or display. + * Creates the select event id. "Select" indicates an object was selected for processing or display. * @return the event id */ protected String select() { @@ -887,8 +815,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the edit event id. "Edit" indicates an object was - * selected for creation or updating. + * Creates the edit event id. "Edit" indicates an object was selected for creation or updating. * @return the event id */ protected String edit() { @@ -896,8 +823,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the add event id. "Add" indicates a child object - * is being added to a parent collection. + * Creates the add event id. "Add" indicates a child object is being added to a parent collection. * @return the event id */ protected String add() { @@ -905,8 +831,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the delete event id. "Delete" indicates a object - * is being removed. + * Creates the delete event id. "Delete" indicates a object is being removed. * @return the event id */ protected String delete() { @@ -914,8 +839,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the yes event id. "Yes" indicates a true result - * was returned. + * Creates the yes event id. "Yes" indicates a true result was returned. * @return the event id */ protected String yes() { @@ -923,8 +847,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Creates the no event id. "False" indicates a false result - * was returned. + * Creates the no event id. "False" indicates a false result was returned. * @return the event id */ protected String no() { @@ -932,9 +855,8 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { } /** - * Factory method that returns a new, fully configured mapping builder to - * assist with building {@link Mapping} objects used by a - * {@link FlowAttributeMapper} to map attributes. + * Factory method that returns a new, fully configured mapping builder to assist with building {@link Mapping} + * objects used by a {@link FlowAttributeMapper} to map attributes. * @return the mapping builder */ protected MappingBuilder mapping() { @@ -942,7 +864,7 @@ public abstract class AbstractFlowBuilder extends BaseFlowBuilder { mapping.setConversionService(getFlowServiceLocator().getConversionService()); return mapping; } - + public String toString() { return new ToStringCreator(this).toString(); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderFlowRegistryFactoryBean.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderFlowRegistryFactoryBean.java index 3a8e1edc..2bf26def 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderFlowRegistryFactoryBean.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderFlowRegistryFactoryBean.java @@ -25,19 +25,18 @@ import org.springframework.webflow.engine.builder.AbstractFlowBuildingFlowRegist import org.springframework.webflow.engine.builder.FlowAssembler; /** - * Base class for factory beans that create flow definition registries containing - * flows built using Java based {@link AbstractFlowBuilder flow builders}. + * Base class for factory beans that create flow definition registries containing flows built using Java based + * {@link AbstractFlowBuilder flow builders}. *

    - * Subclasses only need to define the {@link #doPopulate(FlowDefinitionRegistry)} - * method and use the - * {@link #registerFlowDefinition(FlowDefinitionRegistry, String, AbstractFlowBuilder)} - * convenience methods provided by this class to register all relevant flows: + * Subclasses only need to define the {@link #doPopulate(FlowDefinitionRegistry)} method and use the + * {@link #registerFlowDefinition(FlowDefinitionRegistry, String, AbstractFlowBuilder)} convenience methods provided by + * this class to register all relevant flows: * *

      * public class MyFlowRegistryFactoryBean extends AbstractFlowBuilderFlowRegistryFactoryBean {
      * 	protected void doPopulate(FlowDefinitionRegistry registry) {
    - * 		registerFlowDefinition(registry, "my-flow", new MyFlowBuilder());
    - * 		registerFlowDefinition(registry, "my-other-flow", new MyOtherFlowBuilder());
    + * 		registerFlowDefinition(registry, "my-flow", new MyFlowBuilder());
    + * 		registerFlowDefinition(registry, "my-other-flow", new MyOtherFlowBuilder());
      * 	}
      * }
      * 
    @@ -48,40 +47,34 @@ import org.springframework.webflow.engine.builder.FlowAssembler; * * @author Erwin Vervaet */ -public abstract class AbstractFlowBuilderFlowRegistryFactoryBean extends - AbstractFlowBuildingFlowRegistryFactoryBean { +public abstract class AbstractFlowBuilderFlowRegistryFactoryBean extends AbstractFlowBuildingFlowRegistryFactoryBean { /** - * Register the flow built by given flow builder in specified flow - * definition registry. + * Register the flow built by given flow builder in specified flow definition registry. *

    - * Note that this method will set the - * {@link #getFlowServiceLocator() flow service locator} of this class - * on given flow builder. + * Note that this method will set the {@link #getFlowServiceLocator() flow service locator} of this class on given + * flow builder. * @param registry the registry to register the flow in * @param flowId the flow id to assign * @param flowBuilder the builder used to build the flow */ - protected void registerFlowDefinition( - FlowDefinitionRegistry registry, String flowId, AbstractFlowBuilder flowBuilder) { + protected void registerFlowDefinition(FlowDefinitionRegistry registry, String flowId, + AbstractFlowBuilder flowBuilder) { registerFlowDefinition(registry, flowId, null, flowBuilder); } - + /** - * Register the flow built by given flow builder in specified flow - * definition registry. + * Register the flow built by given flow builder in specified flow definition registry. *

    - * Note that this method will set the - * {@link #getFlowServiceLocator() flow service locator} of this class - * on given flow builder. + * Note that this method will set the {@link #getFlowServiceLocator() flow service locator} of this class on given + * flow builder. * @param registry the registry to register the flow in * @param flowId the flow id to assign - * @param flowAttributes externally assigned flow attributes that can affect - * flow construction + * @param flowAttributes externally assigned flow attributes that can affect flow construction * @param flowBuilder the builder used to build the flow */ - protected void registerFlowDefinition( - FlowDefinitionRegistry registry, String flowId, AttributeMap flowAttributes, AbstractFlowBuilder flowBuilder) { + protected void registerFlowDefinition(FlowDefinitionRegistry registry, String flowId, AttributeMap flowAttributes, + AbstractFlowBuilder flowBuilder) { flowBuilder.setFlowServiceLocator(getFlowServiceLocator()); Flow flow = new FlowAssembler(flowId, flowAttributes, flowBuilder).assembleFlow(); FlowDefinitionHolder flowHolder = new StaticFlowDefinitionHolder(flow); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuildingFlowRegistryFactoryBean.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuildingFlowRegistryFactoryBean.java index 5ceebf3b..eff88afa 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuildingFlowRegistryFactoryBean.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/AbstractFlowBuildingFlowRegistryFactoryBean.java @@ -29,15 +29,13 @@ import org.springframework.webflow.engine.State; import org.springframework.webflow.execution.Action; /** - * A base class for factory beans that create populated registries of flow - * definitions built using a {@link FlowBuilder}, typically a {@link BaseFlowBuilder} - * subclass. This base class will setup a {@link FlowServiceLocator} for - * use by the flow builder. + * A base class for factory beans that create populated registries of flow definitions built using a {@link FlowBuilder}, + * typically a {@link BaseFlowBuilder} subclass. This base class will setup a {@link FlowServiceLocator} for use by the + * flow builder. *

    - * Subclasses should override the {@link #doPopulate(FlowDefinitionRegistry)} - * template method to perform the registry population logic, typically delegating to a - * {@link org.springframework.webflow.definition.registry.FlowDefinitionRegistrar} - * strategy. + * Subclasses should override the {@link #doPopulate(FlowDefinitionRegistry)} template method to perform the registry + * population logic, typically delegating to a + * {@link org.springframework.webflow.definition.registry.FlowDefinitionRegistrar} strategy. * * @see org.springframework.webflow.definition.registry.FlowDefinitionRegistry * @see org.springframework.webflow.definition.registry.FlowDefinitionRegistrar @@ -48,26 +46,24 @@ public abstract class AbstractFlowBuildingFlowRegistryFactoryBean extends Abstra implements BeanFactoryAware, ResourceLoaderAware { /** - * The locator of services needed by the flows built for inclusion in the - * registry. + * The locator of services needed by the flows built for inclusion in the registry. */ private FlowServiceLocator flowServiceLocator; /** - * The factory encapsulating the creation of central Flow artifacts such as - * {@link Flow flows} and {@link State states}. + * The factory encapsulating the creation of central Flow artifacts such as {@link Flow flows} and + * {@link State states}. */ private FlowArtifactFactory flowArtifactFactory; /** - * The factory encapsulating the creation of bean invoking actions, actions - * that adapt methods on objects to the {@link Action} interface. + * The factory encapsulating the creation of bean invoking actions, actions that adapt methods on objects to the + * {@link Action} interface. */ private BeanInvokingActionFactory beanInvokingActionFactory; /** - * The parser for parsing expression strings into evaluatable expression - * objects. + * The parser for parsing expression strings into evaluatable expression objects. */ private ExpressionParser expressionParser; @@ -87,71 +83,67 @@ public abstract class AbstractFlowBuildingFlowRegistryFactoryBean extends Abstra private BeanFactory beanFactory; /** - * Returns the factory encapsulating the creation of central Flow artifacts - * such as {@link Flow flows} and {@link State states}. + * Returns the factory encapsulating the creation of central Flow artifacts such as {@link Flow flows} and + * {@link State states}. */ protected FlowArtifactFactory getFlowArtifactFactory() { return flowArtifactFactory; } - + /** - * Sets the factory encapsulating the creation of central Flow artifacts - * such as {@link Flow flows} and {@link State states}. + * Sets the factory encapsulating the creation of central Flow artifacts such as {@link Flow flows} and + * {@link State states}. */ public void setFlowArtifactFactory(FlowArtifactFactory flowArtifactFactory) { this.flowArtifactFactory = flowArtifactFactory; } - + /** - * Returns the factory for creating bean invoking actions, actions that adapt - * methods on objects to the {@link Action} interface. + * Returns the factory for creating bean invoking actions, actions that adapt methods on objects to the + * {@link Action} interface. */ protected BeanInvokingActionFactory getBeanInvokingActionFactory() { return beanInvokingActionFactory; } /** - * Sets the factory for creating bean invoking actions, actions that adapt - * methods on objects to the {@link Action} interface. + * Sets the factory for creating bean invoking actions, actions that adapt methods on objects to the {@link Action} + * interface. */ public void setBeanInvokingActionFactory(BeanInvokingActionFactory beanInvokingActionFactory) { this.beanInvokingActionFactory = beanInvokingActionFactory; } - + /** - * Returns the expression parser responsible for parsing expression strings into - * evaluatable expression objects. + * Returns the expression parser responsible for parsing expression strings into evaluatable expression objects. */ protected ExpressionParser getExpressionParser() { return expressionParser; } /** - * Set the expression parser responsible for parsing expression strings into - * evaluatable expression objects. + * Set the expression parser responsible for parsing expression strings into evaluatable expression objects. */ public void setExpressionParser(ExpressionParser expressionParser) { this.expressionParser = expressionParser; } - + /** - * Returns the conversion service to use to convert between types; typically - * from string to a rich object type. + * Returns the conversion service to use to convert between types; typically from string to a rich object type. */ protected ConversionService getConversionService() { return conversionService; } /** - * Set the conversion service to use to convert between types; typically - * from string to a rich object type. + * Set the conversion service to use to convert between types; typically from string to a rich object type. */ public void setConversionService(ConversionService conversionService) { this.conversionService = conversionService; } - + // implementing ResourceLoaderAware - + /** * Returns the injected resource loader. */ @@ -162,9 +154,9 @@ public abstract class AbstractFlowBuildingFlowRegistryFactoryBean extends Abstra public void setResourceLoader(ResourceLoader resourceLoader) { this.resourceLoader = resourceLoader; } - + // implementing BeanFactoryAware - + /** * Returns the bean factory managing this bean. */ @@ -184,9 +176,8 @@ public abstract class AbstractFlowBuildingFlowRegistryFactoryBean extends Abstra // subclassing hooks /** - * Factory method for creating the service locator used to locate webflow - * services during flow assembly. Subclasses may override to customize the - * instantiation and configuration of the locator returned. + * Factory method for creating the service locator used to locate webflow services during flow assembly. Subclasses + * may override to customize the instantiation and configuration of the locator returned. * @return the service locator */ protected FlowServiceLocator createFlowServiceLocator() { @@ -210,21 +201,19 @@ public abstract class AbstractFlowBuildingFlowRegistryFactoryBean extends Abstra } /** - * Called after properties have been set on the service locator, but before - * registry population. Subclasses may override to perform custom initialization - * of the flow service locator. - * @param flowServiceLocator the flow service locator to use to locate externally managed - * services needed during flow building and assembly, typically used by a + * Called after properties have been set on the service locator, but before registry population. Subclasses may + * override to perform custom initialization of the flow service locator. + * @param flowServiceLocator the flow service locator to use to locate externally managed services needed during + * flow building and assembly, typically used by a * {@link org.springframework.webflow.definition.registry.FlowDefinitionRegistrar} */ protected void init(FlowServiceLocator flowServiceLocator) { } /** - * Returns the strategy for locating dependent artifacts when a flow is - * being built. May be called by subclasses during - * {@link #doPopulate(FlowDefinitionRegistry) registry population} to wire - * in the service locator needed for flow assembly. + * Returns the strategy for locating dependent artifacts when a flow is being built. May be called by subclasses + * during {@link #doPopulate(FlowDefinitionRegistry) registry population} to wire in the service locator needed for + * flow assembly. */ protected FlowServiceLocator getFlowServiceLocator() { return flowServiceLocator; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/BaseFlowBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/BaseFlowBuilder.java index e54d1c59..4742e67e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/BaseFlowBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/BaseFlowBuilder.java @@ -22,14 +22,11 @@ import org.springframework.webflow.core.collection.AttributeMap; import org.springframework.webflow.engine.Flow; /** - * Abstract base implementation of a flow builder defining common functionality - * needed by most concrete flow builder implementations. This class implements - * all optional parts of the FlowBuilder process as no-op methods. Subclasses - * are only required to implement {@link #init(String, AttributeMap)} and - * {@link #buildStates()}. + * Abstract base implementation of a flow builder defining common functionality needed by most concrete flow builder + * implementations. This class implements all optional parts of the FlowBuilder process as no-op methods. Subclasses are + * only required to implement {@link #init(String, AttributeMap)} and {@link #buildStates()}. *

    - * This class also provides a {@link FlowServiceLocator} for use by - * subclasses in the flow construction process. + * This class also provides a {@link FlowServiceLocator} for use by subclasses in the flow construction process. * * @see org.springframework.webflow.engine.builder.FlowServiceLocator * @@ -44,8 +41,7 @@ public abstract class BaseFlowBuilder implements FlowBuilder { private Flow flow; /** - * Locates actions, attribute mappers, and other artifacts needed by the - * flow built by this builder. + * Locates actions, attribute mappers, and other artifacts needed by the flow built by this builder. */ private FlowServiceLocator flowServiceLocator; @@ -81,9 +77,8 @@ public abstract class BaseFlowBuilder implements FlowBuilder { } /** - * Set the flow being built by this builder. Typically called during - * initialization to set the initial flow reference returned by - * {@link #getFlow()} after building. + * Set the flow being built by this builder. Typically called during initialization to set the initial flow + * reference returned by {@link #getFlow()} after building. */ protected void setFlow(Flow flow) { this.flow = flow; @@ -127,23 +122,22 @@ public abstract class BaseFlowBuilder implements FlowBuilder { public void dispose() { setFlow(null); } - + // helpers for use in subclasses /** - * Returns a conversion executor capable of converting string objects to the - * target class aliased by the provided alias. + * Returns a conversion executor capable of converting string objects to the target class aliased by the provided + * alias. * @param targetAlias the target class alias, e.g. "long" or "float" - * @return the conversion executor, or null if no suitable - * converter exists for given alias + * @return the conversion executor, or null if no suitable converter exists for given alias */ protected ConversionExecutor fromStringTo(String targetAlias) { - return getFlowServiceLocator().getConversionService().getConversionExecutorByTargetAlias(String.class, targetAlias); + return getFlowServiceLocator().getConversionService().getConversionExecutorByTargetAlias(String.class, + targetAlias); } /** - * Returns a converter capable of converting a string value to the given - * type. + * Returns a converter capable of converting a string value to the given type. * @param targetType the type you wish to convert to (from a string) * @return the converter * @throws ConversionException when the converter cannot be found diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/BaseFlowServiceLocator.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/BaseFlowServiceLocator.java index bac49042..1dd29ece 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/BaseFlowServiceLocator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/BaseFlowServiceLocator.java @@ -39,9 +39,8 @@ import org.springframework.webflow.engine.ViewSelector; import org.springframework.webflow.execution.Action; /** - * Base implementation that implements a minimal set of the - * FlowServiceLocator interface, throwing unsupported operation - * exceptions for some operations. + * Base implementation that implements a minimal set of the FlowServiceLocator interface, throwing + * unsupported operation exceptions for some operations. *

    * May be subclassed to offer additional factory/lookup support. * @@ -50,23 +49,22 @@ import org.springframework.webflow.execution.Action; public class BaseFlowServiceLocator implements FlowServiceLocator { /** - * The factory encapsulating the creation of central Flow artifacts such as - * {@link Flow flows} and {@link State states}. + * The factory encapsulating the creation of central Flow artifacts such as {@link Flow flows} and + * {@link State states}. */ private FlowArtifactFactory flowArtifactFactory = new FlowArtifactFactory(); /** - * The factory encapsulating the creation of bean invoking actions, actions - * that adapt methods on objects to the {@link Action} interface. + * The factory encapsulating the creation of bean invoking actions, actions that adapt methods on objects to the + * {@link Action} interface. */ private BeanInvokingActionFactory beanInvokingActionFactory = new BeanInvokingActionFactory(); /** - * The parser for parsing expression strings into evaluatable expression - * objects. + * The parser for parsing expression strings into evaluatable expression objects. */ private ExpressionParser expressionParser = DefaultExpressionParserFactory.getExpressionParser(); - + /** * The conversion service configured by the user (none by default). */ @@ -83,8 +81,8 @@ public class BaseFlowServiceLocator implements FlowServiceLocator { private ResourceLoader resourceLoader = new DefaultResourceLoader(); /** - * Sets the factory encapsulating the creation of central Flow artifacts - * such as {@link Flow flows} and {@link State states}. + * Sets the factory encapsulating the creation of central Flow artifacts such as {@link Flow flows} and + * {@link State states}. */ public void setFlowArtifactFactory(FlowArtifactFactory flowArtifactFactory) { Assert.notNull(flowArtifactFactory, "The flow artifact factory is required"); @@ -92,8 +90,8 @@ public class BaseFlowServiceLocator implements FlowServiceLocator { } /** - * Sets the factory for creating bean invoking actions, actions that adapt - * methods on objects to the {@link Action} interface. + * Sets the factory for creating bean invoking actions, actions that adapt methods on objects to the {@link Action} + * interface. */ public void setBeanInvokingActionFactory(BeanInvokingActionFactory beanInvokingActionFactory) { Assert.notNull(beanInvokingActionFactory, "The bean invoking action factory is required"); @@ -101,19 +99,17 @@ public class BaseFlowServiceLocator implements FlowServiceLocator { } /** - * Set the expression parser responsible for parsing expression strings into - * evaluatable expression objects. + * Set the expression parser responsible for parsing expression strings into evaluatable expression objects. */ public void setExpressionParser(ExpressionParser expressionParser) { Assert.notNull(expressionParser, "The expression parser is required"); this.expressionParser = expressionParser; - //this has impact on the TextToExpression converter in the conversion service! + // this has impact on the TextToExpression converter in the conversion service! this.conversionService = createConversionService(userConversionService); } /** - * Set the conversion service to use to convert between types; typically - * from string to a rich object type. + * Set the conversion service to use to convert between types; typically from string to a rich object type. */ public void setConversionService(ConversionService userConversionService) { Assert.notNull(userConversionService, "The conversion service is required"); @@ -122,40 +118,38 @@ public class BaseFlowServiceLocator implements FlowServiceLocator { } /** - * Set the resource loader to load file-based resources from string-encoded - * paths. This is optional. + * Set the resource loader to load file-based resources from string-encoded paths. This is optional. */ public void setResourceLoader(ResourceLoader resourceLoader) { this.resourceLoader = resourceLoader; } public Flow getSubflow(String id) throws FlowArtifactLookupException { - throw new FlowArtifactLookupException(id, Flow.class, - "Subflow lookup is not supported by this service locator"); + throw new FlowArtifactLookupException(id, Flow.class, "Subflow lookup is not supported by this service locator"); } public Action getAction(String id) throws FlowArtifactLookupException { - return (Action)getBean(id, Action.class); + return (Action) getBean(id, Action.class); } public FlowAttributeMapper getAttributeMapper(String id) throws FlowArtifactLookupException { - return (FlowAttributeMapper)getBean(id, FlowAttributeMapper.class); + return (FlowAttributeMapper) getBean(id, FlowAttributeMapper.class); } public TransitionCriteria getTransitionCriteria(String id) throws FlowArtifactLookupException { - return (TransitionCriteria)getBean(id, TransitionCriteria.class); + return (TransitionCriteria) getBean(id, TransitionCriteria.class); } public TargetStateResolver getTargetStateResolver(String id) throws FlowArtifactLookupException { - return (TargetStateResolver)getBean(id, TargetStateResolver.class); + return (TargetStateResolver) getBean(id, TargetStateResolver.class); } public ViewSelector getViewSelector(String id) throws FlowArtifactLookupException { - return (ViewSelector)getBean(id, ViewSelector.class); + return (ViewSelector) getBean(id, ViewSelector.class); } public FlowExecutionExceptionHandler getExceptionHandler(String id) throws FlowArtifactLookupException { - return (FlowExecutionExceptionHandler)getBean(id, FlowExecutionExceptionHandler.class); + return (FlowExecutionExceptionHandler) getBean(id, FlowExecutionExceptionHandler.class); } public FlowArtifactFactory getFlowArtifactFactory() { @@ -181,12 +175,11 @@ public class BaseFlowServiceLocator implements FlowServiceLocator { public ConversionService getConversionService() { return conversionService; } - + // helpers for use by subclasses /** - * Helper method for determining if the configured bean factory contains the - * provided bean. + * Helper method for determining if the configured bean factory contains the provided bean. * @param id the id of the bean * @return true if yes, false otherwise */ @@ -195,8 +188,7 @@ public class BaseFlowServiceLocator implements FlowServiceLocator { } /** - * Helper method to lookup the bean representing a flow artifact of the - * specified type. + * Helper method to lookup the bean representing a flow artifact of the specified type. * @param id the bean id * @param artifactType the bean type * @return the bean @@ -205,8 +197,7 @@ public class BaseFlowServiceLocator implements FlowServiceLocator { protected Object getBean(String id, Class artifactType) throws FlowArtifactLookupException { try { return getBeanFactory().getBean(id, artifactType); - } - catch (BeansException e) { + } catch (BeansException e) { throw new FlowArtifactLookupException(id, artifactType, e); } } @@ -221,8 +212,7 @@ public class BaseFlowServiceLocator implements FlowServiceLocator { protected Class getBeanType(String id, Class artifactType) throws FlowArtifactLookupException { try { return getBeanFactory().getType(id); - } - catch (BeansException e) { + } catch (BeansException e) { throw new FlowArtifactLookupException(id, artifactType, e); } } @@ -236,10 +226,9 @@ public class BaseFlowServiceLocator implements FlowServiceLocator { DefaultConversionService defaultConversionService = new DefaultConversionService(); addWebFlowConverters(defaultConversionService); if (userConversionService != null) { - return new CompositeConversionService( - new ConversionService[] { userConversionService, defaultConversionService }); - } - else { + return new CompositeConversionService(new ConversionService[] { userConversionService, + defaultConversionService }); + } else { return defaultConversionService; } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/DefaultFlowServiceLocator.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/DefaultFlowServiceLocator.java index 09338a0b..1da5f54e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/DefaultFlowServiceLocator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/DefaultFlowServiceLocator.java @@ -22,9 +22,8 @@ import org.springframework.webflow.definition.registry.NoSuchFlowDefinitionExcep import org.springframework.webflow.engine.Flow; /** - * The default flow service locator implementation that obtains subflow - * definitions from a dedicated {@link FlowDefinitionRegistry} and obtains the - * remaining services from a generic Spring {@link BeanFactory}. + * The default flow service locator implementation that obtains subflow definitions from a dedicated + * {@link FlowDefinitionRegistry} and obtains the remaining services from a generic Spring {@link BeanFactory}. * * @see FlowDefinitionRegistry * @see FlowServiceLocator#getSubflow(String) @@ -45,8 +44,8 @@ public class DefaultFlowServiceLocator extends BaseFlowServiceLocator { private BeanFactory beanFactory; /** - * Creates a flow service locator that retrieves subflows from the provided - * registry and additional artifacts from the provided bean factory. + * Creates a flow service locator that retrieves subflows from the provided registry and additional artifacts from + * the provided bean factory. * @param subflowRegistry the registry for loading subflows * @param beanFactory the spring bean factory */ @@ -56,12 +55,11 @@ public class DefaultFlowServiceLocator extends BaseFlowServiceLocator { this.subflowRegistry = subflowRegistry; this.beanFactory = beanFactory; } - + /** - * Convenience flow service locator constructor that looks up a flow definition - * registry using given bean id in given bean factory. The registry is used - * to retrieve subflows. All additional artifacts are looked up in the provided - * bean factory. + * Convenience flow service locator constructor that looks up a flow definition registry using given bean id in + * given bean factory. The registry is used to retrieve subflows. All additional artifacts are looked up in the + * provided bean factory. * @param subflowRegistryBeanId the bean id of the subflow FlowDefinitionRegistry * @param beanFactory the Spring bean factory * @since 1.0.2 @@ -69,18 +67,17 @@ public class DefaultFlowServiceLocator extends BaseFlowServiceLocator { public DefaultFlowServiceLocator(String subflowRegistryBeanId, BeanFactory beanFactory) { Assert.notNull(subflowRegistryBeanId, "The subflow registry bean id is required"); Assert.notNull(beanFactory, "The bean factory is required"); - this.subflowRegistry = - (FlowDefinitionRegistry)beanFactory.getBean(subflowRegistryBeanId, FlowDefinitionRegistry.class); + this.subflowRegistry = (FlowDefinitionRegistry) beanFactory.getBean(subflowRegistryBeanId, + FlowDefinitionRegistry.class); this.beanFactory = beanFactory; } public Flow getSubflow(String id) throws FlowArtifactLookupException { try { - return (Flow)subflowRegistry.getFlowDefinition(id); - } - catch (NoSuchFlowDefinitionException e) { - throw new FlowArtifactLookupException(id, Flow.class, - "Could not locate subflow definition with id '" + id + "'", e); + return (Flow) subflowRegistry.getFlowDefinition(id); + } catch (NoSuchFlowDefinitionException e) { + throw new FlowArtifactLookupException(id, Flow.class, "Could not locate subflow definition with id '" + id + + "'", e); } } @@ -94,5 +91,5 @@ public class DefaultFlowServiceLocator extends BaseFlowServiceLocator { */ protected FlowDefinitionRegistry getSubflowRegistry() { return subflowRegistry; - } + } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowArtifactFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowArtifactFactory.java index 6ff91214..990fa475 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowArtifactFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowArtifactFactory.java @@ -34,12 +34,11 @@ import org.springframework.webflow.engine.ViewState; import org.springframework.webflow.execution.Action; /** - * A factory for core web flow elements such as {@link Flow flows}, - * {@link State states}, and {@link Transition transitions}. + * A factory for core web flow elements such as {@link Flow flows}, {@link State states}, and + * {@link Transition transitions}. *

    - * This factory encapsulates the construction of each Flow implementation as - * well as each core artifact type. Subclasses may customize how the core elements - * are created, useful for plugging in custom implementations. + * This factory encapsulates the construction of each Flow implementation as well as each core artifact type. Subclasses + * may customize how the core elements are created, useful for plugging in custom implementations. * * @author Keith Donald * @author Erwin Vervaet @@ -49,18 +48,14 @@ public class FlowArtifactFactory { /** * Factory method that creates a new {@link Flow} definition object. *

    - * Note this method does not return a fully configured Flow instance, it - * only encapsulates the selection of implementation. A - * {@link FlowAssembler} delegating to a calling {@link FlowBuilder} is - * expected to assemble the Flow fully before returning it to external - * clients. - * @param id the flow identifier, should be unique to all flows in an - * application (required) - * @param attributes attributes to assign to the Flow, which may also be - * used to affect flow construction; may be null + * Note this method does not return a fully configured Flow instance, it only encapsulates the selection of + * implementation. A {@link FlowAssembler} delegating to a calling {@link FlowBuilder} is expected to assemble the + * Flow fully before returning it to external clients. + * @param id the flow identifier, should be unique to all flows in an application (required) + * @param attributes attributes to assign to the Flow, which may also be used to affect flow construction; may be + * null * @return the initial flow instance, ready for assembly by a FlowBuilder - * @throws FlowArtifactLookupException an exception occured creating the - * Flow instance + * @throws FlowArtifactLookupException an exception occured creating the Flow instance */ public Flow createFlow(String id, AttributeMap attributes) throws FlowArtifactLookupException { Flow flow = new Flow(id); @@ -69,25 +64,21 @@ public class FlowArtifactFactory { } /** - * Factory method that creates a new view state, a state where a user is - * allowed to participate in the flow. This method is an atomic operation - * that returns a fully initialized state. It encapsulates the selection of - * the view state implementation as well as the state assembly. - * @param id the identifier to assign to the state, must be unique to its - * owning flow (required) + * Factory method that creates a new view state, a state where a user is allowed to participate in the flow. This + * method is an atomic operation that returns a fully initialized state. It encapsulates the selection of the view + * state implementation as well as the state assembly. + * @param id the identifier to assign to the state, must be unique to its owning flow (required) * @param flow the flow that will own (contain) this state (required) * @param entryActions any state entry actions; may be null * @param viewSelector the state view selector strategy; may be null - * @param renderActions any 'render actions' to execute on entry and refresh; - * may be null + * @param renderActions any 'render actions' to execute on entry and refresh; may be null * @param transitions any transitions (paths) out of this state; may be null * @param exceptionHandlers any exception handlers; may be null * @param exitActions any state exit actions; may be null - * @param attributes attributes to assign to the State, which may also be - * used to affect state construction; may be null + * @param attributes attributes to assign to the State, which may also be used to affect state construction; may be + * null * @return the fully initialized view state instance - * @throws FlowArtifactLookupException an exception occured creating the - * state + * @throws FlowArtifactLookupException an exception occured creating the state */ public State createViewState(String id, Flow flow, Action[] entryActions, ViewSelector viewSelector, Action[] renderActions, Transition[] transitions, FlowExecutionExceptionHandler[] exceptionHandlers, @@ -102,24 +93,20 @@ public class FlowArtifactFactory { } /** - * Factory method that creates a new action state, a state where a system - * action is executed. This method is an atomic operation that returns a - * fully initialized state. It encapsulates the selection of the action - * state implementation as well as the state assembly. - * @param id the identifier to assign to the state, must be unique to its - * owning flow (required) + * Factory method that creates a new action state, a state where a system action is executed. This method is an + * atomic operation that returns a fully initialized state. It encapsulates the selection of the action state + * implementation as well as the state assembly. + * @param id the identifier to assign to the state, must be unique to its owning flow (required) * @param flow the flow that will own (contain) this state (required) * @param entryActions any state entry actions; may be null - * @param actions the actions to execute when the state is entered - * (required) + * @param actions the actions to execute when the state is entered (required) * @param transitions any transitions (paths) out of this state; may be null * @param exceptionHandlers any exception handlers; may be null * @param exitActions any state exit actions; may be null - * @param attributes attributes to assign to the State, which may also be - * used to affect state construction; may be null + * @param attributes attributes to assign to the State, which may also be used to affect state construction; may be + * null * @return the fully initialized action state instance - * @throws FlowArtifactLookupException an exception occured creating the - * state + * @throws FlowArtifactLookupException an exception occured creating the state */ public State createActionState(String id, Flow flow, Action[] entryActions, Action[] actions, Transition[] transitions, FlowExecutionExceptionHandler[] exceptionHandlers, Action[] exitActions, @@ -131,22 +118,19 @@ public class FlowArtifactFactory { } /** - * Factory method that creates a new decision state, a state where a flow - * routing decision is made. This method is an atomic operation that returns - * a fully initialized state. It encapsulates the selection of the decision - * state implementation as well as the state assembly. - * @param id the identifier to assign to the state, must be unique to its - * owning flow (required) + * Factory method that creates a new decision state, a state where a flow routing decision is made. This method is + * an atomic operation that returns a fully initialized state. It encapsulates the selection of the decision state + * implementation as well as the state assembly. + * @param id the identifier to assign to the state, must be unique to its owning flow (required) * @param flow the flow that will own (contain) this state (required) * @param entryActions any state entry actions; may be null * @param transitions any transitions (paths) out of this state * @param exceptionHandlers any exception handlers; may be null * @param exitActions any state exit actions; may be null - * @param attributes attributes to assign to the State, which may also be - * used to affect state construction; may be null + * @param attributes attributes to assign to the State, which may also be used to affect state construction; may be + * null * @return the fully initialized decision state instance - * @throws FlowArtifactLookupException an exception occured creating the - * state + * @throws FlowArtifactLookupException an exception occured creating the state */ public State createDecisionState(String id, Flow flow, Action[] entryActions, Transition[] transitions, FlowExecutionExceptionHandler[] exceptionHandlers, Action[] exitActions, AttributeMap attributes) @@ -157,25 +141,21 @@ public class FlowArtifactFactory { } /** - * Factory method that creates a new subflow state, a state where a parent - * flow spawns another flow as a subflow. This method is an atomic operation - * that returns a fully initialized state. It encapsulates the selection of - * the subflow state implementation as well as the state assembly. - * @param id the identifier to assign to the state, must be unique to its - * owning flow (required) + * Factory method that creates a new subflow state, a state where a parent flow spawns another flow as a subflow. + * This method is an atomic operation that returns a fully initialized state. It encapsulates the selection of the + * subflow state implementation as well as the state assembly. + * @param id the identifier to assign to the state, must be unique to its owning flow (required) * @param flow the flow that will own (contain) this state (required) * @param entryActions any state entry actions; may be null * @param subflow the subflow definition (required) - * @param attributeMapper the subflow input and output attribute mapper; may - * be null + * @param attributeMapper the subflow input and output attribute mapper; may be null * @param transitions any transitions (paths) out of this state * @param exceptionHandlers any exception handlers; may be null * @param exitActions any state exit actions; may be null - * @param attributes attributes to assign to the State, which may also be - * used to affect state construction; may be null + * @param attributes attributes to assign to the State, which may also be used to affect state construction; may be + * null * @return the fully initialized subflow state instance - * @throws FlowArtifactLookupException an exception occured creating the - * state + * @throws FlowArtifactLookupException an exception occured creating the state */ public State createSubflowState(String id, Flow flow, Action[] entryActions, Flow subflow, FlowAttributeMapper attributeMapper, Transition[] transitions, @@ -190,23 +170,19 @@ public class FlowArtifactFactory { } /** - * Factory method that creates a new end state, a state where an executing - * flow session terminates. This method is an atomic operation that returns - * a fully initialized state. It encapsulates the selection of the end state + * Factory method that creates a new end state, a state where an executing flow session terminates. This method is + * an atomic operation that returns a fully initialized state. It encapsulates the selection of the end state * implementation as well as the state assembly. - * @param id the identifier to assign to the state, must be unique to its - * owning flow (required) + * @param id the identifier to assign to the state, must be unique to its owning flow (required) * @param flow the flow that will own (contain) this state (required) * @param entryActions any state entry actions; may be null - * @param viewSelector the state confirmation view selector strategy; may be - * null + * @param viewSelector the state confirmation view selector strategy; may be null * @param outputMapper the state output mapper; may be null * @param exceptionHandlers any exception handlers; may be null - * @param attributes attributes to assign to the State, which may also be - * used to affect state construction; may be null + * @param attributes attributes to assign to the State, which may also be used to affect state construction; may be + * null * @return the fully initialized subflow state instance - * @throws FlowArtifactLookupException an exception occured creating the - * state + * @throws FlowArtifactLookupException an exception occured creating the state */ public State createEndState(String id, Flow flow, Action[] entryActions, ViewSelector viewSelector, AttributeMapper outputMapper, FlowExecutionExceptionHandler[] exceptionHandlers, AttributeMap attributes) @@ -223,20 +199,16 @@ public class FlowArtifactFactory { } /** - * Factory method that creates a new transition, a path from one step in a - * flow to another. This method is an atomic operation that returns a fully - * initialized transition. It encapsulates the selection of the transition + * Factory method that creates a new transition, a path from one step in a flow to another. This method is an atomic + * operation that returns a fully initialized transition. It encapsulates the selection of the transition * implementation as well as the transition assembly. * @param targetStateResolver the resolver of the target state of the transition (required) - * @param matchingCriteria the criteria that matches the transition; may be - * null - * @param executionCriteria the criteria that governs execution of the - * transition after match; may be null - * @param attributes attributes to assign to the transition, which may also - * be used to affect transition construction; may be null + * @param matchingCriteria the criteria that matches the transition; may be null + * @param executionCriteria the criteria that governs execution of the transition after match; may be null + * @param attributes attributes to assign to the transition, which may also be used to affect transition + * construction; may be null * @return the fully initialized transition instance - * @throws FlowArtifactLookupException an exception occured creating the - * transition + * @throws FlowArtifactLookupException an exception occured creating the transition */ public Transition createTransition(TargetStateResolver targetStateResolver, TransitionCriteria matchingCriteria, TransitionCriteria executionCriteria, AttributeMap attributes) throws FlowArtifactLookupException { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowArtifactLookupException.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowArtifactLookupException.java index 49ece54f..8c81b143 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowArtifactLookupException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowArtifactLookupException.java @@ -21,12 +21,11 @@ import org.springframework.webflow.core.FlowException; import org.springframework.webflow.execution.FlowExecutionException; /** - * A flow artifact lookup exception is thrown when an artifact (such as a flow, state, - * action, etc.) required by the webflow system cannot be obtained. + * A flow artifact lookup exception is thrown when an artifact (such as a flow, state, action, etc.) required by the + * webflow system cannot be obtained. *

    - * Flow artifact lookup exceptions indicate unrecoverable problems with the flow - * definition, e.g. a required action of a flow cannot be found. They're not used - * to signal problems related to execution of a client request. A + * Flow artifact lookup exceptions indicate unrecoverable problems with the flow definition, e.g. a required action of a + * flow cannot be found. They're not used to signal problems related to execution of a client request. A * {@link FlowExecutionException} is used for that. * * @see org.springframework.webflow.execution.FlowExecutionException diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowAssembler.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowAssembler.java index fd9d35b3..8c6ea243 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowAssembler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowAssembler.java @@ -23,10 +23,9 @@ import org.springframework.webflow.core.collection.CollectionUtils; import org.springframework.webflow.engine.Flow; /** - * A director for assembling flows, delegating to a {@link FlowBuilder} to - * construct a flow. This class encapsulates the algorithm for using a - * FlowBuilder to assemble a Flow properly. It acts as the director in the - * classic GoF builder pattern. + * A director for assembling flows, delegating to a {@link FlowBuilder} to construct a flow. This class encapsulates the + * algorithm for using a FlowBuilder to assemble a Flow properly. It acts as the director in the classic GoF builder + * pattern. *

    * Flow assemblers may be used in a standalone, programmatic fashion as follows: * @@ -41,7 +40,7 @@ import org.springframework.webflow.engine.Flow; * @author Erwin Vervaet */ public class FlowAssembler { - + private static final Log logger = LogFactory.getLog(FlowAssembler.class); /** @@ -55,14 +54,12 @@ public class FlowAssembler { private AttributeMap flowAttributes; /** - * The flow builder strategy used to construct the flow from its component - * parts. + * The flow builder strategy used to construct the flow from its component parts. */ private FlowBuilder flowBuilder; /** - * Create a new flow assembler that will direct Flow assembly using the - * specified builder strategy. + * Create a new flow assembler that will direct Flow assembly using the specified builder strategy. * @param flowId the flow id to assign * @param flowBuilder the builder the factory will use to build flows */ @@ -71,11 +68,9 @@ public class FlowAssembler { } /** - * Create a new flow assembler that will direct Flow assembly using the - * specified builder strategy. + * Create a new flow assembler that will direct Flow assembly using the specified builder strategy. * @param flowId the flow id to assign - * @param flowAttributes externally assigned flow attributes that can affect - * flow construction + * @param flowAttributes externally assigned flow attributes that can affect flow construction * @param flowBuilder the builder the factory will use to build flows */ public FlowAssembler(String flowId, AttributeMap flowAttributes, FlowBuilder flowBuilder) { @@ -94,51 +89,45 @@ public class FlowAssembler { } /** - * Returns externally assigned attributes that can be used to affect flow - * construction. + * Returns externally assigned attributes that can be used to affect flow construction. */ public AttributeMap getFlowAttributes() { return flowAttributes; } /** - * Returns the flow builder strategy used to construct the flow from its - * component parts. + * Returns the flow builder strategy used to construct the flow from its component parts. */ public FlowBuilder getFlowBuilder() { return flowBuilder; } /** - * Assembles the flow, directing the construction process by delegating to - * the configured FlowBuilder. Every call to this method will assemble - * the Flow instance. + * Assembles the flow, directing the construction process by delegating to the configured FlowBuilder. Every call to + * this method will assemble the Flow instance. *

    - * This will drive the flow construction process as described in the - * {@link FlowBuilder} JavaDoc, starting with builder initialisation using - * {@link FlowBuilder#init(String, AttributeMap)} and finishing by - * cleaning up the builder with a call to {@link FlowBuilder#dispose()}. + * This will drive the flow construction process as described in the {@link FlowBuilder} JavaDoc, starting with + * builder initialisation using {@link FlowBuilder#init(String, AttributeMap)} and finishing by cleaning up the + * builder with a call to {@link FlowBuilder#dispose()}. * @return the constructed flow * @throws FlowBuilderException when flow assembly fails */ public Flow assembleFlow() throws FlowBuilderException { if (logger.isDebugEnabled()) { - logger.debug("Assembling flow definition with id '" + flowId + "' using flow builder '" + - flowBuilder + "'; externally assigned flow attributes are '" + flowAttributes + "'"); + logger.debug("Assembling flow definition with id '" + flowId + "' using flow builder '" + flowBuilder + + "'; externally assigned flow attributes are '" + flowAttributes + "'"); } try { flowBuilder.init(flowId, flowAttributes); directAssembly(); return flowBuilder.getFlow(); - } - finally { + } finally { flowBuilder.dispose(); } } /** - * Build all parts of the flow by directing flow assembly by the flow - * builder. + * Build all parts of the flow by directing flow assembly by the flow builder. * @throws FlowBuilderException when flow assembly fails */ protected void directAssembly() throws FlowBuilderException { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilder.java index 246e717b..cb431097 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilder.java @@ -19,46 +19,34 @@ import org.springframework.webflow.core.collection.AttributeMap; import org.springframework.webflow.engine.Flow; /** - * Builder interface used to build a flow definition. The process of building a - * flow consists of the following steps: + * Builder interface used to build a flow definition. The process of building a flow consists of the following steps: *

      - *
    1. Initialize this builder, creating the initial flow definition, by - * calling {@link #init(String, AttributeMap)}. - *
    2. Call {@link #buildVariables()} to create any variables of the flow and - * add them to the flow definition. - *
    3. Call {@link #buildInputMapper()} to create and set the input mapper for - * the flow. - *
    4. Call {@link #buildStartActions()} to create and add any start actions to - * the flow. - *
    5. Call {@link #buildInlineFlows()} to create any inline flows - * encapsulated by the flow and add them to the flow definition. - *
    6. Call {@link #buildStates()} to create the states of the flow and add - * them to the flow definition. - *
    7. Call {@link #buildGlobalTransitions()} to create the any transitions - * shared by all states of the flow and add them to the flow definition. - *
    8. Call {@link #buildEndActions()} to create and add any end actions to - * the flow. - *
    9. Call {@link #buildOutputMapper()} to create and set the output mapper - * for the flow. - *
    10. Call {@link #buildExceptionHandlers()} to create the exception - * handlers of the flow and add them to the flow definition. - *
    11. Call {@link #getFlow()} to return the fully-built {@link Flow} + *
    12. Initialize this builder, creating the initial flow definition, by calling {@link #init(String, AttributeMap)}. + *
    13. Call {@link #buildVariables()} to create any variables of the flow and add them to the flow definition. + *
    14. Call {@link #buildInputMapper()} to create and set the input mapper for the flow. + *
    15. Call {@link #buildStartActions()} to create and add any start actions to the flow. + *
    16. Call {@link #buildInlineFlows()} to create any inline flows encapsulated by the flow and add them to the flow * definition. - *
    17. Dispose this builder, releasing any resources allocated during the - * building process by calling {@link #dispose()}. + *
    18. Call {@link #buildStates()} to create the states of the flow and add them to the flow definition. + *
    19. Call {@link #buildGlobalTransitions()} to create the any transitions shared by all states of the flow and add + * them to the flow definition. + *
    20. Call {@link #buildEndActions()} to create and add any end actions to the flow. + *
    21. Call {@link #buildOutputMapper()} to create and set the output mapper for the flow. + *
    22. Call {@link #buildExceptionHandlers()} to create the exception handlers of the flow and add them to the flow + * definition. + *
    23. Call {@link #getFlow()} to return the fully-built {@link Flow} definition. + *
    24. Dispose this builder, releasing any resources allocated during the building process by calling + * {@link #dispose()}. *
    *

    - * Implementations should encapsulate flow construction logic, either for a - * specific kind of flow, for example, an OrderFlowBuilder built - * in Java code, or a generic flow builder strategy, like the + * Implementations should encapsulate flow construction logic, either for a specific kind of flow, for example, an + * OrderFlowBuilder built in Java code, or a generic flow builder strategy, like the * XmlFlowBuilder, for building flows from an XML-definition. *

    - * Flow builders are used by the - * {@link org.springframework.webflow.engine.builder.FlowAssembler}, which acts as an - * assembler (director). Flow Builders may be reused, however, exercise caution - * when doing this as these objects are not thread safe. Also, for each use be - * sure to call init, followed by the build* methods, getFlow, and dispose - * completely in that order. + * Flow builders are used by the {@link org.springframework.webflow.engine.builder.FlowAssembler}, which acts as an + * assembler (director). Flow Builders may be reused, however, exercise caution when doing this as these objects are not + * thread safe. Also, for each use be sure to call init, followed by the build* methods, getFlow, and dispose completely + * in that order. *

    * This is an example of the classic GoF builder pattern. * @@ -73,8 +61,8 @@ import org.springframework.webflow.engine.Flow; public interface FlowBuilder { /** - * Initialize this builder. This could cause the builder to open a stream to - * an externalized resource representing the flow definition, for example. + * Initialize this builder. This could cause the builder to open a stream to an externalized resource representing + * the flow definition, for example. * @param flowId the identifier to assign to the flow * @param attributes custom attributes to assign to the flow * @throws FlowBuilderException an exception occured building the flow @@ -130,24 +118,21 @@ public interface FlowBuilder { public void buildOutputMapper() throws FlowBuilderException; /** - * Creates and adds all exception handlers to the flow built by this - * builder. + * Creates and adds all exception handlers to the flow built by this builder. * @throws FlowBuilderException an exception occured building this flow */ public void buildExceptionHandlers() throws FlowBuilderException; /** - * Get the fully constructed and configured Flow object - called by the - * builder's assembler (director) after assembly. When this method is called - * by the assembler, it is expected flow construction has completed - * and the returned flow is ready for use. + * Get the fully constructed and configured Flow object - called by the builder's assembler (director) after + * assembly. When this method is called by the assembler, it is expected flow construction has completed and the + * returned flow is ready for use. */ public Flow getFlow(); /** - * Shutdown the builder, releasing any resources it holds. A new flow - * construction process should start with another call to the - * {@link #init(String, AttributeMap)} method. + * Shutdown the builder, releasing any resources it holds. A new flow construction process should start with another + * call to the {@link #init(String, AttributeMap)} method. */ public void dispose(); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilderException.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilderException.java index af9251e7..0a689151 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilderException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowBuilderException.java @@ -25,7 +25,7 @@ import org.springframework.webflow.core.FlowException; * @author Erwin Vervaet */ public class FlowBuilderException extends FlowException { - + /** * Create a new flow builder exception. * @param message descriptive message diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowServiceLocator.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowServiceLocator.java index b526662d..46578206 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowServiceLocator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/FlowServiceLocator.java @@ -32,24 +32,20 @@ import org.springframework.webflow.engine.ViewSelector; import org.springframework.webflow.execution.Action; /** - * A support interface used by flow builders at configuration time. Acts as a - * "service locator" responsible for: + * A support interface used by flow builders at configuration time. Acts as a "service locator" responsible for: *

      - *
    1. Retrieving dependent (but externally managed) flow services needed to - * configure flow and state definitions. Such services are usually hosted in a - * backing registry and may be shared by multiple flows. - *
    2. Providing access to abstract factories to create core flow definitional - * artifacts such as {@link Flow}, {@link State}, {@link Transition}, and - * {@link AbstractBeanInvokingAction bean invoking actions}. These artifacts + *
    3. Retrieving dependent (but externally managed) flow services needed to configure flow and state definitions. Such + * services are usually hosted in a backing registry and may be shared by multiple flows. + *
    4. Providing access to abstract factories to create core flow definitional artifacts such as {@link Flow}, + * {@link State}, {@link Transition}, and {@link AbstractBeanInvokingAction bean invoking actions}. These artifacts * are unique to each flow and are typically not shared. *
    *

    - * In general, implementations of this interface act as facades to accessing and - * creating flow artifacts during {@link FlowAssembler flow assembly}. + * In general, implementations of this interface act as facades to accessing and creating flow artifacts during + * {@link FlowAssembler flow assembly}. *

    - * Finally, this interface also exposes access to generic infrastructure - * services also needed by flow assemblers such as a {@link ConversionService} - * and {@link ExpressionParser}. + * Finally, this interface also exposes access to generic infrastructure services also needed by flow assemblers such as + * a {@link ConversionService} and {@link ExpressionParser}. * * @see org.springframework.webflow.engine.builder.FlowBuilder * @see org.springframework.webflow.engine.builder.BaseFlowBuilder @@ -76,8 +72,8 @@ public interface FlowServiceLocator { public Action getAction(String id) throws FlowArtifactLookupException; /** - * Returns the flow attribute mapper with the provided id. Flow attribute - * mappers are used from subflow states to map input and output attributes. + * Returns the flow attribute mapper with the provided id. Flow attribute mappers are used from subflow states to + * map input and output attributes. * @param id the attribute mapper id * @return the attribute mapper * @throws FlowArtifactLookupException when no such mapper is found @@ -85,8 +81,7 @@ public interface FlowServiceLocator { public FlowAttributeMapper getAttributeMapper(String id) throws FlowArtifactLookupException; /** - * Returns the transition criteria to drive state transitions with the - * provided id. + * Returns the transition criteria to drive state transitions with the provided id. * @param id the transition criteria id * @return the transition criteria * @throws FlowArtifactLookupException when no such criteria is found @@ -102,8 +97,7 @@ public interface FlowServiceLocator { public TargetStateResolver getTargetStateResolver(String id) throws FlowArtifactLookupException; /** - * Returns the view selector to make view selections in view states with the - * provided id. + * Returns the view selector to make view selections in view states with the provided id. * @param id the view selector id * @return the view selector * @throws FlowArtifactLookupException when no such selector is found @@ -111,8 +105,7 @@ public interface FlowServiceLocator { public ViewSelector getViewSelector(String id) throws FlowArtifactLookupException; /** - * Returns the exception handler to handle flow execution exceptions with - * the provided id. + * Returns the exception handler to handle flow execution exceptions with the provided id. * @param id the exception handler id * @return the exception handler * @throws FlowArtifactLookupException when no such handler is found @@ -151,8 +144,8 @@ public interface FlowServiceLocator { public ExpressionParser getExpressionParser(); /** - * Returns a generic type conversion service for converting between types, - * typically from string to a rich value object. + * Returns a generic type conversion service for converting between types, typically from string to a rich value + * object. * @return the generic conversion service */ public ConversionService getConversionService(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/RefreshableFlowDefinitionHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/RefreshableFlowDefinitionHolder.java index 85abb5dc..56609af2 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/RefreshableFlowDefinitionHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/RefreshableFlowDefinitionHolder.java @@ -27,14 +27,13 @@ import org.springframework.webflow.engine.Flow; import org.springframework.webflow.util.ResourceHolder; /** - * A flow definition holder that can detect changes on an underlying flow - * definition resource and refresh that resource automatically. + * A flow definition holder that can detect changes on an underlying flow definition resource and refresh that resource + * automatically. *

    * This class is threadsafe. *

    - * Note that this {@link FlowDefinition} holder uses a {@link Flow} assembler. - * This is normal since a {@link Flow} is a {@link FlowDefinition}! This class - * bridges the abstract world of {@link FlowDefinition flow definitions} + * Note that this {@link FlowDefinition} holder uses a {@link Flow} assembler. This is normal since a {@link Flow} is a + * {@link FlowDefinition}! This class bridges the abstract world of {@link FlowDefinition flow definitions} * with the concrete world of {@link Flow flow implementations}. * * @see FlowDefinition @@ -44,7 +43,7 @@ import org.springframework.webflow.util.ResourceHolder; * @author Keith Donald */ public class RefreshableFlowDefinitionHolder implements FlowDefinitionHolder { - + private static final Log logger = LogFactory.getLog(RefreshableFlowDefinitionHolder.class); /** @@ -58,21 +57,19 @@ public class RefreshableFlowDefinitionHolder implements FlowDefinitionHolder { private FlowAssembler assembler; /** - * A last modified date for the backing flow definition resource, used to support - * automatic reassembly on resource change. + * A last modified date for the backing flow definition resource, used to support automatic reassembly on resource + * change. */ private long lastModified; /** - * A flag indicating whether or not this holder is in the middle of the - * assembly process. + * A flag indicating whether or not this holder is in the middle of the assembly process. */ private boolean assembling; /** - * Creates a new refreshable flow definition holder that uses the configured - * assembler (GOF director) to drive flow assembly, on initial use and on any - * resource change or refresh. + * Creates a new refreshable flow definition holder that uses the configured assembler (GOF director) to drive flow + * assembly, on initial use and on any resource change or refresh. * @param assembler the flow assembler to use */ public RefreshableFlowDefinitionHolder(FlowAssembler assembler) { @@ -91,8 +88,7 @@ public class RefreshableFlowDefinitionHolder implements FlowDefinitionHolder { if (!isAssembled()) { lastModified = calculateLastModified(); assembleFlow(); - } - else { + } else { refreshIfChanged(); } return flowDefinition; @@ -101,7 +97,7 @@ public class RefreshableFlowDefinitionHolder implements FlowDefinitionHolder { public synchronized void refresh() throws FlowBuilderException { assembleFlow(); } - + // internal helpers /** @@ -122,8 +118,8 @@ public class RefreshableFlowDefinitionHolder implements FlowDefinitionHolder { long calculatedLastModified = calculateLastModified(); if (this.lastModified < calculatedLastModified) { if (logger.isDebugEnabled()) { - logger.debug("Resource modification detected, reloading flow definition with id '" + - assembler.getFlowId() + "'"); + logger.debug("Resource modification detected, reloading flow definition with id '" + + assembler.getFlowId() + "'"); } assembleFlow(); this.lastModified = calculatedLastModified; @@ -131,21 +127,18 @@ public class RefreshableFlowDefinitionHolder implements FlowDefinitionHolder { } /** - * Helper that retrieves the last modified date by querying the backing flow - * resource. + * Helper that retrieves the last modified date by querying the backing flow resource. * @return the last modified date, or -1 if it could not be retrieved */ protected long calculateLastModified() { if (getFlowBuilder() instanceof ResourceHolder) { - Resource resource = ((ResourceHolder)getFlowBuilder()).getResource(); + Resource resource = ((ResourceHolder) getFlowBuilder()).getResource(); if (logger.isDebugEnabled()) { - logger.debug( - "Calculating last modified timestamp for flow definition resource '" + resource + "'"); + logger.debug("Calculating last modified timestamp for flow definition resource '" + resource + "'"); } try { return resource.getFile().lastModified(); - } - catch (IOException e) { + } catch (IOException e) { // ignore, last modified checks not supported } } @@ -161,8 +154,7 @@ public class RefreshableFlowDefinitionHolder implements FlowDefinitionHolder { } /** - * Assemble the held flow definition, delegating to the configured - * FlowAssembler (director). + * Assemble the held flow definition, delegating to the configured FlowAssembler (director). */ protected void assembleFlow() throws FlowBuilderException { if (logger.isDebugEnabled()) { @@ -171,15 +163,13 @@ public class RefreshableFlowDefinitionHolder implements FlowDefinitionHolder { try { assembling = true; flowDefinition = assembler.assembleFlow(); - } - finally { + } finally { assembling = false; } } /** - * Returns a flag indicating if this holder has performed and completed - * flow definition assembly. + * Returns a flag indicating if this holder has performed and completed flow definition assembly. */ protected boolean isAssembled() { return flowDefinition != null; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToTargetStateResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToTargetStateResolver.java index 79da3a88..07c8da83 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToTargetStateResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToTargetStateResolver.java @@ -22,18 +22,16 @@ import org.springframework.webflow.engine.TargetStateResolver; import org.springframework.webflow.engine.support.DefaultTargetStateResolver; /** - * Converter that takes an encoded string representation and produces a - * corresponding {@link TargetStateResolver} object. + * Converter that takes an encoded string representation and produces a corresponding {@link TargetStateResolver} + * object. *

    * This converter supports the following encoded forms: *

    * * @author Keith Donald @@ -42,8 +40,7 @@ import org.springframework.webflow.engine.support.DefaultTargetStateResolver; public class TextToTargetStateResolver extends AbstractConverter { /** - * Prefix used when the user wants to use a custom TargetStateResolver - * implementation managed by a factory. + * Prefix used when the user wants to use a custom TargetStateResolver implementation managed by a factory. */ private static final String BEAN_PREFIX = "bean:"; @@ -53,9 +50,8 @@ public class TextToTargetStateResolver extends AbstractConverter { private FlowServiceLocator flowServiceLocator; /** - * Create a new converter that converts strings to transition target state - * resolver objects. The given conversion service will be used to do all - * necessary internal conversion (e.g. parsing expression strings). + * Create a new converter that converts strings to transition target state resolver objects. The given conversion + * service will be used to do all necessary internal conversion (e.g. parsing expression strings). */ public TextToTargetStateResolver(FlowServiceLocator flowServiceLocator) { this.flowServiceLocator = flowServiceLocator; @@ -70,15 +66,13 @@ public class TextToTargetStateResolver extends AbstractConverter { } protected Object doConvert(Object source, Class targetClass, ConversionContext context) throws Exception { - String targetStateId = (String)source; + String targetStateId = (String) source; if (flowServiceLocator.getExpressionParser().isDelimitedExpression(targetStateId)) { Expression expression = flowServiceLocator.getExpressionParser().parseExpression(targetStateId); return new DefaultTargetStateResolver(expression); - } - else if (targetStateId.startsWith(BEAN_PREFIX)) { + } else if (targetStateId.startsWith(BEAN_PREFIX)) { return flowServiceLocator.getTargetStateResolver(targetStateId.substring(BEAN_PREFIX.length())); - } - else { + } else { return new DefaultTargetStateResolver(targetStateId); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToTransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToTransitionCriteria.java index a6499010..f6a0a4ca 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToTransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToTransitionCriteria.java @@ -26,23 +26,18 @@ import org.springframework.webflow.engine.support.BooleanExpressionTransitionCri import org.springframework.webflow.engine.support.EventIdTransitionCriteria; /** - * Converter that takes an encoded string representation and produces a - * corresponding TransitionCriteria object. + * Converter that takes an encoded string representation and produces a corresponding TransitionCriteria + * object. *

    * This converter supports the following encoded forms: *

    * * @see org.springframework.webflow.engine.TransitionCriteria @@ -53,8 +48,7 @@ import org.springframework.webflow.engine.support.EventIdTransitionCriteria; public class TextToTransitionCriteria extends AbstractConverter { /** - * Prefix used when the user wants to use a custom TransitionCriteria - * implementation managed by a bean factory. + * Prefix used when the user wants to use a custom TransitionCriteria implementation managed by a bean factory. */ private static final String BEAN_PREFIX = "bean:"; @@ -64,9 +58,8 @@ public class TextToTransitionCriteria extends AbstractConverter { private FlowServiceLocator flowServiceLocator; /** - * Create a new converter that converts strings to transition criteria - * objects. Custom transition criteria will be looked up using given - * service locator. + * Create a new converter that converts strings to transition criteria objects. Custom transition criteria will be + * looked up using given service locator. */ public TextToTransitionCriteria(FlowServiceLocator flowServiceLocator) { this.flowServiceLocator = flowServiceLocator; @@ -81,26 +74,22 @@ public class TextToTransitionCriteria extends AbstractConverter { } protected Object doConvert(Object source, Class targetClass, ConversionContext context) throws Exception { - String encodedCriteria = (String)source; + String encodedCriteria = (String) source; if (!StringUtils.hasText(encodedCriteria) || WildcardTransitionCriteria.WILDCARD_EVENT_ID.equals(encodedCriteria)) { return WildcardTransitionCriteria.INSTANCE; - } - else if (flowServiceLocator.getExpressionParser().isDelimitedExpression(encodedCriteria)) { + } else if (flowServiceLocator.getExpressionParser().isDelimitedExpression(encodedCriteria)) { Expression expression = flowServiceLocator.getExpressionParser().parseExpression(encodedCriteria); return createBooleanExpressionTransitionCriteria(expression); - } - else if (encodedCriteria.startsWith(BEAN_PREFIX)) { + } else if (encodedCriteria.startsWith(BEAN_PREFIX)) { return flowServiceLocator.getTransitionCriteria(encodedCriteria.substring(BEAN_PREFIX.length())); - } - else { + } else { return createEventIdTransitionCriteria(encodedCriteria); } } /** - * Hook method subclasses can override to return a specialized eventId - * matching transition criteria implementation. + * Hook method subclasses can override to return a specialized eventId matching transition criteria implementation. * @param eventId the event id to match * @return the transition criteria object * @throws ConversionException when something goes wrong @@ -110,8 +99,8 @@ public class TextToTransitionCriteria extends AbstractConverter { } /** - * Hook method subclasses can override to return a specialized expression - * evaluating transition criteria implementation. + * Hook method subclasses can override to return a specialized expression evaluating transition criteria + * implementation. * @param expression the expression to evaluate * @return the transition criteria object * @throws ConversionException when something goes wrong diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToViewSelector.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToViewSelector.java index e46d6432..27ce7545 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToViewSelector.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/TextToViewSelector.java @@ -30,25 +30,21 @@ import org.springframework.webflow.execution.support.FlowDefinitionRedirect; import org.springframework.webflow.execution.support.FlowExecutionRedirect; /** - * Converter that converts an encoded string representation of a view selector - * into a {@link ViewSelector} object that will make selections at runtime. + * Converter that converts an encoded string representation of a view selector into a {@link ViewSelector} object that + * will make selections at runtime. *

    * This converter supports the following encoded forms: *

    * * @see org.springframework.webflow.execution.ViewSelection @@ -60,26 +56,24 @@ import org.springframework.webflow.execution.support.FlowExecutionRedirect; public class TextToViewSelector extends ConversionServiceAwareConverter { /** - * Prefix used when the encoded view name wants to specify that a redirect - * is required. ("redirect:") + * Prefix used when the encoded view name wants to specify that a redirect is required. ("redirect:") */ public static final String REDIRECT_PREFIX = "redirect:"; /** - * Prefix used when the encoded view name wants to specify that a redirect - * to an external URL is required. ("externalRedirect:") + * Prefix used when the encoded view name wants to specify that a redirect to an external URL is required. + * ("externalRedirect:") */ public static final String EXTERNAL_REDIRECT_PREFIX = "externalRedirect:"; /** - * Prefix used when the encoded view name wants to specify that a redirect - * to a flow definition is requred. ("flowRedirect:") + * Prefix used when the encoded view name wants to specify that a redirect to a flow definition is requred. + * ("flowRedirect:") */ public static final String FLOW_DEFINITION_REDIRECT_PREFIX = "flowRedirect:"; /** - * Prefix used when the user wants to use a ViewSelector implementation - * managed by a bean factory. ("bean:") + * Prefix used when the user wants to use a ViewSelector implementation managed by a bean factory. ("bean:") */ private static final String BEAN_PREFIX = "bean:"; @@ -89,8 +83,8 @@ public class TextToViewSelector extends ConversionServiceAwareConverter { private FlowServiceLocator flowServiceLocator; /** - * Create a new text to ViewSelector converter. Custom ViewSelector implemenations - * will be looked up using given service locator. + * Create a new text to ViewSelector converter. Custom ViewSelector implemenations will be looked up using given + * service locator. */ public TextToViewSelector(FlowServiceLocator flowServiceLocator) { this.flowServiceLocator = flowServiceLocator; @@ -106,11 +100,10 @@ public class TextToViewSelector extends ConversionServiceAwareConverter { } protected Object doConvert(Object source, Class targetClass, ConversionContext context) throws Exception { - String encodedView = (String)source; + String encodedView = (String) source; if (!StringUtils.hasText(encodedView)) { return NullViewSelector.INSTANCE; - } - else { + } else { return convertEncodedViewSelector(encodedView); } } @@ -123,26 +116,22 @@ public class TextToViewSelector extends ConversionServiceAwareConverter { protected ViewSelector convertEncodedViewSelector(String encodedView) { if (encodedView.startsWith(REDIRECT_PREFIX)) { String viewName = encodedView.substring(REDIRECT_PREFIX.length()); - Expression viewNameExpr = (Expression)fromStringTo(Expression.class).execute(viewName); + Expression viewNameExpr = (Expression) fromStringTo(Expression.class).execute(viewName); // just show the application view using a redirect return new ApplicationViewSelector(viewNameExpr, true); - } - else if (encodedView.startsWith(EXTERNAL_REDIRECT_PREFIX)) { + } else if (encodedView.startsWith(EXTERNAL_REDIRECT_PREFIX)) { String externalUrl = encodedView.substring(EXTERNAL_REDIRECT_PREFIX.length()); - Expression urlExpr = (Expression)fromStringTo(Expression.class).execute(externalUrl); + Expression urlExpr = (Expression) fromStringTo(Expression.class).execute(externalUrl); return new ExternalRedirectSelector(urlExpr); - } - else if (encodedView.startsWith(FLOW_DEFINITION_REDIRECT_PREFIX)) { + } else if (encodedView.startsWith(FLOW_DEFINITION_REDIRECT_PREFIX)) { String flowRedirect = encodedView.substring(FLOW_DEFINITION_REDIRECT_PREFIX.length()); - Expression redirectExpr = (Expression)fromStringTo(Expression.class).execute(flowRedirect); + Expression redirectExpr = (Expression) fromStringTo(Expression.class).execute(flowRedirect); return new FlowDefinitionRedirectSelector(redirectExpr); - } - else if (encodedView.startsWith(BEAN_PREFIX)) { + } else if (encodedView.startsWith(BEAN_PREFIX)) { String id = encodedView.substring(BEAN_PREFIX.length()); return flowServiceLocator.getViewSelector(id); - } - else { - Expression viewNameExpr = (Expression)fromStringTo(Expression.class).execute(encodedView); + } else { + Expression viewNameExpr = (Expression) fromStringTo(Expression.class).execute(encodedView); return new ApplicationViewSelector(viewNameExpr); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/DefaultDocumentLoader.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/DefaultDocumentLoader.java index 1eb07b25..4e5f8a83 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/DefaultDocumentLoader.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/DefaultDocumentLoader.java @@ -31,14 +31,11 @@ import org.xml.sax.EntityResolver; import org.xml.sax.SAXException; /** - * The default document loader strategy for XSD-based XML documents with - * validation enabled by default. + * The default document loader strategy for XSD-based XML documents with validation enabled by default. *

    - * Note: full XSD support requires JDK 5.0 or a capable parser such as Xerces - * 2.0. JDK 1.4 or < do not fully support XSD out of the box. To use this - * implementation on JDK 1.4 make sure Xerces is available in your classpath or - * disable XSD validation by - * {@link #setValidating(boolean) setting the validating property to false}. + * Note: full XSD support requires JDK 5.0 or a capable parser such as Xerces 2.0. JDK 1.4 or < do not fully support XSD + * out of the box. To use this implementation on JDK 1.4 make sure Xerces is available in your classpath or disable XSD + * validation by {@link #setValidating(boolean) setting the validating property to false}. * * @author Keith Donald */ @@ -57,8 +54,7 @@ public class DefaultDocumentLoader implements DocumentLoader { private static final String XSD_SCHEMA_LANGUAGE = "http://www.w3.org/2001/XMLSchema"; /** - * Flag indicating if the XML document parser will perform schema - * validation. + * Flag indicating if the XML document parser will perform schema validation. */ private boolean validating = true; @@ -75,8 +71,7 @@ public class DefaultDocumentLoader implements DocumentLoader { } /** - * Set if the XML parser should validate the document and thus enforce a - * schema. Defaults to true. + * Set if the XML parser should validate the document and thus enforce a schema. Defaults to true. */ public void setValidating(boolean validating) { this.validating = validating; @@ -90,9 +85,8 @@ public class DefaultDocumentLoader implements DocumentLoader { } /** - * Set a SAX entity resolver to be used for parsing. Can be overridden for - * custom entity resolution, for example relative to some specific base - * path. + * Set a SAX entity resolver to be used for parsing. Can be overridden for custom entity resolution, for example + * relative to some specific base path. * @see org.springframework.webflow.engine.builder.xml.WebFlowEntityResolver */ public void setEntityResolver(EntityResolver entityResolver) { @@ -108,8 +102,7 @@ public class DefaultDocumentLoader implements DocumentLoader { factory.setNamespaceAware(true); try { factory.setAttribute(SCHEMA_LANGUAGE_ATTRIBUTE, XSD_SCHEMA_LANGUAGE); - } - catch (IllegalArgumentException ex) { + } catch (IllegalArgumentException ex) { throw new IllegalStateException("Unable to validate using XSD: Your JAXP provider [" + factory + "] does not support XML Schema. " + "Are you running on Java 1.4 or below with Apache Crimson? " @@ -119,8 +112,7 @@ public class DefaultDocumentLoader implements DocumentLoader { docBuilder.setErrorHandler(new SimpleSaxErrorHandler(logger)); docBuilder.setEntityResolver(getEntityResolver()); return docBuilder.parse(is); - } - finally { + } finally { if (is != null) { is.close(); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/DocumentLoader.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/DocumentLoader.java index b02ea14e..de5f0510 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/DocumentLoader.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/DocumentLoader.java @@ -29,7 +29,7 @@ import org.xml.sax.SAXException; * @author Keith Donald */ public interface DocumentLoader { - + /** * Load the XML-based document from the external resource. * @param resource the document resource diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/ImmutableFlowAttributeMapper.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/ImmutableFlowAttributeMapper.java index f484de66..5cab6ed5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/ImmutableFlowAttributeMapper.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/ImmutableFlowAttributeMapper.java @@ -22,8 +22,8 @@ import org.springframework.core.style.ToStringCreator; import org.springframework.webflow.engine.support.AbstractFlowAttributeMapper; /** - * Simple flow attribute mapper that holds an input and output mapper strategy. - * This is an internal helper class of the XmlFlowBuilder. + * Simple flow attribute mapper that holds an input and output mapper strategy. This is an internal helper class of the + * XmlFlowBuilder. * * @see org.springframework.webflow.engine.builder.xml.XmlFlowBuilder * @@ -54,7 +54,7 @@ final class ImmutableFlowAttributeMapper extends AbstractFlowAttributeMapper imp } public String toString() { - return new ToStringCreator(this).append("inputMapper", inputMapper) - .append("outputMapper", outputMapper).toString(); + return new ToStringCreator(this).append("inputMapper", inputMapper).append("outputMapper", outputMapper) + .toString(); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/LocalFlowServiceLocator.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/LocalFlowServiceLocator.java index f64b05f5..1e055db3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/LocalFlowServiceLocator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/LocalFlowServiceLocator.java @@ -35,14 +35,14 @@ import org.springframework.webflow.engine.builder.FlowServiceLocator; import org.springframework.webflow.execution.Action; /** - * Flow service locator that searches flow-local registries first before querying the global, externally - * managed flow service locator. + * Flow service locator that searches flow-local registries first before querying the global, externally managed flow + * service locator. *

    - * Internal helper class of the {@link org.springframework.webflow.engine.builder.xml.XmlFlowBuilder}. - * Package private to highlight it's non-public nature. - * + * Internal helper class of the {@link org.springframework.webflow.engine.builder.xml.XmlFlowBuilder}. Package private + * to highlight it's non-public nature. + * * @see org.springframework.webflow.engine.builder.xml.XmlFlowBuilder - * + * * @author Keith Donald */ class LocalFlowServiceLocator implements FlowServiceLocator { @@ -86,14 +86,14 @@ class LocalFlowServiceLocator implements FlowServiceLocator { * Pop a registry off the stack. */ public LocalFlowServiceRegistry pop() { - return (LocalFlowServiceRegistry)localRegistries.pop(); + return (LocalFlowServiceRegistry) localRegistries.pop(); } /** * Returns the top registry on the stack. */ public LocalFlowServiceRegistry top() { - return (LocalFlowServiceRegistry)localRegistries.peek(); + return (LocalFlowServiceRegistry) localRegistries.peek(); } /** @@ -121,54 +121,48 @@ class LocalFlowServiceLocator implements FlowServiceLocator { public Action getAction(String id) throws FlowArtifactLookupException { if (containsBean(id)) { - return (Action)getBean(id, Action.class); - } - else { + return (Action) getBean(id, Action.class); + } else { return parent.getAction(id); } } public FlowAttributeMapper getAttributeMapper(String id) throws FlowArtifactLookupException { if (containsBean(id)) { - return (FlowAttributeMapper)getBean(id, FlowAttributeMapper.class); - } - else { + return (FlowAttributeMapper) getBean(id, FlowAttributeMapper.class); + } else { return parent.getAttributeMapper(id); } } public TransitionCriteria getTransitionCriteria(String id) throws FlowArtifactLookupException { if (containsBean(id)) { - return (TransitionCriteria)getBean(id, TransitionCriteria.class); - } - else { + return (TransitionCriteria) getBean(id, TransitionCriteria.class); + } else { return parent.getTransitionCriteria(id); } } public TargetStateResolver getTargetStateResolver(String id) throws FlowArtifactLookupException { if (containsBean(id)) { - return (TargetStateResolver)getBean(id, TargetStateResolver.class); - } - else { + return (TargetStateResolver) getBean(id, TargetStateResolver.class); + } else { return parent.getTargetStateResolver(id); } } public ViewSelector getViewSelector(String id) throws FlowArtifactLookupException { if (containsBean(id)) { - return (ViewSelector)getBean(id, ViewSelector.class); - } - else { + return (ViewSelector) getBean(id, ViewSelector.class); + } else { return parent.getViewSelector(id); } } public FlowExecutionExceptionHandler getExceptionHandler(String id) throws FlowArtifactLookupException { if (containsBean(id)) { - return (FlowExecutionExceptionHandler)getBean(id, FlowExecutionExceptionHandler.class); - } - else { + return (FlowExecutionExceptionHandler) getBean(id, FlowExecutionExceptionHandler.class); + } else { return parent.getExceptionHandler(id); } } @@ -212,8 +206,7 @@ class LocalFlowServiceLocator implements FlowServiceLocator { protected boolean containsBean(String id) { if (localRegistries.isEmpty()) { return false; - } - else { + } else { return getBeanFactory().containsBean(id); } } @@ -224,8 +217,7 @@ class LocalFlowServiceLocator implements FlowServiceLocator { protected Object getBean(String id, Class artifactType) throws FlowArtifactLookupException { try { return getBeanFactory().getBean(id, artifactType); - } - catch (BeansException e) { + } catch (BeansException e) { throw new FlowArtifactLookupException(id, artifactType, e); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/LocalFlowServiceRegistry.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/LocalFlowServiceRegistry.java index 24136742..8b9584f6 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/LocalFlowServiceRegistry.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/LocalFlowServiceRegistry.java @@ -19,15 +19,15 @@ import org.springframework.beans.factory.BeanFactory; import org.springframework.webflow.engine.Flow; /** - * Simple object that holds a reference to a local bean factory housing services needed by a flow definition - * at execution time. + * Simple object that holds a reference to a local bean factory housing services needed by a flow definition at + * execution time. *

    * Internal helper class of the {@link org.springframework.webflow.engine.builder.xml.XmlFlowBuilder}. Package private * to highlight it's non-public nature. - * + * * @see org.springframework.webflow.engine.builder.xml.XmlFlowBuilder * @see org.springframework.webflow.engine.builder.xml.LocalFlowServiceLocator - * + * * @author Keith Donald */ class LocalFlowServiceRegistry { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/WebFlowEntityResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/WebFlowEntityResolver.java index 7dc8aa4e..6ed9484b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/WebFlowEntityResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/WebFlowEntityResolver.java @@ -24,8 +24,7 @@ import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** - * EntityResolver implementation for the Spring Web Flow 1.0 XML Schema. This - * will load the XSD from the classpath. + * EntityResolver implementation for the Spring Web Flow 1.0 XML Schema. This will load the XSD from the classpath. *

    * The xmlns of the XSD expected to be resolved: * @@ -53,8 +52,7 @@ public class WebFlowEntityResolver implements EntityResolver { source.setPublicId(publicId); source.setSystemId(systemId); return source; - } - catch (IOException ex) { + } catch (IOException ex) { // fall through below } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowBuilder.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowBuilder.java index a99944db..4a2f5bfb 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowBuilder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowBuilder.java @@ -85,19 +85,17 @@ import org.xml.sax.SAXException; /** * Flow builder that builds flows as defined in an XML document. The XML document should adhere to the following format: - * + * *

      *     <?xml version="1.0" encoding="UTF-8"?>
      *     <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-1.0.xsd">
    - *
      *         <!-- Define your states here -->
    - *
      *     </flow>
      * 
    - * + * *

    * Consult the web flow XML schema * for more information on the XML-based flow definition format. @@ -106,7 +104,7 @@ import org.xml.sax.SAXException; * be populated with XML bean definitions contained in files referenced using the "import" element. The flow-local bean * factory will use the bean factory defing this flow builder as a parent. As such, the flow can access artifacts in * either its flow-local bean factory or in the parent bean factory hierarchy, e.g. the bean factory of the dispatcher. - * + * * @author Erwin Vervaet * @author Keith Donald */ @@ -316,15 +314,12 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { localFlowServiceLocator = new LocalFlowServiceLocator(getFlowServiceLocator()); try { document = documentLoader.loadDocument(location); - } - catch (IOException e) { + } catch (IOException e) { throw new FlowBuilderException("Could not access the XML flow definition resource at " + location, e); - } - catch (ParserConfigurationException e) { + } catch (ParserConfigurationException e) { throw new FlowBuilderException("Could not configure the parser to parse the XML flow definition at " + location, e); - } - catch (SAXException e) { + } catch (SAXException e) { throw new FlowBuilderException("Could not parse the XML flow definition document at " + location, e); } setFlow(parseFlow(id, attributes, getDocumentElement())); @@ -457,8 +452,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { Element importElement = (Element) importElements.get(i); try { resources[i] = getLocation().createRelative(importElement.getAttribute(RESOURCE_ATTRIBUTE)); - } - catch (IOException e) { + } catch (IOException e) { throw new FlowBuilderException("Could not access flow-relative artifact resource '" + importElement.getAttribute(RESOURCE_ATTRIBUTE) + "'", e); } @@ -479,12 +473,10 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { if (localFlowServiceLocator.isEmpty()) { try { parent = getFlowServiceLocator().getBeanFactory(); - } - catch (UnsupportedOperationException e) { + } catch (UnsupportedOperationException e) { // can't link to a parent } - } - else { + } else { parent = localFlowServiceLocator.top().getBeanFactory(); } // determine the context implementation based on the current environment @@ -493,15 +485,13 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { GenericWebApplicationContext webContext = new GenericWebApplicationContext(); webContext.setServletContext(((WebApplicationContext) parent).getServletContext()); context = webContext; - } - else { + } else { context = new GenericApplicationContext(); } // set the parent if necessary if (parent instanceof ApplicationContext) { context.setParent((ApplicationContext) parent); - } - else { + } else { if (parent != null) { context.getBeanFactory().setParentBeanFactory(parent); } @@ -516,8 +506,8 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { /** * Register beans in the bean factory local to the flow definition being built. *

    - * Subclasses may override this metod to customize the population of the bean factory local to - * the flow definition being built; for example, to register mock implementations of services in a test environment. + * Subclasses may override this metod to customize the population of the bean factory local to the flow definition + * being built; for example, to register mock implementations of services in a test environment. * @param flow the current flow definition being built * @param beanFactory the bean factory; register local beans with it using * {@link ConfigurableBeanFactory#registerSingleton(String, Object)} @@ -541,15 +531,13 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { ScopeType scope = parseScope(element, ScopeType.FLOW); if (StringUtils.hasText(element.getAttribute(BEAN_ATTRIBUTE))) { BeanFactory beanFactory = getLocalFlowServiceLocator().getBeanFactory(); - return new BeanFactoryFlowVariable(element.getAttribute(NAME_ATTRIBUTE), - element.getAttribute(BEAN_ATTRIBUTE), beanFactory, scope); - } - else { + return new BeanFactoryFlowVariable(element.getAttribute(NAME_ATTRIBUTE), element + .getAttribute(BEAN_ATTRIBUTE), beanFactory, scope); + } else { if (StringUtils.hasText(element.getAttribute(CLASS_ATTRIBUTE))) { Class variableClass = (Class) fromStringTo(Class.class).execute(element.getAttribute(CLASS_ATTRIBUTE)); return new SimpleFlowVariable(element.getAttribute(NAME_ATTRIBUTE), variableClass, scope); - } - else { + } else { BeanFactory beanFactory = getLocalFlowServiceLocator().getBeanFactory(); return new BeanFactoryFlowVariable(element.getAttribute(NAME_ATTRIBUTE), null, beanFactory, scope); } @@ -611,17 +599,13 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { Element stateElement = (Element) childNode; if (nodeNameEquals(stateElement, ACTION_STATE_ELEMENT)) { parseAndAddActionState(stateElement, flow); - } - else if (nodeNameEquals(stateElement, VIEW_STATE_ELEMENT)) { + } else if (nodeNameEquals(stateElement, VIEW_STATE_ELEMENT)) { parseAndAddViewState(stateElement, flow); - } - else if (nodeNameEquals(stateElement, DECISION_STATE_ELEMENT)) { + } else if (nodeNameEquals(stateElement, DECISION_STATE_ELEMENT)) { parseAndAddDecisionState(stateElement, flow); - } - else if (nodeNameEquals(stateElement, SUBFLOW_STATE_ELEMENT)) { + } else if (nodeNameEquals(stateElement, SUBFLOW_STATE_ELEMENT)) { parseAndAddSubflowState(stateElement, flow); - } - else if (nodeNameEquals(stateElement, END_STATE_ELEMENT)) { + } else if (nodeNameEquals(stateElement, END_STATE_ELEMENT)) { parseAndAddEndState(stateElement, flow); } } @@ -640,35 +624,31 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { } private void parseAndAddActionState(Element element, Flow flow) { - getFlowArtifactFactory().createActionState( - parseId(element), flow, parseEntryActions(element), + getFlowArtifactFactory().createActionState(parseId(element), flow, parseEntryActions(element), parseAnnotatedActions(element), parseTransitions(element), parseExceptionHandlers(element), parseExitActions(element), parseAttributes(element)); } private void parseAndAddViewState(Element element, Flow flow) { - getFlowArtifactFactory().createViewState( - parseId(element), flow, parseEntryActions(element), + getFlowArtifactFactory().createViewState(parseId(element), flow, parseEntryActions(element), parseViewSelector(element), parseRenderActions(element), parseTransitions(element), parseExceptionHandlers(element), parseExitActions(element), parseAttributes(element)); } private void parseAndAddDecisionState(Element element, Flow flow) { - getFlowArtifactFactory().createDecisionState( - parseId(element), flow, parseEntryActions(element), parseIfs(element), - parseExceptionHandlers(element), parseExitActions(element), parseAttributes(element)); + getFlowArtifactFactory() + .createDecisionState(parseId(element), flow, parseEntryActions(element), parseIfs(element), + parseExceptionHandlers(element), parseExitActions(element), parseAttributes(element)); } private void parseAndAddSubflowState(Element element, Flow flow) { - getFlowArtifactFactory().createSubflowState( - parseId(element), flow, parseEntryActions(element), + getFlowArtifactFactory().createSubflowState(parseId(element), flow, parseEntryActions(element), parseSubflow(element), parseFlowAttributeMapper(element), parseTransitions(element), parseExceptionHandlers(element), parseExitActions(element), parseAttributes(element)); } private void parseAndAddEndState(Element element, Flow flow) { - getFlowArtifactFactory().createEndState( - parseId(element), flow, parseEntryActions(element), + getFlowArtifactFactory().createEndState(parseId(element), flow, parseEntryActions(element), parseViewSelector(element), parseOutputMapper(element), parseExceptionHandlers(element), parseAttributes(element)); } @@ -681,8 +661,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { Element entryActionsElement = getChildElementByTagName(element, ENTRY_ACTIONS_ELEMENT); if (entryActionsElement != null) { return parseAnnotatedActions(entryActionsElement); - } - else { + } else { return null; } } @@ -691,8 +670,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { Element renderActionsElement = getChildElementByTagName(element, RENDER_ACTIONS_ELEMENT); if (renderActionsElement != null) { return parseAnnotatedActions(renderActionsElement); - } - else { + } else { return null; } } @@ -701,8 +679,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { Element exitActionsElement = getChildElementByTagName(element, EXIT_ACTIONS_ELEMENT); if (exitActionsElement != null) { return parseAnnotatedActions(exitActionsElement); - } - else { + } else { return null; } } @@ -722,13 +699,13 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { } private Transition parseTransition(Element element) { - TransitionCriteria matchingCriteria = (TransitionCriteria) - fromStringTo(TransitionCriteria.class).execute(element.getAttribute(ON_ATTRIBUTE)); - TargetStateResolver targetStateResolver = (TargetStateResolver) - fromStringTo(TargetStateResolver.class).execute(element.getAttribute(TO_ATTRIBUTE)); + TransitionCriteria matchingCriteria = (TransitionCriteria) fromStringTo(TransitionCriteria.class).execute( + element.getAttribute(ON_ATTRIBUTE)); + TargetStateResolver targetStateResolver = (TargetStateResolver) fromStringTo(TargetStateResolver.class) + .execute(element.getAttribute(TO_ATTRIBUTE)); TransitionCriteria executionCriteria = TransitionCriteriaChain.criteriaChainFor(parseAnnotatedActions(element)); - return getFlowArtifactFactory().createTransition( - targetStateResolver, matchingCriteria, executionCriteria, parseAttributes(element)); + return getFlowArtifactFactory().createTransition(targetStateResolver, matchingCriteria, executionCriteria, + parseAttributes(element)); } private ViewSelector parseViewSelector(Element element) { @@ -752,16 +729,13 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { if (nodeNameEquals(childNode, ACTION_ELEMENT)) { // parse standard action actions.add(parseAnnotatedAction((Element) childNode)); - } - else if (nodeNameEquals(childNode, BEAN_ACTION_ELEMENT)) { + } else if (nodeNameEquals(childNode, BEAN_ACTION_ELEMENT)) { // parse bean invoking action actions.add(parseAnnotatedBeanInvokingAction((Element) childNode)); - } - else if (nodeNameEquals(childNode, EVALUATE_ACTION_ELEMENT)) { + } else if (nodeNameEquals(childNode, EVALUATE_ACTION_ELEMENT)) { // parse evaluate action actions.add(parseAnnotatedEvaluateAction((Element) childNode)); - } - else if (nodeNameEquals(childNode, SET_ELEMENT)) { + } else if (nodeNameEquals(childNode, SET_ELEMENT)) { // parse set action actions.add(parseAnnotatedSetAction((Element) childNode)); } @@ -832,8 +806,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { Element resultElement = getChildElementByTagName(element, METHOD_RESULT_ELEMENT); if (resultElement != null) { return parseActionResultExposer(resultElement); - } - else { + } else { return null; } } @@ -858,8 +831,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { Element resultElement = getChildElementByTagName(element, EVALUATION_RESULT_ELEMENT); if (resultElement != null) { return parseActionResultExposer(resultElement); - } - else { + } else { return null; } } @@ -881,8 +853,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { private ScopeType parseScope(Element element, ScopeType defaultValue) { if (element.hasAttribute(SCOPE_ATTRIBUTE) && !element.getAttribute(SCOPE_ATTRIBUTE).equals(DEFAULT_VALUE)) { return (ScopeType) fromStringTo(ScopeType.class).execute(element.getAttribute(SCOPE_ATTRIBUTE)); - } - else { + } else { return defaultValue; } } @@ -901,8 +872,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { String value = null; if (element.hasAttribute(VALUE_ATTRIBUTE)) { value = element.getAttribute(VALUE_ATTRIBUTE); - } - else { + } else { List valueElements = DomUtils.getChildElementsByTagName(element, VALUE_ELEMENT); Assert.state(valueElements.size() == 1, "A property value should be specified for property '" + name + "'"); value = DomUtils.getTextValue((Element) valueElements.get(0)); @@ -915,8 +885,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { Class targetClass = (Class) fromStringTo(Class.class).execute(element.getAttribute(TYPE_ATTRIBUTE)); // convert string value to instance of target class return fromStringTo(targetClass).execute(stringValue); - } - else { + } else { return stringValue; } } @@ -935,8 +904,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { if (StringUtils.hasText(element.getAttribute(ELSE_ATTRIBUTE))) { Transition elseTransition = parseElse(element); return new Transition[] { thenTransition, elseTransition }; - } - else { + } else { return new Transition[] { thenTransition }; } } @@ -963,8 +931,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { } if (StringUtils.hasText(mapperElement.getAttribute(BEAN_ATTRIBUTE))) { return getLocalFlowServiceLocator().getAttributeMapper(mapperElement.getAttribute(BEAN_ATTRIBUTE)); - } - else { + } else { return new ImmutableFlowAttributeMapper(parseInputMapper(mapperElement), parseOutputMapper(mapperElement)); } } @@ -973,12 +940,11 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { Element mapperElement = getChildElementByTagName(element, INPUT_MAPPER_ELEMENT); if (mapperElement != null) { DefaultAttributeMapper mapper = new DefaultAttributeMapper(); - parseSimpleAttributeMappings(mapper, - DomUtils.getChildElementsByTagName(mapperElement, INPUT_ATTRIBUTE_ELEMENT)); + parseSimpleAttributeMappings(mapper, DomUtils.getChildElementsByTagName(mapperElement, + INPUT_ATTRIBUTE_ELEMENT)); parseMappings(mapper, mapperElement); return mapper; - } - else { + } else { return null; } } @@ -987,12 +953,11 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { Element mapperElement = getChildElementByTagName(element, OUTPUT_MAPPER_ELEMENT); if (mapperElement != null) { DefaultAttributeMapper mapper = new DefaultAttributeMapper(); - parseSimpleAttributeMappings(mapper, - DomUtils.getChildElementsByTagName(mapperElement, OUTPUT_ATTRIBUTE_ELEMENT)); + parseSimpleAttributeMappings(mapper, DomUtils.getChildElementsByTagName(mapperElement, + OUTPUT_ATTRIBUTE_ELEMENT)); parseMappings(mapper, mapperElement); return mapper; - } - else { + } else { return null; } } @@ -1006,15 +971,13 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { SettableExpression target = null; if (StringUtils.hasText(mappingElement.getAttribute(TARGET_ATTRIBUTE))) { target = parser.parseSettableExpression(mappingElement.getAttribute(TARGET_ATTRIBUTE)); - } - else if (StringUtils.hasText(mappingElement.getAttribute(TARGET_COLLECTION_ATTRIBUTE))) { - target = new CollectionAddingExpression( - parser.parseSettableExpression(mappingElement.getAttribute(TARGET_COLLECTION_ATTRIBUTE))); + } else if (StringUtils.hasText(mappingElement.getAttribute(TARGET_COLLECTION_ATTRIBUTE))) { + target = new CollectionAddingExpression(parser.parseSettableExpression(mappingElement + .getAttribute(TARGET_COLLECTION_ATTRIBUTE))); } if (getRequired(mappingElement, false)) { mapper.addMapping(new RequiredMapping(source, target, parseTypeConverter(mappingElement))); - } - else { + } else { mapper.addMapping(new Mapping(source, target, parseTypeConverter(mappingElement))); } } @@ -1028,8 +991,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { SettableExpression expression = new AttributeExpression(attribute, parseScope(element, ScopeType.FLOW)); if (getRequired(element, false)) { mapper.addMapping(new RequiredMapping(expression, expression, null)); - } - else { + } else { mapper.addMapping(new Mapping(expression, expression, null)); } } @@ -1039,8 +1001,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { if (StringUtils.hasText(element.getAttribute(REQUIRED_ATTRIBUTE))) { return ((Boolean) fromStringTo(Boolean.class).execute(element.getAttribute(REQUIRED_ATTRIBUTE))) .booleanValue(); - } - else { + } else { return defaultValue; } } @@ -1054,12 +1015,10 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { Class sourceClass = (Class) fromStringTo(Class.class).execute(from); Class targetClass = (Class) fromStringTo(Class.class).execute(to); return service.getConversionExecutor(sourceClass, targetClass); - } - else { + } else { throw new IllegalArgumentException("Use of the 'from' attribute requires use of the 'to' attribute"); } - } - else { + } else { Assert.isTrue(!StringUtils.hasText(to), "Use of the 'to' attribute requires use of the 'from' attribute"); } return null; @@ -1068,8 +1027,8 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { private FlowExecutionExceptionHandler[] parseExceptionHandlers(Element element) { FlowExecutionExceptionHandler[] transitionExecutingHandlers = parseTransitionExecutingExceptionHandlers(element); FlowExecutionExceptionHandler[] customHandlers = parseCustomExceptionHandlers(element); - FlowExecutionExceptionHandler[] exceptionHandlers = - new FlowExecutionExceptionHandler[transitionExecutingHandlers.length + customHandlers.length]; + FlowExecutionExceptionHandler[] exceptionHandlers = new FlowExecutionExceptionHandler[transitionExecutingHandlers.length + + customHandlers.length]; System.arraycopy(transitionExecutingHandlers, 0, exceptionHandlers, 0, transitionExecutingHandlers.length); System.arraycopy(customHandlers, 0, exceptionHandlers, transitionExecutingHandlers.length, customHandlers.length); @@ -1083,8 +1042,7 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { if (globalTransitionsElement != null) { transitionElements = DomUtils.getChildElementsByTagName(globalTransitionsElement, TRANSITION_ELEMENT); } - } - else { + } else { transitionElements = DomUtils.getChildElementsByTagName(element, TRANSITION_ELEMENT); } List exceptionHandlers = new LinkedList(); @@ -1103,8 +1061,8 @@ public class XmlFlowBuilder extends BaseFlowBuilder implements ResourceHolder { private FlowExecutionExceptionHandler parseTransitionExecutingExceptionHandler(Element element) { TransitionExecutingStateExceptionHandler handler = new TransitionExecutingStateExceptionHandler(); Class exceptionClass = (Class) fromStringTo(Class.class).execute(element.getAttribute(ON_EXCEPTION_ATTRIBUTE)); - TargetStateResolver targetStateResolver = (TargetStateResolver) - fromStringTo(TargetStateResolver.class).execute(element.getAttribute(TO_ATTRIBUTE)); + TargetStateResolver targetStateResolver = (TargetStateResolver) fromStringTo(TargetStateResolver.class) + .execute(element.getAttribute(TO_ATTRIBUTE)); handler.add(exceptionClass, targetStateResolver); handler.getActionList().addAll(parseAnnotatedActions(element)); return handler; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowRegistrar.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowRegistrar.java index d4dbf264..ae2994f5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowRegistrar.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowRegistrar.java @@ -26,16 +26,13 @@ import org.springframework.webflow.engine.builder.FlowServiceLocator; import org.springframework.webflow.engine.builder.RefreshableFlowDefinitionHolder; /** - * A flow definition registrar that populates a flow definition registry with - * flow definitions defined in externalized XML resources. Typically used in - * conjunction with a {@link XmlFlowRegistryFactoryBean} but may also be used + * A flow definition registrar that populates a flow definition registry with flow definitions defined in externalized + * XML resources. Typically used in conjunction with a {@link XmlFlowRegistryFactoryBean} but may also be used * standalone in programmatic fashion. *

    - * By default, a flow definition registered by this registrar will be assigned a - * registry identifier equal to the filename of the underlying definition - * resource, minus the filename extension. For example, a XML-based flow - * definition defined in the file "flow1.xml" will be identified as "flow1" when - * registered in a registry. + * By default, a flow definition registered by this registrar will be assigned a registry identifier equal to the + * filename of the underlying definition resource, minus the filename extension. For example, a XML-based flow + * definition defined in the file "flow1.xml" will be identified as "flow1" when registered in a registry. *

    * Programmatic usage example: * @@ -71,16 +68,15 @@ public class XmlFlowRegistrar extends ExternalizedFlowDefinitionRegistrar { private DocumentLoader documentLoader; /** - * Creates a new XML flow registrar. Protected constructor - if used, make - * sure the required {@link #flowServiceLocator} reference is set. + * Creates a new XML flow registrar. Protected constructor - if used, make sure the required + * {@link #flowServiceLocator} reference is set. */ protected XmlFlowRegistrar() { } /** * Creates a new XML flow registrar. - * @param flowServiceLocator the locator needed to support flow definition - * assembly + * @param flowServiceLocator the locator needed to support flow definition assembly */ public XmlFlowRegistrar(FlowServiceLocator flowServiceLocator) { setFlowServiceLocator(flowServiceLocator); @@ -103,15 +99,14 @@ public class XmlFlowRegistrar extends ExternalizedFlowDefinitionRegistrar { } /** - * Sets the loader to load XML-based flow definition documents during flow - * definition assembly. Allows for customization over how documents are - * loaded. Optional. + * Sets the loader to load XML-based flow definition documents during flow definition assembly. Allows for + * customization over how documents are loaded. Optional. * @param documentLoader the document loader */ public void setDocumentLoader(DocumentLoader documentLoader) { this.documentLoader = documentLoader; } - + /** * Returns the loader of XML-based flow definition documents. */ @@ -128,12 +123,11 @@ public class XmlFlowRegistrar extends ExternalizedFlowDefinitionRegistrar { FlowAssembler assembler = new FlowAssembler(resource.getId(), resource.getAttributes(), builder); return new RefreshableFlowDefinitionHolder(assembler); } - + // hook methods /** - * Factory method that creates and fully initializes the XML-based flow - * definition builder. + * Factory method that creates and fully initializes the XML-based flow definition builder. * @param location the xml-based resource * @return the builder to build the flow definition from the resource. */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowRegistryFactoryBean.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowRegistryFactoryBean.java index 2ab1ce2f..2ea21fa7 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowRegistryFactoryBean.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/builder/xml/XmlFlowRegistryFactoryBean.java @@ -30,25 +30,21 @@ import org.springframework.webflow.engine.builder.DefaultFlowServiceLocator; import org.springframework.webflow.engine.builder.FlowServiceLocator; /** - * A factory bean that produces a populated flow registry using an - * {@link XmlFlowRegistrar}. This is the simplest implementation to use when - * using a Spring BeanFactory to deploy an explicit registry of XML-based Flow - * definitions for execution. + * A factory bean that produces a populated flow registry using an {@link XmlFlowRegistrar}. This is the simplest + * implementation to use when using a Spring BeanFactory to deploy an explicit registry of XML-based Flow definitions + * for execution. *

    - * By default, a configured flow definition will be assigned a registry - * identifier equal to the filename of the underlying definition resource, minus - * the filename extension. For example, an XML-based flow definition defined in - * the file flow1.xml will be identified as flow1 - * in the registry created by this factory bean. + * By default, a configured flow definition will be assigned a registry identifier equal to the filename of the + * underlying definition resource, minus the filename extension. For example, an XML-based flow definition defined in + * the file flow1.xml will be identified as flow1 in the registry created by this factory + * bean. *

    - * This class is also BeanFactoryAware and when used with Spring - * will automatically create a configured {@link DefaultFlowServiceLocator} for - * loading Flow artifacts like Actions from the Spring bean factory during the + * This class is also BeanFactoryAware and when used with Spring will automatically create a configured + * {@link DefaultFlowServiceLocator} for loading Flow artifacts like Actions from the Spring bean factory during the * Flow registration process. *

    - * This class is also ResourceLoaderAware; when an instance is - * created by a Spring BeanFactory the factory will automatically configure the - * XmlFlowRegistrar with a context-relative resource loader for accessing other + * This class is also ResourceLoaderAware; when an instance is created by a Spring BeanFactory the + * factory will automatically configure the XmlFlowRegistrar with a context-relative resource loader for accessing other * resources during Flow assembly. * * Usage example: @@ -67,17 +63,17 @@ public class XmlFlowRegistryFactoryBean extends AbstractFlowBuildingFlowRegistry * The flow registrar that will perform the definition registrations. */ private XmlFlowRegistrar flowRegistrar = new XmlFlowRegistrar(); - + /** * Temporary holder for flow definition locations. */ - private Resource[] locations; + private Resource[] locations; /** * Temporary holder for flow definitions configured using a property map. */ private Properties flowDefinitions; - + /** * A map that contains a map (java.util.Map) of flow attributes keyed by flow id (String). */ @@ -89,7 +85,7 @@ public class XmlFlowRegistryFactoryBean extends AbstractFlowBuildingFlowRegistry public XmlFlowRegistrar getXmlFlowRegistrar() { return flowRegistrar; } - + /** * Set the configured externalized XML flow registrar. * @since 1.0.1 @@ -100,12 +96,10 @@ public class XmlFlowRegistryFactoryBean extends AbstractFlowBuildingFlowRegistry } /** - * Sets the locations (resource file paths) pointing to XML-based flow - * definitions. + * Sets the locations (resource file paths) pointing to XML-based flow definitions. *

    - * When configuring as a Spring bean definition, ANT-style resource - * patterns/wildcards are also supported, taking advantage of Spring's built - * in ResourceArrayPropertyEditor machinery. + * When configuring as a Spring bean definition, ANT-style resource patterns/wildcards are also supported, taking + * advantage of Spring's built in ResourceArrayPropertyEditor machinery. *

    * For example: * @@ -123,8 +117,8 @@ public class XmlFlowRegistryFactoryBean extends AbstractFlowBuildingFlowRegistry * </bean> * * - * Flows registered from this set will be automatically assigned an id based - * on the filename of the matched XML resource. + * Flows registered from this set will be automatically assigned an id based on the filename of the matched XML + * resource. * @param locations the resource locations */ public void setFlowLocations(Resource[] locations) { @@ -132,17 +126,16 @@ public class XmlFlowRegistryFactoryBean extends AbstractFlowBuildingFlowRegistry } /** - * Convenience method for setting externalized flow definitions - * from a java.util.Properties map. Allows for more control - * over the definition, including which flowId is assigned. + * Convenience method for setting externalized flow definitions from a java.util.Properties map. + * Allows for more control over the definition, including which flowId is assigned. *

    - * Each property key is the flowId and each property value is - * the string encoded location of the externalized flow definition resource. + * Each property key is the flowId and each property value is the string encoded location of the + * externalized flow definition resource. *

    * Here is the exact format: * *

    -	 *      flowId=resource
    +	 * flowId = resource
     	 * 
    * * For example: @@ -157,21 +150,21 @@ public class XmlFlowRegistryFactoryBean extends AbstractFlowBuildingFlowRegistry * </property> * </bean> * - * @param flowDefinitions the flow definitions, defined within a properties - * map + * + * @param flowDefinitions the flow definitions, defined within a properties map */ public void setFlowDefinitions(Properties flowDefinitions) { this.flowDefinitions = flowDefinitions; } - + /** - * Sets flow attributes from an externalized java.util.Map. The keys in the - * map are String flow ids. The corresponding values should be java.util.Map - * maps containing flow attributes to be assigned to the flow. A flow with an id not - * contained in the provided map will get not externally defined flow attributes assigned. + * Sets flow attributes from an externalized java.util.Map. The keys in the map are String flow ids. + * The corresponding values should be java.util.Map maps containing flow attributes to be assigned to + * the flow. A flow with an id not contained in the provided map will get not externally defined flow attributes + * assigned. *

    - * Can be used in conjunction with both {@link #setFlowLocations(Resource[])} - * and {@link #setFlowDefinitions(Properties)}. + * Can be used in conjunction with both {@link #setFlowLocations(Resource[])} and + * {@link #setFlowDefinitions(Properties)}. * @param flowAttributes the flow attributes, keyed by flow id * @since 1.0.1 */ @@ -180,9 +173,8 @@ public class XmlFlowRegistryFactoryBean extends AbstractFlowBuildingFlowRegistry } /** - * Sets the loader to load XML-based flow definition documents during flow - * definition assembly. Allows for customization over how flow definition - * documents are loaded. Optional. + * Sets the loader to load XML-based flow definition documents during flow definition assembly. Allows for + * customization over how flow definition documents are loaded. Optional. * @param documentLoader the document loader */ public void setDocumentLoader(DocumentLoader documentLoader) { @@ -190,7 +182,7 @@ public class XmlFlowRegistryFactoryBean extends AbstractFlowBuildingFlowRegistry } protected void init(FlowServiceLocator flowServiceLocator) { - // simply wire in the locator to the registrar + // simply wire in the locator to the registrar getXmlFlowRegistrar().setFlowServiceLocator(flowServiceLocator); } @@ -199,10 +191,9 @@ public class XmlFlowRegistryFactoryBean extends AbstractFlowBuildingFlowRegistry addFlowDefinitionsFromProperties(); getXmlFlowRegistrar().registerFlowDefinitions(registry); } - + /** - * Add configured flow definition locations to the flow definition - * registrar. + * Add configured flow definition locations to the flow definition registrar. */ private void addFlowDefinitionLocations() { if (locations != null) { @@ -215,30 +206,29 @@ public class XmlFlowRegistryFactoryBean extends AbstractFlowBuildingFlowRegistry } /** - * Add flow definitions configured using a property map to - * the flow definition registrar. + * Add flow definitions configured using a property map to the flow definition registrar. */ private void addFlowDefinitionsFromProperties() { if (flowDefinitions != null) { Iterator it = flowDefinitions.entrySet().iterator(); while (it.hasNext()) { - Map.Entry entry = (Map.Entry)it.next(); - String flowId = (String)entry.getKey(); - String location = (String)entry.getValue(); + Map.Entry entry = (Map.Entry) it.next(); + String flowId = (String) entry.getKey(); + String location = (String) entry.getValue(); Resource resource = getFlowServiceLocator().getResourceLoader().getResource(location); getXmlFlowRegistrar().addResource( new FlowDefinitionResource(flowId, resource, getFlowAttributes(flowId))); } } } - + /** - * Returns the flow attributes to be assigned to the flow with given id. Returns - * null if no attributes should be assigned. + * Returns the flow attributes to be assigned to the flow with given id. Returns null if no attributes should be + * assigned. */ private AttributeMap getFlowAttributes(String flowId) { if (flowAttributes != null) { - Map attributes = (Map)flowAttributes.get(flowId); + Map attributes = (Map) flowAttributes.get(flowId); if (attributes != null) { return new LocalAttributeMap(attributes); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java index d2a4cba5..71430fc5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImpl.java @@ -45,22 +45,18 @@ import org.springframework.webflow.execution.FlowSessionStatus; import org.springframework.webflow.execution.ViewSelection; /** - * Default implementation of FlowExecution that uses a stack-based data - * structure to manage spawned flow sessions. This class is closely coupled with - * package-private FlowSessionImpl and - * RequestControlContextImpl. The three classes work together to - * form a complete flow execution implementation based on a finite state - * machine. + * Default implementation of FlowExecution that uses a stack-based data structure to manage spawned flow sessions. This + * class is closely coupled with package-private FlowSessionImpl and + * RequestControlContextImpl. The three classes work together to form a complete flow execution + * implementation based on a finite state machine. *

    - * This implementation of FlowExecution is serializable so it can be safely - * stored in an HTTP session or other persistent store such as a file, database, - * or client-side form field. Once deserialized, the - * {@link FlowExecutionImplStateRestorer} strategy is expected to be used to - * restore the execution to a usable state. - * + * This implementation of FlowExecution is serializable so it can be safely stored in an HTTP session or other + * persistent store such as a file, database, or client-side form field. Once deserialized, the + * {@link FlowExecutionImplStateRestorer} strategy is expected to be used to restore the execution to a usable state. + * * @see FlowExecutionImplFactory * @see FlowExecutionImplStateRestorer - * + * * @author Keith Donald * @author Erwin Vervaet * @author Ben Hale @@ -70,23 +66,20 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { private static final Log logger = LogFactory.getLog(FlowExecutionImpl.class); /** - * The execution's root flow; the top level flow that acts as the starting - * point for this flow execution. + * The execution's root flow; the top level flow that acts as the starting point for this flow execution. *

    * Transient to support restoration by the {@link FlowExecutionImplStateRestorer}. */ private transient Flow flow; /** - * The stack of active, currently executing flow sessions. As subflows are - * spawned, they are pushed onto the stack. As they end, they are popped off - * the stack. + * The stack of active, currently executing flow sessions. As subflows are spawned, they are pushed onto the stack. + * As they end, they are popped off the stack. */ private LinkedList flowSessions; /** - * A thread-safe listener list, holding listeners monitoring the lifecycle - * of this flow execution. + * A thread-safe listener list, holding listeners monitoring the lifecycle of this flow execution. *

    * Transient to support restoration by the {@link FlowExecutionImplStateRestorer}. */ @@ -107,21 +100,18 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { private transient AttributeMap attributes; /** - * Set so the transient {@link #flow} field can be restored by the - * {@link FlowExecutionImplStateRestorer}. + * Set so the transient {@link #flow} field can be restored by the {@link FlowExecutionImplStateRestorer}. */ private String flowId; /** - * Default constructor required for externalizable serialization. Should NOT - * be called programmatically. + * Default constructor required for externalizable serialization. Should NOT be called programmatically. */ public FlowExecutionImpl() { } /** - * Create a new flow execution executing the provided flow. This constructor - * is mainly used for testing. + * Create a new flow execution executing the provided flow. This constructor is mainly used for testing. * @param flow the root flow of this flow execution */ public FlowExecutionImpl(Flow flow) { @@ -131,8 +121,7 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { /** * Create a new flow execution executing the provided flow. * @param flow the root flow of this flow execution - * @param listeners the listeners interested in flow execution lifecycle - * events + * @param listeners the listeners interested in flow execution lifecycle events * @param attributes flow execution system attributes */ public FlowExecutionImpl(Flow flow, FlowExecutionListener[] listeners, AttributeMap attributes) { @@ -176,8 +165,7 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { public ViewSelection start(MutableAttributeMap input, ExternalContext externalContext) throws FlowExecutionException { - Assert.state(!isActive(), - "This flow is already executing -- you cannot call 'start()' more than once"); + Assert.state(!isActive(), "This flow is already executing -- you cannot call 'start()' more than once"); if (logger.isDebugEnabled()) { logger.debug("Starting execution with input '" + input + "'"); } @@ -188,15 +176,12 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { // launch a flow session for the root flow ViewSelection selectedView = context.start(flow, input); return pause(context, selectedView); - } - catch (FlowExecutionException e) { + } catch (FlowExecutionException e) { return pause(context, handleException(e, context)); - } - catch (Exception e) { + } catch (Exception e) { return pause(context, handleException(wrapException(e), context)); } - } - finally { + } finally { getListeners().fireRequestProcessed(context); } } @@ -212,19 +197,16 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { try { try { resume(context); - Event event = - new Event(externalContext, eventId, externalContext.getRequestParameterMap().asAttributeMap()); + Event event = new Event(externalContext, eventId, externalContext.getRequestParameterMap() + .asAttributeMap()); ViewSelection selectedView = context.signalEvent(event); return pause(context, selectedView); - } - catch (FlowExecutionException e) { + } catch (FlowExecutionException e) { return pause(context, handleException(e, context)); - } - catch (Exception e) { + } catch (Exception e) { return pause(context, handleException(wrapException(e), context)); } - } - finally { + } finally { getListeners().fireRequestProcessed(context); } } @@ -244,17 +226,14 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { throw new IllegalStateException("Current state is not a view state - cannot refresh; " + "perhaps an unhandled exception occured in another state?"); } - ViewSelection selectedView = ((ViewState)currentState).refresh(context); + ViewSelection selectedView = ((ViewState) currentState).refresh(context); return pause(context, selectedView); - } - catch (FlowExecutionException e) { + } catch (FlowExecutionException e) { return pause(context, handleException(e, context)); - } - catch (Exception e) { + } catch (Exception e) { return pause(context, handleException(wrapException(e), context)); } - } - finally { + } finally { getListeners().fireRequestProcessed(context); } } @@ -292,8 +271,7 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { if (logger.isDebugEnabled()) { if (selectedView != null) { logger.debug("Paused to render " + selectedView + " and wait for user input"); - } - else { + } else { logger.debug("Paused to wait for user input"); } } @@ -301,14 +279,12 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { } /** - * Handles an exception that occured performing an operation on this flow - * execution. First trys the set of exception handlers associated with the - * offending state, then the handlers at the flow level. + * Handles an exception that occured performing an operation on this flow execution. First trys the set of exception + * handlers associated with the offending state, then the handlers at the flow level. * @param exception the exception that occured * @param context the request control context the exception occured in * @return the selected error view, never null - * @throws FlowExecutionException rethrows the exception if it was not handled - * at the state or flow level + * @throws FlowExecutionException rethrows the exception if it was not handled at the state or flow level */ protected ViewSelection handleException(FlowExecutionException exception, RequestControlContext context) throws FlowExecutionException { @@ -332,12 +308,10 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { } return selectedView; } - } - catch (FlowExecutionException newException) { + } catch (FlowExecutionException newException) { // exception handling resulted in a new FlowExecutionException, try to handle it return handleException(newException, context); - } - catch (Exception e) { + } catch (Exception e) { // a lower-level exception occured, wrap it in a flow execution exception and try to handle it return handleException(wrapException(e), context); } @@ -348,21 +322,20 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { } /** - * Try to handle given exception using execution exception handlers registered - * at the state level. Returns null if no handler handled the exception. + * Try to handle given exception using execution exception handlers registered at the state level. Returns null if + * no handler handled the exception. */ private ViewSelection tryStateHandlers(FlowExecutionException exception, RequestControlContext context) { if (isActive() && exception.getStateId() != null) { return getActiveFlow().getStateInstance(exception.getStateId()).handleException(exception, context); - } - else { + } else { return null; } } /** - * Try to handle given exception using execution exception handlers registered - * at the flow level. Returns null if no handler handled the exception. + * Try to handle given exception using execution exception handlers registered at the flow level. Returns null if no + * handler handled the exception. */ private ViewSelection tryFlowHandlers(FlowExecutionException exception, RequestControlContext context) { return getCurrentFlow().handleException(exception, context); @@ -384,7 +357,7 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { */ FlowSessionImpl getActiveSessionInternal() throws IllegalStateException { assertActive(); - return (FlowSessionImpl)flowSessions.getLast(); + return (FlowSessionImpl) flowSessions.getLast(); } /** @@ -396,8 +369,8 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { } /** - * Activate a new FlowSession for the flow definition. - * Creates the new flow session and pushes it onto the stack. + * Activate a new FlowSession for the flow definition. Creates the new flow session and pushes it + * onto the stack. * @param flow the flow definition * @return the new flow session */ @@ -407,8 +380,7 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { FlowSessionImpl parent = getActiveSessionInternal(); parent.setStatus(FlowSessionStatus.SUSPENDED); session = createFlowSession(flow, parent); - } - else { + } else { session = createFlowSession(flow, null); } flowSessions.add(session); @@ -420,11 +392,9 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { } /** - * Create a new flow session object. Subclasses can override this to return - * a special implementation if required. + * Create a new flow session object. Subclasses can override this to return a special implementation if required. * @param flow the flow that should be associated with the flow session - * @param parent the flow session that should be the parent of the newly - * created flow session (may be null) + * @param parent the flow session that should be the parent of the newly created flow session (may be null) * @return the newly created flow session */ FlowSessionImpl createFlowSession(Flow flow, FlowSessionImpl parent) { @@ -436,7 +406,7 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { * @return the ended session */ public FlowSession endActiveFlowSession() { - FlowSessionImpl endingSession = (FlowSessionImpl)flowSessions.removeLast(); + FlowSessionImpl endingSession = (FlowSessionImpl) flowSessions.removeLast(); endingSession.setStatus(FlowSessionStatus.ENDED); if (!flowSessions.isEmpty()) { if (logger.isDebugEnabled()) { @@ -444,8 +414,7 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { + getActiveSessionInternal().getState().getId() + "'"); } getActiveSessionInternal().setStatus(FlowSessionStatus.ACTIVE); - } - else { + } else { if (logger.isDebugEnabled()) { logger.debug("[Ended] - this execution is now inactive"); } @@ -454,8 +423,7 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { } /** - * Make sure that this flow execution is active and throw an exception if it's - * not. + * Make sure that this flow execution is active and throw an exception if it's not. */ private void assertActive() throws IllegalStateException { if (!isActive()) { @@ -465,15 +433,16 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { } /** - * Returns the "current flow": which is the active flow if this execution is active, else the top-level flow definition. + * Returns the "current flow": which is the active flow if this execution is active, else the top-level flow + * definition. */ private Flow getCurrentFlow() { return isActive() ? getActiveFlow() : this.flow; } /** - * Returns the id of the "current" state: a valid state identifier if the flow is active and in a state; null if the flow - * is not active or has not yet entered a state. + * Returns the id of the "current" state: a valid state identifier if the flow is active and in a state; null if the + * flow is not active or has not yet entered a state. */ private String getCurrentStateId() { if (isActive()) { @@ -489,14 +458,14 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { * Returns the currently active flow. */ private Flow getActiveFlow() throws IllegalStateException { - return (Flow)getActiveSessionInternal().getDefinition(); + return (Flow) getActiveSessionInternal().getDefinition(); } /** * Returns the current state of this flow execution. */ private State getCurrentState() throws IllegalStateException { - return (State)getActiveSessionInternal().getState(); + return (State) getActiveSessionInternal().getState(); } /** @@ -505,16 +474,16 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { private FlowExecutionException wrapException(Exception e) { String flowId = getCurrentFlow().getId(); String stateId = getCurrentStateId(); - return new FlowExecutionException(flowId, stateId, - "Exception thrown in state '" + stateId + "' of flow '" + flowId + "'", e); + return new FlowExecutionException(flowId, stateId, "Exception thrown in state '" + stateId + "' of flow '" + + flowId + "'", e); } // custom serialization (implementation of Externalizable for optimized // storage) public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - flowId = (String)in.readObject(); - flowSessions = (LinkedList)in.readObject(); + flowId = (String) in.readObject(); + flowSessions = (LinkedList) in.readObject(); } public void writeExternal(ObjectOutput out) throws IOException { @@ -525,13 +494,11 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { public String toString() { if (!isActive()) { return "[Inactive " + getCaption() + "]"; - } - else { + } else { if (flow != null) { return new ToStringCreator(this).append("flow", flow.getId()).append("flowSessions", flowSessions) .toString(); - } - else { + } else { return "[Unhydrated " + getCaption() + "]"; } } @@ -605,12 +572,11 @@ public class FlowExecutionImpl implements FlowExecution, Externalizable { * Returns the flow session for the root flow of this flow execution. */ FlowSessionImpl getRootSession() { - return (FlowSessionImpl)flowSessions.getFirst(); + return (FlowSessionImpl) flowSessions.getFirst(); } /** - * Returns an iterator looping over the subflow sessions - * in this flow execution. + * Returns an iterator looping over the subflow sessions in this flow execution. */ ListIterator getSubflowSessionIterator() { return flowSessions.listIterator(1); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactory.java index 3dd51211..7b19926d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplFactory.java @@ -32,30 +32,28 @@ import org.springframework.webflow.execution.factory.FlowExecutionListenerLoader import org.springframework.webflow.execution.factory.StaticFlowExecutionListenerLoader; /** - * A factory for instances of the - * {@link FlowExecutionImpl default flow execution} implementation. + * A factory for instances of the {@link FlowExecutionImpl default flow execution} implementation. * * @author Keith Donald */ public class FlowExecutionImplFactory implements FlowExecutionFactory { - + private static final Log logger = LogFactory.getLog(FlowExecutionImplFactory.class); /** - * The strategy for loading listeners that should observe executions of a - * flow definition. The default simply loads an empty static listener list. + * The strategy for loading listeners that should observe executions of a flow definition. The default simply loads + * an empty static listener list. */ private FlowExecutionListenerLoader executionListenerLoader = StaticFlowExecutionListenerLoader.EMPTY_INSTANCE; /** - * System execution attributes that may influence flow execution behavior. - * The default is an empty map. + * System execution attributes that may influence flow execution behavior. The default is an empty map. */ private AttributeMap executionAttributes = CollectionUtils.EMPTY_ATTRIBUTE_MAP; - + /** - * Returns the attributes to apply to flow executions created by this factory. - * Execution attributes may affect flow execution behavior. + * Returns the attributes to apply to flow executions created by this factory. Execution attributes may affect flow + * execution behavior. * @return flow execution attributes */ public AttributeMap getExecutionAttributes() { @@ -63,41 +61,38 @@ public class FlowExecutionImplFactory implements FlowExecutionFactory { } /** - * Sets the attributes to apply to flow executions created by this factory. - * Execution attributes may affect flow execution behavior. + * Sets the attributes to apply to flow executions created by this factory. Execution attributes may affect flow + * execution behavior. * @param executionAttributes flow execution system attributes */ public void setExecutionAttributes(AttributeMap executionAttributes) { Assert.notNull(executionAttributes, "The execution attributes map is required"); this.executionAttributes = executionAttributes; } - + /** - * Sets the attributes to apply to flow executions created by this factory. - * Execution attributes may affect flow execution behavior. + * Sets the attributes to apply to flow executions created by this factory. Execution attributes may affect flow + * execution behavior. *

    - * Convenience setter that takes a simple java.util.Map to ease - * bean style configuration. + * Convenience setter that takes a simple java.util.Map to ease bean style configuration. * @param executionAttributes flow execution system attributes */ public void setExecutionAttributesMap(Map executionAttributes) { Assert.notNull(executionAttributes, "The execution attributes map is required"); this.executionAttributes = new LocalAttributeMap(executionAttributes); } - + /** - * Returns the strategy for loading listeners that should observe executions of - * a flow definition. Allows full control over what listeners should apply - * for executions of a flow definition. + * Returns the strategy for loading listeners that should observe executions of a flow definition. Allows full + * control over what listeners should apply for executions of a flow definition. */ public FlowExecutionListenerLoader getExecutionListenerLoader() { return executionListenerLoader; } /** - * Sets the strategy for loading listeners that should observe executions of - * a flow definition. Allows full control over what listeners should apply - * for executions of a flow definition. + * Sets the strategy for loading listeners that should observe executions of a flow definition. Allows full control + * over what listeners should apply for executions of a flow definition. */ public void setExecutionListenerLoader(FlowExecutionListenerLoader listenerLoader) { Assert.notNull(listenerLoader, "The listener loader is required"); @@ -110,6 +105,6 @@ public class FlowExecutionImplFactory implements FlowExecutionFactory { logger.debug("Creating flow execution for flow definition with id '" + flowDefinition.getId() + "'"); } FlowExecutionListener[] listeners = executionListenerLoader.getListeners(flowDefinition); - return new FlowExecutionImpl((Flow)flowDefinition, listeners, executionAttributes); + return new FlowExecutionImpl((Flow) flowDefinition, listeners, executionAttributes); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplStateRestorer.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplStateRestorer.java index a746b405..0cc16656 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplStateRestorer.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionImplStateRestorer.java @@ -31,8 +31,7 @@ import org.springframework.webflow.execution.factory.StaticFlowExecutionListener import org.springframework.webflow.execution.repository.support.FlowExecutionStateRestorer; /** - * Restores the transient state of deserialized {@link FlowExecutionImpl} - * objects. + * Restores the transient state of deserialized {@link FlowExecutionImpl} objects. * * @author Keith Donald */ @@ -63,8 +62,8 @@ public class FlowExecutionImplStateRestorer implements FlowExecutionStateRestore } /** - * Sets the attributes to apply to restored flow executions. - * Execution attributes may affect flow execution behavior. + * Sets the attributes to apply to restored flow executions. Execution attributes may affect flow execution + * behavior. * @param executionAttributes flow execution system attributes */ public void setExecutionAttributes(AttributeMap executionAttributes) { @@ -73,22 +72,20 @@ public class FlowExecutionImplStateRestorer implements FlowExecutionStateRestore } /** - * Sets the attributes to apply to restored flow executions. - * Execution attributes may affect flow execution behavior. + * Sets the attributes to apply to restored flow executions. Execution attributes may affect flow execution + * behavior. *

    - * Convenience setter that takes a simple java.util.Map to ease - * bean style configuration. + * Convenience setter that takes a simple java.util.Map to ease bean style configuration. * @param executionAttributes flow execution system attributes */ public void setExecutionAttributesMap(Map executionAttributes) { Assert.notNull(executionAttributes, "The execution attributes map is required"); this.executionAttributes = new LocalAttributeMap(executionAttributes); } - + /** - * Sets the strategy for loading listeners that should observe executions of - * a flow definition. Allows full control over what listeners should apply. - * for executions of a flow definition. + * Sets the strategy for loading listeners that should observe executions of a flow definition. Allows full control + * over what listeners should apply. for executions of a flow definition. */ public void setExecutionListenerLoader(FlowExecutionListenerLoader executionListenerLoader) { Assert.notNull(executionListenerLoader, "The listener loader is required"); @@ -96,9 +93,9 @@ public class FlowExecutionImplStateRestorer implements FlowExecutionStateRestore } public FlowExecution restoreState(FlowExecution flowExecution, MutableAttributeMap conversationScope) { - FlowExecutionImpl impl = (FlowExecutionImpl)flowExecution; + FlowExecutionImpl impl = (FlowExecutionImpl) flowExecution; // the root flow should be a top-level flow visible by the flow def locator - Flow flow = (Flow)definitionLocator.getFlowDefinition(impl.getFlowId()); + Flow flow = (Flow) definitionLocator.getFlowDefinition(impl.getFlowId()); impl.setFlow(flow); if (impl.hasSessions()) { FlowSessionImpl root = impl.getRootSession(); @@ -107,14 +104,14 @@ public class FlowExecutionImplStateRestorer implements FlowExecutionStateRestore if (impl.hasSubflowSessions()) { Flow parent = flow; for (ListIterator it = impl.getSubflowSessionIterator(); it.hasNext();) { - FlowSessionImpl subflow = (FlowSessionImpl)it.next(); + FlowSessionImpl subflow = (FlowSessionImpl) it.next(); Flow definition; if (parent.containsInlineFlow(subflow.getFlowId())) { // subflow is an inline flow of it's parent definition = parent.getInlineFlow(subflow.getFlowId()); } else { // subflow is a top-level flow - definition = (Flow)definitionLocator.getFlowDefinition(subflow.getFlowId()); + definition = (Flow) definitionLocator.getFlowDefinition(subflow.getFlowId()); } subflow.setFlow(definition); subflow.setState(definition.getStateInstance(subflow.getStateId())); @@ -129,5 +126,5 @@ public class FlowExecutionImplStateRestorer implements FlowExecutionStateRestore impl.setListeners(new FlowExecutionListeners(executionListenerLoader.getListeners(flow))); impl.setAttributes(executionAttributes); return flowExecution; - } + } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionListeners.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionListeners.java index 40169e4c..966fde36 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionListeners.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowExecutionListeners.java @@ -27,8 +27,7 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * A helper that aids in publishing events to an array of - * FlowExecutionListener objects. + * A helper that aids in publishing events to an array of FlowExecutionListener objects. * * @see org.springframework.webflow.execution.FlowExecutionListener * @@ -38,29 +37,25 @@ import org.springframework.webflow.execution.ViewSelection; class FlowExecutionListeners { /** - * The list of listeners that should receive event callbacks during managed - * flow executions. + * The list of listeners that should receive event callbacks during managed flow executions. */ private FlowExecutionListener[] listeners; /** - * Create a flow execution listener helper that wraps an empty listener - * array. + * Create a flow execution listener helper that wraps an empty listener array. */ public FlowExecutionListeners() { this(null); } /** - * Create a flow execution listener helper that wraps the specified listener - * array. + * Create a flow execution listener helper that wraps the specified listener array. * @param listeners the listener array */ public FlowExecutionListeners(FlowExecutionListener[] listeners) { if (listeners != null) { this.listeners = listeners; - } - else { + } else { this.listeners = new FlowExecutionListener[0]; } } @@ -83,8 +78,7 @@ class FlowExecutionListeners { // methods to fire events to all listeners /** - * Notify all interested listeners that a request was submitted to the flow - * execution. + * Notify all interested listeners that a request was submitted to the flow execution. */ public void fireRequestSubmitted(RequestContext context) { for (int i = 0; i < listeners.length; i++) { @@ -93,8 +87,7 @@ class FlowExecutionListeners { } /** - * Notify all interested listeners that the flow execution finished - * processing a request. + * Notify all interested listeners that the flow execution finished processing a request. */ public void fireRequestProcessed(RequestContext context) { for (int i = 0; i < listeners.length; i++) { @@ -103,8 +96,7 @@ class FlowExecutionListeners { } /** - * Notify all interested listeners that a flow execution session is starting - * (about to be created). + * Notify all interested listeners that a flow execution session is starting (about to be created). */ public void fireSessionStarting(RequestContext context, FlowDefinition flow, MutableAttributeMap input) { for (int i = 0; i < listeners.length; i++) { @@ -113,8 +105,8 @@ class FlowExecutionListeners { } /** - * Notify all interested listeners that a flow execution session has been - * activated (created, on the stack and about to start). + * Notify all interested listeners that a flow execution session has been activated (created, on the stack and about + * to start). */ public void fireSessionCreated(RequestContext context, FlowSession session) { for (int i = 0; i < listeners.length; i++) { @@ -123,8 +115,7 @@ class FlowExecutionListeners { } /** - * Notify all interested listeners that a flow execution session has - * started (has entered its start state). + * Notify all interested listeners that a flow execution session has started (has entered its start state). */ public void fireSessionStarted(RequestContext context, FlowSession session) { for (int i = 0; i < listeners.length; i++) { @@ -133,8 +124,7 @@ class FlowExecutionListeners { } /** - * Notify all interested listeners that an event was signaled in the flow - * execution. + * Notify all interested listeners that an event was signaled in the flow execution. */ public void fireEventSignaled(RequestContext context, Event event) { for (int i = 0; i < listeners.length; i++) { @@ -143,8 +133,7 @@ class FlowExecutionListeners { } /** - * Notify all interested listeners that a state is being entered in the flow - * execution. + * Notify all interested listeners that a state is being entered in the flow execution. */ public void fireStateEntering(RequestContext context, StateDefinition nextState) { for (int i = 0; i < listeners.length; i++) { @@ -153,8 +142,7 @@ class FlowExecutionListeners { } /** - * Notify all interested listeners that a state was entered in the flow - * execution. + * Notify all interested listeners that a state was entered in the flow execution. */ public void fireStateEntered(RequestContext context, StateDefinition previousState) { for (int i = 0; i < listeners.length; i++) { @@ -163,8 +151,7 @@ class FlowExecutionListeners { } /** - * Notify all interested listeners that a flow session was paused in the - * flow execution. + * Notify all interested listeners that a flow session was paused in the flow execution. */ public void firePaused(RequestContext context, ViewSelection selectedView) { for (int i = 0; i < listeners.length; i++) { @@ -182,8 +169,7 @@ class FlowExecutionListeners { } /** - * Notify all interested listeners that the active flow execution session is - * ending. + * Notify all interested listeners that the active flow execution session is ending. */ public void fireSessionEnding(RequestContext context, FlowSession session, MutableAttributeMap output) { for (int i = 0; i < listeners.length; i++) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowSessionImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowSessionImpl.java index e6607840..debe639f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowSessionImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/FlowSessionImpl.java @@ -32,11 +32,9 @@ import org.springframework.webflow.execution.FlowSession; import org.springframework.webflow.execution.FlowSessionStatus; /** - * Implementation of the FlowSession interfaced used internally by the - * FlowExecutionImpl. This class is closely coupled with - * FlowExecutionImpl and RequestControlContextImpl. - * The three classes work together to form a complete flow execution - * implementation. + * Implementation of the FlowSession interfaced used internally by the FlowExecutionImpl. This class is + * closely coupled with FlowExecutionImpl and RequestControlContextImpl. The three + * classes work together to form a complete flow execution implementation. * * @author Keith Donald * @author Erwin Vervaet @@ -47,34 +45,29 @@ class FlowSessionImpl implements FlowSession, Externalizable { /** * The flow definition (a singleton). *

    - * Transient to support restoration by the - * {@link FlowExecutionImplStateRestorer}. + * Transient to support restoration by the {@link FlowExecutionImplStateRestorer}. */ private transient Flow flow; /** - * Set so the transient {@link #flow} field can be restored by the - * {@link FlowExecutionImplStateRestorer}. + * Set so the transient {@link #flow} field can be restored by the {@link FlowExecutionImplStateRestorer}. */ private String flowId; /** * The current state of this flow session. *

    - * Transient to support restoration by the - * {@link FlowExecutionImplStateRestorer}. + * Transient to support restoration by the {@link FlowExecutionImplStateRestorer}. */ private transient State state; /** - * Set so the transient {@link #state} field can be restored by the - * {@link FlowExecutionImplStateRestorer}. + * Set so the transient {@link #state} field can be restored by the {@link FlowExecutionImplStateRestorer}. */ private String stateId; /** - * The session status; may be CREATED, STARTING, ACTIVE, PAUSED, SUSPENDED, - * or ENDED. + * The session status; may be CREATED, STARTING, ACTIVE, PAUSED, SUSPENDED, or ENDED. */ private FlowSessionStatus status = FlowSessionStatus.CREATED; @@ -89,14 +82,12 @@ class FlowSessionImpl implements FlowSession, Externalizable { private MutableAttributeMap flashMap = new LocalAttributeMap(); /** - * The parent session of this session (may be null if this is - * a root session.) + * The parent session of this session (may be null if this is a root session.) */ private FlowSessionImpl parent; /** - * Default constructor required for externalizable serialization. Should NOT - * be called programmatically. + * Default constructor required for externalizable serialization. Should NOT be called programmatically. */ public FlowSessionImpl() { } @@ -144,12 +135,12 @@ class FlowSessionImpl implements FlowSession, Externalizable { // custom serialization public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - flowId = (String)in.readObject(); - stateId = (String)in.readObject(); - status = (FlowSessionStatus)in.readObject(); - scope = (MutableAttributeMap)in.readObject(); - flashMap = (MutableAttributeMap)in.readObject(); - parent = (FlowSessionImpl)in.readObject(); + flowId = (String) in.readObject(); + stateId = (String) in.readObject(); + status = (FlowSessionStatus) in.readObject(); + scope = (MutableAttributeMap) in.readObject(); + flashMap = (MutableAttributeMap) in.readObject(); + parent = (FlowSessionImpl) in.readObject(); } public void writeExternal(ObjectOutput out) throws IOException { @@ -211,7 +202,7 @@ class FlowSessionImpl implements FlowSession, Externalizable { String getStateId() { return stateId; } - + public String toString() { return new ToStringCreator(this).append("flow", flowId).append("state", stateId).append("scope", scope).append( "flashMap", flashMap).append("status", status).toString(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java index f6725f46..d3b39003 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/impl/RequestControlContextImpl.java @@ -40,11 +40,9 @@ import org.springframework.webflow.execution.FlowSessionStatus; import org.springframework.webflow.execution.ViewSelection; /** - * Default request control context implementation used internally by the web - * flow system. This class is closely coupled with - * FlowExecutionImpl and FlowSessionImpl. The - * three classes work together to form a complete flow execution implementation - * based on a finite state machine. + * Default request control context implementation used internally by the web flow system. This class is closely coupled + * with FlowExecutionImpl and FlowSessionImpl. The three classes work together to form a + * complete flow execution implementation based on a finite state machine. * * @see FlowExecutionImpl * @see FlowSessionImpl @@ -89,8 +87,7 @@ class RequestControlContextImpl implements RequestControlContext { /** * Create a new request context. * @param flowExecution the owning flow execution - * @param externalContext the external context that originated the flow - * execution request + * @param externalContext the external context that originated the flow execution request */ public RequestControlContextImpl(FlowExecutionImpl flowExecution, ExternalContext externalContext) { Assert.notNull(flowExecution, "The owning flow execution is required"); @@ -151,8 +148,7 @@ class RequestControlContextImpl implements RequestControlContext { public void setAttributes(AttributeMap attributes) { if (attributes == null) { this.attributes = CollectionUtils.EMPTY_ATTRIBUTE_MAP; - } - else { + } else { this.attributes = attributes; } } @@ -228,8 +224,7 @@ class RequestControlContextImpl implements RequestControlContext { // internal helpers /** - * Returns the execution listerns for the flow execution of this request - * context. + * Returns the execution listerns for the flow execution of this request context. */ protected FlowExecutionListeners getExecutionListeners() { return flowExecution.getListeners(); @@ -239,19 +234,18 @@ class RequestControlContextImpl implements RequestControlContext { * Returns the active flow in the flow execution of this request context. */ protected Flow getActiveFlowInternal() { - return (Flow)getActiveSession().getDefinition(); + return (Flow) getActiveSession().getDefinition(); } /** * Returns the current state in the flow execution of this request context. */ protected State getCurrentStateInternal() { - return (State)getActiveSession().getState(); + return (State) getActiveSession().getState(); } /** - * Returns the active flow session in the flow execution of this request - * context. + * Returns the active flow session in the flow execution of this request context. */ protected FlowSessionImpl getActiveSession() { return flowExecution.getActiveSessionInternal(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/AbstractFlowAttributeMapper.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/AbstractFlowAttributeMapper.java index 197c9e69..926f41b0 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/AbstractFlowAttributeMapper.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/AbstractFlowAttributeMapper.java @@ -26,26 +26,25 @@ import org.springframework.webflow.engine.FlowAttributeMapper; import org.springframework.webflow.execution.RequestContext; /** - * Convenient base class for attribute mapper implementations. Encapsulates - * common attribute mapper workflow. Contains no state. Subclasses must override - * the {@link #getInputMapper()} and {@link #getOutputMapper()} methods to - * return the input mapper and output mapper, respectively. + * Convenient base class for attribute mapper implementations. Encapsulates common attribute mapper workflow. Contains + * no state. Subclasses must override the {@link #getInputMapper()} and {@link #getOutputMapper()} methods to return the + * input mapper and output mapper, respectively. * * @author Keith Donald */ public abstract class AbstractFlowAttributeMapper implements FlowAttributeMapper, Serializable { /** - * Returns the input mapper to use to map attributes of a parent flow - * {@link RequestContext} to a subflow input attribute {@link AttributeMap map}. + * Returns the input mapper to use to map attributes of a parent flow {@link RequestContext} to a subflow input + * attribute {@link AttributeMap map}. * @return the input mapper, or null if none * @see #createFlowInput(RequestContext) */ protected abstract AttributeMapper getInputMapper(); /** - * Returns the output mapper to use to map attributes from a subflow output - * attribute map to the {@link RequestContext}. + * Returns the output mapper to use to map attributes from a subflow output attribute map to the + * {@link RequestContext}. * @return the output mapper, or null if none * @see #mapFlowOutput(AttributeMap, RequestContext) */ @@ -57,8 +56,7 @@ public abstract class AbstractFlowAttributeMapper implements FlowAttributeMapper // map from request context to input map getInputMapper().map(context, input, getMappingContext(context)); return input; - } - else { + } else { // an empty, but modifiable map return new LocalAttributeMap(); } @@ -72,8 +70,7 @@ public abstract class AbstractFlowAttributeMapper implements FlowAttributeMapper } /** - * Returns a map of contextual data available during mapping. - * This implementation just returns null. + * Returns a map of contextual data available during mapping. This implementation just returns null. */ protected MappingContext getMappingContext(RequestContext context) { return null; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ActionTransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ActionTransitionCriteria.java index 24edf8db..e4100edb 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ActionTransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ActionTransitionCriteria.java @@ -23,9 +23,8 @@ import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; /** - * A transition criteria that will execute an action when tested and return - * true if the action's result is equal to the 'trueEventId', - * false otherwise. + * A transition criteria that will execute an action when tested and return true if the action's result + * is equal to the 'trueEventId', false otherwise. *

    * This effectively adapts an Action to a TransitionCriteria. * @@ -38,14 +37,12 @@ import org.springframework.webflow.execution.RequestContext; public class ActionTransitionCriteria implements TransitionCriteria { /** - * The result event id that should map to a true - * return value. + * The result event id that should map to a true return value. */ private String trueEventId = "success"; /** - * The action to execute when the criteria is tested, annotated with - * usage attributes. + * The action to execute when the criteria is tested, annotated with usage attributes. */ private Action action; @@ -58,17 +55,16 @@ public class ActionTransitionCriteria implements TransitionCriteria { } /** - * Returns the action result eventId that should cause this - * criteria to return true (it will return false otherwise). Defaults to - * "success". + * Returns the action result eventId that should cause this criteria to return true (it will return + * false otherwise). Defaults to "success". */ public String getTrueEventId() { return trueEventId; } /** - * Sets the action result eventId that should cause this - * precondition to return true (it will return false otherwise). + * Sets the action result eventId that should cause this precondition to return true (it will return + * false otherwise). * @param trueEventId the true result event ID */ public void setTrueEventId(String trueEventId) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ApplicationViewSelector.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ApplicationViewSelector.java index e586c01d..436469b0 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ApplicationViewSelector.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ApplicationViewSelector.java @@ -29,17 +29,14 @@ import org.springframework.webflow.execution.support.ApplicationView; import org.springframework.webflow.execution.support.FlowExecutionRedirect; /** - * Simple view selector that makes an {@link ApplicationView} selection using a - * view name expression. + * Simple view selector that makes an {@link ApplicationView} selection using a view name expression. *

    - * This factory will treat all attributes returned from calling - * {@link RequestContext#getModel()} as the application model exposed to the - * view during rendering. This is typically the union of attributes in request, - * flow, and conversation scope. + * This factory will treat all attributes returned from calling {@link RequestContext#getModel()} as the application + * model exposed to the view during rendering. This is typically the union of attributes in request, flow, and + * conversation scope. *

    - * This selector also supports setting a redirect flag that can be used - * to trigger a redirect to the {@link ApplicationView} at a bookmarkable URL - * using an {@link FlowExecutionRedirect}}. + * This selector also supports setting a redirect flag that can be used to trigger a redirect to the + * {@link ApplicationView} at a bookmarkable URL using an {@link FlowExecutionRedirect}}. * * @see org.springframework.webflow.execution.support.ApplicationView * @see org.springframework.webflow.execution.support.FlowExecutionRedirect @@ -50,8 +47,7 @@ import org.springframework.webflow.execution.support.FlowExecutionRedirect; public class ApplicationViewSelector implements ViewSelector, Serializable { /** - * Flow execution attribute name that indicates that we should always render - * an application view via a redirect. + * Flow execution attribute name that indicates that we should always render an application view via a redirect. */ public static final String ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE = "alwaysRedirectOnPause"; @@ -61,17 +57,15 @@ public class ApplicationViewSelector implements ViewSelector, Serializable { private Expression viewName; /** - * A flag indicating if a redirect to the selected application view should - * be requested. + * A flag indicating if a redirect to the selected application view should be requested. *

    - * Setting this allows you to redirect while the flow is in progress to a - * stable URL that can be safely refreshed. + * Setting this allows you to redirect while the flow is in progress to a stable URL that can be safely refreshed. */ private boolean redirect; /** - * Creates a application view selector that will make application view - * selections requesting that the specified view be rendered. + * Creates a application view selector that will make application view selections requesting that the specified view + * be rendered. * @param viewName the view name expression */ public ApplicationViewSelector(Expression viewName) { @@ -79,9 +73,8 @@ public class ApplicationViewSelector implements ViewSelector, Serializable { } /** - * Creates a application view selector that will make application view - * selections requesting that the specified view be rendered. No redirects - * will be done. + * Creates a application view selector that will make application view selections requesting that the specified view + * be rendered. No redirects will be done. * @param viewName the view name expression * @param redirect indicates if a redirect to the view should be initiated */ @@ -112,8 +105,7 @@ public class ApplicationViewSelector implements ViewSelector, Serializable { public ViewSelection makeEntrySelection(RequestContext context) { if (shouldRedirect(context)) { return FlowExecutionRedirect.INSTANCE; - } - else { + } else { return makeRefreshSelection(context); } } @@ -149,8 +141,7 @@ public class ApplicationViewSelector implements ViewSelector, Serializable { } /** - * Determine whether or not a redirect should be used to render the - * application view. + * Determine whether or not a redirect should be used to render the application view. * @param context the context * @return true or false */ @@ -159,8 +150,8 @@ public class ApplicationViewSelector implements ViewSelector, Serializable { } /** - * Checks the {@link #ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE} to see if every - * application view of the flow execution should be rendered via a redirect. + * Checks the {@link #ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE} to see if every application view of the flow execution + * should be rendered via a redirect. * @param context the flow execution request context * @return true or false */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/AttributeExpression.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/AttributeExpression.java index 6c57ad1c..531f5e8d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/AttributeExpression.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/AttributeExpression.java @@ -27,8 +27,7 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ScopeType; /** - * Expression evaluator that can evalute attribute maps and supported - * request context scope types. + * Expression evaluator that can evalute attribute maps and supported request context scope types. * * @see org.springframework.webflow.execution.RequestContext * @see org.springframework.webflow.core.collection.AttributeMap @@ -47,11 +46,10 @@ public class AttributeExpression implements SettableExpression { * The scope type. */ private ScopeType scopeType; - + /** - * Create a new expression evaluator that executes given expression in an - * attribute map. When using this wrapper to set a property value, make - * sure the given expression is a {@link SettableExpression}}. + * Create a new expression evaluator that executes given expression in an attribute map. When using this wrapper to + * set a property value, make sure the given expression is a {@link SettableExpression}}. * @param expression the nested evaluator to execute */ public AttributeExpression(Expression expression) { @@ -59,9 +57,8 @@ public class AttributeExpression implements SettableExpression { } /** - * Create a new expression evaluator that executes given expression in the - * specified scope. When using this wrapper to set a property value, make - * sure the given expression is a {@link SettableExpression}}. + * Create a new expression evaluator that executes given expression in the specified scope. When using this wrapper + * to set a property value, make sure the given expression is a {@link SettableExpression}}. * @param expression the nested evaluator to execute * @param scopeType the scopeType */ @@ -79,36 +76,32 @@ public class AttributeExpression implements SettableExpression { public Object evaluate(Object target, EvaluationContext context) throws EvaluationException { if (target instanceof RequestContext) { - RequestContext requestContext = (RequestContext)target; + RequestContext requestContext = (RequestContext) target; AttributeMap scope = scopeType.getScope(requestContext); return expression.evaluate(scope, context); - } - else if (target instanceof AttributeMap) { + } else if (target instanceof AttributeMap) { return expression.evaluate(target, context); - } - else { + } else { throw new IllegalArgumentException( "Only supports evaluation against a [RequestContext] or [AttributeMap] instance, but was a [" - + target.getClass() + "]"); + + target.getClass() + "]"); } } public void evaluateToSet(Object target, Object value, EvaluationContext context) throws EvaluationException { Assert.isInstanceOf(SettableExpression.class, expression, "When an AttributeExpression is used to set a property value, the nested expression needs " - + "to be a SettableExpression"); + + "to be a SettableExpression"); if (target instanceof RequestContext) { - RequestContext requestContext = (RequestContext)target; + RequestContext requestContext = (RequestContext) target; MutableAttributeMap scope = scopeType.getScope(requestContext); - ((SettableExpression)expression).evaluateToSet(scope, value, context); - } - else if (target instanceof AttributeMap) { - ((SettableExpression)expression).evaluateToSet(target, value, context); - } - else { + ((SettableExpression) expression).evaluateToSet(scope, value, context); + } else if (target instanceof AttributeMap) { + ((SettableExpression) expression).evaluateToSet(target, value, context); + } else { throw new IllegalArgumentException( "Only supports evaluation against a [RequestContext] or [AttributeMap] instance, but was a [" - + target.getClass() + "]"); + + target.getClass() + "]"); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BeanFactoryFlowVariable.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BeanFactoryFlowVariable.java index e5233a78..c995958c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BeanFactoryFlowVariable.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BeanFactoryFlowVariable.java @@ -23,8 +23,7 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ScopeType; /** - * A concrete flow variable subclass that obtains variable values from a Spring - * {@link BeanFactory}. + * A concrete flow variable subclass that obtains variable values from a Spring {@link BeanFactory}. * * @author Keith Donald * @author Erwin Vervaet @@ -32,8 +31,7 @@ import org.springframework.webflow.execution.ScopeType; public class BeanFactoryFlowVariable extends FlowVariable { /** - * The name of the bean whose value will be used as the flow - * variable. The bean should be a prototype. + * The name of the bean whose value will be used as the flow variable. The bean should be a prototype. */ private String beanName; @@ -41,13 +39,11 @@ public class BeanFactoryFlowVariable extends FlowVariable { * The bean factory where initial variable values will be obtained. */ private BeanFactory beanFactory; - + /** - * Convenience constructor to create a new bean factory flow variable. - * Defaults the bean name to the variable name. + * Convenience constructor to create a new bean factory flow variable. Defaults the bean name to the variable name. * @param name the variable name which will also be used as the bean name - * @param beanFactory the bean factory where initial variable values will be - * obtained + * @param beanFactory the bean factory where initial variable values will be obtained * @param scope the variable scope * @since 1.0.2 */ @@ -59,16 +55,14 @@ public class BeanFactoryFlowVariable extends FlowVariable { * Creates a new bean factory flow variable. * @param variableName the variable name * @param beanName the bean name, will default to the variable name if not specified - * @param beanFactory the bean factory where initial variable values will be - * obtained + * @param beanFactory the bean factory where initial variable values will be obtained * @param scope the variable scope */ public BeanFactoryFlowVariable(String variableName, String beanName, BeanFactory beanFactory, ScopeType scope) { super(variableName, scope); if (StringUtils.hasText(beanName)) { this.beanName = beanName; - } - else { + } else { this.beanName = variableName; } Assert.notNull(beanFactory, "The bean factory is required"); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BooleanExpressionTransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BooleanExpressionTransitionCriteria.java index 571b8290..6701872e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BooleanExpressionTransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/BooleanExpressionTransitionCriteria.java @@ -25,10 +25,9 @@ import org.springframework.webflow.engine.TransitionCriteria; import org.springframework.webflow.execution.RequestContext; /** - * Transition criteria that tests the value of an expression. The - * expression is used to express a condition that guards transition - * execution in a web flow. Expressions will be evaluated agains the request - * context and should return a boolean result. + * Transition criteria that tests the value of an expression. The expression is used to express a condition that guards + * transition execution in a web flow. Expressions will be evaluated agains the request context and should return a + * boolean result. * * @author Keith Donald * @author Erwin Vervaet @@ -36,11 +35,10 @@ import org.springframework.webflow.execution.RequestContext; public class BooleanExpressionTransitionCriteria implements TransitionCriteria { /** - * Constant alias that points to the id of the last event that occured - * in a web flow execution. + * Constant alias that points to the id of the last event that occured in a web flow execution. */ private static final String RESULT_ALIAS = "result"; - + /** * The expression evaluator to use. */ @@ -48,8 +46,8 @@ public class BooleanExpressionTransitionCriteria implements TransitionCriteria { /** * Create a new expression based transition criteria object. - * @param booleanExpression the expression evaluator testing the criteria, - * this expression should be a condition that returns a Boolean value + * @param booleanExpression the expression evaluator testing the criteria, this expression should be a condition + * that returns a Boolean value */ public BooleanExpressionTransitionCriteria(Expression booleanExpression) { Assert.notNull(booleanExpression, "The expression to test is required"); @@ -59,12 +57,11 @@ public class BooleanExpressionTransitionCriteria implements TransitionCriteria { public boolean test(RequestContext context) { Object result = booleanExpression.evaluate(context, getEvaluationContext(context)); Assert.isInstanceOf(Boolean.class, result, "Impossible to determine result of boolean expression: "); - return ((Boolean)result).booleanValue(); + return ((Boolean) result).booleanValue(); } /** - * Setup a context with a few aliased values to make writing expression based - * transition conditions a bit easier. + * Setup a context with a few aliased values to make writing expression based transition conditions a bit easier. */ protected EvaluationContext getEvaluationContext(RequestContext context) { final Map attributes = new HashMap(1, 1); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ConfigurableFlowAttributeMapper.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ConfigurableFlowAttributeMapper.java index 03836831..7bdfa10e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ConfigurableFlowAttributeMapper.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ConfigurableFlowAttributeMapper.java @@ -29,23 +29,18 @@ import org.springframework.webflow.core.DefaultExpressionParserFactory; import org.springframework.webflow.execution.ScopeType; /** - * Generic flow attribute mapper implementation that allows mappings to be - * configured in a declarative fashion. + * Generic flow attribute mapper implementation that allows mappings to be configured in a declarative fashion. *

    * Two types of mappings may be configured, input mappings and output mappings: *

      - *
    1. Input mappings define the rules for mapping attributes in a parent flow - * to a spawning subflow. - *
    2. Output mappings define the rules for mapping attributes returned from an - * ended subflow into the resuming parent. + *
    3. Input mappings define the rules for mapping attributes in a parent flow to a spawning subflow. + *
    4. Output mappings define the rules for mapping attributes returned from an ended subflow into the resuming parent. *
    *

    - * The mappings defined using the configuration properties fully support bean - * property access. So an entry name in a mapping can either be "beanName" or - * "beanName.propName". Nested property values are also supported - * ("beanName.propName.nestedPropName"). When the from mapping string is - * enclosed in "${...}", it will be interpreted as an expression that will be - * evaluated against the flow execution request context. + * The mappings defined using the configuration properties fully support bean property access. So an entry name in a + * mapping can either be "beanName" or "beanName.propName". Nested property values are also supported + * ("beanName.propName.nestedPropName"). When the from mapping string is enclosed in "${...}", it will be + * interpreted as an expression that will be evaluated against the flow execution request context. * * @see org.springframework.webflow.execution.RequestContext * @@ -54,15 +49,13 @@ import org.springframework.webflow.execution.ScopeType; * @author Colin Sampaleanu */ public class ConfigurableFlowAttributeMapper extends AbstractFlowAttributeMapper implements Serializable { - + /* - * Note: no longer used by the Spring Web Flow code base. Kept around - * for possible usage by end users. + * Note: no longer used by the Spring Web Flow code base. Kept around for possible usage by end users. */ /** - * The expression parser that will parse input and output attribute - * expressions. + * The expression parser that will parse input and output attribute expressions. */ private ExpressionParser expressionParser = DefaultExpressionParserFactory.getExpressionParser(); @@ -77,8 +70,7 @@ public class ConfigurableFlowAttributeMapper extends AbstractFlowAttributeMapper private DefaultAttributeMapper outputMapper = new DefaultAttributeMapper(); /** - * Set the expression parser responsible for parsing expression strings into - * evaluatable expression objects. + * Set the expression parser responsible for parsing expression strings into evaluatable expression objects. */ public void setExpressionParser(ExpressionParser expressionParser) { Assert.notNull(expressionParser, "The expression parser is required"); @@ -86,8 +78,8 @@ public class ConfigurableFlowAttributeMapper extends AbstractFlowAttributeMapper } /** - * Adds a new input mapping. Use when you need full control over defining - * how a subflow input attribute mapping will be perfomed. + * Adds a new input mapping. Use when you need full control over defining how a subflow input attribute mapping will + * be perfomed. * @param inputMapping the input mapping * @return this, to support call chaining */ @@ -97,8 +89,8 @@ public class ConfigurableFlowAttributeMapper extends AbstractFlowAttributeMapper } /** - * Adds a collection of input mappings. Use when you need full control over - * defining how a subflow input attribute mapping will be perfomed. + * Adds a collection of input mappings. Use when you need full control over defining how a subflow input attribute + * mapping will be perfomed. * @param inputMappings the input mappings */ public void addInputMappings(AttributeMapper[] inputMappings) { @@ -106,8 +98,8 @@ public class ConfigurableFlowAttributeMapper extends AbstractFlowAttributeMapper } /** - * Adds a new output mapping. Use when you need full control over defining - * how a subflow output attribute mapping will be perfomed. + * Adds a new output mapping. Use when you need full control over defining how a subflow output attribute mapping + * will be perfomed. * @param outputMapping the output mapping * @return this, to support call chaining */ @@ -117,8 +109,8 @@ public class ConfigurableFlowAttributeMapper extends AbstractFlowAttributeMapper } /** - * Adds a collection of output mappings. Use when you need full control over - * defining how a subflow output attribute mapping will be perfomed. + * Adds a collection of output mappings. Use when you need full control over defining how a subflow output attribute + * mapping will be perfomed. * @param outputMappings the output mappings */ public void addOutputMappings(AttributeMapper[] outputMappings) { @@ -126,10 +118,9 @@ public class ConfigurableFlowAttributeMapper extends AbstractFlowAttributeMapper } /** - * Adds an input mapping that maps a single attribute in parent flow - * scope into the subflow input map. For instance: "x" will result in - * the "x" attribute in parent flow scope being mapped into the subflow - * input map as "x". + * Adds an input mapping that maps a single attribute in parent flow scope into the subflow input map. For + * instance: "x" will result in the "x" attribute in parent flow scope being mapped into the subflow input map as + * "x". * @param attributeName the attribute in flow scope to map into the subflow * @return this, to support call chaining */ @@ -141,12 +132,10 @@ public class ConfigurableFlowAttributeMapper extends AbstractFlowAttributeMapper } /** - * Adds a collection of input mappings that map attributes in parent flow - * scope into the subflow input map. For instance: "x" will result in - * the "x" attribute in parent flow scope being mapped into the subflow - * input map as "x". - * @param attributeNames the attributes in flow scope to map into the - * subflow + * Adds a collection of input mappings that map attributes in parent flow scope into the subflow input map. + * For instance: "x" will result in the "x" attribute in parent flow scope being mapped into the subflow input map + * as "x". + * @param attributeNames the attributes in flow scope to map into the subflow */ public void addInputAttributes(String[] attributeNames) { if (attributeNames == null) { @@ -158,12 +147,10 @@ public class ConfigurableFlowAttributeMapper extends AbstractFlowAttributeMapper } /** - * Adds an output mapping that maps a single subflow output attribute into - * the flow scope of the resuming parent flow. For instance: "y" - * will result in the "y" attribute of the subflow output map being mapped - * into the flowscope of the resuming parent flow as "y". - * @param attributeName the subflow output attribute to map into the parent - * flow scope + * Adds an output mapping that maps a single subflow output attribute into the flow scope of the resuming + * parent flow. For instance: "y" will result in the "y" attribute of the subflow output map being mapped into the + * flowscope of the resuming parent flow as "y". + * @param attributeName the subflow output attribute to map into the parent flow scope * @return this, to support call chaining */ public ConfigurableFlowAttributeMapper addOutputAttribute(String attributeName) { @@ -174,12 +161,10 @@ public class ConfigurableFlowAttributeMapper extends AbstractFlowAttributeMapper } /** - * Adds a collection of output mappings that map subflow output attributes - * into the scope of the resuming parent flow. For instance: "y" will result - * in the "y" attribute of the subflow output map being mapped into the + * Adds a collection of output mappings that map subflow output attributes into the scope of the resuming parent + * flow. For instance: "y" will result in the "y" attribute of the subflow output map being mapped into the * flowscope of the resuming parent flow as "y". - * @param attributeNames the subflow output attributes to map into the - * parent flow + * @param attributeNames the subflow output attributes to map into the parent flow */ public void addOutputAttributes(String[] attributeNames) { if (attributeNames == null) { @@ -207,8 +192,7 @@ public class ConfigurableFlowAttributeMapper extends AbstractFlowAttributeMapper } /** - * Returns the configured expression parser. Can be used by subclasses that - * build mappings. + * Returns the configured expression parser. Can be used by subclasses that build mappings. */ protected ExpressionParser getExpressionParser() { return expressionParser; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/DefaultTargetStateResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/DefaultTargetStateResolver.java index c2ff4020..b77c2139 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/DefaultTargetStateResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/DefaultTargetStateResolver.java @@ -25,8 +25,8 @@ import org.springframework.webflow.engine.Transition; import org.springframework.webflow.execution.RequestContext; /** - * A transition target state resolver that evaluates an expression to resolve - * the target state. The default implementation. + * A transition target state resolver that evaluates an expression to resolve the target state. The default + * implementation. * * @author Keith Donald */ @@ -38,8 +38,7 @@ public class DefaultTargetStateResolver implements TargetStateResolver { private Expression targetStateIdExpression; /** - * Creates a new target state resolver that always returns the same - * target state id. + * Creates a new target state resolver that always returns the same target state id. * @param targetStateId the id of the target state */ public DefaultTargetStateResolver(String targetStateId) { @@ -57,7 +56,7 @@ public class DefaultTargetStateResolver implements TargetStateResolver { public State resolveTargetState(Transition transition, State sourceState, RequestContext context) { String stateId = String.valueOf(targetStateIdExpression.evaluate(context, null)); - return ((Flow)context.getActiveFlow()).getStateInstance(stateId); + return ((Flow) context.getActiveFlow()).getStateInstance(stateId); } public String toString() { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/EventIdTransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/EventIdTransitionCriteria.java index 72ed2b99..66349ec3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/EventIdTransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/EventIdTransitionCriteria.java @@ -23,9 +23,8 @@ import org.springframework.webflow.execution.Event; import org.springframework.webflow.execution.RequestContext; /** - * Simple transition criteria that matches on an eventId and nothing else. - * Specifically, if the id of the last event that occured equals - * {@link #getEventId()} this criteria will return true. + * Simple transition criteria that matches on an eventId and nothing else. Specifically, if the id of the last event + * that occured equals {@link #getEventId()} this criteria will return true. * * @see RequestContext#getLastEvent() * @@ -38,7 +37,7 @@ public class EventIdTransitionCriteria implements TransitionCriteria, Serializab * The event id to match. */ private String eventId; - + /** * Whether or not to match case sensitively. Default is true. */ @@ -59,10 +58,9 @@ public class EventIdTransitionCriteria implements TransitionCriteria, Serializab public String getEventId() { return eventId; } - + /** - * Set whether or not the event id should be matched in a case sensitve - * manner. Defaults to true. + * Set whether or not the event id should be matched in a case sensitve manner. Defaults to true. */ public void setCaseSensitive(boolean caseSensitive) { this.caseSensitive = caseSensitive; @@ -75,8 +73,7 @@ public class EventIdTransitionCriteria implements TransitionCriteria, Serializab } if (caseSensitive) { return eventId.equals(lastEvent.getId()); - } - else { + } else { return eventId.equalsIgnoreCase(lastEvent.getId()); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ExternalRedirectSelector.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ExternalRedirectSelector.java index 74ca3977..201a3c63 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ExternalRedirectSelector.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/ExternalRedirectSelector.java @@ -25,16 +25,14 @@ import org.springframework.webflow.execution.ViewSelection; import org.springframework.webflow.execution.support.ExternalRedirect; /** - * Makes view selections requesting a client side redirect to an external - * URL outside of the flow. + * Makes view selections requesting a client side redirect to an external URL outside of the flow. *

    - * This selector is usefull when you wish to request a redirect after - * conversation completion as part of entering an EndState. + * This selector is usefull when you wish to request a redirect after conversation completion as part of + * entering an EndState. *

    - * This selector may also be used to redirect to an external URL from a - * ViewState of an active conversation. The external system redirected to will - * be provided the flow execution context necessary to allow it to communicate - * back to the executing flow at a later time. + * This selector may also be used to redirect to an external URL from a ViewState of an active conversation. The + * external system redirected to will be provided the flow execution context necessary to allow it to communicate back + * to the executing flow at a later time. * * @see org.springframework.webflow.execution.support.ExternalRedirect * @@ -49,9 +47,8 @@ public class ExternalRedirectSelector implements ViewSelector, Serializable { private Expression urlExpression; /** - * Create a new redirecting view selector that takes given URL expression as - * input. The expression is the parsed form (expression-tokenized) of the - * encoded view (e.g. "/pathInfo?param0=value0¶m1=value1"). + * Create a new redirecting view selector that takes given URL expression as input. The expression is the parsed + * form (expression-tokenized) of the encoded view (e.g. "/pathInfo?param0=value0¶m1=value1"). * @param urlExpression the url expression */ public ExternalRedirectSelector(Expression urlExpression) { @@ -70,7 +67,7 @@ public class ExternalRedirectSelector implements ViewSelector, Serializable { } public ViewSelection makeEntrySelection(RequestContext context) { - String url = (String)urlExpression.evaluate(context, null); + String url = (String) urlExpression.evaluate(context, null); return new ExternalRedirect(url); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/FlowDefinitionRedirectSelector.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/FlowDefinitionRedirectSelector.java index 3467055a..38488578 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/FlowDefinitionRedirectSelector.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/FlowDefinitionRedirectSelector.java @@ -26,9 +26,8 @@ import org.springframework.webflow.execution.ViewSelection; import org.springframework.webflow.execution.support.FlowDefinitionRedirect; /** - * Makes a {@link FlowDefinitionRedirect} selection when requested, calculating the - * flowDefinitionId and executionInput by - * evaluating an expression against the request context. + * Makes a {@link FlowDefinitionRedirect} selection when requested, calculating the flowDefinitionId and + * executionInput by evaluating an expression against the request context. * * @see org.springframework.webflow.execution.support.FlowDefinitionRedirect * @@ -44,8 +43,8 @@ public class FlowDefinitionRedirectSelector implements ViewSelector { /** * Creates a new launch flow redirect selector. - * @param expression the parsed flow redirect expression, evaluatable to the - * string format: flowDefinitionId?param1Name=parmValue¶m2Name=paramValue + * @param expression the parsed flow redirect expression, evaluatable to the string format: + * flowDefinitionId?param1Name=parmValue¶m2Name=paramValue */ public FlowDefinitionRedirectSelector(Expression expression) { this.expression = expression; @@ -56,7 +55,7 @@ public class FlowDefinitionRedirectSelector implements ViewSelector { } public ViewSelection makeEntrySelection(RequestContext context) { - String encodedRedirect = (String)expression.evaluate(context, null); + String encodedRedirect = (String) expression.evaluate(context, null); if (encodedRedirect == null) { throw new IllegalStateException( "Flow definition redirect expression evaluated to [null], the expression was " + expression); @@ -76,13 +75,11 @@ public class FlowDefinitionRedirectSelector implements ViewSelector { index = nameAndValue.indexOf('='); if (index != -1) { executionInput.put(nameAndValue.substring(0, index), nameAndValue.substring(index + 1)); - } - else { + } else { executionInput.put(nameAndValue, ""); } } - } - else { + } else { flowDefinitionId = encodedRedirect; } if (!StringUtils.hasText(flowDefinitionId)) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/NotTransitionCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/NotTransitionCriteria.java index af10940f..f24dc829 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/NotTransitionCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/NotTransitionCriteria.java @@ -20,8 +20,7 @@ import org.springframework.webflow.engine.TransitionCriteria; import org.springframework.webflow.execution.RequestContext; /** - * Transition criteria that negates the result of the evaluation of - * another criteria object. + * Transition criteria that negates the result of the evaluation of another criteria object. * * @author Keith Donald */ @@ -31,21 +30,20 @@ public class NotTransitionCriteria implements TransitionCriteria { * The criteria to negate. */ private TransitionCriteria criteria; - + /** - * Create a new transition criteria object that will negate - * the result of given criteria object. - * @param criteria the criteria to negate + * Create a new transition criteria object that will negate the result of given criteria object. + * @param criteria the criteria to negate */ public NotTransitionCriteria(TransitionCriteria criteria) { Assert.notNull(criteria, "The criteria object to negate is required"); this.criteria = criteria; } - + public boolean test(RequestContext context) { return !criteria.test(context); } - + public String toString() { return "[not(" + criteria + ")]"; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/SimpleFlowVariable.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/SimpleFlowVariable.java index 2ced0fd9..34eee48b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/SimpleFlowVariable.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/SimpleFlowVariable.java @@ -24,8 +24,7 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ScopeType; /** - * A trivial concrete flow variable subclass that creates new variable values - * using Java reflection. + * A trivial concrete flow variable subclass that creates new variable values using Java reflection. * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/TransitionCriteriaChain.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/TransitionCriteriaChain.java index 6524eb29..c7beadbe 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/TransitionCriteriaChain.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/TransitionCriteriaChain.java @@ -27,9 +27,8 @@ import org.springframework.webflow.engine.WildcardTransitionCriteria; import org.springframework.webflow.execution.RequestContext; /** - * An ordered chain of TransitionCriteria. Iterates over each element - * in the chain, continues until one returns false or the list is exhausted. So - * in effect it will do a logical AND between the contained criteria. + * An ordered chain of TransitionCriteria. Iterates over each element in the chain, continues until one + * returns false or the list is exhausted. So in effect it will do a logical AND between the contained criteria. * * @author Keith Donald */ @@ -41,14 +40,14 @@ public class TransitionCriteriaChain implements TransitionCriteria { private List criteriaChain = new LinkedList(); /** - * Creates an initially empty transition criteria chain. + * Creates an initially empty transition criteria chain. * @see #add(TransitionCriteria) */ public TransitionCriteriaChain() { } /** - * Creates a transition criteria chain with the specified criteria. + * Creates a transition criteria chain with the specified criteria. * @param criteria the criteria */ public TransitionCriteriaChain(TransitionCriteria[] criteria) { @@ -58,8 +57,7 @@ public class TransitionCriteriaChain implements TransitionCriteria { /** * Add given criteria object to the end of the chain. * @param criteria the criteria - * @return this object, so multiple criteria can be added in a single - * statement + * @return this object, so multiple criteria can be added in a single statement */ public TransitionCriteriaChain add(TransitionCriteria criteria) { this.criteriaChain.add(criteria); @@ -69,7 +67,7 @@ public class TransitionCriteriaChain implements TransitionCriteria { public boolean test(RequestContext context) { Iterator it = criteriaChain.iterator(); while (it.hasNext()) { - TransitionCriteria criteria = (TransitionCriteria)it.next(); + TransitionCriteria criteria = (TransitionCriteria) it.next(); if (!criteria.test(context)) { return false; } @@ -82,7 +80,7 @@ public class TransitionCriteriaChain implements TransitionCriteria { } // static helpers - + /** * Create a transition criteria chain chaining given list of actions. * @param actions the actions (and their execution properties) to chain together @@ -96,5 +94,5 @@ public class TransitionCriteriaChain implements TransitionCriteria { chain.add(new ActionTransitionCriteria(actions[i])); } return chain; - } + } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/TransitionExecutingStateExceptionHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/TransitionExecutingStateExceptionHandler.java index 79f576b9..46c7dc72 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/engine/support/TransitionExecutingStateExceptionHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/engine/support/TransitionExecutingStateExceptionHandler.java @@ -34,34 +34,31 @@ import org.springframework.webflow.execution.RequestContext; import org.springframework.webflow.execution.ViewSelection; /** - * A flow execution exception handler that maps the occurence of a specific type of - * exception to a transition to a new {@link org.springframework.webflow.engine.State}. + * A flow execution exception handler that maps the occurence of a specific type of exception to a transition to a new + * {@link org.springframework.webflow.engine.State}. *

    - * The handled {@link FlowExecutionException} will be exposed in flash scope as - * {@link #STATE_EXCEPTION_ATTRIBUTE}. The underlying root cause of that exception - * will be exposed in flash scope as {@link #ROOT_CAUSE_EXCEPTION_ATTRIBUTE}. + * The handled {@link FlowExecutionException} will be exposed in flash scope as {@link #STATE_EXCEPTION_ATTRIBUTE}. The + * underlying root cause of that exception will be exposed in flash scope as {@link #ROOT_CAUSE_EXCEPTION_ATTRIBUTE}. * * @author Keith Donald */ public class TransitionExecutingStateExceptionHandler implements FlowExecutionExceptionHandler { - + // this class should really have been called TransitionExecutingFlowExceptionHandler private static final Log logger = LogFactory.getLog(TransitionExecutingStateExceptionHandler.class); /** - * The name of the attribute to expose a handled exception under in - * flash scope ("stateException"). + * The name of the attribute to expose a handled exception under in flash scope ("stateException"). */ public static final String STATE_EXCEPTION_ATTRIBUTE = "stateException"; /** - * The name of the attribute to expose a root cause of a handled exception - * under in flash scope ("rootCauseException"). + * The name of the attribute to expose a root cause of a handled exception under in flash scope + * ("rootCauseException"). */ public static final String ROOT_CAUSE_EXCEPTION_ATTRIBUTE = "rootCauseException"; - /** * The exceptionType->targetStateResolver map. */ @@ -75,10 +72,8 @@ public class TransitionExecutingStateExceptionHandler implements FlowExecutionEx /** * Adds an exception->state mapping to this handler. * @param exceptionClass the type of exception to map - * @param targetStateId the id of the state to transition to if the - * specified type of exception is handled - * @return this handler, to allow for adding multiple mappings in a single - * statement + * @param targetStateId the id of the state to transition to if the specified type of exception is handled + * @return this handler, to allow for adding multiple mappings in a single statement */ public TransitionExecutingStateExceptionHandler add(Class exceptionClass, String targetStateId) { return add(exceptionClass, new DefaultTargetStateResolver(targetStateId)); @@ -87,10 +82,9 @@ public class TransitionExecutingStateExceptionHandler implements FlowExecutionEx /** * Adds a exception->state mapping to this handler. * @param exceptionClass the type of exception to map - * @param targetStateResolver the resolver to calculate the state to - * transition to if the specified type of exception is handled - * @return this handler, to allow for adding multiple mappings in a single - * statement + * @param targetStateResolver the resolver to calculate the state to transition to if the specified type of + * exception is handled + * @return this handler, to allow for adding multiple mappings in a single statement */ public TransitionExecutingStateExceptionHandler add(Class exceptionClass, TargetStateResolver targetStateResolver) { Assert.notNull(exceptionClass, "The exception class is required"); @@ -98,10 +92,9 @@ public class TransitionExecutingStateExceptionHandler implements FlowExecutionEx exceptionTargetStateMappings.put(exceptionClass, targetStateResolver); return this; } - + /** - * Returns the list of actions to execute when this handler handles an exception. - * The returned list is mutable. + * Returns the list of actions to execute when this handler handles an exception. The returned list is mutable. */ public ActionList getActionList() { return actionList; @@ -121,12 +114,11 @@ public class TransitionExecutingStateExceptionHandler implements FlowExecutionEx } // helpers - + /** - * Exposes the given flow exception and root cause in flash scope to make - * them available for response rendering. Subclasses can override this - * if they want to expose the exceptions in a different way or do special - * processing before the exceptions are exposed. + * Exposes the given flow exception and root cause in flash scope to make them available for response rendering. + * Subclasses can override this if they want to expose the exceptions in a different way or do special processing + * before the exceptions are exposed. * @param context the request control context * @param exception the exception being handled * @param rootCause root cause of the exception being handled (could be null) @@ -144,15 +136,13 @@ public class TransitionExecutingStateExceptionHandler implements FlowExecutionEx } /** - * Find the mapped target state resolver for given exception. Returns - * null if no mapping can be found for given exception. Will - * try all exceptions in the exception cause chain. + * Find the mapped target state resolver for given exception. Returns null if no mapping can be found + * for given exception. Will try all exceptions in the exception cause chain. */ protected TargetStateResolver getTargetStateResolver(FlowExecutionException e) { if (JdkVersion.getMajorJavaVersion() == JdkVersion.JAVA_13) { return getTargetStateResolver13(e); - } - else { + } else { return getTargetStateResolver14(e); } } @@ -164,17 +154,14 @@ public class TransitionExecutingStateExceptionHandler implements FlowExecutionEx TargetStateResolver targetStateResolver; if (isRootCause13(e)) { return findTargetStateResolver(e.getClass()); - } - else { - targetStateResolver = (TargetStateResolver)exceptionTargetStateMappings.get(e.getClass()); + } else { + targetStateResolver = (TargetStateResolver) exceptionTargetStateMappings.get(e.getClass()); if (targetStateResolver != null) { return targetStateResolver; - } - else { + } else { if (e.getCause() instanceof NestedRuntimeException) { - return getTargetStateResolver13((NestedRuntimeException)e.getCause()); - } - else { + return getTargetStateResolver13((NestedRuntimeException) e.getCause()); + } else { return null; } } @@ -188,46 +175,41 @@ public class TransitionExecutingStateExceptionHandler implements FlowExecutionEx TargetStateResolver targetStateResolver; if (isRootCause14(t)) { return findTargetStateResolver(t.getClass()); - } - else { - targetStateResolver = (TargetStateResolver)exceptionTargetStateMappings.get(t.getClass()); + } else { + targetStateResolver = (TargetStateResolver) exceptionTargetStateMappings.get(t.getClass()); if (targetStateResolver != null) { return targetStateResolver; - } - else { + } else { return getTargetStateResolver14(t.getCause()); } } } /** - * Check if given exception is the root of the exception cause chain. - * For use with JDK 1.3. + * Check if given exception is the root of the exception cause chain. For use with JDK 1.3. */ private boolean isRootCause13(NestedRuntimeException e) { return e.getCause() == null; } /** - * Check if given exception is the root of the exception cause chain. - * For use with JDK 1.4 or later. + * Check if given exception is the root of the exception cause chain. For use with JDK 1.4 or later. */ private boolean isRootCause14(Throwable t) { return t.getCause() == null; } /** - * Try to find a mapped target state resolver for given exception type. Will - * also try to lookup using the class hierarchy of given exception type. + * Try to find a mapped target state resolver for given exception type. Will also try to lookup using the class + * hierarchy of given exception type. * @param exceptionType the exception type to lookup * @return the target state id or null if not found */ private TargetStateResolver findTargetStateResolver(Class exceptionType) { while (exceptionType != null && exceptionType != Object.class) { if (exceptionTargetStateMappings.containsKey(exceptionType)) { - return (TargetStateResolver)exceptionTargetStateMappings.get(exceptionType); - } - else { + return (TargetStateResolver) exceptionTargetStateMappings.get(exceptionType); + } else { exceptionType = exceptionType.getSuperclass(); } } @@ -240,8 +222,7 @@ public class TransitionExecutingStateExceptionHandler implements FlowExecutionEx protected Throwable findRootCause(Throwable t) { if (JdkVersion.getMajorJavaVersion() == JdkVersion.JAVA_13) { return findRootCause13(t); - } - else { + } else { return findRootCause14(t); } } @@ -251,16 +232,14 @@ public class TransitionExecutingStateExceptionHandler implements FlowExecutionEx */ private Throwable findRootCause13(Throwable t) { if (t instanceof NestedRuntimeException) { - NestedRuntimeException nre = (NestedRuntimeException)t; + NestedRuntimeException nre = (NestedRuntimeException) t; Throwable cause = nre.getCause(); if (cause == null) { return nre; - } - else { + } else { return findRootCause13(cause); } - } - else { + } else { return t; } } @@ -272,8 +251,7 @@ public class TransitionExecutingStateExceptionHandler implements FlowExecutionEx Throwable cause = e.getCause(); if (cause == null) { return e; - } - else { + } else { return findRootCause14(cause); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java index b1472278..c9edc514 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/Action.java @@ -16,47 +16,36 @@ package org.springframework.webflow.execution; /** - * A command that executes a behavior and returns a logical execution result a - * calling flow execution can respond to. + * A command that executes a behavior and returns a logical execution result a calling flow execution can respond to. *

    - * Actions typically delegate down to the application (or service) layer to - * perform business operations. They often retrieve data to support response - * rendering. They act as a bridge between a SWF web-tier and your middle-tier + * Actions typically delegate down to the application (or service) layer to perform business operations. They often + * retrieve data to support response rendering. They act as a bridge between a SWF web-tier and your middle-tier * business logic layer. *

    - * When an action completes execution it signals a result event describing the - * outcome of that execution (for example, "success", "error", "yes", "no", - * "tryAgain", etc). In addition to providing a logical outcome the flow can - * respond to, a result event may have payload associated with it, for example a - * "success" return value or an "error" error code. The result event is - * typically used as grounds for a state transition out of the current state of - * the calling Flow. + * When an action completes execution it signals a result event describing the outcome of that execution (for example, + * "success", "error", "yes", "no", "tryAgain", etc). In addition to providing a logical outcome the flow can respond + * to, a result event may have payload associated with it, for example a "success" return value or an "error" error + * code. The result event is typically used as grounds for a state transition out of the current state of the calling + * Flow. *

    - * Action implementations are often application-scoped singletons instantiated - * and managed by a web-tier Spring application context to take advantage of - * Spring's externalized configuration and dependency injection capabilities - * (which is a form of Inversion of Control [IoC]). Actions may also be stateful - * prototypes, storing conversational state as instance variables. Action - * instance definitions may also be locally scoped to a specific flow definition + * Action implementations are often application-scoped singletons instantiated and managed by a web-tier Spring + * application context to take advantage of Spring's externalized configuration and dependency injection capabilities + * (which is a form of Inversion of Control [IoC]). Actions may also be stateful prototypes, storing conversational + * state as instance variables. Action instance definitions may also be locally scoped to a specific flow definition * (see use of the "import" element of the root XML flow definition element.) *

    - * Note: Actions are directly instantiatable for use in a standalone test - * environment and can be parameterized with mocks or stubs, as they are simple - * POJOs. Action proxies may also be generated at runtime for delegating to POJO + * Note: Actions are directly instantiatable for use in a standalone test environment and can be parameterized with + * mocks or stubs, as they are simple POJOs. Action proxies may also be generated at runtime for delegating to POJO * business operations that have no dependency on the Spring Web Flow API. *

    - * Note: if an Action is a singleton managed in application scope, take care not - * to store and/or modify caller-specific state in a unsafe manner. The Action - * {@link #execute(RequestContext)} method runs in an independently executing - * thread on each invocation so make sure you deal only with local data or - * internal, thread-safe services. + * Note: if an Action is a singleton managed in application scope, take care not to store and/or modify caller-specific + * state in a unsafe manner. The Action {@link #execute(RequestContext)} method runs in an independently executing + * thread on each invocation so make sure you deal only with local data or internal, thread-safe services. *

    - * Note: an Action is not a controller like a Spring MVC controller or a Struts - * action is a controller. Flow actions are commands. Such commands do - * not select views, they execute arbitrary behavioral logic and then return an - * logical execution result. The flow that invokes an Action is responsible for - * responding to the execution result to decide what to do next. In Spring Web - * Flow, the flow is the controller. + * Note: an Action is not a controller like a Spring MVC controller or a Struts action is a controller. Flow actions are + * commands. Such commands do not select views, they execute arbitrary behavioral logic and then return an + * logical execution result. The flow that invokes an Action is responsible for responding to the execution result to + * decide what to do next. In Spring Web Flow, the flow is the controller. * * @author Keith Donald * @author Erwin Vervaet @@ -64,63 +53,49 @@ package org.springframework.webflow.execution; public interface Action { /** - * Execute this action. Action execution will occur in the context of a - * request associated with an active flow execution. + * Execute this action. Action execution will occur in the context of a request associated with an active flow + * execution. *

    - * Action invocation is typically triggered in a production environment by a - * state within a flow carrying out the execution of a flow definition. The - * result of action execution, a logical outcome event, can be used as - * grounds for a transition out of the calling state. + * Action invocation is typically triggered in a production environment by a state within a flow carrying out the + * execution of a flow definition. The result of action execution, a logical outcome event, can be used as grounds + * for a transition out of the calling state. *

    - * Note: The {@link RequestContext} argument to this method provides access - * to data about the active flow execution in the context of the currently - * executing thread. Among other things, this allows this action to access - * {@link RequestContext#getRequestScope() data} set by other actions, as - * well as set its own attributes it wishes to expose in a given scope. + * Note: The {@link RequestContext} argument to this method provides access to data about the active flow execution + * in the context of the currently executing thread. Among other things, this allows this action to access + * {@link RequestContext#getRequestScope() data} set by other actions, as well as set its own attributes it wishes + * to expose in a given scope. *

    * Some notes about actions and their usage of the attribute scope types: *

    *

    - * All attributes present in any scope are typically exposed in a model - * for access by a view when an "interactive" state type such as a view - * state is entered. + * All attributes present in any scope are typically exposed in a model for access by a view when an "interactive" + * state type such as a view state is entered. *

    - * Note: flow scope should generally not be used as a general purpose cache, - * but rather as a context for data needed locally by other states of the - * flow this action participates in. For example, it would be inappropriate - * to stuff large collections of objects (like those returned to support a - * search results view) into flow scope. Instead, put such result - * collections in request scope, and ensure you execute this action again - * each time you wish to view those results. 2nd level caches managed - * outside of SWF are more general cache solutions. + * Note: flow scope should generally not be used as a general purpose cache, but rather as a context for data needed + * locally by other states of the flow this action participates in. For example, it would be inappropriate to stuff + * large collections of objects (like those returned to support a search results view) into flow scope. Instead, put + * such result collections in request scope, and ensure you execute this action again each time you wish to view + * those results. 2nd level caches managed outside of SWF are more general cache solutions. *

    - * Note: as flow scoped attributes are eligible for serialization they - * should be Serializable. + * Note: as flow scoped attributes are eligible for serialization they should be Serializable. * - * @param context the action execution context, for accessing and setting - * data in a {@link ScopeType scope type}, as well as obtaining other flow - * contextual information (e.g. request context attributes and flow - * execution context information) - * @return a logical result outcome, used as grounds for a transition in the - * calling flow (e.g. "success", "error", "yes", "no", * ...) - * @throws Exception a exception occured during action execution, either - * checked or unchecked; note, any recoverable exceptions should be - * caught within this method and an appropriate result outcome returned + * @param context the action execution context, for accessing and setting data in a {@link ScopeType scope type}, + * as well as obtaining other flow contextual information (e.g. request context attributes and flow execution + * context information) + * @return a logical result outcome, used as grounds for a transition in the calling flow (e.g. "success", "error", + * "yes", "no", * ...) + * @throws Exception a exception occured during action execution, either checked or unchecked; note, any + * recoverable exceptions should be caught within this method and an appropriate result outcome returned * or be handled by the current state of the calling flow execution. */ public Event execute(RequestContext context) throws Exception; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/EnterStateVetoException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/EnterStateVetoException.java index 7e93a520..0ed5129d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/EnterStateVetoException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/EnterStateVetoException.java @@ -18,9 +18,8 @@ package org.springframework.webflow.execution; import org.springframework.webflow.definition.StateDefinition; /** - * Exception thrown to veto the entering of a state of a flow. Typically thrown - * by {@link FlowExecutionListener} objects that apply security or other runtime - * constraint checks to flow executions. + * Exception thrown to veto the entering of a state of a flow. Typically thrown by {@link FlowExecutionListener} objects + * that apply security or other runtime constraint checks to flow executions. * * @author Keith Donald * @author Erwin Vervaet @@ -52,7 +51,8 @@ public class EnterStateVetoException extends FlowExecutionException { * @param message a descriptive message * @param cause the underlying cause */ - public EnterStateVetoException(String flowId, String sourceStateId, String vetoedStateId, String message, Throwable cause) { + public EnterStateVetoException(String flowId, String sourceStateId, String vetoedStateId, String message, + Throwable cause) { super(flowId, sourceStateId, message, cause); this.vetoedStateId = vetoedStateId; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/Event.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/Event.java index 7aa3c59f..1ea31070 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/Event.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/Event.java @@ -22,20 +22,16 @@ import org.springframework.webflow.core.collection.AttributeMap; import org.springframework.webflow.core.collection.CollectionUtils; /** - * Signals the occurrence of something an active flow execution should respond - * to. Each event has a string id that provides a key for identifying what - * happened: e.g "coinInserted", or "pinDropped". Events may have attributes - * that provide arbitrary payload data, e.g. "coin.amount=25", or - * "pinDropSpeed=25ms". + * Signals the occurrence of something an active flow execution should respond to. Each event has a string id that + * provides a key for identifying what happened: e.g "coinInserted", or "pinDropped". Events may have attributes that + * provide arbitrary payload data, e.g. "coin.amount=25", or "pinDropSpeed=25ms". *

    - * As an example, a "submit" event might signal that a Submit button was pressed - * in a web browser. A "success" event might signal an action executed - * successfully. A "finish" event might signal a subflow ended normally. + * As an example, a "submit" event might signal that a Submit button was pressed in a web browser. A "success" event + * might signal an action executed successfully. A "finish" event might signal a subflow ended normally. *

    - * Why is this not an interface? A specific design choice. An event is not a - * strategy that defines a generic type or role--it is essentially an immutable - * value object. It is expected that specializations of this base class be - * "Events" and not part of some other inheritence hierarchy. + * Why is this not an interface? A specific design choice. An event is not a strategy that defines a generic type or + * role--it is essentially an immutable value object. It is expected that specializations of this base class be "Events" + * and not part of some other inheritence hierarchy. * * @author Keith Donald * @author Erwin Vervaet @@ -68,8 +64,7 @@ public final class Event extends EventObject { } /** - * Create a new event with the specified id and payload - * attributes. + * Create a new event with the specified id and payload attributes. * @param source the source of the event (required) * @param id the event identifier (required) * @param attributes additional event attributes @@ -90,8 +85,8 @@ public final class Event extends EventObject { } /** - * Returns the time at which the event occured, represented as the number of - * milliseconds since January 1, 1970, 00:00:00 GMT. + * Returns the time at which the event occured, represented as the number of milliseconds since January 1, 1970, + * 00:00:00 GMT. * @return the timestamp */ public long getTimestamp() { @@ -99,8 +94,7 @@ public final class Event extends EventObject { } /** - * Returns an unmodifiable map storing the attributes of this event. Never - * returns null. + * Returns an unmodifiable map storing the attributes of this event. Never returns null. * @return the event attributes (payload) */ public AttributeMap getAttributes() { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecution.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecution.java index 4f338665..fd2384f4 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecution.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecution.java @@ -20,53 +20,38 @@ import org.springframework.webflow.core.collection.MutableAttributeMap; import org.springframework.webflow.definition.FlowDefinition; /** - * A top-level instance of a flow definition that carries out definition - * execution on behalf of a single client. Typically used to support the - * orchestration of a web conversation. + * A top-level instance of a flow definition that carries out definition execution on behalf of a single client. + * Typically used to support the orchestration of a web conversation. *

    - * This is the central facade interface for manipulating one runtime execution - * of a flow definition. Implementations of this interface are the finite state - * machine that is the heart of Spring Web Flow. + * This is the central facade interface for manipulating one runtime execution of a flow definition. Implementations of + * this interface are the finite state machine that is the heart of Spring Web Flow. *

    - * Typically, when a client wants to launch a flow execution at production time, - * she passes the id of the governing {@link FlowDefinition flow definition} to - * a coordinating - * {@link org.springframework.webflow.executor.FlowExecutor#launch(String, ExternalContext) flow executor}. - * This coordinator then typically uses a - * {@link FlowExecutionFactory flow execution factory} to create an object - * implementing this interface, initializing it with the requested flow - * definition which becomes the execution's "root" or top-level flow. + * Typically, when a client wants to launch a flow execution at production time, she passes the id of the governing + * {@link FlowDefinition flow definition} to a coordinating + * {@link org.springframework.webflow.executor.FlowExecutor#launch(String, ExternalContext) flow executor}. This + * coordinator then typically uses a {@link FlowExecutionFactory flow execution factory} to create an object + * implementing this interface, initializing it with the requested flow definition which becomes the execution's "root" + * or top-level flow. *

    - * After execution creation, the - * {@link #start(MutableAttributeMap, ExternalContext) start} operation is - * called, which causes this execution to activate a new - * {@link FlowSession session} for its root flow definition. That session is - * then said to become the active flow. An execution - * {@link RequestContext request context} is created, the Flow's - * {@link FlowDefinition#getStartState() start state} is entered, and the - * request is processed. + * After execution creation, the {@link #start(MutableAttributeMap, ExternalContext) start} operation is called, which + * causes this execution to activate a new {@link FlowSession session} for its root flow definition. That session is + * then said to become the active flow. An execution {@link RequestContext request context} is created, the + * Flow's {@link FlowDefinition#getStartState() start state} is entered, and the request is processed. *

    - * In a distributed environment such as HTTP, after a call into this object has - * completed and control returns to the caller, this execution object (if still - * active) is typically saved out to a repository before the server request - * ends. For example it might be saved out to the HttpSession, a Database, or a - * client-side hidden form field for later restoration and manipulation. This - * execution persistence is the responsibility of the - * {@link org.springframework.webflow.execution.repository.FlowExecutionRepository flow execution repository} - * subsystem. + * In a distributed environment such as HTTP, after a call into this object has completed and control returns to the + * caller, this execution object (if still active) is typically saved out to a repository before the server request + * ends. For example it might be saved out to the HttpSession, a Database, or a client-side hidden form field for later + * restoration and manipulation. This execution persistence is the responsibility of the + * {@link org.springframework.webflow.execution.repository.FlowExecutionRepository flow execution repository} subsystem. *

    - * Subsequent requests from the client to manipuate this flow execution trigger - * restoration of this object, followed by an invocation of the - * {@link #signalEvent(String, ExternalContext) signal event} operation. The - * signalEvent operation resumes this execution by indicating what action the - * user took from within the current state; for example, the user may have - * pressed the "submit" button, or pressed "cancel". After the user - * event is processed, control again goes back to the caller and if this - * execution is still active, it is again saved out to the repository. + * Subsequent requests from the client to manipuate this flow execution trigger restoration of this object, followed by + * an invocation of the {@link #signalEvent(String, ExternalContext) signal event} operation. The signalEvent operation + * resumes this execution by indicating what action the user took from within the current state; for example, the user + * may have pressed the "submit" button, or pressed "cancel". After the user event is processed, control again goes back + * to the caller and if this execution is still active, it is again saved out to the repository. *

    - * This process continues until a client event causes this flow execution to end - * (by the root flow reaching an end state). At that time this object is no - * longer active, and is removed from the repository and discarded. + * This process continues until a client event causes this flow execution to end (by the root flow reaching an end + * state). At that time this object is no longer active, and is removed from the repository and discarded. *

    * Flow executions can have their lifecycle observed by {@link FlowExecutionListener listeners}. * @@ -83,43 +68,38 @@ import org.springframework.webflow.definition.FlowDefinition; public interface FlowExecution extends FlowExecutionContext { /** - * Start this flow execution, transitioning it to the root flow's start - * state and returning the starting view selection needed to issue an - * initial user response. Typically called by a flow executor on behalf of a - * browser client, but also from test code. + * Start this flow execution, transitioning it to the root flow's start state and returning the starting view + * selection needed to issue an initial user response. Typically called by a flow executor on behalf of a browser + * client, but also from test code. *

    * This will start the entire flow execution from scratch. - * @param input input attributes to pass to the flow, which the flow may - * choose to map into its scope + * @param input input attributes to pass to the flow, which the flow may choose to map into its scope * @param context the external context in which the starting event occured - * @return the starting view selection, a value object to be used to issue a - * suitable response to the caller - * @throws FlowExecutionException if an exception was thrown within a state - * of the flow execution during request processing + * @return the starting view selection, a value object to be used to issue a suitable response to the caller + * @throws FlowExecutionException if an exception was thrown within a state of the flow execution during request + * processing */ public ViewSelection start(MutableAttributeMap input, ExternalContext context) throws FlowExecutionException; /** - * Signal an occurrence of the specified user event in the current state of - * this executing flow. The event will be processed in full and control will - * be returned once event processing is complete. + * Signal an occurrence of the specified user event in the current state of this executing flow. The event will be + * processed in full and control will be returned once event processing is complete. * @param eventId the identifier of the user event that occured * @param context the external context in which the event occured - * @return the next view selection to render, used by the calling executor - * to issue a suitable response to the client - * @throws FlowExecutionException if an exception was thrown within a state - * of the resumed flow execution during event processing + * @return the next view selection to render, used by the calling executor to issue a suitable response to the + * client + * @throws FlowExecutionException if an exception was thrown within a state of the resumed flow execution during + * event processing */ public ViewSelection signalEvent(String eventId, ExternalContext context) throws FlowExecutionException; /** - * Refresh this flow execution, asking the current view selection to be - * reconstituted to support reissuing the last response. This is an idempotent - * operation that may be safely called on a paused execution. + * Refresh this flow execution, asking the current view selection to be reconstituted to support reissuing the last + * response. This is an idempotent operation that may be safely called on a paused execution. * @param context the externa context in which the refresh event occured * @return the current view selection for this flow execution - * @throws FlowExecutionException if an exception was thrown within a state - * of the resumed flow execution during event processing + * @throws FlowExecutionException if an exception was thrown within a state of the resumed flow execution during + * event processing */ public ViewSelection refresh(ExternalContext context) throws FlowExecutionException; } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionContext.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionContext.java index 73dcc0ba..e2d22675 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionContext.java @@ -20,21 +20,17 @@ import org.springframework.webflow.core.collection.MutableAttributeMap; import org.springframework.webflow.definition.FlowDefinition; /** - * Provides contextual information about a flow execution. A flow execution is - * an runnable instance of a {@link FlowDefinition}. In other words, it is the - * central Spring Web Flow construct for carrying out a conversation with a - * client. This immutable interface provides access to runtime information - * about the conversation, such as it's {@link #isActive() status} and - * {@link #getActiveSession() current state}. + * Provides contextual information about a flow execution. A flow execution is an runnable instance of a + * {@link FlowDefinition}. In other words, it is the central Spring Web Flow construct for carrying out a conversation + * with a client. This immutable interface provides access to runtime information about the conversation, such as it's + * {@link #isActive() status} and {@link #getActiveSession() current state}. *

    - * An object implementing this interface is also traversable from a execution - * request context (see + * An object implementing this interface is also traversable from a execution request context (see * {@link org.springframework.webflow.execution.RequestContext#getFlowExecutionContext()}). *

    - * This interface provides information that may span more than one request in a - * thread safe manner. The {@link RequestContext} interface defines a request - * specific control interface for manipulating exactly one flow execution - * locally from exactly one request. + * This interface provides information that may span more than one request in a thread safe manner. The + * {@link RequestContext} interface defines a request specific control interface for manipulating exactly one + * flow execution locally from exactly one request. * * @see FlowDefinition * @see FlowSession @@ -48,9 +44,8 @@ public interface FlowExecutionContext { /** * Returns the root flow definition associated with this executing flow. *

    - * A call to this method always returns the same flow definition -- the - * top-level "root" -- no matter what flow may actually be active (for - * example, if subflows have been spawned). + * A call to this method always returns the same flow definition -- the top-level "root" -- no matter what flow may + * actually be active (for example, if subflows have been spawned). * @return the root flow definition */ public FlowDefinition getDefinition(); @@ -58,35 +53,32 @@ public interface FlowExecutionContext { /** * Is the flow execution active? *

    - * All methods on an active flow execution context can be called - * successfully. If the flow execution is not active, a caller cannot access - * some methods such as {@link #getActiveSession()}. + * All methods on an active flow execution context can be called successfully. If the flow execution is not active, + * a caller cannot access some methods such as {@link #getActiveSession()}. * @return true if active, false if the flow execution has terminated */ public boolean isActive(); /** - * Returns the active flow session of this flow execution. The active flow - * session is the currently executing session -- it may be the "root flow" - * session, or it may be a subflow session if this flow execution has - * spawned a subflow. + * Returns the active flow session of this flow execution. The active flow session is the currently executing + * session -- it may be the "root flow" session, or it may be a subflow session if this flow execution has spawned a + * subflow. * @return the active flow session - * @throws IllegalStateException if this flow execution has not been started - * at all or if this execution has ended and is no longer actively executing + * @throws IllegalStateException if this flow execution has not been started at all or if this execution has ended + * and is no longer actively executing */ public FlowSession getActiveSession() throws IllegalStateException; /** - * Returns a mutable map for data held in "conversation scope". Conversation - * scope is a data structure that exists for the life of this flow execution - * and is accessible to all flow sessions. + * Returns a mutable map for data held in "conversation scope". Conversation scope is a data structure that exists + * for the life of this flow execution and is accessible to all flow sessions. * @return conversation scope */ public MutableAttributeMap getConversationScope(); /** - * Returns runtime execution attributes that may influence the behavior of - * flow artifacts, such as states and actions. + * Returns runtime execution attributes that may influence the behavior of flow artifacts, such as states and + * actions. * @return execution attributes */ public AttributeMap getAttributes(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionException.java index 744e83fd..669fa20d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionException.java @@ -18,13 +18,11 @@ package org.springframework.webflow.execution; import org.springframework.webflow.core.FlowException; /** - * Base class for exceptions that occur within a flow while it is executing. Can - * be used directly, but you are encouraged to create a specific subclass for a - * particular use case. + * Base class for exceptions that occur within a flow while it is executing. Can be used directly, but you are + * encouraged to create a specific subclass for a particular use case. *

    - * Execution exceptions occur at runtime when the flow is executing requests on - * behalf of a client. They signal that an execution problem occured: e.g. - * action execution failed or no transition matched the current request context. + * Execution exceptions occur at runtime when the flow is executing requests on behalf of a client. They signal that an + * execution problem occured: e.g. action execution failed or no transition matched the current request context. * * @author Keith Donald * @author Erwin Vervaet @@ -67,16 +65,15 @@ public class FlowExecutionException extends FlowException { } /** - * Returns the id of the flow definition that was executing when this - * exception occured. + * Returns the id of the flow definition that was executing when this exception occured. */ public String getFlowId() { return flowId; } /** - * Returns the id of the state definition where the exception occured. Could - * be null if no state was active at the time when the exception was thrown. + * Returns the id of the state definition where the exception occured. Could be null if no state was active at the + * time when the exception was thrown. */ public String getStateId() { return stateId; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionFactory.java index 3a7b5466..e2a98a96 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionFactory.java @@ -18,14 +18,14 @@ package org.springframework.webflow.execution; import org.springframework.webflow.definition.FlowDefinition; /** - * An abstract factory for creating flow exections. A flow execution represents - * a runtime, top-level instance of a flow definition. + * An abstract factory for creating flow exections. A flow execution represents a runtime, top-level instance of a flow + * definition. *

    - * This factory provides encapsulation of the flow execution implementation - * type, as well as its construction and assembly process. + * This factory provides encapsulation of the flow execution implementation type, as well as its construction and + * assembly process. *

    - * Flow execution factories are responsible for registering - * {@link FlowExecutionListener listeners} with the constructed flow execution. + * Flow execution factories are responsible for registering {@link FlowExecutionListener listeners} with the constructed + * flow execution. * * @see FlowExecution * @see FlowDefinition @@ -38,9 +38,9 @@ public interface FlowExecutionFactory { /** * Create a new flow execution product for the given flow definition. * @param flowDefinition the flow definition - * @return the new flow execution, fully initialized and awaiting to be - * started - * @see FlowExecution#start(org.springframework.webflow.core.collection.MutableAttributeMap, org.springframework.webflow.context.ExternalContext) + * @return the new flow execution, fully initialized and awaiting to be started + * @see FlowExecution#start(org.springframework.webflow.core.collection.MutableAttributeMap, + * org.springframework.webflow.context.ExternalContext) */ public FlowExecution createFlowExecution(FlowDefinition flowDefinition); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListener.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListener.java index 8da4969e..fd44986a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListener.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListener.java @@ -22,26 +22,21 @@ import org.springframework.webflow.definition.StateDefinition; import org.springframework.webflow.engine.FlowExecutionExceptionHandler; /** - * Interface to be implemented by objects that wish to listen and respond to the - * lifecycle of {@link FlowExecution flow executions}. + * Interface to be implemented by objects that wish to listen and respond to the lifecycle of + * {@link FlowExecution flow executions}. *

    - * An 'observer' that is very aspect like, allowing you to insert 'cross - * cutting' behavior at well-defined points within one or more well-defined flow - * execution lifecycles. + * An 'observer' that is very aspect like, allowing you to insert 'cross cutting' behavior at well-defined points within + * one or more well-defined flow execution lifecycles. *

    - * For example, one custom listener may apply security checks at the flow - * execution level, preventing a flow from starting or a state from entering if - * the curent user does not have the necessary permissions. Another listener may - * track flow execution navigation history to support bread crumbs. Another may - * perform auditing, or setup and tear down connections to a transactional - * resource. + * For example, one custom listener may apply security checks at the flow execution level, preventing a flow from + * starting or a state from entering if the curent user does not have the necessary permissions. Another listener may + * track flow execution navigation history to support bread crumbs. Another may perform auditing, or setup and tear down + * connections to a transactional resource. *

    - * Note that flow execution listeners are registered with a flow execution when - * that execution is created by a {@link FlowExecutionFactory factory} or - * restored by a - * {@link org.springframework.webflow.execution.repository.FlowExecutionRepository}. - * Typically a listener will not be registered with a flow execution at - * runtime, when the flow execution is already active. + * Note that flow execution listeners are registered with a flow execution when that execution is created by a + * {@link FlowExecutionFactory factory} or restored by a + * {@link org.springframework.webflow.execution.repository.FlowExecutionRepository}. Typically a listener will not be + * registered with a flow execution at runtime, when the flow execution is already active. * * @see FlowDefinition * @see StateDefinition @@ -56,8 +51,8 @@ import org.springframework.webflow.engine.FlowExecutionExceptionHandler; public interface FlowExecutionListener { /** - * Called when any client request is submitted to manipulate this flow - * execution. This call happens before request processing. + * Called when any client request is submitted to manipulate this flow execution. This call happens before request + * processing. * @param context the source of the event */ public void requestSubmitted(RequestContext context); @@ -69,21 +64,19 @@ public interface FlowExecutionListener { public void requestProcessed(RequestContext context); /** - * Called to indicate a new flow definition session is about to be created - * and started. Called before the session is created. An exception may be - * thrown from this method to veto the start operation. Any type of runtime - * exception can be used for this purpose. + * Called to indicate a new flow definition session is about to be created and started. Called before the session is + * created. An exception may be thrown from this method to veto the start operation. Any type of runtime exception + * can be used for this purpose. * @param context the source of the event * @param definition the flow for which a new session is starting - * @param input a mutable input map - attributes placed in this map are - * eligible for input mapping by the flow definition at startup + * @param input a mutable input map - attributes placed in this map are eligible for input mapping by the flow + * definition at startup */ public void sessionStarting(RequestContext context, FlowDefinition definition, MutableAttributeMap input); /** - * Called after a new flow session has been created but before it starts. - * Useful for setting arbitrary attributes in the session before the flow - * starts. + * Called after a new flow session has been created but before it starts. Useful for setting arbitrary attributes in + * the session before the flow starts. * @param context the source of the event * @param session the session that was created * @since 1.0.2 @@ -91,25 +84,22 @@ public interface FlowExecutionListener { public void sessionCreated(RequestContext context, FlowSession session); /** - * Called after a new flow session has started. At this point the flow's - * start state has been entered and any other startup behaviors have been - * executed. + * Called after a new flow session has started. At this point the flow's start state has been entered and any other + * startup behaviors have been executed. * @param context the source of the event * @param session the session that was started */ public void sessionStarted(RequestContext context, FlowSession session); /** - * Called when an event is signaled in the current state, but prior to any - * state transition. + * Called when an event is signaled in the current state, but prior to any state transition. * @param context the source of the event * @param event the event that occured */ public void eventSignaled(RequestContext context, Event event); /** - * Called when a state transitions, after the transition is matched but - * before the transition occurs. + * Called when a state transitions, after the transition is matched but before the transition occurs. * @param context the source of the event * @param state the proposed state to transition to * @throws EnterStateVetoException when entering the state is not allowed @@ -125,33 +115,30 @@ public interface FlowExecutionListener { public void stateEntered(RequestContext context, StateDefinition previousState, StateDefinition state); /** - * Called when a flow execution is paused, for instance when it is waiting - * for user input (after event processing). + * Called when a flow execution is paused, for instance when it is waiting for user input (after event processing). * @param context the source of the event * @param selectedView the view that will display */ public void paused(RequestContext context, ViewSelection selectedView); /** - * Called after a flow execution is successfully reactivated after pause - * (but before event processing). + * Called after a flow execution is successfully reactivated after pause (but before event processing). * @param context the source of the event */ public void resumed(RequestContext context); /** - * Called when the active flow execution session has been asked to end but - * before it has ended. + * Called when the active flow execution session has been asked to end but before it has ended. * @param context the source of the event * @param session the current active session that is ending - * @param output the flow output produced by the ending session, this map - * may be modified by this listener to affect the output returned + * @param output the flow output produced by the ending session, this map may be modified by this listener to affect + * the output returned */ public void sessionEnding(RequestContext context, FlowSession session, MutableAttributeMap output); /** - * Called when a flow execution session ends. If the ended session was the - * root session of the flow execution, the entire flow execution also ends. + * Called when a flow execution session ends. If the ended session was the root session of the flow execution, the + * entire flow execution also ends. * @param context the source of the event * @param session ending flow session * @param output final, unmodifiable output returned by the ended session @@ -159,8 +146,7 @@ public interface FlowExecutionListener { public void sessionEnded(RequestContext context, FlowSession session, AttributeMap output); /** - * Called when an exception is thrown during a flow execution, before the - * exception is handled by any registered + * Called when an exception is thrown during a flow execution, before the exception is handled by any registered * {@link FlowExecutionExceptionHandler handler}. * @param context the source of the exception * @param exception the exception that occurred diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListenerAdapter.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListenerAdapter.java index 63edcd90..6a6358e6 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListenerAdapter.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowExecutionListenerAdapter.java @@ -21,10 +21,8 @@ import org.springframework.webflow.definition.FlowDefinition; import org.springframework.webflow.definition.StateDefinition; /** - * An abstract adapter class for listeners (observers) of flow execution - * lifecycle events. The methods in this class are empty. This class exists as - * convenience for creating listener objects; subclass it and override what you - * need. + * An abstract adapter class for listeners (observers) of flow execution lifecycle events. The methods in this class are + * empty. This class exists as convenience for creating listener objects; subclass it and override what you need. * * @author Erwin Vervaet * @author Keith Donald diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSession.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSession.java index 2954f844..eca493ae 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSession.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSession.java @@ -20,44 +20,34 @@ import org.springframework.webflow.definition.FlowDefinition; import org.springframework.webflow.definition.StateDefinition; /** - * A single, local instantiation of a {@link FlowDefinition flow definition} - * launched within an overall flow execution. + * A single, local instantiation of a {@link FlowDefinition flow definition} launched within an overall flow execution. *

    - * This object maintains all instance state including session status within - * exactly one governing FlowExecution, as well as the current flow state. This - * object also acts as the local "flow scope" data model. Data in - * {@link #getScope() flow scope} lives for the life of this object and is - * cleaned up automatically when this object is destroyed. Destruction happens - * when this session enters an end state. + * This object maintains all instance state including session status within exactly one governing FlowExecution, as well + * as the current flow state. This object also acts as the local "flow scope" data model. Data in + * {@link #getScope() flow scope} lives for the life of this object and is cleaned up automatically when this object is + * destroyed. Destruction happens when this session enters an end state. *

    - * A flow session will go through several status changes during its lifecycle. - * Initially it will be {@link FlowSessionStatus#CREATED} when a new execution - * is started. + * A flow session will go through several status changes during its lifecycle. Initially it will be + * {@link FlowSessionStatus#CREATED} when a new execution is started. *

    - * After passing through the {@link FlowSessionStatus#STARTING} status, the flow - * session is activated (about to be manipulated) and its status becomes - * {@link FlowSessionStatus#ACTIVE}. In the case of a new execution session - * activation happens immediately after creation to put the "root flow" at the - * top of the stack and transition it to its start state. + * After passing through the {@link FlowSessionStatus#STARTING} status, the flow session is activated (about to be + * manipulated) and its status becomes {@link FlowSessionStatus#ACTIVE}. In the case of a new execution session + * activation happens immediately after creation to put the "root flow" at the top of the stack and transition it to its + * start state. *

    - * When control returns to the client for user think time the status is updated - * to {@link FlowSessionStatus#PAUSED}. The flow is no longer actively - * processing then, as it is stored off to a repository waiting on the user to - * resume. + * When control returns to the client for user think time the status is updated to {@link FlowSessionStatus#PAUSED}. + * The flow is no longer actively processing then, as it is stored off to a repository waiting on the user to resume. *

    - * If a flow session is pushed down in the stack because a subflow is spawned, - * its status becomes {@link FlowSessionStatus#SUSPENDED} until the subflow - * returns (ends) and is popped off the stack. The resuming flow session then - * becomes active once again. + * If a flow session is pushed down in the stack because a subflow is spawned, its status becomes + * {@link FlowSessionStatus#SUSPENDED} until the subflow returns (ends) and is popped off the stack. The resuming flow + * session then becomes active once again. *

    - * When a flow session is terminated because an EndState is reached its status - * becomes {@link FlowSessionStatus#ENDED}, which ends its life. When this - * happens the session is popped off the stack and discarded, and any allocated - * resources in "flow scope" are automatically cleaned up. + * When a flow session is terminated because an EndState is reached its status becomes {@link FlowSessionStatus#ENDED}, + * which ends its life. When this happens the session is popped off the stack and discarded, and any allocated resources + * in "flow scope" are automatically cleaned up. *

    - * Note that a flow session is in no way linked to an HTTP session. It - * just uses the familiar "session" naming convention to denote a stateful - * object. + * Note that a flow session is in no way linked to an HTTP session. It just uses the familiar "session" naming + * convention to denote a stateful object. * * @see FlowDefinition * @see FlowExecution @@ -74,41 +64,37 @@ public interface FlowSession { public FlowDefinition getDefinition(); /** - * Returns the current state of this flow session. This value changes as the - * flow executes. + * Returns the current state of this flow session. This value changes as the flow executes. */ public StateDefinition getState(); /** - * Returns the current status of this flow session. This value changes as - * the flow executes. + * Returns the current status of this flow session. This value changes as the flow executes. */ public FlowSessionStatus getStatus(); /** - * Return this session's local attributes; the basis for "flow scope" (flow - * session scope). + * Return this session's local attributes; the basis for "flow scope" (flow session scope). * @return the flow scope attributes */ public MutableAttributeMap getScope(); /** - * Returns the local "flash map". Attributes in this map are cleared out - * on the next event signaled in the flow execution, so they survive a refresh. + * Returns the local "flash map". Attributes in this map are cleared out on the next event signaled in the flow + * execution, so they survive a refresh. * @return the flash map */ public MutableAttributeMap getFlashMap(); /** - * Returns the parent flow session in the current flow execution, or - * null if there is no parent flow session. + * Returns the parent flow session in the current flow execution, or null if there is no parent flow + * session. */ public FlowSession getParent(); /** - * Returns whether this flow session is the root flow session in the ongoing - * flow execution. The root flow session does not have a parent flow - * session. + * Returns whether this flow session is the root flow session in the ongoing flow execution. The root flow session + * does not have a parent flow session. */ public boolean isRoot(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSessionStatus.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSessionStatus.java index 2b7c121c..5f3ca797 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSessionStatus.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/FlowSessionStatus.java @@ -18,9 +18,8 @@ package org.springframework.webflow.execution; import org.springframework.core.enums.StaticLabeledEnum; /** - * Type-safe enumeration of possible flow session statuses. Consult the - * JavaDoc for the {@link FlowSession} for more information on how these - * statuses are used during the life cycle of a flow session. + * Type-safe enumeration of possible flow session statuses. Consult the JavaDoc for the {@link FlowSession} for more + * information on how these statuses are used during the life cycle of a flow session. * * @see org.springframework.webflow.execution.FlowSession * @@ -30,8 +29,7 @@ import org.springframework.core.enums.StaticLabeledEnum; public class FlowSessionStatus extends StaticLabeledEnum { /** - * Initial status of a flow session; the session has been created but not - * yet activated. + * Initial status of a flow session; the session has been created but not yet activated. */ public static final FlowSessionStatus CREATED = new FlowSessionStatus(0, "Created"); @@ -46,20 +44,18 @@ public class FlowSessionStatus extends StaticLabeledEnum { public static final FlowSessionStatus ACTIVE = new FlowSessionStatus(2, "Active"); /** - * A flow session with PAUSED status is currently waiting on the user to - * signal an event. + * A flow session with PAUSED status is currently waiting on the user to signal an event. */ public static final FlowSessionStatus PAUSED = new FlowSessionStatus(3, "Paused"); /** - * A flow session that is SUSPENDED is not actively executing a flow. It is - * waiting for subflow execution to complete before continuing. + * A flow session that is SUSPENDED is not actively executing a flow. It is waiting for subflow execution to + * complete before continuing. */ public static final FlowSessionStatus SUSPENDED = new FlowSessionStatus(4, "Suspended"); /** - * A flow session that has ENDED is no longer actively executing a flow. - * This is the final status of a flow session. + * A flow session that has ENDED is no longer actively executing a flow. This is the final status of a flow session. */ public static final FlowSessionStatus ENDED = new FlowSessionStatus(5, "Ended"); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java index e7bd2bdc..67f20899 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/RequestContext.java @@ -24,45 +24,35 @@ import org.springframework.webflow.definition.StateDefinition; import org.springframework.webflow.definition.TransitionDefinition; /** - * A context for a single request to manipulate a flow execution. Allows Web - * Flow users to access contextual information about the executing request, as - * well as the governing - * {@link #getFlowExecutionContext() active flow execution}. + * A context for a single request to manipulate a flow execution. Allows Web Flow users to access contextual information + * about the executing request, as well as the governing {@link #getFlowExecutionContext() active flow execution}. *

    - * The term request is used to describe a single call (thread) into the - * flow system by an external actor to manipulate exactly one flow execution. + * The term request is used to describe a single call (thread) into the flow system by an external actor to + * manipulate exactly one flow execution. *

    - * A new instance of this object is typically created when one of the core - * operations supported by a flow execution is invoked, either - * start to launch the flow execution, signalEvent - * to resume the flow execution, or refresh to reconstitute the - * flow execution's last view selection for purposes of reissuing a user - * response. + * A new instance of this object is typically created when one of the core operations supported by a flow execution is + * invoked, either start to launch the flow execution, signalEvent to resume the flow + * execution, or refresh to reconstitute the flow execution's last view selection for purposes of + * reissuing a user response. *

    - * Once created this context object is passed around throughout flow execution - * request processing where it may be accessed and reasoned upon by SWF-internal - * artifacts such as states, user-implemented action code, and state transition - * criteria. + * Once created this context object is passed around throughout flow execution request processing where it may be + * accessed and reasoned upon by SWF-internal artifacts such as states, user-implemented action code, and state + * transition criteria. *

    - * When a call into a flow execution returns this object goes out of scope and - * is disposed of automatically. Thus a request context is an internal artifact - * used within a FlowExecution: this object is not exposed to external client + * When a call into a flow execution returns this object goes out of scope and is disposed of automatically. Thus a + * request context is an internal artifact used within a FlowExecution: this object is not exposed to external client * code, e.g. a view implementation (JSP). *

    - * The {@link #getRequestScope() requestScope} property may be used as a store - * for arbitrary data that should exist for the life of this object. - * Request-scoped data, along with all data in {@link #getFlashScope() flash scope}, - * {@link #getFlowScope() flow scope} and - * {@link #getConversationScope() conversation scope} is available for exposing + * The {@link #getRequestScope() requestScope} property may be used as a store for arbitrary data that should exist for + * the life of this object. Request-scoped data, along with all data in {@link #getFlashScope() flash scope}, + * {@link #getFlowScope() flow scope} and {@link #getConversationScope() conversation scope} is available for exposing * to view templates via a {@link #getModel() model} property. *

    - * The web flow system will ensure that a RequestContext object is local to the - * current thread. It can be safely manipulated without needing to worry about - * concurrent access. + * The web flow system will ensure that a RequestContext object is local to the current thread. It can be safely + * manipulated without needing to worry about concurrent access. *

    - * Note: this request context is in no way linked to an HTTP or Portlet request. - * It uses the familiar "request" naming convention to indicate a single call to - * manipulate a runtime execution of a flow definition. + * Note: this request context is in no way linked to an HTTP or Portlet request. It uses the familiar "request" naming + * convention to indicate a single call to manipulate a runtime execution of a flow definition. * * @author Keith Donald * @author Erwin Vervaet @@ -72,133 +62,114 @@ public interface RequestContext { /** * Returns the definition of the flow that is currently executing. * @return the flow definition for the active session - * @throws IllegalStateException if the flow execution has not been started - * at all, or if the execution has ended and is no longer actively executing + * @throws IllegalStateException if the flow execution has not been started at all, or if the execution has ended + * and is no longer actively executing */ public FlowDefinition getActiveFlow() throws IllegalStateException; /** - * Returns the current state of the executing flow. May return - * null if this flow execution is in the process of starting - * and has not yet entered its start state. - * @return the current state, or null if in the process of - * starting - * @throws IllegalStateException if this flow execution has not been started - * at all, or if this execution has ended and is no longer actively - * executing + * Returns the current state of the executing flow. May return null if this flow execution is in the + * process of starting and has not yet entered its start state. + * @return the current state, or null if in the process of starting + * @throws IllegalStateException if this flow execution has not been started at all, or if this execution has ended + * and is no longer actively executing */ public StateDefinition getCurrentState() throws IllegalStateException; /** - * Returns a mutable accessor for accessing and/or setting attributes in - * request scope. Request scoped attributes exist for the duration of - * this request only. + * Returns a mutable accessor for accessing and/or setting attributes in request scope. Request scoped attributes + * exist for the duration of this request only. * @return the request scope */ public MutableAttributeMap getRequestScope(); /** - * Returns a mutable accessor for accessing and/or setting attributes in - * flash scope. Flash scoped attributes exist untill the next event - * is signaled in the flow execution. + * Returns a mutable accessor for accessing and/or setting attributes in flash scope. Flash scoped attributes + * exist untill the next event is signaled in the flow execution. * @return the flash scope */ public MutableAttributeMap getFlashScope(); /** - * Returns a mutable accessor for accessing and/or setting attributes in - * flow scope. Flow scoped attributes exist for the life of the active - * flow session. + * Returns a mutable accessor for accessing and/or setting attributes in flow scope. Flow scoped attributes exist + * for the life of the active flow session. * @return the flow scope * @see FlowSession */ public MutableAttributeMap getFlowScope(); /** - * Returns a mutable accessor for accessing and/or setting attributes in - * conversation scope. Conversation scoped attributes exist for the life - * of the executing flow and are shared across all flow sessions. + * Returns a mutable accessor for accessing and/or setting attributes in conversation scope. Conversation scoped + * attributes exist for the life of the executing flow and are shared across all flow sessions. * @return the conversation scope * @see FlowExecutionContext */ public MutableAttributeMap getConversationScope(); /** - * Returns the immutable input parameters associated with this request into - * Spring Web Flow. The map returned is immutable and cannot be changed. + * Returns the immutable input parameters associated with this request into Spring Web Flow. The map returned is + * immutable and cannot be changed. *

    - * This is typically a convenient shortcut for accessing the - * {@link ExternalContext#getRequestParameterMap()} directly. + * This is typically a convenient shortcut for accessing the {@link ExternalContext#getRequestParameterMap()} + * directly. * @see #getExternalContext() */ public ParameterMap getRequestParameters(); /** - * Returns the external client context that originated (or triggered) this - * request. + * Returns the external client context that originated (or triggered) this request. *

    - * Acting as a facade, the returned context object provides a single point - * of access to the calling client's environment. It provides normalized - * access to attributes of the client environment without tying you to - * specific constructs within that environment. + * Acting as a facade, the returned context object provides a single point of access to the calling client's + * environment. It provides normalized access to attributes of the client environment without tying you to specific + * constructs within that environment. *

    - * In addition, this context may be downcastable to a specific context type - * for a specific client environment, such as a - * {@link org.springframework.webflow.context.servlet.ServletExternalContext} - * for servlets or a - * {@link org.springframework.webflow.context.portlet.PortletExternalContext} - * for portlets. Such downcasting will give you full access to a native - * HttpServletRequest, for example. With that said, for portability reasons - * you should avoid coupling your flow artifacts to a specific deployment - * environment when possible. - * @return the originating external context, the one that triggered the - * current execution request + * In addition, this context may be downcastable to a specific context type for a specific client environment, such + * as a {@link org.springframework.webflow.context.servlet.ServletExternalContext} for servlets or a + * {@link org.springframework.webflow.context.portlet.PortletExternalContext} for portlets. Such downcasting will + * give you full access to a native HttpServletRequest, for example. With that said, for portability reasons you + * should avoid coupling your flow artifacts to a specific deployment environment when possible. + * @return the originating external context, the one that triggered the current execution request */ public ExternalContext getExternalContext(); /** - * Returns contextual information about the flow execution itself. - * Information in this context typically spans more than one request. + * Returns contextual information about the flow execution itself. Information in this context typically spans more + * than one request. * @return the flow execution context */ public FlowExecutionContext getFlowExecutionContext(); /** - * Returns the last event signaled during this request. The event may or may - * not have caused a state transition to happen. + * Returns the last event signaled during this request. The event may or may not have caused a state transition to + * happen. * @return the last signaled event, or null if no event has been signaled yet */ public Event getLastEvent(); /** * Returns the last state transition that executed in this request. - * @return the last transition, or null if no transition has - * occured yet + * @return the last transition, or null if no transition has occured yet */ public TransitionDefinition getLastTransition(); /** - * Returns a context map for accessing arbitrary attributes about the state - * of the current request. These attributes may be used to influence flow - * execution behavior. + * Returns a context map for accessing arbitrary attributes about the state of the current request. These attributes + * may be used to influence flow execution behavior. * @return the current attributes of this request, or empty if not set */ public AttributeMap getAttributes(); /** - * Set the contextual attributes describing the state of this request. - * Overwrites any pre-existing collection. + * Set the contextual attributes describing the state of this request. Overwrites any pre-existing collection. * @param attributes the attributes */ public void setAttributes(AttributeMap attributes); /** - * Returns the data model capturing the state of this context, suitable for - * exposing to clients (mostly web views). Typically the model will contain - * the union of the data available in request, flash, session and conversation + * Returns the data model capturing the state of this context, suitable for exposing to clients (mostly web views). + * Typically the model will contain the union of the data available in request, flash, session and conversation * scope. - * @return the model that can be exposed to a client view for rendering - * purposes + * @return the model that can be exposed to a client view for rendering purposes */ public AttributeMap getModel(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/ScopeType.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/ScopeType.java index 359ebba6..c70a9150 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/ScopeType.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/ScopeType.java @@ -20,13 +20,11 @@ import org.springframework.webflow.core.collection.MutableAttributeMap; import org.springframework.webflow.definition.FlowDefinition; /** - * An enumeration of the core scope types of Spring Web Flow. Provides easy - * access to each scope by type using + * An enumeration of the core scope types of Spring Web Flow. Provides easy access to each scope by type using * {@link #getScope(RequestContext)}. *

    - * A "scope" defines a data structure for storing custom user attributes within - * a flow execution. Different scope types have different semantics in terms of - * how long attributes placed in those scope maps remain valid. + * A "scope" defines a data structure for storing custom user attributes within a flow execution. Different scope types + * have different semantics in terms of how long attributes placed in those scope maps remain valid. * * @author Keith Donald * @author Erwin Vervaet @@ -34,9 +32,8 @@ import org.springframework.webflow.definition.FlowDefinition; public abstract class ScopeType extends StaticLabeledEnum { /** - * The "request" scope type. Attributes placed in request scope exist for - * the life of the current request into the flow execution. When the request - * ends any attributes in request scope go out of scope. + * The "request" scope type. Attributes placed in request scope exist for the life of the current request into the + * flow execution. When the request ends any attributes in request scope go out of scope. */ public static final ScopeType REQUEST = new ScopeType(0, "Request") { public MutableAttributeMap getScope(RequestContext context) { @@ -45,14 +42,12 @@ public abstract class ScopeType extends StaticLabeledEnum { }; /** - * The "flash" scope type. Attributes placed in flash scope exist through - * the life of the current request and until the next user event is - * signaled in a subsequent request. When the next external user event - * is signaled flash scope is cleared. + * The "flash" scope type. Attributes placed in flash scope exist through the life of the current request and + * until the next user event is signaled in a subsequent request. When the next external user event is signaled + * flash scope is cleared. *

    - * Flash scope is typically used to store messages that should be preserved - * across refreshes of the next view state (for example, on a redirect and - * any browser refreshes). + * Flash scope is typically used to store messages that should be preserved across refreshes of the next view state + * (for example, on a redirect and any browser refreshes). */ public static final ScopeType FLASH = new ScopeType(1, "Flash") { public MutableAttributeMap getScope(RequestContext context) { @@ -61,10 +56,9 @@ public abstract class ScopeType extends StaticLabeledEnum { }; /** - * The "flow" scope type. Attributes placed in flow scope exist through the - * life of an executing flow session, representing an instance a single - * {@link FlowDefinition flow definition}. When the flow session ends any - * data in flow scope goes out of scope. + * The "flow" scope type. Attributes placed in flow scope exist through the life of an executing flow session, + * representing an instance a single {@link FlowDefinition flow definition}. When the flow session ends any data in + * flow scope goes out of scope. */ public static final ScopeType FLOW = new ScopeType(2, "Flow") { public MutableAttributeMap getScope(RequestContext context) { @@ -73,11 +67,9 @@ public abstract class ScopeType extends StaticLabeledEnum { }; /** - * The "conversation" scope type. Attributes placed in conversation scope - * are shared by all flow sessions started within a flow execution and live - * for the life of the entire flow execution (representing a single logical - * user conversation). When the governing execution ends, any data in - * conversation scope goes out of scope. + * The "conversation" scope type. Attributes placed in conversation scope are shared by all flow sessions started + * within a flow execution and live for the life of the entire flow execution (representing a single logical user + * conversation). When the governing execution ends, any data in conversation scope goes out of scope. */ public static final ScopeType CONVERSATION = new ScopeType(3, "Conversation") { public MutableAttributeMap getScope(RequestContext context) { @@ -98,11 +90,9 @@ public abstract class ScopeType extends StaticLabeledEnum { } /** - * Accessor that returns the mutable attribute map for this scope type for a - * given flow execution request context. + * Accessor that returns the mutable attribute map for this scope type for a given flow execution request context. * @param context the context representing an executing request - * @return the scope map of this type for that request, allowing attributes - * to be accessed and set + * @return the scope map of this type for that request, allowing attributes to be accessed and set */ public abstract MutableAttributeMap getScope(RequestContext context); } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/ViewSelection.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/ViewSelection.java index 954e65a4..82fd0d75 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/ViewSelection.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/ViewSelection.java @@ -19,15 +19,13 @@ import java.io.ObjectStreamException; import java.io.Serializable; /** - * Abstract base class for value objects that provide callers into a flow - * execution information about a logical response to issue and the data - * necessary to issue it. + * Abstract base class for value objects that provide callers into a flow execution information about a logical response + * to issue and the data necessary to issue it. *

    - * This class is a generic marker returned when a request into an executing flow - * has completed processing, indicating a client response needs to be issued. An - * instance of a ViewSelection subclass represents the selection of a concrete - * response type. It is expected that callers introspect the returned view - * selection instance to handle the response types they support. + * This class is a generic marker returned when a request into an executing flow has completed processing, indicating a + * client response needs to be issued. An instance of a ViewSelection subclass represents the selection of a concrete + * response type. It is expected that callers introspect the returned view selection instance to handle the response + * types they support. * * @see FlowExecution * @@ -37,14 +35,12 @@ import java.io.Serializable; public abstract class ViewSelection implements Serializable { /** - * Constant for a null or empty view selection, indicating no - * response should be issued. + * Constant for a null or empty view selection, indicating no response should be issued. */ public static final ViewSelection NULL_VIEW = new NullView(); /** - * The definition of the 'null' view selection type, indicating that no - * response should be issued. + * The definition of the 'null' view selection type, indicating that no response should be issued. */ private static final class NullView extends ViewSelection { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerHolder.java index 7ebd8f29..ce6ab22c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerHolder.java @@ -24,8 +24,7 @@ import org.springframework.webflow.definition.FlowDefinition; import org.springframework.webflow.execution.FlowExecutionListener; /** - * A holder that holds a listener plus a set of criteria defining the flows in - * which that listener applies. + * A holder that holds a listener plus a set of criteria defining the flows in which that listener applies. *

    * This is an internal helper class used by the {@link ConditionalFlowExecutionListenerLoader}. * @@ -83,15 +82,15 @@ class ConditionalFlowExecutionListenerHolder { } /** - * Determines if the listener held by this holder applies to the specified - * flow definition. Will do a logical OR between the registered criteria. + * Determines if the listener held by this holder applies to the specified flow definition. Will do a logical OR + * between the registered criteria. * @param flowDefinition the flow * @return true if yes, false otherwise */ public boolean listenerAppliesTo(FlowDefinition flowDefinition) { Iterator it = criteriaSet.iterator(); while (it.hasNext()) { - FlowExecutionListenerCriteria criteria = (FlowExecutionListenerCriteria)it.next(); + FlowExecutionListenerCriteria criteria = (FlowExecutionListenerCriteria) it.next(); if (criteria.appliesTo(flowDefinition)) { return true; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerLoader.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerLoader.java index f9bce15e..0a51cc74 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerLoader.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerLoader.java @@ -30,13 +30,12 @@ import org.springframework.webflow.definition.FlowDefinition; import org.springframework.webflow.execution.FlowExecutionListener; /** - * A flow execution listener loader that stores listeners in a list-backed data - * structure and allows for configuration of which listeners should apply to - * which flow definitions. For trivial listener loading, see + * A flow execution listener loader that stores listeners in a list-backed data structure and allows for configuration + * of which listeners should apply to which flow definitions. For trivial listener loading, see * {@link StaticFlowExecutionListenerLoader}. - * + * * @see StaticFlowExecutionListenerLoader - * + * * @author Keith Donald */ public class ConditionalFlowExecutionListenerLoader implements FlowExecutionListenerLoader { @@ -47,10 +46,8 @@ public class ConditionalFlowExecutionListenerLoader implements FlowExecutionList protected final Log logger = LogFactory.getLog(getClass()); /** - * The list of flow execution listeners containing - * {@link ConditionalFlowExecutionListenerHolder} objects. The list - * determines the conditions in which a single flow execution listener - * applies. + * The list of flow execution listeners containing {@link ConditionalFlowExecutionListenerHolder} objects. The list + * determines the conditions in which a single flow execution listener applies. */ private List listeners = new LinkedList(); @@ -74,8 +71,7 @@ public class ConditionalFlowExecutionListenerLoader implements FlowExecutionList } /** - * Add a listener that will listen to executions to flows matching the - * specified criteria. + * Add a listener that will listen to executions to flows matching the specified criteria. * @param listener the listener * @param criteria the listener criteria */ @@ -98,32 +94,27 @@ public class ConditionalFlowExecutionListenerLoader implements FlowExecutionList } /** - * Set the list of flow execution listeners with corresponding criteria. - * Allows for bean style configuration. The given map should have - * {@link FlowExecutionListener} objects as keys and Strings ("*", "flowId", - * "flowId1,flowId2") or {@link FlowExecutionListenerCriteria} - * objects as values. This will clear any listeners registered with - * this object using the addListener methods. + * Set the list of flow execution listeners with corresponding criteria. Allows for bean style configuration. The + * given map should have {@link FlowExecutionListener} objects as keys and Strings ("*", "flowId", + * "flowId1,flowId2") or {@link FlowExecutionListenerCriteria} objects as values. This will clear any listeners + * registered with this object using the addListener methods. * @param listenersWithCriteria the map of listeners and their corresponding criteria */ public void setListeners(Map listenersWithCriteria) { removeAllListeners(); - for (Iterator it = listenersWithCriteria.entrySet().iterator(); it.hasNext(); ) { - Entry entry = (Entry)it.next(); + for (Iterator it = listenersWithCriteria.entrySet().iterator(); it.hasNext();) { + Entry entry = (Entry) it.next(); Assert.isInstanceOf(FlowExecutionListener.class, entry.getKey(), "The key in the listenersWithCriteria map needs to be a FlowExecutionListener object"); - FlowExecutionListener listener = (FlowExecutionListener)entry.getKey(); + FlowExecutionListener listener = (FlowExecutionListener) entry.getKey(); FlowExecutionListenerCriteria criteria = null; if (entry.getValue() instanceof String) { - criteria = getCriteria((String)entry.getValue()); - } - else if (entry.getValue() instanceof FlowExecutionListenerCriteria) { - criteria = (FlowExecutionListenerCriteria)entry.getValue(); - } - else if (entry.getValue() != null) { - throw new IllegalArgumentException( - "The value in the listenersWithCriteria map needs to be a " + - "String or a FlowExecutionListenerCriteria object"); + criteria = getCriteria((String) entry.getValue()); + } else if (entry.getValue() instanceof FlowExecutionListenerCriteria) { + criteria = (FlowExecutionListenerCriteria) entry.getValue(); + } else if (entry.getValue() != null) { + throw new IllegalArgumentException("The value in the listenersWithCriteria map needs to be a " + + "String or a FlowExecutionListenerCriteria object"); } addListener(listener, criteria); } @@ -137,7 +128,7 @@ public class ConditionalFlowExecutionListenerLoader implements FlowExecutionList public boolean containsListener(FlowExecutionListener listener) { Iterator it = listeners.iterator(); while (it.hasNext()) { - ConditionalFlowExecutionListenerHolder h = (ConditionalFlowExecutionListenerHolder)it.next(); + ConditionalFlowExecutionListenerHolder h = (ConditionalFlowExecutionListenerHolder) it.next(); if (h.getListener().equals(listener)) { return true; } @@ -152,7 +143,7 @@ public class ConditionalFlowExecutionListenerLoader implements FlowExecutionList public void removeListener(FlowExecutionListener listener) { Iterator it = listeners.iterator(); while (it.hasNext()) { - ConditionalFlowExecutionListenerHolder h = (ConditionalFlowExecutionListenerHolder)it.next(); + ConditionalFlowExecutionListenerHolder h = (ConditionalFlowExecutionListenerHolder) it.next(); if (h.getListener().equals(listener)) { it.remove(); } @@ -183,15 +174,14 @@ public class ConditionalFlowExecutionListenerLoader implements FlowExecutionList /** * Returns the array of flow execution listeners for specified flow. - * @param flowDefinition the flow definition associated with the execution - * to be listened to + * @param flowDefinition the flow definition associated with the execution to be listened to * @return the flow execution listeners that apply */ public FlowExecutionListener[] getListeners(FlowDefinition flowDefinition) { Assert.notNull(flowDefinition, "The Flow to load listeners for cannot be null"); List listenersToAttach = new LinkedList(); for (Iterator it = listeners.iterator(); it.hasNext();) { - ConditionalFlowExecutionListenerHolder listenerHolder = (ConditionalFlowExecutionListenerHolder)it.next(); + ConditionalFlowExecutionListenerHolder listenerHolder = (ConditionalFlowExecutionListenerHolder) it.next(); if (listenerHolder.listenerAppliesTo(flowDefinition)) { listenersToAttach.add(listenerHolder.getListener()); } @@ -201,7 +191,7 @@ public class ConditionalFlowExecutionListenerLoader implements FlowExecutionList + " listeners for this execution request for flow '" + flowDefinition.getId() + "', the listeners to attach are " + StylerUtils.style(listenersToAttach)); } - return (FlowExecutionListener[])listenersToAttach.toArray(new FlowExecutionListener[listenersToAttach.size()]); + return (FlowExecutionListener[]) listenersToAttach.toArray(new FlowExecutionListener[listenersToAttach.size()]); } // internal helpers @@ -214,7 +204,7 @@ public class ConditionalFlowExecutionListenerLoader implements FlowExecutionList private ConditionalFlowExecutionListenerHolder getHolder(FlowExecutionListener listener) { Iterator it = listeners.iterator(); while (it.hasNext()) { - ConditionalFlowExecutionListenerHolder next = (ConditionalFlowExecutionListenerHolder)it.next(); + ConditionalFlowExecutionListenerHolder next = (ConditionalFlowExecutionListenerHolder) it.next(); if (next.getListener().equals(listener)) { return next; } @@ -229,8 +219,7 @@ public class ConditionalFlowExecutionListenerLoader implements FlowExecutionList protected FlowExecutionListenerCriteria getCriteria(String value) { if ("*".equals(value)) { return new FlowExecutionListenerCriteriaFactory().allFlows(); - } - else { + } else { String[] flowIds = StringUtils.commaDelimitedListToStringArray(value); for (int i = 0; i < flowIds.length; i++) { flowIds[i] = flowIds[i].trim(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteria.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteria.java index fe1e37a8..af6cf9dd 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteria.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteria.java @@ -18,11 +18,10 @@ package org.springframework.webflow.execution.factory; import org.springframework.webflow.definition.FlowDefinition; /** - * Strategy interface that determines if a flow execution listener should attach - * to executions of a specific flow definition. + * Strategy interface that determines if a flow execution listener should attach to executions of a specific flow + * definition. *

    - * This selection strategy is typically used by the - * {@link FlowExecutionListenerLoader} to determine which listeners + * This selection strategy is typically used by the {@link FlowExecutionListenerLoader} to determine which listeners * should apply to which flow definitions. * * @see org.springframework.webflow.execution.FlowExecution @@ -35,8 +34,7 @@ import org.springframework.webflow.definition.FlowDefinition; public interface FlowExecutionListenerCriteria { /** - * Do the listeners guarded by this criteria object apply to the provided - * flow definition? + * Do the listeners guarded by this criteria object apply to the provided flow definition? * @param definition the flow definition * @return true if yes, false if no */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactory.java index 47245686..cb2d28df 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerCriteriaFactory.java @@ -46,8 +46,7 @@ public class FlowExecutionListenerCriteriaFactory { } /** - * Returns a criteria that just matches a flow if it is identified by one of - * the specified ids. + * Returns a criteria that just matches a flow if it is identified by one of the specified ids. * @param flowIds the flow ids to match */ public FlowExecutionListenerCriteria flows(String[] flowIds) { @@ -55,8 +54,7 @@ public class FlowExecutionListenerCriteriaFactory { } /** - * A flow execution listener criteria implementation that matches for all - * flows. + * A flow execution listener criteria implementation that matches for all flows. */ private static class WildcardFlowExecutionListenerCriteria implements FlowExecutionListenerCriteria { @@ -70,8 +68,7 @@ public class FlowExecutionListenerCriteriaFactory { } /** - * A flow execution listener criteria implementation that matches flows with - * a specified id. + * A flow execution listener criteria implementation that matches flows with a specified id. */ private static class FlowIdFlowExecutionListenerCriteria implements FlowExecutionListenerCriteria { @@ -81,8 +78,7 @@ public class FlowExecutionListenerCriteriaFactory { private String[] flowIds; /** - * Create a new flow id matching flow execution listener criteria - * implemenation. + * Create a new flow id matching flow execution listener criteria implemenation. * @param flowId the flow id to match */ public FlowIdFlowExecutionListenerCriteria(String flowId) { @@ -91,8 +87,7 @@ public class FlowExecutionListenerCriteriaFactory { } /** - * Create a new flow id matching flow execution listener criteria - * implemenation. + * Create a new flow id matching flow execution listener criteria implemenation. * @param flowIds the flow ids to match */ public FlowIdFlowExecutionListenerCriteria(String[] flowIds) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerLoader.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerLoader.java index d718d572..18d4df18 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerLoader.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/FlowExecutionListenerLoader.java @@ -20,9 +20,8 @@ import org.springframework.webflow.execution.FlowExecutionFactory; import org.springframework.webflow.execution.FlowExecutionListener; /** - * A strategy interface for loading the set of FlowExecutionListener's that - * should apply to executions of a given flow definition. Typically used by a - * {@link FlowExecutionFactory} as part of execution creation. + * A strategy interface for loading the set of FlowExecutionListener's that should apply to executions of a given flow + * definition. Typically used by a {@link FlowExecutionFactory} as part of execution creation. * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/StaticFlowExecutionListenerLoader.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/StaticFlowExecutionListenerLoader.java index 6d14b7c2..bd86426d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/StaticFlowExecutionListenerLoader.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/factory/StaticFlowExecutionListenerLoader.java @@ -20,9 +20,8 @@ import org.springframework.webflow.definition.FlowDefinition; import org.springframework.webflow.execution.FlowExecutionListener; /** - * A simple flow execution listener loader that simply returns a static listener - * array on each invocation. For more elaborate needs see the - * {@link ConditionalFlowExecutionListenerLoader}. + * A simple flow execution listener loader that simply returns a static listener array on each invocation. For more + * elaborate needs see the {@link ConditionalFlowExecutionListenerLoader}. * * @see ConditionalFlowExecutionListenerLoader * @@ -34,24 +33,21 @@ public final class StaticFlowExecutionListenerLoader implements FlowExecutionLis * A shared listener loader instance that returns am empty listener array on each invocation. */ public static final FlowExecutionListenerLoader EMPTY_INSTANCE = new StaticFlowExecutionListenerLoader(); - + /** - * The listener array to return when {@link #getListeners(FlowDefinition)} - * is invoked. + * The listener array to return when {@link #getListeners(FlowDefinition)} is invoked. */ private final FlowExecutionListener[] listeners; /** - * Creates a new flow execution listener loader that returns an empty - * listener array on each invocation. + * Creates a new flow execution listener loader that returns an empty listener array on each invocation. */ private StaticFlowExecutionListenerLoader() { this(new FlowExecutionListener[0]); } /** - * Creates a new flow execution listener loader that returns the provided - * listener on each invocation. + * Creates a new flow execution listener loader that returns the provided listener on each invocation. * @param listener the listener */ public StaticFlowExecutionListenerLoader(FlowExecutionListener listener) { @@ -59,9 +55,8 @@ public final class StaticFlowExecutionListenerLoader implements FlowExecutionLis } /** - * Creates a new flow execution listener loader that returns the provided - * listener array on each invocation. Clients should not attempt to modify - * the passed in array as no deep copy is made. + * Creates a new flow execution listener loader that returns the provided listener array on each invocation. Clients + * should not attempt to modify the passed in array as no deep copy is made. * @param listeners the listener array. */ public StaticFlowExecutionListenerLoader(FlowExecutionListener[] listeners) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/BadlyFormattedFlowExecutionKeyException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/BadlyFormattedFlowExecutionKeyException.java index a44d1f33..975c4742 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/BadlyFormattedFlowExecutionKeyException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/BadlyFormattedFlowExecutionKeyException.java @@ -16,8 +16,7 @@ package org.springframework.webflow.execution.repository; /** - * Thrown when an encoded flow execution key is badly formatted and could not be - * parsed. + * Thrown when an encoded flow execution key is badly formatted and could not be parsed. * * @author Keith Donald * @author Erwin Vervaet @@ -30,8 +29,7 @@ public class BadlyFormattedFlowExecutionKeyException extends FlowExecutionReposi private String invalidKey; /** - * The format the string key should have been in. Could just be a - * description of that format. + * The format the string key should have been in. Could just be a description of that format. */ private String format; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionAccessException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionAccessException.java index e025657e..a9abda0a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionAccessException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionAccessException.java @@ -16,8 +16,7 @@ package org.springframework.webflow.execution.repository; /** - * Base class for exceptions that indicate a flow execution could not be - * accessed within a repository. + * Base class for exceptions that indicate a flow execution could not be accessed within a repository. * * @author Keith Donald * @author Erwin Vervaet @@ -31,8 +30,7 @@ public abstract class FlowExecutionAccessException extends FlowExecutionReposito /** * Creates a new flow execution access exception. - * @param flowExecutionKey the key of the execution that could not be - * accessed + * @param flowExecutionKey the key of the execution that could not be accessed * @param message a descriptive message */ public FlowExecutionAccessException(FlowExecutionKey flowExecutionKey, String message) { @@ -41,8 +39,7 @@ public abstract class FlowExecutionAccessException extends FlowExecutionReposito /** * Creates a new flow execution access exception. - * @param flowExecutionKey the key of the execution that could not be - * accessed + * @param flowExecutionKey the key of the execution that could not be accessed * @param message a descriptive message * @param cause the root cause of the access failure */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionKey.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionKey.java index 7ba696a1..d479099d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionKey.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionKey.java @@ -18,20 +18,17 @@ package org.springframework.webflow.execution.repository; import java.io.Serializable; /** - * A key that uniquely identifies a flow execution in a managed - * {@link FlowExecutionRepository}. Serves as a flow execution's persistent - * identity. + * A key that uniquely identifies a flow execution in a managed {@link FlowExecutionRepository}. Serves as a flow + * execution's persistent identity. *

    - * This class is abstract. The repository subsystem encapsulates the structure - * of concrete key implementations. + * This class is abstract. The repository subsystem encapsulates the structure of concrete key implementations. * * @author Keith Donald */ public abstract class FlowExecutionKey implements Serializable { /** - * Subclasses should override toString to return a parseable string form of - * the key. + * Subclasses should override toString to return a parseable string form of the key. * @see java.lang.Object#toString() * @see FlowExecutionRepository#parseFlowExecutionKey(String) */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionLock.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionLock.java index 8b29cc2b..9665fa95 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionLock.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionLock.java @@ -16,17 +16,15 @@ package org.springframework.webflow.execution.repository; /** - * A pessmistic lock to obtain exclusive rights to a flow execution. Used to - * prevent conflicts when multiple requests to manipulate a flow execution - * arrive from different threads concurrently. + * A pessmistic lock to obtain exclusive rights to a flow execution. Used to prevent conflicts when multiple requests to + * manipulate a flow execution arrive from different threads concurrently. * * @author Keith Donald */ public interface FlowExecutionLock { /** - * Acquire the flow execution lock. This method will block until the lock - * becomes available for acquisition. + * Acquire the flow execution lock. This method will block until the lock becomes available for acquisition. */ public void lock(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepository.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepository.java index 41e36acd..162d42d7 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepository.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepository.java @@ -18,16 +18,14 @@ package org.springframework.webflow.execution.repository; import org.springframework.webflow.execution.FlowExecution; /** - * Central subsystem interface responsible for the saving and restoring of flow - * executions, where each flow execution represents a state of an active flow - * definition. + * Central subsystem interface responsible for the saving and restoring of flow executions, where each flow execution + * represents a state of an active flow definition. *

    - * Flow execution repositories are responsible for managing the storage, restoration - * and removal of flow executions launched by clients of the Spring Web Flow system. + * Flow execution repositories are responsible for managing the storage, restoration and removal of flow executions + * launched by clients of the Spring Web Flow system. *

    - * When placed in a repository a {@link FlowExecution} object representing the - * state of a flow at a point in time is indexed under a unique - * {@link FlowExecutionKey}. + * When placed in a repository a {@link FlowExecution} object representing the state of a flow at a point in time is + * indexed under a unique {@link FlowExecutionKey}. * * @see FlowExecution * @see FlowExecutionKey @@ -38,107 +36,90 @@ import org.springframework.webflow.execution.FlowExecution; public interface FlowExecutionRepository { /** - * Generate a unique flow execution key to be used as the persistent - * identifier of the flow execution. This method should be called after a - * new flow execution is started and remains active; thus needing to be - * saved. The FlowExecutionKey is the execution's persistent identity. + * Generate a unique flow execution key to be used as the persistent identifier of the flow execution. This method + * should be called after a new flow execution is started and remains active; thus needing to be saved. The + * FlowExecutionKey is the execution's persistent identity. * @param flowExecution the flow execution * @return the flow execution key - * @throws FlowExecutionRepositoryException a problem occured generating the - * key + * @throws FlowExecutionRepositoryException a problem occured generating the key */ public FlowExecutionKey generateKey(FlowExecution flowExecution) throws FlowExecutionRepositoryException; /** - * Obtain the "next" flow execution key to be used as the flow - * execution's persistent identity. This method should be called after a - * existing flow execution has resumed and remains active; thus needing to - * be updated. This repository may choose to return the previous key or - * generate a new key. + * Obtain the "next" flow execution key to be used as the flow execution's persistent identity. This method should + * be called after a existing flow execution has resumed and remains active; thus needing to be updated. This + * repository may choose to return the previous key or generate a new key. * @param flowExecution the flow execution * @param previousKey the current key associated with the flow exection - * @throws FlowExecutionRepositoryException a problem occured generating the - * key + * @throws FlowExecutionRepositoryException a problem occured generating the key */ public FlowExecutionKey getNextKey(FlowExecution flowExecution, FlowExecutionKey previousKey) throws FlowExecutionRepositoryException; /** - * Return the lock for the flow execution, allowing for the lock to be - * acquired or released. + * Return the lock for the flow execution, allowing for the lock to be acquired or released. *

    - * Caution: care should be made not to allow for a deadlock situation. If - * you acquire a lock make sure you release it when you are done. + * Caution: care should be made not to allow for a deadlock situation. If you acquire a lock make sure you release + * it when you are done. *

    - * The general pattern for safely doing work against a locked conversation - * follows: + * The general pattern for safely doing work against a locked conversation follows: + * *

     	 * FlowExecutionLock lock = repository.getLock(key);
     	 * lock.lock();
     	 * try {
     	 * 	FlowExecution execution = repository.getFlowExecution(key);
     	 * 	// do work
    -	 * }
    -	 * finally {
    +	 * } finally {
     	 * 	lock.unlock();
     	 * }
     	 * 
    + * * @param key the identifier of the flow execution to lock * @return the lock - * @throws FlowExecutionRepositoryException a problem occured accessing the - * lock object + * @throws FlowExecutionRepositoryException a problem occured accessing the lock object */ public FlowExecutionLock getLock(FlowExecutionKey key) throws FlowExecutionRepositoryException; /** - * Return the FlowExecution indexed by the provided key. The - * returned flow execution represents the restored state of an executing - * flow from a point in time. This should be called to resume a persistent - * flow execution. + * Return the FlowExecution indexed by the provided key. The returned flow execution represents the + * restored state of an executing flow from a point in time. This should be called to resume a persistent flow + * execution. *

    - * Before calling this method, you should aquire the lock for the keyed - * flow execution. + * Before calling this method, you should aquire the lock for the keyed flow execution. * @param key the flow execution key - * @return the flow execution, fully hydrated and ready to signal an event - * against - * @throws FlowExecutionRepositoryException if no flow execution was indexed - * with the key provided + * @return the flow execution, fully hydrated and ready to signal an event against + * @throws FlowExecutionRepositoryException if no flow execution was indexed with the key provided */ public FlowExecution getFlowExecution(FlowExecutionKey key) throws FlowExecutionRepositoryException; /** - * Place the FlowExecution in this repository under the - * provided key. This should be called to save or update the persistent - * state of an active (but paused) flow execution. + * Place the FlowExecution in this repository under the provided key. This should be called to save + * or update the persistent state of an active (but paused) flow execution. *

    - * Before calling this method, you should aquire the lock for the keyed - * flow execution. + * Before calling this method, you should aquire the lock for the keyed flow execution. * @param key the flow execution key * @param flowExecution the flow execution - * @throws FlowExecutionRepositoryException the flow execution could not be - * stored + * @throws FlowExecutionRepositoryException the flow execution could not be stored */ public void putFlowExecution(FlowExecutionKey key, FlowExecution flowExecution) throws FlowExecutionRepositoryException; /** - * Remove the flow execution from the repository. This should be called when - * the flow execution ends (is no longer active). + * Remove the flow execution from the repository. This should be called when the flow execution ends (is no longer + * active). *

    - * Before calling this method, you should aquire the lock for the keyed - * flow execution. + * Before calling this method, you should aquire the lock for the keyed flow execution. * @param key the flow execution key - * @throws FlowExecutionRepositoryException the flow execution could not be - * removed. + * @throws FlowExecutionRepositoryException the flow execution could not be removed. */ public void removeFlowExecution(FlowExecutionKey key) throws FlowExecutionRepositoryException; /** - * Parse the string-encoded flow execution key into its object form. - * Essentially, the reverse of {@link FlowExecutionKey#toString()}. + * Parse the string-encoded flow execution key into its object form. Essentially, the reverse of + * {@link FlowExecutionKey#toString()}. * @param encodedKey the string encoded key - * @return the parsed flow execution key, the persistent identifier for - * exactly one flow execution + * @return the parsed flow execution key, the persistent identifier for exactly one flow execution */ public FlowExecutionKey parseFlowExecutionKey(String encodedKey) throws FlowExecutionRepositoryException; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepositoryException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepositoryException.java index 1b9167c7..4693babe 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepositoryException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRepositoryException.java @@ -18,9 +18,8 @@ package org.springframework.webflow.execution.repository; import org.springframework.webflow.core.FlowException; /** - * The root of the {@link FlowExecutionRepository} exception hierarchy. - * Indicates a problem occured either saving, restoring, or invalidating - * a managed flow execution. + * The root of the {@link FlowExecutionRepository} exception hierarchy. Indicates a problem occured either saving, + * restoring, or invalidating a managed flow execution. * * @author Erwin Vervaet * @author Keith Donald diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRestorationFailureException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRestorationFailureException.java index aa8fbf0e..e90f4869 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRestorationFailureException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/FlowExecutionRestorationFailureException.java @@ -16,8 +16,7 @@ package org.springframework.webflow.execution.repository; /** - * Thrown when the flow execution with the persistent identifier provided could - * not be restored. + * Thrown when the flow execution with the persistent identifier provided could not be restored. * * @author Keith Donald * @author Erwin Vervaet @@ -26,8 +25,7 @@ public class FlowExecutionRestorationFailureException extends FlowExecutionAcces /** * Creates a new flow execution restoration failure exception. - * @param flowExecutionKey the key of the execution that could not be - * restored + * @param flowExecutionKey the key of the execution that could not be restored * @param cause the root cause of the restoration failure */ public FlowExecutionRestorationFailureException(FlowExecutionKey flowExecutionKey, Exception cause) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/NoSuchFlowExecutionException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/NoSuchFlowExecutionException.java index e2136e42..05d5d441 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/NoSuchFlowExecutionException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/NoSuchFlowExecutionException.java @@ -16,9 +16,8 @@ package org.springframework.webflow.execution.repository; /** - * Thrown when the flow execution with the persistent identifier provided could - * not be found. This could occur if the execution has been removed from the - * repository and a client still has a handle to the key. + * Thrown when the flow execution with the persistent identifier provided could not be found. This could occur if the + * execution has been removed from the repository and a client still has a handle to the key. * * @author Keith Donald * @author Erwin Vervaet @@ -27,8 +26,7 @@ public class NoSuchFlowExecutionException extends FlowExecutionAccessException { /** * Creates a new no such flow execution exception. - * @param flowExecutionKey the key of the execution that could not be - * found + * @param flowExecutionKey the key of the execution that could not be found * @param cause the root cause of the failure */ public NoSuchFlowExecutionException(FlowExecutionKey flowExecutionKey, Exception cause) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/PermissionDeniedFlowExecutionAccessException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/PermissionDeniedFlowExecutionAccessException.java index c4cd0d75..aa5c061d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/PermissionDeniedFlowExecutionAccessException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/PermissionDeniedFlowExecutionAccessException.java @@ -25,8 +25,7 @@ public class PermissionDeniedFlowExecutionAccessException extends FlowExecutionA /** * Creates a new flow execution restoration exception. - * @param flowExecutionKey the key of the execution that could not be - * accessed + * @param flowExecutionKey the key of the execution that could not be accessed * @param cause the root cause of the access failure */ public PermissionDeniedFlowExecutionAccessException(FlowExecutionKey flowExecutionKey, Exception cause) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ClientContinuationFlowExecutionRepository.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ClientContinuationFlowExecutionRepository.java index 715eb3db..de952d30 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ClientContinuationFlowExecutionRepository.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ClientContinuationFlowExecutionRepository.java @@ -33,36 +33,27 @@ import org.springframework.webflow.execution.repository.support.FlowExecutionSta import org.springframework.webflow.util.Base64; /** - * Stores flow execution state client side, requiring no use of server-side - * state. + * Stores flow execution state client side, requiring no use of server-side state. *

    - * More specifically, instead of putting {@link FlowExecution} objects in a - * server-side store this repository encodes them directly into the - * continuationId of the generated {@link FlowExecutionKey}. - * When asked to load a flow execution by its key this repository decodes the - * serialized continuationId, restoring the + * More specifically, instead of putting {@link FlowExecution} objects in a server-side store this repository encodes + * them directly into the continuationId of the generated {@link FlowExecutionKey}. When asked to load a + * flow execution by its key this repository decodes the serialized continuationId, restoring the * {@link FlowExecution} object at the state it was in when encoded. *

    - * Note: currently this repository implementation does not by default support - * conversation management. This has two consequences. First, there is no - * conversation invalidation after completion, which enables automatic - * prevention of duplicate submission after a conversation has completed. - * Secondly, The contents of conversation scope will not be maintained - * across requests. Support for these features requires tracking active - * conversations using a conversation service backed by some centralized storage - * medium like a database table. If you want to have proper conversation management, - * configure this class with an appropriate conversation manager (the default + * Note: currently this repository implementation does not by default support conversation management. This has + * two consequences. First, there is no conversation invalidation after completion, which enables automatic + * prevention of duplicate submission after a conversation has completed. Secondly, The contents of conversation + * scope will not be maintained across requests. Support for these features requires tracking active conversations + * using a conversation service backed by some centralized storage medium like a database table. If you want to have + * proper conversation management, configure this class with an appropriate conversation manager (the default * conversation manager used does nothing). *

    - * Warning: storing state (a flow execution continuation) on the client entails - * a certain security risk. This implementation does not provide a secure way of - * storing state on the client, so a malicious client could reverse engineer a - * continuation and get access to possible sensitive data stored in the flow - * execution. If you need more security and still want to store continuations on - * the client, subclass this class and override the methods - * {@link #encode(FlowExecution)} and {@link #decode(String)}, implementing - * them with a secure encoding/decoding algorithm, e.g. based on public/private - * key encryption. + * Warning: storing state (a flow execution continuation) on the client entails a certain security risk. This + * implementation does not provide a secure way of storing state on the client, so a malicious client could reverse + * engineer a continuation and get access to possible sensitive data stored in the flow execution. If you need more + * security and still want to store continuations on the client, subclass this class and override the methods + * {@link #encode(FlowExecution)} and {@link #decode(String)}, implementing them with a secure encoding/decoding + * algorithm, e.g. based on public/private key encryption. * * @see Base64 * @@ -72,8 +63,7 @@ import org.springframework.webflow.util.Base64; public class ClientContinuationFlowExecutionRepository extends AbstractConversationFlowExecutionRepository { /** - * The continuation factory that will be used to create new continuations to - * be added to active conversations. + * The continuation factory that will be used to create new continuations to be added to active conversations. */ private FlowExecutionContinuationFactory continuationFactory = new SerializedFlowExecutionContinuationFactory(); @@ -84,11 +74,10 @@ public class ClientContinuationFlowExecutionRepository extends AbstractConversat public ClientContinuationFlowExecutionRepository(FlowExecutionStateRestorer executionStateRestorer) { super(executionStateRestorer, new NoOpConversationManager()); } - + /** - * Creates a new client continuation repository. Use this contructor when you want - * to use a particular conversation manager, e.g. one that does proper conversation - * management. + * Creates a new client continuation repository. Use this contructor when you want to use a particular conversation + * manager, e.g. one that does proper conversation management. * @param executionStateRestorer the transient flow execution state restorer * @param conversationManager the conversation manager for managing centralized conversational state */ @@ -116,19 +105,18 @@ public class ClientContinuationFlowExecutionRepository extends AbstractConversat if (logger.isDebugEnabled()) { logger.debug("Getting flow execution with key '" + key + "'"); } - + // note that the call to getConversationScope() below will try to obtain // the conversation identified by the key, which will fail if that conversation // is no longer managed by the conversation manager (i.e. it has expired) - - FlowExecutionContinuation continuation = decode((String)getContinuationId(key)); + + FlowExecutionContinuation continuation = decode((String) getContinuationId(key)); try { FlowExecution execution = continuation.unmarshal(); // the flow execution was deserialized so we need to restore transient // state return getExecutionStateRestorer().restoreState(execution, getConversationScope(key)); - } - catch (ContinuationUnmarshalException e) { + } catch (ContinuationUnmarshalException e) { throw new FlowExecutionRestorationFailureException(key, e); } } @@ -137,7 +125,7 @@ public class ClientContinuationFlowExecutionRepository extends AbstractConversat if (logger.isDebugEnabled()) { logger.debug("Putting flow execution '" + flowExecution + "' into repository with key '" + key + "'"); } - + // note that the call to putConversationScope() below will try to obtain // the conversation identified by the key, which will fail if that conversation // is no longer managed by the conversation manager (i.e. it has expired) @@ -157,11 +145,10 @@ public class ClientContinuationFlowExecutionRepository extends AbstractConversat } /** - * Encode given flow execution object into data that can be stored on the - * client. + * Encode given flow execution object into data that can be stored on the client. *

    - * Subclasses can override this to change the encoding algorithm. This class - * just does a BASE64 encoding of the serialized flow execution. + * Subclasses can override this to change the encoding algorithm. This class just does a BASE64 encoding of the + * serialized flow execution. * @param flowExecution the flow execution instance * @return the encoded representation */ @@ -171,12 +158,10 @@ public class ClientContinuationFlowExecutionRepository extends AbstractConversat } /** - * Decode given data, received from the client, and return the corresponding - * flow execution object. + * Decode given data, received from the client, and return the corresponding flow execution object. *

    - * Subclasses can override this to change the decoding algorithm. This class - * just does a BASE64 decoding and then deserializes the flow - * execution. + * Subclasses can override this to change the decoding algorithm. This class just does a BASE64 + * decoding and then deserializes the flow execution. * @param encodedContinuation the encoded flow execution data * @return the decoded flow execution instance */ @@ -186,8 +171,8 @@ public class ClientContinuationFlowExecutionRepository extends AbstractConversat } /** - * Conversation manager that doesn't do anything - the default. Does not support - * conversation scope or conversation invalidation. + * Conversation manager that doesn't do anything - the default. Does not support conversation scope or conversation + * invalidation. * * @author Keith Donald */ @@ -212,7 +197,7 @@ public class ClientContinuationFlowExecutionRepository extends AbstractConversat } private static class NoOpConversation implements Conversation { - + private static final ConversationId ID = new ConversationId() { public String toString() { return "NoOpConversation id"; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationCreationException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationCreationException.java index 0576b2e0..46d1f11a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationCreationException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationCreationException.java @@ -19,8 +19,7 @@ import org.springframework.webflow.execution.FlowExecution; import org.springframework.webflow.execution.repository.FlowExecutionRepositoryException; /** - * Thrown when a continuation snapshot could not be taken of flow execution - * state. + * Thrown when a continuation snapshot could not be taken of flow execution state. * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationFlowExecutionRepository.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationFlowExecutionRepository.java index 8c7d6651..d04e99c3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationFlowExecutionRepository.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationFlowExecutionRepository.java @@ -29,41 +29,32 @@ import org.springframework.webflow.util.RandomGuidUidGenerator; import org.springframework.webflow.util.UidGenerator; /** - * Stores one to many flow execution continuations (snapshots) per - * conversation, where each continuation represents a paused, restorable - * view-state of a flow execution snapshotted at a point in time. + * Stores one to many flow execution continuations (snapshots) per conversation, where each continuation + * represents a paused, restorable view-state of a flow execution snapshotted at a point in time. *

    - * The set of active user conversations are managed by a - * {@link ConversationManager} implementation, which this repository delegates - * to. + * The set of active user conversations are managed by a {@link ConversationManager} implementation, which this + * repository delegates to. *

    * This repository is responsible for: *

    *

    - * This repository implementation also provides support for conversation - * invalidation after completion, where once a logical conversation - * completes (by one of its FlowExecution's reaching an end state), the entire - * conversation (including all continuations) is invalidated. This prevents the - * possibility of duplicate submission after completion. + * This repository implementation also provides support for conversation invalidation after completion, where + * once a logical conversation completes (by one of its FlowExecution's reaching an end state), the entire conversation + * (including all continuations) is invalidated. This prevents the possibility of duplicate submission after completion. *

    - * This repository implementation should be considered when you do have to - * support browser navigational button use, e.g. you cannot lock down the - * browser and require that all navigational events to be routed explicitly - * through Spring Web Flow. + * This repository implementation should be considered when you do have to support browser navigational button use, e.g. + * you cannot lock down the browser and require that all navigational events to be routed explicitly through Spring Web + * Flow. * * @author Keith Donald */ @@ -75,8 +66,7 @@ public class ContinuationFlowExecutionRepository extends AbstractConversationFlo private static final String CONTINUATION_GROUP_ATTRIBUTE = "continuationGroup"; /** - * The continuation factory that will be used to create new continuations to - * be added to active conversations. + * The continuation factory that will be used to create new continuations to be added to active conversations. */ private FlowExecutionContinuationFactory continuationFactory = new SerializedFlowExecutionContinuationFactory(); @@ -86,16 +76,14 @@ public class ContinuationFlowExecutionRepository extends AbstractConversationFlo private UidGenerator continuationIdGenerator = new RandomGuidUidGenerator(); /** - * The maximum number of continuations that can be active per conversation. - * The default is 30, which is high enough not to interfere with the user experience - * of normal users using the back button, but low enough to avoid excessive - * resource usage or easy denial of service attacks. + * The maximum number of continuations that can be active per conversation. The default is 30, which is high enough + * not to interfere with the user experience of normal users using the back button, but low enough to avoid + * excessive resource usage or easy denial of service attacks. */ private int maxContinuations = 30; /** - * Create a new continuation based flow execution repository using given state - * restorer and conversation manager. + * Create a new continuation based flow execution repository using given state restorer and conversation manager. * @param executionStateRestorer the state restoration strategy to use * @param conversationManager the conversation manager to use */ @@ -105,17 +93,15 @@ public class ContinuationFlowExecutionRepository extends AbstractConversationFlo } /** - * Returns the continuation factory that encapsulates the construction of - * continuations stored in this repository. Defaults to - * {@link SerializedFlowExecutionContinuationFactory}. + * Returns the continuation factory that encapsulates the construction of continuations stored in this repository. + * Defaults to {@link SerializedFlowExecutionContinuationFactory}. */ public FlowExecutionContinuationFactory getContinuationFactory() { return continuationFactory; } /** - * Sets the continuation factory that encapsulates the construction of - * continuations stored in this repository. + * Sets the continuation factory that encapsulates the construction of continuations stored in this repository. */ public void setContinuationFactory(FlowExecutionContinuationFactory continuationFactory) { Assert.notNull(continuationFactory, "The continuation factory is required"); @@ -123,16 +109,16 @@ public class ContinuationFlowExecutionRepository extends AbstractConversationFlo } /** - * Returns the uid generation strategy used to generate continuation - * identifiers. Defaults to {@link RandomGuidUidGenerator}. + * Returns the uid generation strategy used to generate continuation identifiers. Defaults to + * {@link RandomGuidUidGenerator}. */ public UidGenerator getContinuationIdGenerator() { return continuationIdGenerator; } /** - * Sets the uid generation strategy used to generate unique continuation - * identifiers for {@link FlowExecutionKey flow execution keys}. + * Sets the uid generation strategy used to generate unique continuation identifiers for + * {@link FlowExecutionKey flow execution keys}. */ public void setContinuationIdGenerator(UidGenerator continuationIdGenerator) { Assert.notNull(continuationIdGenerator, "The continuation id generator is required"); @@ -140,21 +126,20 @@ public class ContinuationFlowExecutionRepository extends AbstractConversationFlo } /** - * Returns the maximum number of continuations allowed per conversation in - * this repository. + * Returns the maximum number of continuations allowed per conversation in this repository. */ public int getMaxContinuations() { return maxContinuations; } /** - * Sets the maximum number of continuations allowed per conversation in this - * repository. Use -1 for unlimited. The default is 30. + * Sets the maximum number of continuations allowed per conversation in this repository. Use -1 for unlimited. The + * default is 30. */ public void setMaxContinuations(int maxContinuations) { this.maxContinuations = maxContinuations; } - + public FlowExecution getFlowExecution(FlowExecutionKey key) { if (logger.isDebugEnabled()) { logger.debug("Getting flow execution with key '" + key + "'"); @@ -164,8 +149,7 @@ public class ContinuationFlowExecutionRepository extends AbstractConversationFlo FlowExecution execution = continuation.unmarshal(); // flow execution was deserialized, so restore transient state return getExecutionStateRestorer().restoreState(execution, getConversationScope(key)); - } - catch (ContinuationUnmarshalException e) { + } catch (ContinuationUnmarshalException e) { throw new FlowExecutionRestorationFailureException(key, e); } } @@ -178,7 +162,7 @@ public class ContinuationFlowExecutionRepository extends AbstractConversationFlo FlowExecutionContinuation continuation = continuationFactory.createContinuation(flowExecution); if (logger.isDebugEnabled()) { logger.debug("Adding new continuation to group with id " + getContinuationId(key)); - } + } continuationGroup.add(getContinuationId(key), continuation); putConversationScope(key, flowExecution.getConversationScope()); } @@ -192,15 +176,14 @@ public class ContinuationFlowExecutionRepository extends AbstractConversationFlo } /** - * Returns the continuation group associated with the governing - * conversation. + * Returns the continuation group associated with the governing conversation. * @param key the flow execution key * @return the continuation group */ FlowExecutionContinuationGroup getContinuationGroup(FlowExecutionKey key) { Conversation conversation = getConversation(key); - FlowExecutionContinuationGroup group = - (FlowExecutionContinuationGroup)conversation.getAttribute(CONTINUATION_GROUP_ATTRIBUTE); + FlowExecutionContinuationGroup group = (FlowExecutionContinuationGroup) conversation + .getAttribute(CONTINUATION_GROUP_ATTRIBUTE); if (group == null) { // setup a new continuation group for the conversation // no need to synchronize here since this code will only be executed @@ -221,8 +204,7 @@ public class ContinuationFlowExecutionRepository extends AbstractConversationFlo throws FlowExecutionRestorationFailureException { try { return getContinuationGroup(key).get(getContinuationId(key)); - } - catch (ContinuationNotFoundException e) { + } catch (ContinuationNotFoundException e) { throw new FlowExecutionRestorationFailureException(key, e); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationNotFoundException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationNotFoundException.java index 04aaebeb..69807b07 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationNotFoundException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationNotFoundException.java @@ -20,9 +20,8 @@ import java.io.Serializable; import org.springframework.webflow.execution.repository.FlowExecutionRepositoryException; /** - * Thrown when no flow execution continuation exists within a continuation - * group with a particular id. This might occur if the continuation has expired - * or was explictly invalidated but a client's browser page cache still references it. + * Thrown when no flow execution continuation exists within a continuation group with a particular id. This might occur + * if the continuation has expired or was explictly invalidated but a client's browser page cache still references it. * * @author Keith Donald * @author Erwin Vervaet diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationUnmarshalException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationUnmarshalException.java index 85dfbbce..c0a94f09 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationUnmarshalException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/ContinuationUnmarshalException.java @@ -19,8 +19,7 @@ import org.springframework.webflow.execution.FlowExecution; import org.springframework.webflow.execution.repository.FlowExecutionRepositoryException; /** - * Thrown when a FlowExecutionContinuation could not be deserialized into a - * FlowExecution. + * Thrown when a FlowExecutionContinuation could not be deserialized into a FlowExecution. * * @see FlowExecutionContinuation * @see FlowExecution diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuation.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuation.java index 6b065a9d..ae28448e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuation.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuation.java @@ -20,8 +20,7 @@ import java.io.Serializable; import org.springframework.webflow.execution.FlowExecution; /** - * A snapshot of a flow execution that can be restored from and serialized to a byte - * array. + * A snapshot of a flow execution that can be restored from and serialized to a byte array. * * @see FlowExecutionContinuationFactory * @@ -33,8 +32,7 @@ public abstract class FlowExecutionContinuation implements Serializable { /** * Restores the flow execution wrapped in this continuation. * @return the unmarshalled flow execution - * @throws ContinuationUnmarshalException when there is a problem unmarshalling - * this continuation + * @throws ContinuationUnmarshalException when there is a problem unmarshalling this continuation */ public abstract FlowExecution unmarshal() throws ContinuationUnmarshalException; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationFactory.java index d6ecbb39..08c87969 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationFactory.java @@ -18,8 +18,7 @@ package org.springframework.webflow.execution.repository.continuation; import org.springframework.webflow.execution.FlowExecution; /** - * A factory for creating different {@link FlowExecutionContinuation} - * implementations. + * A factory for creating different {@link FlowExecutionContinuation} implementations. * * @author Keith Donald * @author Erwin Vervaet diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationGroup.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationGroup.java index 69aad6e0..3e2cf891 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationGroup.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationGroup.java @@ -21,24 +21,22 @@ import java.util.LinkedList; import java.util.Map; /** - * A group of flow execution continuations. Simple typed data structure backed - * by a map and linked list. Supports expelling the oldest continuation once a - * maximum group size is met. + * A group of flow execution continuations. Simple typed data structure backed by a map and linked list. Supports + * expelling the oldest continuation once a maximum group size is met. * * @author Keith Donald */ class FlowExecutionContinuationGroup implements Serializable { /** - * A map of continuations; the key is the continuation id, and the value is - * the {@link FlowExecutionContinuation} object. + * A map of continuations; the key is the continuation id, and the value is the {@link FlowExecutionContinuation} + * object. */ private Map continuations = new HashMap(); /** - * An ordered list of continuation ids. Each continuation id represents an - * pointer to a continuation in the map. The first element is the oldest - * continuation and the last is the youngest. + * An ordered list of continuation ids. Each continuation id represents an pointer to a continuation in the map. The + * first element is the oldest continuation and the last is the youngest. */ private LinkedList continuationIds = new LinkedList(); @@ -49,13 +47,12 @@ class FlowExecutionContinuationGroup implements Serializable { /** * Creates a new flow execution continuation group. - * @param maxContinuations the maximum number of continuations that can be - * stored in this group, -1 for unlimited - */ + * @param maxContinuations the maximum number of continuations that can be stored in this group, -1 for unlimited + */ public FlowExecutionContinuationGroup(int maxContinuations) { this.maxContinuations = maxContinuations; } - + /** * Returns the count of continuations in this group. */ @@ -64,15 +61,14 @@ class FlowExecutionContinuationGroup implements Serializable { } /** - * Returns the continuation with the provided id, or - * null if no such continuation exists with that id. + * Returns the continuation with the provided id, or null if no such continuation + * exists with that id. * @param id the continuation id * @return the continuation - * @throws ContinuationNotFoundException if the id does not match a - * continuation in this group + * @throws ContinuationNotFoundException if the id does not match a continuation in this group */ public FlowExecutionContinuation get(Serializable id) throws ContinuationNotFoundException { - FlowExecutionContinuation continuation = (FlowExecutionContinuation)continuations.get(id); + FlowExecutionContinuation continuation = (FlowExecutionContinuation) continuations.get(id); if (continuation == null) { throw new ContinuationNotFoundException(id); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuation.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuation.java index b5eaec89..84c43074 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuation.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuation.java @@ -31,8 +31,8 @@ import org.springframework.util.FileCopyUtils; import org.springframework.webflow.execution.FlowExecution; /** - * A continuation implementation that is based on standard Java serialization, - * created by a {@link SerializedFlowExecutionContinuationFactory}. + * A continuation implementation that is based on standard Java serialization, created by a + * {@link SerializedFlowExecutionContinuationFactory}. * * @see SerializedFlowExecutionContinuationFactory * @@ -52,15 +52,15 @@ public class SerializedFlowExecutionContinuation extends FlowExecutionContinuati private boolean compressed; /** - * Default constructor necessary for {@link Externalizable} custom - * serialization semantics. Should not be called by application code. + * Default constructor necessary for {@link Externalizable} custom serialization semantics. Should not be called by + * application code. */ public SerializedFlowExecutionContinuation() { } /** - * Creates a new serialized flow execution continuation. This will marshall - * given flow execution into a serialized continuation form. + * Creates a new serialized flow execution continuation. This will marshall given flow execution into a serialized + * continuation form. * @param flowExecution the flow execution * @param compress whether or not the flow execution should be compressed */ @@ -71,13 +71,10 @@ public class SerializedFlowExecutionContinuation extends FlowExecutionContinuati if (compress) { flowExecutionData = compress(flowExecutionData); } - } - catch (NotSerializableException e) { - throw new ContinuationCreationException(flowExecution, - "Could not serialize flow execution; " + - "make sure all objects stored in flow or flash scope are serializable", e); - } - catch (IOException e) { + } catch (NotSerializableException e) { + throw new ContinuationCreationException(flowExecution, "Could not serialize flow execution; " + + "make sure all objects stored in flow or flash scope are serializable", e); + } catch (IOException e) { throw new ContinuationCreationException(flowExecution, "IOException thrown serializing flow execution -- this should not happen!", e); } @@ -85,8 +82,7 @@ public class SerializedFlowExecutionContinuation extends FlowExecutionContinuati } /** - * Returns whether or not the flow execution data in this continuation is - * compressed. + * Returns whether or not the flow execution data in this continuation is compressed. */ public boolean isCompressed() { return compressed; @@ -95,13 +91,11 @@ public class SerializedFlowExecutionContinuation extends FlowExecutionContinuati public FlowExecution unmarshal() throws ContinuationUnmarshalException { try { return deserialize(getFlowExecutionData()); - } - catch (IOException e) { + } catch (IOException e) { throw new ContinuationUnmarshalException( "IOException thrown deserializing the flow execution stored in this continuation -- this should not happen!", e); - } - catch (ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new ContinuationUnmarshalException( "ClassNotFoundException thrown deserializing the flow execution stored in this continuation -- " + "This should not happen! Make sure there are no classloader issues. " @@ -117,19 +111,17 @@ public class SerializedFlowExecutionContinuation extends FlowExecutionContinuati try { oos.writeObject(this); oos.flush(); - } - finally { + } finally { oos.close(); } return baos.toByteArray(); - } - catch (IOException e) { + } catch (IOException e) { throw new IllegalStateException(); } } // implementing Externalizable for custom serialization - + public void writeExternal(ObjectOutput out) throws IOException { // write out length first out.writeInt(flowExecutionData.length); @@ -146,27 +138,24 @@ public class SerializedFlowExecutionContinuation extends FlowExecutionContinuati in.readFully(flowExecutionData); compressed = in.readBoolean(); } - + // internal helpers /** - * Return the flow execution data in its raw byte[] form. Will decompress if - * necessary. + * Return the flow execution data in its raw byte[] form. Will decompress if necessary. * @return the byte array * @throws IOException a problem occured with decompression */ protected byte[] getFlowExecutionData() throws IOException { if (isCompressed()) { return decompress(flowExecutionData); - } - else { + } else { return flowExecutionData; } } /** - * Internal helper method to serialize given flow execution. Override if a - * custom serialization method is used. + * Internal helper method to serialize given flow execution. Override if a custom serialization method is used. * @param flowExecution flow execution to serialize * @return serialized flow flow execution data * @throws IOException when something goes wrong during during serialization @@ -178,15 +167,14 @@ public class SerializedFlowExecutionContinuation extends FlowExecutionContinuati oos.writeObject(flowExecution); oos.flush(); return baos.toByteArray(); - } - finally { + } finally { oos.close(); } } /** - * Internal helper method to deserialize given flow execution data. Override - * if a custom serialization method is used. + * Internal helper method to deserialize given flow execution data. Override if a custom serialization method is + * used. * @param data serialized flow flow execution data * @return deserialized flow execution * @throws IOException when something goes wrong during deserialization @@ -195,16 +183,15 @@ public class SerializedFlowExecutionContinuation extends FlowExecutionContinuati protected FlowExecution deserialize(byte[] data) throws IOException, ClassNotFoundException { ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data)); try { - return (FlowExecution)ois.readObject(); - } - finally { + return (FlowExecution) ois.readObject(); + } finally { ois.close(); } } /** - * Internal helper method to compress given flow execution data using GZIP - * compression. Override if custom compression is desired. + * Internal helper method to compress given flow execution data using GZIP compression. Override if custom + * compression is desired. */ protected byte[] compress(byte[] dataToCompress) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); @@ -212,24 +199,22 @@ public class SerializedFlowExecutionContinuation extends FlowExecutionContinuati try { gzipos.write(dataToCompress); gzipos.flush(); - } - finally { + } finally { gzipos.close(); } return baos.toByteArray(); } /** - * Internal helper method to decompress given flow execution data using GZIP - * decompression. Override if custom decompression is desired. + * Internal helper method to decompress given flow execution data using GZIP decompression. Override if custom + * decompression is desired. */ protected byte[] decompress(byte[] dataToDecompress) throws IOException { GZIPInputStream gzipin = new GZIPInputStream(new ByteArrayInputStream(dataToDecompress)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { FileCopyUtils.copy(gzipin, baos); - } - finally { + } finally { gzipin.close(); } return baos.toByteArray(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuationFactory.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuationFactory.java index 7ecf726b..e8f18d5d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuationFactory.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuationFactory.java @@ -22,8 +22,7 @@ import java.io.ObjectInputStream; import org.springframework.webflow.execution.FlowExecution; /** - * A factory that creates new instances of flow execution continuations based on - * standard Java serialization. + * A factory that creates new instances of flow execution continuations based on standard Java serialization. * * @see SerializedFlowExecutionContinuation * @@ -51,25 +50,23 @@ public class SerializedFlowExecutionContinuationFactory implements FlowExecution this.compress = compress; } - public FlowExecutionContinuation createContinuation(FlowExecution flowExecution) throws ContinuationCreationException { - return new SerializedFlowExecutionContinuation(flowExecution, compress); + public FlowExecutionContinuation createContinuation(FlowExecution flowExecution) + throws ContinuationCreationException { + return new SerializedFlowExecutionContinuation(flowExecution, compress); + } + + public FlowExecutionContinuation createContinuation(byte[] bytes) throws ContinuationUnmarshalException { + try { + ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes)); + try { + return (FlowExecutionContinuation) ois.readObject(); + } finally { + ois.close(); + } + } catch (IOException e) { + throw new ContinuationUnmarshalException("IO problem while creating a flow execution continuation", e); + } catch (ClassNotFoundException e) { + throw new ContinuationUnmarshalException("Class not found while creating a flow execution continuation", e); + } } - - public FlowExecutionContinuation createContinuation(byte[] bytes) throws ContinuationUnmarshalException { - try { - ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes)); - try { - return (FlowExecutionContinuation)ois.readObject(); - } - finally { - ois.close(); - } - } - catch (IOException e) { - throw new ContinuationUnmarshalException("IO problem while creating a flow execution continuation", e); - } - catch (ClassNotFoundException e) { - throw new ContinuationUnmarshalException("Class not found while creating a flow execution continuation", e); - } - } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractConversationFlowExecutionRepository.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractConversationFlowExecutionRepository.java index 7a4dd6fa..e7c56461 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractConversationFlowExecutionRepository.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractConversationFlowExecutionRepository.java @@ -37,16 +37,15 @@ import org.springframework.webflow.execution.repository.FlowExecutionRepositoryE import org.springframework.webflow.execution.repository.NoSuchFlowExecutionException; /** - * A convenient base class for flow execution repository implementations that delegate - * to a conversation service for managing conversations that govern the - * persistent state of paused flow executions. + * A convenient base class for flow execution repository implementations that delegate to a conversation service for + * managing conversations that govern the persistent state of paused flow executions. * * @see ConversationManager * * @author Keith Donald */ public abstract class AbstractConversationFlowExecutionRepository extends AbstractFlowExecutionRepository { - + /** * Logger, usable in subclasses */ @@ -58,8 +57,7 @@ public abstract class AbstractConversationFlowExecutionRepository extends Abstra private static final String SCOPE_ATTRIBUTE = "scope"; /** - * The conversation service to delegate to for managing conversations - * initiated by this repository. + * The conversation service to delegate to for managing conversations initiated by this repository. */ private ConversationManager conversationManager; @@ -89,15 +87,15 @@ public abstract class AbstractConversationFlowExecutionRepository extends Abstra Assert.notNull(conversationManager, "The conversation manager is required"); this.conversationManager = conversationManager; } - + public FlowExecutionKey generateKey(FlowExecution flowExecution) { // we need to generate a key for a new flow execution, so a new conversation has // started ConversationParameters parameters = createConversationParameters(flowExecution); Conversation conversation = conversationManager.beginConversation(parameters); onBegin(conversation); - FlowExecutionKey key = - new CompositeFlowExecutionKey(conversation.getId(), generateContinuationId(flowExecution)); + FlowExecutionKey key = new CompositeFlowExecutionKey(conversation.getId(), + generateContinuationId(flowExecution)); if (logger.isDebugEnabled()) { logger.debug("Generated new key for flow execution '" + flowExecution + "': '" + key + "'"); } @@ -105,14 +103,14 @@ public abstract class AbstractConversationFlowExecutionRepository extends Abstra } public FlowExecutionKey getNextKey(FlowExecution flowExecution, FlowExecutionKey previousKey) { - CompositeFlowExecutionKey key = (CompositeFlowExecutionKey)previousKey; + CompositeFlowExecutionKey key = (CompositeFlowExecutionKey) previousKey; // the conversation id remains the same for the life of the flow execution // but the continuation id changes - FlowExecutionKey nextKey = - new CompositeFlowExecutionKey(key.getConversationId(), generateContinuationId(flowExecution)); + FlowExecutionKey nextKey = new CompositeFlowExecutionKey(key.getConversationId(), + generateContinuationId(flowExecution)); if (logger.isDebugEnabled()) { - logger.debug("Generated next key for flow execution '" + flowExecution + "': '" + nextKey + "'; " + - "previous key was '" + key + "'"); + logger.debug("Generated next key for flow execution '" + flowExecution + "': '" + nextKey + "'; " + + "previous key was '" + key + "'"); } return nextKey; } @@ -130,7 +128,7 @@ public abstract class AbstractConversationFlowExecutionRepository extends Abstra if (logger.isDebugEnabled()) { logger.debug("Removing flow execution with key '" + key + "' from repository"); } - + // end the governing conversation Conversation conversation = getConversation(key); conversation.end(); @@ -139,39 +137,35 @@ public abstract class AbstractConversationFlowExecutionRepository extends Abstra public FlowExecutionKey parseFlowExecutionKey(String encodedKey) throws FlowExecutionRepositoryException { if (!StringUtils.hasText(encodedKey)) { - throw new BadlyFormattedFlowExecutionKeyException(encodedKey, + throw new BadlyFormattedFlowExecutionKeyException(encodedKey, "The string encoded flow execution key is required"); } - + String[] keyParts = CompositeFlowExecutionKey.keyParts(encodedKey); - + // parse out the conversation id ConversationId conversationId; try { conversationId = conversationManager.parseConversationId(keyParts[0]); + } catch (ConversationException e) { + throw new BadlyFormattedFlowExecutionKeyException(encodedKey, "The conversation id '" + keyParts[0] + + "' contained in the composite flow execution key '" + encodedKey + "' is invalid", e); } - catch (ConversationException e) { - throw new BadlyFormattedFlowExecutionKeyException(encodedKey, - "The conversation id '" + keyParts[0] + "' contained in the composite flow execution key '" - + encodedKey + "' is invalid", e); - } - + // parse out the continuation id Serializable continuationId; try { continuationId = parseContinuationId(keyParts[1]); + } catch (FlowExecutionRepositoryException e) { + throw new BadlyFormattedFlowExecutionKeyException(encodedKey, "The continuation id '" + keyParts[1] + + "' contained in the composite flow execution key '" + encodedKey + "' is invalid", e); } - catch (FlowExecutionRepositoryException e) { - throw new BadlyFormattedFlowExecutionKeyException(encodedKey, - "The continuation id '" + keyParts[1] + "' contained in the composite flow execution key '" - + encodedKey + "' is invalid", e); - } - + if (logger.isDebugEnabled()) { logger.debug("Parsed encoded flow execution key '" + encodedKey + "', extracted conversation id '" + conversationId + "' and continuation id '" + continuationId + "'"); } - + return new CompositeFlowExecutionKey(conversationId, continuationId); } @@ -181,8 +175,7 @@ public abstract class AbstractConversationFlowExecutionRepository extends Abstra * Factory method that maps a new flow execution to a descriptive * {@link ConversationParameters conversation parameters} object. * @param flowExecution the new flow execution - * @return the conversation parameters object to pass to the conversation - * manager when the conversation is started + * @return the conversation parameters object to pass to the conversation manager when the conversation is started */ protected ConversationParameters createConversationParameters(FlowExecution flowExecution) { FlowDefinition flow = flowExecution.getDefinition(); @@ -190,19 +183,16 @@ public abstract class AbstractConversationFlowExecutionRepository extends Abstra } /** - * An "on begin conversation" callback, allowing for insertion of custom - * logic after a new conversation has begun. + * An "on begin conversation" callback, allowing for insertion of custom logic after a new conversation has begun. * This implementation is emtpy. * @param conversation the conversation that has begun */ protected void onBegin(Conversation conversation) { } - + /** - * An "on conversation end" callback, allowing for insertion of custom logic - * after a conversation has ended (it's {@link Conversation#end()} method has been - * called). - * This implementation is empty. + * An "on conversation end" callback, allowing for insertion of custom logic after a conversation has ended (it's + * {@link Conversation#end()} method has been called). This implementation is empty. * @param conversation the conversation that has ended */ protected void onEnd(Conversation conversation) { @@ -214,7 +204,7 @@ public abstract class AbstractConversationFlowExecutionRepository extends Abstra * @return the conversationId key part */ protected ConversationId getConversationId(FlowExecutionKey key) { - return ((CompositeFlowExecutionKey)key).getConversationId(); + return ((CompositeFlowExecutionKey) key).getConversationId(); } /** @@ -223,40 +213,35 @@ public abstract class AbstractConversationFlowExecutionRepository extends Abstra * @return the continuation id key part */ protected Serializable getContinuationId(FlowExecutionKey key) { - return ((CompositeFlowExecutionKey)key).getContinuationId(); + return ((CompositeFlowExecutionKey) key).getContinuationId(); } /** - * Returns the conversation governing the execution of the - * {@link FlowExecution} with the provided key. + * Returns the conversation governing the execution of the {@link FlowExecution} with the provided key. * @param key the flow execution key * @return the governing conversation - * @throws NoSuchFlowExecutionException when the conversation for identified - * flow execution cannot be found + * @throws NoSuchFlowExecutionException when the conversation for identified flow execution cannot be found */ protected Conversation getConversation(FlowExecutionKey key) throws NoSuchFlowExecutionException { try { return getConversationManager().getConversation(getConversationId(key)); - } - catch (NoSuchConversationException e) { + } catch (NoSuchConversationException e) { throw new NoSuchFlowExecutionException(key, e); } } /** - * Returns the "conversation scope" for the flow execution with the - * key provided. This is mainly useful for reinitialisation of a flow execution - * after restoration from the repository. + * Returns the "conversation scope" for the flow execution with the key provided. This is mainly useful for + * reinitialisation of a flow execution after restoration from the repository. * @param key the flow execution key * @return the execution's conversation scope */ protected MutableAttributeMap getConversationScope(FlowExecutionKey key) { - return (MutableAttributeMap)getConversation(key).getAttribute(SCOPE_ATTRIBUTE); + return (MutableAttributeMap) getConversation(key).getAttribute(SCOPE_ATTRIBUTE); } /** - * Sets the conversation scope attribute for the flow execution with the key - * provided. + * Sets the conversation scope attribute for the flow execution with the key provided. * @param key the flow execution key * @param scope the execution's conversation scope */ @@ -268,8 +253,7 @@ public abstract class AbstractConversationFlowExecutionRepository extends Abstra // abstract template methods /** - * Template method used to generate a new continuation id for given flow - * execution. Subclasses must override. + * Template method used to generate a new continuation id for given flow execution. Subclasses must override. * @param flowExecution the flow execution * @return the continuation id */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractFlowExecutionRepository.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractFlowExecutionRepository.java index 50ccb15d..e8e7b57e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractFlowExecutionRepository.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/AbstractFlowExecutionRepository.java @@ -21,26 +21,22 @@ import org.springframework.webflow.execution.FlowExecutionFactory; import org.springframework.webflow.execution.repository.FlowExecutionRepository; /** - * Abstract base class for flow execution repository implementations. Does not - * make any assumptions about the storage medium used to store active flow - * executions. Mandates the use of a {@link FlowExecutionStateRestorer}, used - * to rehydrate a flow execution after it has been obtained from storage - * from resume. + * Abstract base class for flow execution repository implementations. Does not make any assumptions about the storage + * medium used to store active flow executions. Mandates the use of a {@link FlowExecutionStateRestorer}, used to + * rehydrate a flow execution after it has been obtained from storage from resume. *

    - * The configured {@link FlowExecutionStateRestorer} should be compatible - * with the chosen {@link FlowExecution} implementation and is configuration - * as done by a {@link FlowExecutionFactory} (listeners, execution attributes, ...). + * The configured {@link FlowExecutionStateRestorer} should be compatible with the chosen {@link FlowExecution} + * implementation and is configuration as done by a {@link FlowExecutionFactory} (listeners, execution attributes, ...). * * @author Erwin Vervaet */ public abstract class AbstractFlowExecutionRepository implements FlowExecutionRepository { /** - * The strategy for restoring transient flow execution state after - * obtaining it from storage. + * The strategy for restoring transient flow execution state after obtaining it from storage. */ private FlowExecutionStateRestorer executionStateRestorer; - + /** * Constructor for use in subclasses. * @param executionStateRestorer the transient flow execution state restorer @@ -50,22 +46,18 @@ public abstract class AbstractFlowExecutionRepository implements FlowExecutionRe } /** - * Returns the strategy for restoring transient flow execution state after - * obtaining it from storage. + * Returns the strategy for restoring transient flow execution state after obtaining it from storage. * @return the transient flow execution state restorer */ protected FlowExecutionStateRestorer getExecutionStateRestorer() { return executionStateRestorer; } - + /** - * Sets the strategy for restoring transient flow execution state after - * obtaining it from storage. - * @param executionStateRestorer the transient flow execution state restorer, - * may not be null + * Sets the strategy for restoring transient flow execution state after obtaining it from storage. + * @param executionStateRestorer the transient flow execution state restorer, may not be null */ - private void setExecutionStateRestorer( - FlowExecutionStateRestorer executionStateRestorer) { + private void setExecutionStateRestorer(FlowExecutionStateRestorer executionStateRestorer) { Assert.notNull(executionStateRestorer, "The flow execution state restorer is required"); this.executionStateRestorer = executionStateRestorer; } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/CompositeFlowExecutionKey.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/CompositeFlowExecutionKey.java index abd8bc77..a2b4518c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/CompositeFlowExecutionKey.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/CompositeFlowExecutionKey.java @@ -27,15 +27,12 @@ import org.springframework.webflow.execution.repository.continuation.FlowExecuti /** * A flow execution key consisting of two parts: *

      - *
    1. A conversationId, identifying an active conversation managed by a - * {@link ConversationManager}. - *
    2. A continuationId, identifying a restorable - * {@link FlowExecutionContinuation} within a continuation group governed by - * that conversation. + *
    3. A conversationId, identifying an active conversation managed by a {@link ConversationManager}. + *
    4. A continuationId, identifying a restorable {@link FlowExecutionContinuation} within a continuation group + * governed by that conversation. *
    *

    - * This key is used to restore a FlowExecution from a conversation-service - * backed store. + * This key is used to restore a FlowExecution from a conversation-service backed store. * * @see ConversationManager * @see FlowExecutionContinuation @@ -43,7 +40,7 @@ import org.springframework.webflow.execution.repository.continuation.FlowExecuti * @author Keith Donald */ class CompositeFlowExecutionKey extends FlowExecutionKey { - + /** * The default conversation id prefix delimiter ("_c"). */ @@ -55,11 +52,10 @@ class CompositeFlowExecutionKey extends FlowExecutionKey { private static final String CONTINUATION_ID_PREFIX = "_k"; /** - * The format of the default string-encoded form, as returned - * by toString(). + * The format of the default string-encoded form, as returned by toString(). */ - private static final String FORMAT = - CONVERSATION_ID_PREFIX + "" + CONTINUATION_ID_PREFIX + ""; + private static final String FORMAT = CONVERSATION_ID_PREFIX + "" + CONTINUATION_ID_PREFIX + + ""; /** * The conversation id. @@ -101,7 +97,7 @@ class CompositeFlowExecutionKey extends FlowExecutionKey { if (!(obj instanceof CompositeFlowExecutionKey)) { return false; } - CompositeFlowExecutionKey other = (CompositeFlowExecutionKey)obj; + CompositeFlowExecutionKey other = (CompositeFlowExecutionKey) obj; return conversationId.equals(other.conversationId) && continuationId.equals(other.continuationId); } @@ -110,18 +106,17 @@ class CompositeFlowExecutionKey extends FlowExecutionKey { } public String toString() { - return new StringBuffer().append(CONVERSATION_ID_PREFIX).append(getConversationId()) - .append(CONTINUATION_ID_PREFIX).append(getContinuationId()).toString(); + return new StringBuffer().append(CONVERSATION_ID_PREFIX).append(getConversationId()).append( + CONTINUATION_ID_PREFIX).append(getContinuationId()).toString(); } - + // static helpers /** - * Helper that splits the string-form of an instance of this class into its - * "parts" so the parts can be easily parsed. + * Helper that splits the string-form of an instance of this class into its "parts" so the parts can be easily + * parsed. * @param encodedKey the string-encoded composite flow execution key - * @return the composite key parts as a String array (conversationId = 0, - * continuationId = 1) + * @return the composite key parts as a String array (conversationId = 0, continuationId = 1) */ public static String[] keyParts(String encodedKey) throws BadlyFormattedFlowExecutionKeyException { if (!encodedKey.startsWith(CONVERSATION_ID_PREFIX)) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/ConversationBackedFlowExecutionLock.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/ConversationBackedFlowExecutionLock.java index f31dd7c4..9fe89106 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/ConversationBackedFlowExecutionLock.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/ConversationBackedFlowExecutionLock.java @@ -20,13 +20,10 @@ import org.springframework.webflow.conversation.ConversationManager; import org.springframework.webflow.execution.repository.FlowExecutionLock; /** - * A flow execution lock that locks a conversation managed by a - * {@link ConversationManager}. + * A flow execution lock that locks a conversation managed by a {@link ConversationManager}. *

    - * This implementation ensures multiple threads cannot manipulate the same - * conversation at the same time. The locked conversation is the sole gateway to - * a flow execution, and a lock on it prevents access to any associated - * execution. + * This implementation ensures multiple threads cannot manipulate the same conversation at the same time. The locked + * conversation is the sole gateway to a flow execution, and a lock on it prevents access to any associated execution. * * @see ConversationManager * @see Conversation diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/FlowExecutionStateRestorer.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/FlowExecutionStateRestorer.java index 5e11bb07..b7f70552 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/FlowExecutionStateRestorer.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/FlowExecutionStateRestorer.java @@ -19,8 +19,8 @@ import org.springframework.webflow.core.collection.MutableAttributeMap; import org.springframework.webflow.execution.FlowExecution; /** - * A support strategy used by repositories that serialize flow executions to - * restore transient execution state after deserialization. + * A support strategy used by repositories that serialize flow executions to restore transient execution state after + * deserialization. * * @author Keith Donald */ @@ -29,10 +29,9 @@ public interface FlowExecutionStateRestorer { /** * Restore the transient state of the flow execution. * @param flowExecution the (potentially deserialized) flow execution - * @param conversationScope the execution's conversation scope, which is - * typically not part of the serialized form since it could be shared - * by multiple physical flow execution copies all sharing the - * same logical conversation + * @param conversationScope the execution's conversation scope, which is typically not part of the serialized form + * since it could be shared by multiple physical flow execution copies all sharing the same logical + * conversation * @return the restored flow execution */ public FlowExecution restoreState(FlowExecution flowExecution, MutableAttributeMap conversationScope); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/InvalidContinuationIdException.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/InvalidContinuationIdException.java index 253a1944..623afe8e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/InvalidContinuationIdException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/InvalidContinuationIdException.java @@ -20,9 +20,8 @@ import java.io.Serializable; import org.springframework.webflow.execution.repository.FlowExecutionRepositoryException; /** - * Thrown when no flow execution continuation exists with the provided id. - * This might occur if the continuation has expired or was explictly invalidated - * but a client's browser page cache still references it. + * Thrown when no flow execution continuation exists with the provided id. This might occur if the continuation has + * expired or was explictly invalidated but a client's browser page cache still references it. * * @author Keith Donald * @author Erwin Vervaet diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/SimpleFlowExecutionRepository.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/SimpleFlowExecutionRepository.java index 5562320d..bf64a329 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/SimpleFlowExecutionRepository.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/repository/support/SimpleFlowExecutionRepository.java @@ -26,24 +26,18 @@ import org.springframework.webflow.util.RandomGuidUidGenerator; import org.springframework.webflow.util.UidGenerator; /** - * Conversation manager based flow execution repository that stores - * exactly one flow execution per conversation. + * Conversation manager based flow execution repository that stores exactly one flow execution per conversation. *

    - * It is important to note that by default use of this repository does not - * allow for duplicate submission in conjunction with browser navigational buttons - * (such as the back button). Specifically, if you attempt to "go back" and resubmit, - * the continuation id stored on the page in your browser history will not - * match the continuation id of the flow execution entry and access to the - * conversation will be disallowed. This is because the - * continuationId changes on each request to consistently prevent - * the possibility of duplicate submission ({@link #setAlwaysGenerateNewNextKey(boolean)}). + * It is important to note that by default use of this repository does not allow for duplicate submission in + * conjunction with browser navigational buttons (such as the back button). Specifically, if you attempt to "go back" + * and resubmit, the continuation id stored on the page in your browser history will not match the continuation + * id of the flow execution entry and access to the conversation will be disallowed. This is because the + * continuationId changes on each request to consistently prevent the possibility of duplicate submission ({@link #setAlwaysGenerateNewNextKey(boolean)}). *

    - * This repository is specifically designed to be 'simple': incurring minimal - * resources and overhead, as only one {@link FlowExecution} is stored per - * conversation. This repository implementation should only be used - * when you do not have to support browser navigational button use, e.g. you - * lock down the browser and require that all navigational events to be routed - * explicitly through Spring Web Flow. + * This repository is specifically designed to be 'simple': incurring minimal resources and overhead, as only one + * {@link FlowExecution} is stored per conversation. This repository implementation should only be used when you + * do not have to support browser navigational button use, e.g. you lock down the browser and require that all + * navigational events to be routed explicitly through Spring Web Flow. * * @author Erwin Vervaet * @author Keith Donald @@ -56,11 +50,11 @@ public class SimpleFlowExecutionRepository extends AbstractConversationFlowExecu private static final String FLOW_EXECUTION_ENTRY_ATTRIBUTE = "flowExecutionEntry"; /** - * Flag to indicate whether or not a new flow execution key should always be - * generated before each put call. Default is true. + * Flag to indicate whether or not a new flow execution key should always be generated before each put call. Default + * is true. */ private boolean alwaysGenerateNewNextKey = true; - + /** * The uid generation strategy to use. */ @@ -77,33 +71,31 @@ public class SimpleFlowExecutionRepository extends AbstractConversationFlowExecu } /** - * Returns whether or not a new flow execution key should always be - * generated before each put call. Default is true. + * Returns whether or not a new flow execution key should always be generated before each put call. Default is true. */ public boolean isAlwaysGenerateNewNextKey() { return alwaysGenerateNewNextKey; } /** - * Sets a flag indicating if a new {@link FlowExecutionKey} should always be - * generated before each put call. By setting this to false a FlowExecution - * can remain identified by the same key throughout its life. + * Sets a flag indicating if a new {@link FlowExecutionKey} should always be generated before each put call. By + * setting this to false a FlowExecution can remain identified by the same key throughout its life. */ public void setAlwaysGenerateNewNextKey(boolean alwaysGenerateNewNextKey) { this.alwaysGenerateNewNextKey = alwaysGenerateNewNextKey; } /** - * Returns the uid generation strategy used to generate continuation - * identifiers. Defaults to {@link RandomGuidUidGenerator}. + * Returns the uid generation strategy used to generate continuation identifiers. Defaults to + * {@link RandomGuidUidGenerator}. */ public UidGenerator getContinuationIdGenerator() { return continuationIdGenerator; } /** - * Sets the uid generation strategy used to generate unique continuation - * identifiers for {@link FlowExecutionKey flow execution keys}. + * Sets the uid generation strategy used to generate unique continuation identifiers for + * {@link FlowExecutionKey flow execution keys}. */ public void setContinuationIdGenerator(UidGenerator continuationIdGenerator) { Assert.notNull(continuationIdGenerator, "The continuation id generator is required"); @@ -113,8 +105,7 @@ public class SimpleFlowExecutionRepository extends AbstractConversationFlowExecu public FlowExecutionKey getNextKey(FlowExecution flowExecution, FlowExecutionKey previousKey) { if (isAlwaysGenerateNewNextKey()) { return super.getNextKey(flowExecution, previousKey); - } - else { + } else { return previousKey; } } @@ -129,8 +120,7 @@ public class SimpleFlowExecutionRepository extends AbstractConversationFlowExecu // it could be that the entry was serialized out and read back in, so // we need to restore transient flow execution state return getExecutionStateRestorer().restoreState(execution, getConversationScope(key)); - } - catch (InvalidContinuationIdException e) { + } catch (InvalidContinuationIdException e) { throw new PermissionDeniedFlowExecutionAccessException(key, e); } } @@ -152,15 +142,15 @@ public class SimpleFlowExecutionRepository extends AbstractConversationFlowExecu protected Serializable parseContinuationId(String encodedId) { return continuationIdGenerator.parseUid(encodedId); } - + // internal helpers /** * Lookup the entry for keyed flow execution in the governing conversation. */ private FlowExecutionEntry getEntry(FlowExecutionKey key) { - FlowExecutionEntry entry = - (FlowExecutionEntry)getConversation(key).getAttribute(FLOW_EXECUTION_ENTRY_ATTRIBUTE); + FlowExecutionEntry entry = (FlowExecutionEntry) getConversation(key).getAttribute( + FLOW_EXECUTION_ENTRY_ATTRIBUTE); if (entry == null) { throw new IllegalStateException("No '" + FLOW_EXECUTION_ENTRY_ATTRIBUTE + "' attribute present in the governing conversation: " @@ -179,8 +169,8 @@ public class SimpleFlowExecutionRepository extends AbstractConversationFlowExecu } /** - * Simple holder for a flow execution. In order to access the held flow - * execution you must present a valid continuationId. + * Simple holder for a flow execution. In order to access the held flow execution you must present a valid + * continuationId. * * @author Keith Donald */ @@ -210,8 +200,8 @@ public class SimpleFlowExecutionRepository extends AbstractConversationFlowExecu * Access the wrapped flow execution, using given continuation id as a password. * @param continuationId the continuation id to match * @return the flow execution - * @throws InvalidContinuationIdException given continuation id does not match the - * continuation id stored in this entry + * @throws InvalidContinuationIdException given continuation id does not match the continuation id stored in + * this entry */ public FlowExecution access(Serializable continuationId) throws InvalidContinuationIdException { if (!this.continuationId.equals(continuationId)) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/support/ApplicationView.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/support/ApplicationView.java index 9dc49288..4444c726 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/support/ApplicationView.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/support/ApplicationView.java @@ -22,8 +22,8 @@ import org.springframework.util.ObjectUtils; import org.springframework.webflow.execution.ViewSelection; /** - * Concrete response type that requests the rendering of a local, internal - * application view resource such as a JSP, Velocity, or FreeMarker template. + * Concrete response type that requests the rendering of a local, internal application view resource such as a JSP, + * Velocity, or FreeMarker template. *

    * This is typically the most common type of view selection. * @@ -33,26 +33,22 @@ import org.springframework.webflow.execution.ViewSelection; public final class ApplicationView extends ViewSelection { /** - * The name of the view (or page or other response) to render. This name may - * identify a logical view resource or may be a physical - * path to an internal view template. + * The name of the view (or page or other response) to render. This name may identify a logical view + * resource or may be a physical path to an internal view template. */ private final String viewName; /** - * A map of the application data to make available to the view for - * rendering. + * A map of the application data to make available to the view for rendering. */ private final Map model; /** * Creates a new application view. - * @param viewName the name (or resource identifier) of the view that should - * be rendered - * @param model the map of application model data to make available to the - * view during rendering; entries consist of model names (Strings) to model - * objects (Objects), model entries may not be null, but the model Map may - * be null if there is no model data + * @param viewName the name (or resource identifier) of the view that should be rendered + * @param model the map of application model data to make available to the view during rendering; entries consist of + * model names (Strings) to model objects (Objects), model entries may not be null, but the model Map may be null if + * there is no model data */ public ApplicationView(String viewName, Map model) { if (model == null) { @@ -70,8 +66,8 @@ public final class ApplicationView extends ViewSelection { } /** - * Return the view's application model that should be made available during - * the rendering process. Never returns null. The returned map is unmodifiable. + * Return the view's application model that should be made available during the rendering process. Never returns + * null. The returned map is unmodifiable. */ public Map getModel() { return Collections.unmodifiableMap(model); @@ -81,7 +77,7 @@ public final class ApplicationView extends ViewSelection { if (!(o instanceof ApplicationView)) { return false; } - ApplicationView other = (ApplicationView)o; + ApplicationView other = (ApplicationView) o; return ObjectUtils.nullSafeEquals(viewName, other.viewName) && model.equals(other.model); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/support/EventFactorySupport.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/support/EventFactorySupport.java index 29ef953d..7b6b8b81 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/support/EventFactorySupport.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/support/EventFactorySupport.java @@ -22,9 +22,8 @@ import org.springframework.webflow.execution.Event; /** * A convenience support class assisting in the creation of {@link Event} objects. *

    - * This class can be used as a simple utility class when you need to create - * common event objects. Alternatively you could extend it as a base support class - * when creating custom event factories. + * This class can be used as a simple utility class when you need to create common event objects. Alternatively you + * could extend it as a base support class when creating custom event factories. * * @author Keith Donald * @author Erwin Vervaet @@ -65,7 +64,7 @@ public class EventFactorySupport { * The default 'result' event attribute name ("result"). */ private static final String RESULT_ATTRIBUTE_NAME = "result"; - + /** * The success event identifier. */ @@ -166,9 +165,8 @@ public class EventFactorySupport { } /** - * Returns a "success" event with the provided result object as an - * attribute. The result object is identified by the attribute name - * {@link #getResultAttributeName()}. + * Returns a "success" event with the provided result object as an attribute. The result object is identified by the + * attribute name {@link #getResultAttributeName()}. * @param source the source of the event * @param result the action success result */ @@ -187,8 +185,8 @@ public class EventFactorySupport { /** * Returns an "error" event caused by the provided exception. * @param source the source of the event - * @param e the exception that caused the error event, to be put as an - * event attribute under the name {@link #getExceptionAttributeName()} + * @param e the exception that caused the error event, to be put as an event attribute under the name + * {@link #getExceptionAttributeName()} */ public Event error(Object source, Exception e) { return event(source, getErrorEventId(), getExceptionAttributeName(), e); @@ -219,8 +217,7 @@ public class EventFactorySupport { public Event event(Object source, boolean booleanResult) { if (booleanResult) { return yes(source); - } - else { + } else { return no(source); } } @@ -236,8 +233,7 @@ public class EventFactorySupport { } /** - * Returns a event with the specified identifier and the specified set of - * attributes. + * Returns a event with the specified identifier and the specified set of attributes. * @param source the source of the event * @param eventId the result event identifier * @param attributes the event payload attributes @@ -248,8 +244,7 @@ public class EventFactorySupport { } /** - * Returns a result event with the specified identifier and - * a single attribute. + * Returns a result event with the specified identifier and a single attribute. * @param source the source of the event * @param eventId the result id * @param attributeName the attribute name diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/support/ExternalRedirect.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/support/ExternalRedirect.java index af8aa809..97998aae 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/support/ExternalRedirect.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/support/ExternalRedirect.java @@ -19,8 +19,7 @@ import org.springframework.util.Assert; import org.springframework.webflow.execution.ViewSelection; /** - * Concrete response type that requests a redirect to an external URL outside of - * Spring Web Flow. + * Concrete response type that requests a redirect to an external URL outside of Spring Web Flow. * * @author Keith Donald * @author Erwin Vervaet @@ -40,7 +39,7 @@ public final class ExternalRedirect extends ViewSelection { Assert.notNull(url, "The external URL to redirect to is required"); this.url = url; } - + /** * Returns the external URL to redirect to. */ @@ -52,7 +51,7 @@ public final class ExternalRedirect extends ViewSelection { if (!(o instanceof ExternalRedirect)) { return false; } - ExternalRedirect other = (ExternalRedirect)o; + ExternalRedirect other = (ExternalRedirect) o; return url.equals(other.url); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/support/FlowDefinitionRedirect.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/support/FlowDefinitionRedirect.java index 11c83172..b351297f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/support/FlowDefinitionRedirect.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/support/FlowDefinitionRedirect.java @@ -22,12 +22,11 @@ import org.springframework.util.Assert; import org.springframework.webflow.execution.ViewSelection; /** - * Concrete response type that requests that a new execution of a flow - * definition (representing the start of a new conversation) be launched. + * Concrete response type that requests that a new execution of a flow definition (representing the start of a + * new conversation) be launched. *

    - * This allows "redirect to new flow" semantics; useful for restarting a flow - * after completion, or starting an entirely new flow from within the end state - * of another flow definition. + * This allows "redirect to new flow" semantics; useful for restarting a flow after completion, or starting an entirely + * new flow from within the end state of another flow definition. * * @author Keith Donald * @author Erwin Vervaet @@ -66,8 +65,7 @@ public final class FlowDefinitionRedirect extends ViewSelection { } /** - * Return the flow execution input map as an unmodifiable map. Never returns - * null. + * Return the flow execution input map as an unmodifiable map. Never returns null. */ public Map getExecutionInput() { return Collections.unmodifiableMap(executionInput); @@ -77,7 +75,7 @@ public final class FlowDefinitionRedirect extends ViewSelection { if (!(o instanceof FlowDefinitionRedirect)) { return false; } - FlowDefinitionRedirect other = (FlowDefinitionRedirect)o; + FlowDefinitionRedirect other = (FlowDefinitionRedirect) o; return flowDefinitionId.equals(other.flowDefinitionId) && executionInput.equals(other.executionInput); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/execution/support/FlowExecutionRedirect.java b/spring-webflow/src/main/java/org/springframework/webflow/execution/support/FlowExecutionRedirect.java index 18e32ef1..1bf1d4d6 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/execution/support/FlowExecutionRedirect.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/execution/support/FlowExecutionRedirect.java @@ -21,16 +21,13 @@ import org.springframework.webflow.engine.ViewState; import org.springframework.webflow.execution.ViewSelection; /** - * Concrete response type that refreshes an application view by redirecting - * to an existing, active Spring Web Flow execution at a unique - * SWF-specific flow execution URL. This enables the triggering of - * post-redirect-get semantics from within an active flow execution. + * Concrete response type that refreshes an application view by redirecting to an existing, active Spring Web + * Flow execution at a unique SWF-specific flow execution URL. This enables the triggering of post-redirect-get + * semantics from within an active flow execution. *

    - * Once the redirect response is issued a new request is initiated by the - * browser targeted at the flow execution URL. The URL is stabally refreshable - * (and bookmarkable) while the conversation remains active, safely triggering a - * {@link ViewState#refresh(org.springframework.webflow.execution.RequestContext)} - * on each access. + * Once the redirect response is issued a new request is initiated by the browser targeted at the flow execution URL. + * The URL is stabally refreshable (and bookmarkable) while the conversation remains active, safely triggering a + * {@link ViewState#refresh(org.springframework.webflow.execution.RequestContext)} on each access. * * @author Keith Donald * @author Erwin Vervaet diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutor.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutor.java index a9b07b09..46d7c3f6 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutor.java @@ -19,58 +19,50 @@ import org.springframework.webflow.context.ExternalContext; import org.springframework.webflow.core.FlowException; /** - * The central facade and entry-point service interface into the Spring Web Flow - * system for driving the executions of flow definitions. This interface - * defines a coarse-grained system boundary suitable for invocation by most + * The central facade and entry-point service interface into the Spring Web Flow system for driving the executions of + * flow definitions. This interface defines a coarse-grained system boundary suitable for invocation by most * clients. *

    - * Implementations of this interface abstract away much of the internal - * complexity of the web flow execution subsystem, which consists of launching - * and resuming managed flow executions from repositories. + * Implementations of this interface abstract away much of the internal complexity of the web flow execution subsystem, + * which consists of launching and resuming managed flow executions from repositories. * * @author Keith Donald */ public interface FlowExecutor { /** - * Launch a new execution of identified flow definition in the context of - * the current external client request. + * Launch a new execution of identified flow definition in the context of the current external client request. * @param flowDefinitionId the unique id of the flow definition to launch - * @param context the external context representing the state of a request - * into Spring Web Flow from an external system + * @param context the external context representing the state of a request into Spring Web Flow from an external + * system * @return the starting response instruction - * @throws FlowException if an exception occured launching the new flow - * execution + * @throws FlowException if an exception occured launching the new flow execution */ public ResponseInstruction launch(String flowDefinitionId, ExternalContext context) throws FlowException; /** - * Resume an existing, paused flow execution by signaling an event against - * its current state. - * @param flowExecutionKey the identifying key of a paused flow execution - * that is waiting to resume on the occurrence of a user event + * Resume an existing, paused flow execution by signaling an event against its current state. + * @param flowExecutionKey the identifying key of a paused flow execution that is waiting to resume on the + * occurrence of a user event * @param eventId the user event that occured - * @param context the external context representing the state of a request - * into Spring Web Flow from an external system + * @param context the external context representing the state of a request into Spring Web Flow from an external + * system * @return the next response instruction - * @throws FlowException if an exception occured resuming the existing flow - * execution + * @throws FlowException if an exception occured resuming the existing flow execution */ public ResponseInstruction resume(String flowExecutionKey, String eventId, ExternalContext context) throws FlowException; /** - * Reissue the last response instruction issued by the flow execution. This is - * a logical refresh operation that allows the "current response" to be - * re-issued. This operation is idempotent and does not affect the state of the flow - * execution. - * @param flowExecutionKey the identifying key of a paused flow execution - * that is waiting to resume on the ocurrence of a user event - * @param context the external context representing the state of a request - * into Spring Web Flow from an external system + * Reissue the last response instruction issued by the flow execution. This is a logical refresh operation that + * allows the "current response" to be re-issued. This operation is idempotent and does not affect the state of the + * flow execution. + * @param flowExecutionKey the identifying key of a paused flow execution that is waiting to resume on the ocurrence + * of a user event + * @param context the external context representing the state of a request into Spring Web Flow from an external + * system * @return the current response instruction - * @throws FlowException if an exception occured retrieving the current - * response instruction + * @throws FlowException if an exception occured retrieving the current response instruction */ public ResponseInstruction refresh(String flowExecutionKey, ExternalContext context) throws FlowException; } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutorImpl.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutorImpl.java index d9f1ac9f..2e81f18c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutorImpl.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/FlowExecutorImpl.java @@ -34,17 +34,14 @@ import org.springframework.webflow.execution.repository.FlowExecutionLock; import org.springframework.webflow.execution.repository.FlowExecutionRepository; /** - * The default implementation of the central facade for driving the - * execution of flows within an application. + * The default implementation of the central facade for driving the execution of flows within an application. *

    - * This object is responsible for creating and starting new flow executions as - * requested by clients, as well as signaling events for processing by existing, - * paused executions (that are waiting to be resumed in response to a user + * This object is responsible for creating and starting new flow executions as requested by clients, as well as + * signaling events for processing by existing, paused executions (that are waiting to be resumed in response to a user * event). *

    - * This object is a facade or entry point into the Spring Web Flow execution - * system and makes the overall system easier to use. The name executor - * was chosen as executors drive executions. + * This object is a facade or entry point into the Spring Web Flow execution system and makes the overall system easier + * to use. The name executor was chosen as executors drive executions. *

    * Commonly used configurable properties
    * @@ -70,15 +67,11 @@ import org.springframework.webflow.execution.repository.FlowExecutionRepository; * * * - * - * + * + * * *
    inputMapperThe service responsible for mapping attributes of - * {@link ExternalContext external contexts} that request to launch new - * {@link FlowExecution flow executions}. - * After mapping, the target map is then passed to the FlowExecution, exposing - * external context attributes as input to the flow during startup.A - * {@link org.springframework.webflow.executor.RequestParameterInputMapper request parameter mapper}, - * which exposes all request parameters in to the flow execution for input - * mapping.The service responsible for mapping attributes of {@link ExternalContext external contexts} that request to + * launch new {@link FlowExecution flow executions}. After mapping, the target map is then passed to the FlowExecution, + * exposing external context attributes as input to the flow during startup.A {@link org.springframework.webflow.executor.RequestParameterInputMapper request parameter mapper}, which + * exposes all request parameters in to the flow execution for input mapping.
    *

    @@ -93,7 +86,7 @@ import org.springframework.webflow.execution.repository.FlowExecutionRepository; * @author Colin Sampaleanu */ public class FlowExecutorImpl implements FlowExecutor { - + private static final Log logger = LogFactory.getLog(FlowExecutorImpl.class); /** @@ -107,34 +100,27 @@ public class FlowExecutorImpl implements FlowExecutor { private FlowExecutionFactory executionFactory; /** - * An repository used to save, update, and load existing flow executions - * to/from a persistent store. + * An repository used to save, update, and load existing flow executions to/from a persistent store. */ private FlowExecutionRepository executionRepository; /** - * The service responsible for mapping attributes of an - * {@link ExternalContext} to a new {@link FlowExecution} during the - * {@link #launch(String, ExternalContext) launch flow} operation. + * The service responsible for mapping attributes of an {@link ExternalContext} to a new {@link FlowExecution} + * during the {@link #launch(String, ExternalContext) launch flow} operation. *

    - * This allows developers to control what attributes are made available in - * the inputMap to new top-level flow executions. The - * starting execution may then choose to map that available input into its - * own local scope. + * This allows developers to control what attributes are made available in the inputMap to new + * top-level flow executions. The starting execution may then choose to map that available input into its own local + * scope. *

    - * The default implementation simply exposes all request parameters as flow - * execution input attributes. May be null. + * The default implementation simply exposes all request parameters as flow execution input attributes. May be null. */ private AttributeMapper inputMapper = new RequestParameterInputMapper(); /** * Create a new flow executor. - * @param definitionLocator the locator for accessing flow definitions to - * execute - * @param executionFactory the factory for creating executions of flow - * definitions - * @param executionRepository the repository for persisting paused flow - * executions + * @param definitionLocator the locator for accessing flow definitions to execute + * @param executionFactory the factory for creating executions of flow definitions + * @param executionRepository the repository for persisting paused flow executions */ public FlowExecutorImpl(FlowDefinitionLocator definitionLocator, FlowExecutionFactory executionFactory, FlowExecutionRepository executionRepository) { @@ -147,8 +133,7 @@ public class FlowExecutorImpl implements FlowExecutor { } /** - * Exposes the configured input mapper to subclasses and privileged - * accessors. + * Exposes the configured input mapper to subclasses and privileged accessors. * @return the input mapper */ public AttributeMapper getInputMapper() { @@ -156,12 +141,10 @@ public class FlowExecutorImpl implements FlowExecutor { } /** - * Set the service responsible for mapping attributes of an - * {@link ExternalContext} to a new {@link FlowExecution} during the - * {@link #launch(String, ExternalContext) launch flow} operation. + * Set the service responsible for mapping attributes of an {@link ExternalContext} to a new {@link FlowExecution} + * during the {@link #launch(String, ExternalContext) launch flow} operation. *

    - * The default implementation simply exposes all request parameters as flow - * execution input attributes. May be null. + * The default implementation simply exposes all request parameters as flow execution input attributes. May be null. * @see RequestParameterInputMapper */ public void setInputMapper(AttributeMapper inputMapper) { @@ -169,8 +152,7 @@ public class FlowExecutorImpl implements FlowExecutor { } /** - * Exposes the configured flow definition locator to subclasses and - * privileged accessors. + * Exposes the configured flow definition locator to subclasses and privileged accessors. * @return the flow definition locator */ public FlowDefinitionLocator getDefinitionLocator() { @@ -178,8 +160,7 @@ public class FlowExecutorImpl implements FlowExecutor { } /** - * Exposes the configured execution factory to subclasses and privileged - * accessors. + * Exposes the configured execution factory to subclasses and privileged accessors. * @return the execution factory */ public FlowExecutionFactory getExecutionFactory() { @@ -211,18 +192,15 @@ public class FlowExecutorImpl implements FlowExecutor { lock.lock(); try { executionRepository.putFlowExecution(key, flowExecution); - } - finally { + } finally { lock.unlock(); } return new ResponseInstruction(key.toString(), flowExecution, selectedView); - } - else { + } else { // execution already ended => just render the selected view return new ResponseInstruction(flowExecution, selectedView); } - } - finally { + } finally { ExternalContextHolder.setExternalContext(null); } } @@ -230,8 +208,7 @@ public class FlowExecutorImpl implements FlowExecutor { public ResponseInstruction resume(String flowExecutionKey, String eventId, ExternalContext context) throws FlowException { if (logger.isDebugEnabled()) { - logger.debug("Resuming flow execution with key '" + flowExecutionKey + - "' on user event '" + eventId + "'"); + logger.debug("Resuming flow execution with key '" + flowExecutionKey + "' on user event '" + eventId + "'"); } // expose external context as a thread-bound service ExternalContextHolder.setExternalContext(context); @@ -248,18 +225,15 @@ public class FlowExecutorImpl implements FlowExecutor { key = executionRepository.getNextKey(flowExecution, key); executionRepository.putFlowExecution(key, flowExecution); return new ResponseInstruction(key.toString(), flowExecution, selectedView); - } - else { + } else { // execution ended => remove it from the repository executionRepository.removeFlowExecution(key); return new ResponseInstruction(flowExecution, selectedView); } - } - finally { + } finally { lock.unlock(); } - } - finally { + } finally { ExternalContextHolder.setExternalContext(null); } } @@ -282,12 +256,10 @@ public class FlowExecutorImpl implements FlowExecutor { // the flow execution with it's existing key executionRepository.putFlowExecution(key, flowExecution); return new ResponseInstruction(key.toString(), flowExecution, selectedView); - } - finally { + } finally { lock.unlock(); } - } - finally { + } finally { ExternalContextHolder.setExternalContext(null); } } @@ -295,9 +267,8 @@ public class FlowExecutorImpl implements FlowExecutor { // helper methods /** - * Factory method that creates the input attribute map for a newly created - * {@link FlowExecution}. This implementation uses the registered input mapper, - * if any. + * Factory method that creates the input attribute map for a newly created {@link FlowExecution}. This + * implementation uses the registered input mapper, if any. * @param context the external context * @return the input map, or null if no input */ @@ -306,8 +277,7 @@ public class FlowExecutorImpl implements FlowExecutor { MutableAttributeMap inputMap = new LocalAttributeMap(); inputMapper.map(context, inputMap, null); return inputMap; - } - else { + } else { return null; } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/RequestParameterInputMapper.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/RequestParameterInputMapper.java index e8a84b3b..3b18ba99 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/RequestParameterInputMapper.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/RequestParameterInputMapper.java @@ -21,13 +21,11 @@ import org.springframework.webflow.context.ExternalContext; import org.springframework.webflow.core.collection.MutableAttributeMap; /** - * Simple attribute mapper implementation that puts all entries in the - * request parameter map of a source {@link ExternalContext} into the - * FlowExecution inputMap. This makes request parameters available to launching - * flows for input mapping. + * Simple attribute mapper implementation that puts all entries in the request parameter map of a source + * {@link ExternalContext} into the FlowExecution inputMap. This makes request parameters available to launching flows + * for input mapping. *

    - * Used by {@link FlowExecutorImpl} as the default AttributeMapper - * implementation. + * Used by {@link FlowExecutorImpl} as the default AttributeMapper implementation. * * @see ExternalContext#getRequestParameterMap() * @see FlowExecutor#launch(String, ExternalContext) @@ -36,8 +34,8 @@ import org.springframework.webflow.core.collection.MutableAttributeMap; */ public class RequestParameterInputMapper implements AttributeMapper { public void map(Object source, Object target, MappingContext context) { - ExternalContext externalContext = (ExternalContext)source; - MutableAttributeMap inputMap = (MutableAttributeMap)target; + ExternalContext externalContext = (ExternalContext) source; + MutableAttributeMap inputMap = (MutableAttributeMap) target; inputMap.putAll(externalContext.getRequestParameterMap().asAttributeMap()); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/ResponseInstruction.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/ResponseInstruction.java index e273a5f2..9147fac6 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/ResponseInstruction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/ResponseInstruction.java @@ -27,19 +27,15 @@ import org.springframework.webflow.execution.support.FlowDefinitionRedirect; import org.springframework.webflow.execution.support.FlowExecutionRedirect; /** - * Immutable value object that provides clients with information about a - * response to issue. + * Immutable value object that provides clients with information about a response to issue. *

    * There are five different types of response instruction: *

    * @@ -49,8 +45,7 @@ import org.springframework.webflow.execution.support.FlowExecutionRedirect; public class ResponseInstruction implements Serializable { /** - * The persistent identifier of the flow execution that - * resulted in this response instruction. + * The persistent identifier of the flow execution that resulted in this response instruction. */ private String flowExecutionKey; @@ -78,9 +73,8 @@ public class ResponseInstruction implements Serializable { } /** - * Create a new response instruction for an ended flow execution. No - * flow execution key needs to be provided since the flow execution no longer - * exists and cannot be referenced any longer. + * Create a new response instruction for an ended flow execution. No flow execution key needs to be provided since + * the flow execution no longer exists and cannot be referenced any longer. * @param flowExecutionContext the current flow execution context (inactive) * @param viewSelection the selected view */ @@ -106,9 +100,8 @@ public class ResponseInstruction implements Serializable { } /** - * Returns the flow execution context representing the current state of the - * execution. It could be that the returned flow execution is - * {@link FlowExecutionContext#isActive() inactive}. + * Returns the flow execution context representing the current state of the execution. It could be that the returned + * flow execution is {@link FlowExecutionContext#isActive() inactive}. */ public FlowExecutionContext getFlowExecutionContext() { return flowExecutionContext; @@ -122,58 +115,54 @@ public class ResponseInstruction implements Serializable { } /** - * Returns true if this is an instruction to render an application view for - * an "active" (in progress) flow execution. + * Returns true if this is an instruction to render an application view for an "active" (in progress) flow + * execution. */ public boolean isActiveView() { return isApplicationView() && flowExecutionContext.isActive(); } /** - * Returns true if this is an instruction to render an application view for - * an "ended" (inactive) flow execution from an end state. + * Returns true if this is an instruction to render an application view for an "ended" (inactive) flow execution + * from an end state. */ public boolean isEndingView() { return isApplicationView() && !flowExecutionContext.isActive(); } - + // response types /** - * Returns true if this is an "application view" (forward) response - * instruction. + * Returns true if this is an "application view" (forward) response instruction. */ public boolean isApplicationView() { return viewSelection instanceof ApplicationView; } /** - * Returns true if this is an instruction to perform a redirect to the - * current flow execution to render an application view. + * Returns true if this is an instruction to perform a redirect to the current flow execution to render an + * application view. */ public boolean isFlowExecutionRedirect() { return viewSelection instanceof FlowExecutionRedirect; } /** - * Returns true if this is an instruction to launch an entirely new - * (independent) flow execution. + * Returns true if this is an instruction to launch an entirely new (independent) flow execution. */ public boolean isFlowDefinitionRedirect() { return viewSelection instanceof FlowDefinitionRedirect; } /** - * Returns true if this an instruction to perform a redirect to an external - * URL. + * Returns true if this an instruction to perform a redirect to an external URL. */ public boolean isExternalRedirect() { return viewSelection instanceof ExternalRedirect; } /** - * Returns true if this is a "null" response instruction, e.g. - * no response needs to be rendered. + * Returns true if this is a "null" response instruction, e.g. no response needs to be rendered. */ public boolean isNull() { return viewSelection == ViewSelection.NULL_VIEW; @@ -183,12 +172,11 @@ public class ResponseInstruction implements Serializable { if (!(o instanceof ResponseInstruction)) { return false; } - ResponseInstruction other = (ResponseInstruction)o; + ResponseInstruction other = (ResponseInstruction) o; if (getFlowExecutionKey() != null) { return getFlowExecutionKey().equals(other.getFlowExecutionKey()) && viewSelection.equals(other.viewSelection); - } - else { + } else { return other.getFlowExecutionKey() == null && viewSelection.equals(other.viewSelection); } } @@ -202,7 +190,7 @@ public class ResponseInstruction implements Serializable { } public String toString() { - return new ToStringCreator(this).append("flowExecutionKey", flowExecutionKey) - .append("viewSelection", viewSelection).append("flowExecutionContext", flowExecutionContext).toString(); + return new ToStringCreator(this).append("flowExecutionKey", flowExecutionKey).append("viewSelection", + viewSelection).append("flowExecutionContext", flowExecutionContext).toString(); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/AbstractFlowExecutionPropertyResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/AbstractFlowExecutionPropertyResolver.java index c4c02b41..08b5e38c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/AbstractFlowExecutionPropertyResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/AbstractFlowExecutionPropertyResolver.java @@ -54,8 +54,7 @@ public abstract class AbstractFlowExecutionPropertyResolver extends PropertyReso FlowExecution execution = (FlowExecution) base; assertPropertyNameValid(property); return doGetAttributeType(execution, (String) property); - } - else { + } else { return resolverDelegate.getType(base, property); } } @@ -64,8 +63,7 @@ public abstract class AbstractFlowExecutionPropertyResolver extends PropertyReso if (base instanceof FlowExecution) { // cannot access flow execution by index so we cannot determine type. Return null per JSF spec return null; - } - else { + } else { return resolverDelegate.getType(base, index); } } @@ -75,8 +73,7 @@ public abstract class AbstractFlowExecutionPropertyResolver extends PropertyReso FlowExecution execution = (FlowExecution) base; assertPropertyNameValid(property); return doGetAttribute(execution, (String) property); - } - else { + } else { return resolverDelegate.getValue(base, property); } } @@ -84,8 +81,7 @@ public abstract class AbstractFlowExecutionPropertyResolver extends PropertyReso public Object getValue(Object base, int index) throws EvaluationException, PropertyNotFoundException { if (base instanceof FlowExecution) { throw new ReferenceSyntaxException("Cannot apply an index value to a flow execution"); - } - else { + } else { return resolverDelegate.getValue(base, index); } } @@ -93,8 +89,7 @@ public abstract class AbstractFlowExecutionPropertyResolver extends PropertyReso public boolean isReadOnly(Object base, Object property) throws EvaluationException, PropertyNotFoundException { if (base instanceof FlowExecution) { return false; - } - else { + } else { return resolverDelegate.isReadOnly(base, property); } } @@ -102,8 +97,7 @@ public abstract class AbstractFlowExecutionPropertyResolver extends PropertyReso public boolean isReadOnly(Object base, int index) throws EvaluationException, PropertyNotFoundException { if (base instanceof FlowExecution) { return false; - } - else { + } else { return resolverDelegate.isReadOnly(base, index); } } @@ -114,8 +108,7 @@ public abstract class AbstractFlowExecutionPropertyResolver extends PropertyReso FlowExecution execution = (FlowExecution) base; assertPropertyNameValid(property); doSetAttribute(execution, (String) property, value); - } - else { + } else { resolverDelegate.setValue(base, property, value); } } @@ -123,8 +116,7 @@ public abstract class AbstractFlowExecutionPropertyResolver extends PropertyReso public void setValue(Object base, int index, Object value) throws EvaluationException, PropertyNotFoundException { if (base instanceof FlowExecution) { throw new ReferenceSyntaxException("Cannot apply an index value to a flow execution"); - } - else { + } else { resolverDelegate.setValue(base, index, value); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/DelegatingFlowVariableResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/DelegatingFlowVariableResolver.java index 0d552157..8ea04536 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/DelegatingFlowVariableResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/DelegatingFlowVariableResolver.java @@ -69,11 +69,9 @@ public class DelegatingFlowVariableResolver extends VariableResolver { // flow execution is active: try flash/flow/conversation scope if (execution.getActiveSession().getFlashMap().contains(name)) { return execution.getActiveSession().getFlashMap().get(name); - } - else if (execution.getActiveSession().getScope().contains(name)) { + } else if (execution.getActiveSession().getScope().contains(name)) { return execution.getActiveSession().getScope().get(name); - } - else if (execution.getConversationScope().contains(name)) { + } else if (execution.getConversationScope().contains(name)) { return execution.getConversationScope().get(name); } } else { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionHolder.java index 7d1fb6ab..d6965dab 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionHolder.java @@ -109,7 +109,7 @@ public class FlowExecutionHolder implements Serializable { public void setFlowExecutionLock(FlowExecutionLock lock) { this.flowExecutionLock = lock; } - + /** * Returns the view selected from the current flow execution request. */ @@ -136,7 +136,7 @@ public class FlowExecutionHolder implements Serializable { unlockFlowExecutionIfNecessary(); this.flowExecution = flowExecution; } - + /** * Unlock the held flow execution if necessary. */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionHolderUtils.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionHolderUtils.java index 522dc1d4..13747924 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionHolderUtils.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionHolderUtils.java @@ -26,7 +26,7 @@ import org.springframework.webflow.execution.FlowExecution; *

    * By default, the current flow execution holder is stored associated with the current thread in the * {@link FacesContext}'s {@link ExternalContext#getRequestMap()}. - * + * * @author Keith Donald */ public class FlowExecutionHolderUtils { @@ -82,8 +82,7 @@ public class FlowExecutionHolderUtils { FlowExecution execution = getCurrentFlowExecution(context); if (execution != null) { return execution; - } - else { + } else { throw new EvaluationException("No current FlowExecution bound to the Faces Context " + "- was the current flow execution not restored before a view referenced it? " + "Has the flow execution ended or expired?"); @@ -91,9 +90,8 @@ public class FlowExecutionHolderUtils { } /** - * Cleans up the current flow execution in the faces context if necessary. - * Specifically, handles unlocking the execution if necessary and setting the - * holder to null. + * Cleans up the current flow execution in the faces context if necessary. Specifically, handles unlocking the + * execution if necessary and setting the holder to null. * @param context the faces context */ public static void cleanupCurrentFlowExecution(FacesContext context) { @@ -104,8 +102,7 @@ public class FlowExecutionHolderUtils { } /** - * Returns the key used to index the flow execution holder in the request - * attributes. + * Returns the key used to index the flow execution holder in the request attributes. */ static String getFlowExecutionHolderKey() { return FlowExecutionHolder.class.getName(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionKeyStateHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionKeyStateHolder.java index a06f0a82..662c4e90 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionKeyStateHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionKeyStateHolder.java @@ -115,7 +115,8 @@ public class FlowExecutionKeyStateHolder extends UIComponentBase { JsfExternalContext context = new JsfExternalContext(facesContext); // restore only if the key is present and the current flow execution has not already been restored if (StringUtils.hasText(flowExecutionKey) && !FlowExecutionHolderUtils.isFlowExecutionRestored(facesContext)) { - // restore the "current" flow execution from repository so it will be available to variable/property resolvers + // restore the "current" flow execution from repository so it will be available to variable/property + // resolvers // and the flow navigation handler (this could happen as part of a view action like a form submission) FlowExecutionRepository repository = getRepository(context); // restore the key from the stored encoded key string @@ -126,21 +127,21 @@ public class FlowExecutionKeyStateHolder extends UIComponentBase { try { FlowExecution flowExecution = repository.getFlowExecution(key); if (logger.isDebugEnabled()) { - logger.debug("Loaded existing flow execution with key '" + flowExecutionKey - + "' as part of component restoration [triggered via an action event like a button click]"); + logger + .debug("Loaded existing flow execution with key '" + + flowExecutionKey + + "' as part of component restoration [triggered via an action event like a button click]"); } - FlowExecutionHolderUtils.setFlowExecutionHolder(new FlowExecutionHolder(key, flowExecution, lock), facesContext); - } - catch (RuntimeException e) { + FlowExecutionHolderUtils.setFlowExecutionHolder(new FlowExecutionHolder(key, flowExecution, lock), + facesContext); + } catch (RuntimeException e) { + lock.unlock(); + throw e; + } catch (Error e) { lock.unlock(); throw e; } - catch (Error e) { - lock.unlock(); - throw e; - } - } - catch (FlowExecutionAccessException e) { + } catch (FlowExecutionAccessException e) { handleFlowExecutionAccessException(e, facesContext); } } @@ -155,7 +156,7 @@ public class FlowExecutionKeyStateHolder extends UIComponentBase { protected void handleFlowExecutionAccessException(FlowExecutionAccessException e, FacesContext context) { throw e; } - + /** * Save the just the current FlowExecutionKey value. */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionPropertyResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionPropertyResolver.java index e055b0b9..71667c48 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionPropertyResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionPropertyResolver.java @@ -23,10 +23,9 @@ import javax.faces.el.PropertyResolver; import org.springframework.webflow.execution.FlowExecution; /** - * Custom property resolver that resolves supported properties of the current flow execution. - * Supports resolving all scopes as java.util.Maps: "flowScope", "conversationScope", and "flashScope". - * Also supports attribute searching when no scope prefix is specified. The search order is - * flash, flow, conversation. + * Custom property resolver that resolves supported properties of the current flow execution. Supports resolving all + * scopes as java.util.Maps: "flowScope", "conversationScope", and "flashScope". Also supports attribute searching when + * no scope prefix is specified. The search order is flash, flow, conversation. * * @author Keith Donald */ @@ -64,7 +63,7 @@ public class FlowExecutionPropertyResolver extends AbstractFlowExecutionProperty return Map.class; } else { // perform an attribute search - + // try flash scope first Object value = execution.getActiveSession().getFlashMap().get(attributeName); if (value != null) { @@ -82,7 +81,7 @@ public class FlowExecutionPropertyResolver extends AbstractFlowExecutionProperty } // cannot determine return null; - } + } } protected Object doGetAttribute(FlowExecution execution, String attributeName) { @@ -94,7 +93,7 @@ public class FlowExecutionPropertyResolver extends AbstractFlowExecutionProperty return execution.getConversationScope().asMap(); } else { // perform an attribute search - + // try flash scope Object value = execution.getActiveSession().getFlashMap().get(attributeName); if (value != null) { @@ -111,22 +110,23 @@ public class FlowExecutionPropertyResolver extends AbstractFlowExecutionProperty return value; } // cannot resolve as expected - throw new PropertyNotFoundException("Readable flow execution attribute '" + attributeName + "' not found in any scope (flash, flow, or conversation)"); - } + throw new PropertyNotFoundException("Readable flow execution attribute '" + attributeName + + "' not found in any scope (flash, flow, or conversation)"); + } } protected void doSetAttribute(FlowExecution execution, String attributeName, Object attributeValue) { // perform a search if (execution.getActiveSession().getFlashMap().contains(attributeName)) { execution.getActiveSession().getFlashMap().put(attributeName, attributeValue); - } - else if (execution.getActiveSession().getScope().contains(attributeName)) { + } else if (execution.getActiveSession().getScope().contains(attributeName)) { execution.getActiveSession().getScope().put(attributeName, attributeValue); } else if (execution.getConversationScope().contains(attributeName)) { execution.getConversationScope().put(attributeName, attributeValue); } else { // cannot resolve as expected - throw new PropertyNotFoundException("Settable flow execution attribute '" + attributeName + "' not found in any scope (flash, flow, or conversation)"); - } + throw new PropertyNotFoundException("Settable flow execution attribute '" + attributeName + + "' not found in any scope (flash, flow, or conversation)"); + } } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionVariableResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionVariableResolver.java index 1a215940..d689a5c1 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionVariableResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowExecutionVariableResolver.java @@ -63,8 +63,7 @@ public class FlowExecutionVariableResolver extends VariableResolver { public Object resolveVariable(FacesContext context, String name) throws EvaluationException { if (FLOW_EXECUTION_VARIABLE_NAME.equals(name)) { return FlowExecutionHolderUtils.getRequiredCurrentFlowExecution(context); - } - else { + } else { return resolverDelegate.resolveVariable(context, name); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowFacesUtils.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowFacesUtils.java index 0c573ffd..00fd5cd6 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowFacesUtils.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowFacesUtils.java @@ -29,8 +29,8 @@ import org.springframework.webflow.execution.repository.support.SimpleFlowExecut import org.springframework.webflow.executor.FlowExecutorImpl; /** - * Trivial helper utility class for SWF within a JSF environment. Used mainly to - * locate Web Flow services needed to run the JSF integration. + * Trivial helper utility class for SWF within a JSF environment. Used mainly to locate Web Flow services needed to run + * the JSF integration. * * @author Keith Donald */ @@ -39,10 +39,9 @@ public class FlowFacesUtils { /** * Bean name of a custom flow executor implementation. * - * Note the flow executor object is used only at configuration time to - * extract other lower-level services needed by the JSF integration (flow - * execution repository, flow execution factory). The runtime FlowExecutor - * interface is never used by this JSF integration. + * Note the flow executor object is used only at configuration time to extract other lower-level services needed by + * the JSF integration (flow execution repository, flow execution factory). The runtime FlowExecutor interface is + * never used by this JSF integration. */ private static final String FLOW_EXECUTOR_BEAN_NAME = "flowExecutor"; @@ -72,9 +71,8 @@ public class FlowFacesUtils { private static FlowExecutionFactory defaultExecutionFactory; /** - * Returns the locator for flow definitions to use in a JSF environment. - * Searches for a bean in the root web application context named - * {@link #FLOW_DEFINITION_LOCATOR_BEAN_NAME}. A bean of type + * Returns the locator for flow definitions to use in a JSF environment. Searches for a bean in the root web + * application context named {@link #FLOW_DEFINITION_LOCATOR_BEAN_NAME}. A bean of type * {@link FlowDefinitionLocator} must exist by this name. * @param context the faces context * @return the flow definition locator @@ -83,14 +81,14 @@ public class FlowFacesUtils { ApplicationContext ac = FacesContextUtils.getRequiredWebApplicationContext(context); if (ac.containsBean(FLOW_DEFINITION_LOCATOR_BEAN_NAME)) { return (FlowDefinitionLocator) ac.getBean(FLOW_DEFINITION_LOCATOR_BEAN_NAME, FlowDefinitionLocator.class); - } - else { + } else { FlowExecutorImpl flowExecutor = getFlowExecutor(context); if (flowExecutor != null) { return flowExecutor.getDefinitionLocator(); - } - else { - String message = "No bean definition with id '" + FLOW_DEFINITION_LOCATOR_BEAN_NAME + "' or '" + } else { + String message = "No bean definition with id '" + + FLOW_DEFINITION_LOCATOR_BEAN_NAME + + "' or '" + FLOW_EXECUTOR_BEAN_NAME + "' could be found; to use Spring Web Flow with JSF a FlowDefinitionLocator must be resolvable"; throw new JsfFlowConfigurationException(message); @@ -99,12 +97,10 @@ public class FlowFacesUtils { } /** - * Returns the flow execution repository to use in a JSF environment. - * Searches for a bean in the root web application context named - * {@link #FLOW_EXECUTION_REPOSITORY_BEAN_NAME}. If no such bean exists - * with this name, falls back on the repository configured by a bean with - * name {@link #FLOW_EXECUTOR_BEAN_NAME}. If no bean exists with that name, - * uses the default 'simple' repository implementation. + * Returns the flow execution repository to use in a JSF environment. Searches for a bean in the root web + * application context named {@link #FLOW_EXECUTION_REPOSITORY_BEAN_NAME}. If no such bean exists with this name, + * falls back on the repository configured by a bean with name {@link #FLOW_EXECUTOR_BEAN_NAME}. If no bean exists + * with that name, uses the default 'simple' repository implementation. * @param context the faces context * @return the flow execution repository */ @@ -113,14 +109,12 @@ public class FlowFacesUtils { if (ac.containsBean(FLOW_EXECUTION_REPOSITORY_BEAN_NAME)) { return (FlowExecutionRepository) ac.getBean(FLOW_EXECUTION_REPOSITORY_BEAN_NAME, FlowExecutionRepository.class); - } - else { + } else { if (defaultExecutionRepository == null) { FlowExecutorImpl flowExecutor = getFlowExecutor(context); if (flowExecutor != null) { defaultExecutionRepository = flowExecutor.getExecutionRepository(); - } - else { + } else { defaultExecutionRepository = new SimpleFlowExecutionRepository(new FlowExecutionImplStateRestorer( getDefinitionLocator(context)), new SessionBindingConversationManager()); } @@ -130,12 +124,10 @@ public class FlowFacesUtils { } /** - * Returns the flow execution factory to use in a JSF environment. Searches - * for a bean in the root web application context named - * {@link #FLOW_EXECUTION_FACTORY_BEAN_NAME}. If no such bean exists with - * this name, falls back on the repository configured by a bean with name - * {@link #FLOW_EXECUTOR_BEAN_NAME}. If no bean exists with that name, uses - * the default factory implementation. + * Returns the flow execution factory to use in a JSF environment. Searches for a bean in the root web application + * context named {@link #FLOW_EXECUTION_FACTORY_BEAN_NAME}. If no such bean exists with this name, falls back on + * the repository configured by a bean with name {@link #FLOW_EXECUTOR_BEAN_NAME}. If no bean exists with that + * name, uses the default factory implementation. * @param context the faces context * @return the flow execution factory */ @@ -143,14 +135,12 @@ public class FlowFacesUtils { ApplicationContext ac = FacesContextUtils.getRequiredWebApplicationContext(context); if (ac.containsBean(FLOW_EXECUTION_FACTORY_BEAN_NAME)) { return (FlowExecutionFactory) ac.getBean(FLOW_EXECUTION_FACTORY_BEAN_NAME, FlowExecutionFactory.class); - } - else { + } else { if (defaultExecutionFactory == null) { FlowExecutorImpl flowExecutor = getFlowExecutor(context); if (flowExecutor != null) { defaultExecutionFactory = flowExecutor.getExecutionFactory(); - } - else { + } else { defaultExecutionFactory = new FlowExecutionImplFactory(); } } @@ -159,9 +149,8 @@ public class FlowFacesUtils { } /** - * Returns the flow executor providing access to services used by the Spring - * Web Flow JSF integration. Searches for a bean in the root web application - * context named {@link #FLOW_EXECUTOR_BEAN_NAME}. If no such bean exists + * Returns the flow executor providing access to services used by the Spring Web Flow JSF integration. Searches for + * a bean in the root web application context named {@link #FLOW_EXECUTOR_BEAN_NAME}. If no such bean exists * returns null. * @param context the faces context * @return the flow executor, or null if no such bean exists @@ -170,8 +159,7 @@ public class FlowFacesUtils { ApplicationContext ac = FacesContextUtils.getRequiredWebApplicationContext(context); if (ac.containsBean(FLOW_EXECUTOR_BEAN_NAME)) { return (FlowExecutorImpl) ac.getBean(FLOW_EXECUTOR_BEAN_NAME, FlowExecutorImpl.class); - } - else { + } else { return null; } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowNavigationHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowNavigationHandler.java index 230cd7c5..88f14d07 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowNavigationHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowNavigationHandler.java @@ -161,8 +161,7 @@ public class FlowNavigationHandler extends DecoratingNavigationHandler { if (FlowExecutionHolderUtils.isFlowExecutionRestored(facesContext)) { // replace the current flow execution with the new one FlowExecutionHolderUtils.getFlowExecutionHolder(facesContext).replaceWith(flowExecution); - } - else { + } else { // bind the new execution as the 'current execution' FlowExecutionHolderUtils.setFlowExecutionHolder(new FlowExecutionHolder(flowExecution), facesContext); @@ -171,8 +170,7 @@ public class FlowNavigationHandler extends DecoratingNavigationHandler { ViewSelection selectedView = flowExecution.start(createInput(context), context); // set the starting view to render FlowExecutionHolderUtils.getFlowExecutionHolder(facesContext).setViewSelection(selectedView); - } - else { + } else { // not a launch request - see if this is a resume request to continue an existing execution if (FlowExecutionHolderUtils.isFlowExecutionRestored(facesContext)) { // a flow execution has been restored - see if we need to signal an event against it @@ -184,8 +182,7 @@ public class FlowNavigationHandler extends DecoratingNavigationHandler { ViewSelection selectedView = holder.getFlowExecution().signalEvent(eventId, context); // set the next view to render holder.setViewSelection(selectedView); - } - catch (NoMatchingTransitionException e) { + } catch (NoMatchingTransitionException e) { if (logger.isDebugEnabled()) { logger.debug("No flow state transition found for event '" + eventId + "'; falling back to standard navigation handler."); @@ -194,18 +191,15 @@ public class FlowNavigationHandler extends DecoratingNavigationHandler { originalNavigationHandler.handleNavigation(facesContext, fromAction, outcome); } } - } - else { + } else { // neither a flow launch or resume request: proceed with standard navigation originalNavigationHandler.handleNavigation(facesContext, fromAction, outcome); } } - } - catch (RuntimeException e) { + } catch (RuntimeException e) { cleanupResources(facesContext); throw e; - } - catch (Error e) { + } catch (Error e) { cleanupResources(facesContext); throw e; } @@ -222,8 +216,7 @@ public class FlowNavigationHandler extends DecoratingNavigationHandler { MutableAttributeMap inputMap = new LocalAttributeMap(); inputMapper.map(context, inputMap, null); return inputMap; - } - else { + } else { return null; } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowNavigationHandlerArgumentExtractor.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowNavigationHandlerArgumentExtractor.java index d312a3ae..62662a69 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowNavigationHandlerArgumentExtractor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowNavigationHandlerArgumentExtractor.java @@ -22,7 +22,7 @@ import org.springframework.webflow.executor.support.FlowExecutorArgumentExtracto /** * An {@link FlowExecutorArgumentExtractor} that is aware of JSF outcomes that communicate requests to launch flow - * executions and signal event in existing flow executions. Designed to be used wih a {@link FlowNavigationHandler}. + * executions and signal event in existing flow executions. Designed to be used wih a {@link FlowNavigationHandler}. * * Note: this class only implements flow id and event id extraction methods. A FlowNavigationHandler is not expected to * extract a flow execution key, as flow execution restoration is fully handled by the {@link FlowPhaseListener} and the @@ -60,8 +60,7 @@ public class FlowNavigationHandlerArgumentExtractor implements FlowExecutorArgum String outcome = getOutcome(context); if (outcome != null && outcome.startsWith(getFlowIdPrefix())) { return true; - } - else { + } else { return false; } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowPhaseListener.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowPhaseListener.java index 02c02817..092fe96e 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowPhaseListener.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowPhaseListener.java @@ -227,19 +227,16 @@ public class FlowPhaseListener implements PhaseListener { restoreFlowExecution(event.getFacesContext()); // we do not need to worry about clean up here since other phases will continue to run even if an exception // occurs in restoreFlowExecution(FacesContext) - } - else if (event.getPhaseId() == PhaseId.RENDER_RESPONSE) { + } else if (event.getPhaseId() == PhaseId.RENDER_RESPONSE) { if (FlowExecutionHolderUtils.isFlowExecutionRestored(event.getFacesContext())) { try { prepareResponse(getCurrentContext(), FlowExecutionHolderUtils.getFlowExecutionHolder(context)); - } - catch (RuntimeException e) { + } catch (RuntimeException e) { // we must cleanup here since this is the render response phase and the after phase callback will // NOT run when an exception occurs (which typically does the cleanup--see below) cleanupResources(context); throw e; - } - catch (Error e) { + } catch (Error e) { cleanupResources(context); throw e; } @@ -253,14 +250,12 @@ public class FlowPhaseListener implements PhaseListener { if (FlowExecutionHolderUtils.isFlowExecutionRestored(context)) { try { saveFlowExecution(getCurrentContext(), FlowExecutionHolderUtils.getFlowExecutionHolder(context)); - } - finally { + } finally { // always cleanup after save - we are done with flow execution request processing cleanupResources(context); } } - } - else { + } else { // cleanup if some other JSF artifact marked 'response complete' to short-circuit the lifecycle early if (context.getResponseComplete()) { cleanupResources(context); @@ -288,22 +283,18 @@ public class FlowPhaseListener implements PhaseListener { } FlowExecutionHolderUtils.setFlowExecutionHolder(new FlowExecutionHolder(flowExecutionKey, flowExecution, lock), facesContext); - } - catch (RuntimeException e) { + } catch (RuntimeException e) { + lock.unlock(); + throw e; + } catch (Error e) { lock.unlock(); throw e; } - catch (Error e) { - lock.unlock(); - throw e; - } - } - catch (FlowExecutionAccessException e) { + } catch (FlowExecutionAccessException e) { // thrown if access to the execution could not be granted handleFlowExecutionAccessException(e, facesContext); } - } - else if (argumentHandler.isFlowIdPresent(context)) { + } else if (argumentHandler.isFlowIdPresent(context)) { // launch a new flow execution // (this could happen as part of direct browser access or a flow definition redirect) String flowId = argumentHandler.extractFlowId(context); @@ -343,8 +334,7 @@ public class FlowPhaseListener implements PhaseListener { MutableAttributeMap inputMap = new LocalAttributeMap(); inputMapper.map(context, inputMap, null); return inputMap; - } - else { + } else { return null; } } @@ -360,8 +350,7 @@ public class FlowPhaseListener implements PhaseListener { // no navigation event has been processed - simply refresh the execution with the same key selectedView = holder.getFlowExecution().refresh(context); holder.setViewSelection(selectedView); - } - else { + } else { // an navigation event has been processed - generate a new flow execution key if necessary generateKey(context, holder); } @@ -417,17 +406,17 @@ public class FlowPhaseListener implements PhaseListener { } /** - * Factory method that creates the state holder UI component that will track the flow execution key - * used for execution restoration during subsequent restore view phases. Subclasses may override to - * customize the state holder component implementation, for example--to handle flow execution - * restoration/access exceptions in a certain way. + * Factory method that creates the state holder UI component that will track the flow execution key used for + * execution restoration during subsequent restore view phases. Subclasses may override to customize the state + * holder component implementation, for example--to handle flow execution restoration/access exceptions in a certain + * way. * @return the flow execution key state holder * @see #saveInViewRoot(FacesContext, String) */ protected FlowExecutionKeyStateHolder createFlowExecutionKeyStateHolder() { return new FlowExecutionKeyStateHolder(); } - + /** * Updates the current flow execution in the repository. * @param context the external context @@ -442,8 +431,7 @@ public class FlowPhaseListener implements PhaseListener { logger.debug("Saving execution to repository with key " + holder.getFlowExecutionKey()); } repository.putFlowExecution(holder.getFlowExecutionKey(), flowExecution); - } - else { + } else { if (holder.getFlowExecutionKey() != null) { // remove the flow execution from the repository if (logger.isDebugEnabled()) { @@ -455,8 +443,7 @@ public class FlowPhaseListener implements PhaseListener { } /** - * Helper method to issue a redirect in a JSF environment properly. Subclasses may use - * as utility code. + * Helper method to issue a redirect in a JSF environment properly. Subclasses may use as utility code. * @param url the url to redirect to * @param context the faces context */ @@ -465,12 +452,11 @@ public class FlowPhaseListener implements PhaseListener { url = context.getExternalContext().encodeResourceURL(url); context.getExternalContext().redirect(url); context.responseComplete(); - } - catch (IOException e) { + } catch (IOException e) { throw new IllegalArgumentException("Could not send redirect to " + url); } } - + // private helpers private JsfExternalContext getCurrentContext() { @@ -480,7 +466,7 @@ public class FlowPhaseListener implements PhaseListener { private void cleanupResources(FacesContext context) { if (logger.isDebugEnabled()) { logger.debug("Cleaning up allocated flow system resources"); - } + } FlowExecutionHolderUtils.cleanupCurrentFlowExecution(context); ExternalContextHolder.setExternalContext(null); } @@ -530,8 +516,7 @@ public class FlowPhaseListener implements PhaseListener { lock.lock(); // set that the flow execution lock has been acquired holder.setFlowExecutionLock(lock); - } - else { + } else { // it is an existing conversation - get the next key flowExecutionKey = repository.getNextKey(flowExecution, flowExecutionKey); } @@ -548,8 +533,7 @@ public class FlowPhaseListener implements PhaseListener { private void putInto(Map targetMap, Map map) { try { targetMap.putAll(map); - } - catch (UnsupportedOperationException e) { + } catch (UnsupportedOperationException e) { // work around nasty MyFaces bug where it's RequestMap doesn't // support putAll remove after it's fixed in MyFaces Iterator it = map.entrySet().iterator(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowSystemCleanupFilter.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowSystemCleanupFilter.java index cca65412..47ef15fd 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowSystemCleanupFilter.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowSystemCleanupFilter.java @@ -27,10 +27,9 @@ import org.springframework.web.filter.OncePerRequestFilter; import org.springframework.webflow.context.ExternalContextHolder; /** - * A servlet filter used to guarantee that web flow context information is - * cleaned up in a JSF environment. Most useful to ensure no possibility - * of a flow execution remaining locked due to an uncaught JSF exception. - * + * A servlet filter used to guarantee that web flow context information is cleaned up in a JSF environment. Most useful + * to ensure no possibility of a flow execution remaining locked due to an uncaught JSF exception. + * * @author Ben Hale */ public class FlowSystemCleanupFilter extends OncePerRequestFilter { @@ -39,17 +38,15 @@ public class FlowSystemCleanupFilter extends OncePerRequestFilter { throws ServletException, IOException { try { chain.doFilter(request, response); - } - finally { + } finally { cleanupCurrentFlowExecution(request); ExternalContextHolder.setExternalContext(null); } } /** - * Cleans up the current flow execution in the request context if necessary. - * Specifically, handles unlocking the execution if necessary and setting the - * holder to null. Can be safely called even if no execution is bound or one + * Cleans up the current flow execution in the request context if necessary. Specifically, handles unlocking the + * execution if necessary and setting the holder to null. Can be safely called even if no execution is bound or one * is bound but not locked. * @param request the servlet request */ @@ -61,8 +58,7 @@ public class FlowSystemCleanupFilter extends OncePerRequestFilter { } /** - * Returns true if the flow execution has been restored in the current - * thread. + * Returns true if the flow execution has been restored in the current thread. * @param request the servlet request * @return true if restored, false otherwise */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowVariableResolver.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowVariableResolver.java index e2e7c603..5b0d97d7 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowVariableResolver.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/FlowVariableResolver.java @@ -67,8 +67,7 @@ public class FlowVariableResolver extends VariableResolver { public Object resolveVariable(FacesContext context, String name) throws EvaluationException { if (FLOW_SCOPE_VARIABLE.equals(name)) { return FlowExecutionHolderUtils.getRequiredCurrentFlowExecution(context); - } - else { + } else { return resolverDelegate.resolveVariable(context, name); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/JsfExternalContext.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/JsfExternalContext.java index f26bb342..17bb9dfb 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/JsfExternalContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/JsfExternalContext.java @@ -151,7 +151,7 @@ public class JsfExternalContext implements ExternalContext { this.actionId = actionId; this.outcome = outcome; } - + /** * An accessor of a JSF session map. * @author Keith Donald diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/JsfFlowConfigurationException.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/JsfFlowConfigurationException.java index 86d445fb..9d069ffd 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/JsfFlowConfigurationException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/jsf/JsfFlowConfigurationException.java @@ -27,7 +27,7 @@ public class JsfFlowConfigurationException extends FlowException { public JsfFlowConfigurationException(String msg) { super(msg); } - + public JsfFlowConfigurationException(String msg, Throwable cause) { super(msg, cause); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/mvc/FlowController.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/mvc/FlowController.java index 147b0353..c63b42e4 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/mvc/FlowController.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/mvc/FlowController.java @@ -42,30 +42,26 @@ import org.springframework.webflow.executor.support.RequestPathFlowExecutorArgum import org.springframework.webflow.executor.support.ResponseInstructionHandler; /** - * Point of integration between Spring Web MVC and Spring Web Flow: a - * {@link Controller} that routes incoming requests to one or more managed flow - * executions. + * Point of integration between Spring Web MVC and Spring Web Flow: a {@link Controller} that routes incoming requests + * to one or more managed flow executions. *

    - * Requests into the web flow system are handled by a {@link FlowExecutor}, - * which this class delegates to using a {@link FlowRequestHandler} helper. - * Consult the JavaDoc of that class for more information on how requests are + * Requests into the web flow system are handled by a {@link FlowExecutor}, which this class delegates to using a + * {@link FlowRequestHandler} helper. Consult the JavaDoc of that class for more information on how requests are * processed. *

    * Note: a single FlowController may execute all flows of your application. *

    *

    * Usage example: + * *

      *     <!--
      *         Exposes flows for execution at a single request URL.
    @@ -77,10 +73,10 @@ import org.springframework.webflow.executor.support.ResponseInstructionHandler;
      *         <property name="flowExecutor" ref="flowExecutor"/>
      *     </bean>
      * 
    + * *

    - * It is also possible to customize the {@link FlowExecutorArgumentHandler} - * strategy to allow for different types of controller parameterization, for - * example perhaps in conjunction with a REST-style request mapper (see + * It is also possible to customize the {@link FlowExecutorArgumentHandler} strategy to allow for different types of + * controller parameterization, for example perhaps in conjunction with a REST-style request mapper (see * {@link RequestPathFlowExecutorArgumentHandler}). * * @see org.springframework.webflow.executor.FlowExecutor @@ -93,8 +89,7 @@ import org.springframework.webflow.executor.support.ResponseInstructionHandler; public class FlowController extends AbstractController implements InitializingBean { /** - * The facade for executing flows (launching new executions, and resuming - * existing executions). + * The facade for executing flows (launching new executions, and resuming existing executions). */ private FlowExecutor flowExecutor; @@ -131,8 +126,8 @@ public class FlowController extends AbstractController implements InitializingBe } /** - * Returns the flow executor argument handler used by this controller. - * Defaults to {@link RequestParameterFlowExecutorArgumentHandler}. + * Returns the flow executor argument handler used by this controller. Defaults to + * {@link RequestParameterFlowExecutorArgumentHandler}. * @return the argument handler */ public FlowExecutorArgumentHandler getArgumentHandler() { @@ -149,13 +144,11 @@ public class FlowController extends AbstractController implements InitializingBe } /** - * Sets the identifier of the default flow to launch if no flowId argument - * can be extracted by the configured {@link FlowExecutorArgumentHandler} - * during request processing. + * Sets the identifier of the default flow to launch if no flowId argument can be extracted by the configured + * {@link FlowExecutorArgumentHandler} during request processing. *

    - * This is a convenience method that sets the default flow id of the - * controller's argument handler. Don't use this when using - * {@link #setArgumentHandler(FlowExecutorArgumentHandler)}. + * This is a convenience method that sets the default flow id of the controller's argument handler. Don't use this + * when using {@link #setArgumentHandler(FlowExecutorArgumentHandler)}. */ public void setDefaultFlowId(String defaultFlowId) { this.argumentHandler.setDefaultFlowId(defaultFlowId); @@ -174,10 +167,9 @@ public class FlowController extends AbstractController implements InitializingBe } /** - * Factory method that creates a new helper for processing a request into - * this flow controller. The handler is a basic template encapsulating - * reusable flow execution request handling workflow. - * This implementation just creates a new {@link FlowRequestHandler}. + * Factory method that creates a new helper for processing a request into this flow controller. The handler is a + * basic template encapsulating reusable flow execution request handling workflow. This implementation just creates + * a new {@link FlowRequestHandler}. * @return the controller helper */ protected FlowRequestHandler createRequestHandler() { @@ -185,15 +177,13 @@ public class FlowController extends AbstractController implements InitializingBe } /** - * Create a ModelAndView object based on the information in the selected - * response instruction. Subclasses can override this to return a - * specialized ModelAndView or to do custom processing on it. + * Create a ModelAndView object based on the information in the selected response instruction. Subclasses can + * override this to return a specialized ModelAndView or to do custom processing on it. * @param responseInstruction the response instruction to convert * @return a new ModelAndView object */ - protected ModelAndView toModelAndView( - final ResponseInstruction responseInstruction, final ExternalContext context) { - return (ModelAndView)new ResponseInstructionHandler() { + protected ModelAndView toModelAndView(final ResponseInstruction responseInstruction, final ExternalContext context) { + return (ModelAndView) new ResponseInstructionHandler() { protected void handleApplicationView(ApplicationView view) throws Exception { // forward to a view as part of an active conversation Map model = new HashMap(view.getModel()); @@ -210,16 +200,15 @@ public class FlowController extends AbstractController implements InitializingBe protected void handleFlowExecutionRedirect(FlowExecutionRedirect redirect) throws Exception { // redirect to active flow execution URL - String flowExecutionUrl = argumentHandler.createFlowExecutionUrl( - responseInstruction.getFlowExecutionKey(), - responseInstruction.getFlowExecutionContext(), context); + String flowExecutionUrl = argumentHandler.createFlowExecutionUrl(responseInstruction + .getFlowExecutionKey(), responseInstruction.getFlowExecutionContext(), context); setResult(new ModelAndView(new RedirectView(flowExecutionUrl))); } protected void handleExternalRedirect(ExternalRedirect redirect) throws Exception { // redirect to external URL - String externalUrl = argumentHandler.createExternalUrl(redirect, - responseInstruction.getFlowExecutionKey(), context); + String externalUrl = argumentHandler.createExternalUrl(redirect, responseInstruction + .getFlowExecutionKey(), context); setResult(new ModelAndView(new RedirectView(externalUrl))); } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/mvc/PortletFlowController.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/mvc/PortletFlowController.java index 2df29dd5..969a4c0c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/mvc/PortletFlowController.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/mvc/PortletFlowController.java @@ -46,12 +46,12 @@ import org.springframework.webflow.executor.support.ResponseInstructionHandler; * Point of integration between Spring Portlet MVC and Spring Web Flow: a {@link Controller} that routes incoming * portlet requests to one or more managed flow executions. *

    - * Requests into the web flow system are handled by a {@link FlowExecutor}, which this class delegates to. Consult - * the JavaDoc of that class for more information on how requests are processed. + * Requests into the web flow system are handled by a {@link FlowExecutor}, which this class delegates to. Consult the + * JavaDoc of that class for more information on how requests are processed. *

    * Note: a single PortletFlowController may execute all flows within your application. See the - * phonebook-portlet sample application for examples of the various strategies for launching and - * resuming flow executions in a Portlet environment. + * phonebook-portlet sample application for examples of the various strategies for launching and resuming + * flow executions in a Portlet environment. *

    * It is also possible to customize the {@link FlowExecutorArgumentHandler} strategy to allow for different types of * controller parameterization, for example perhaps in conjunction with a REST-style request mapper. @@ -61,13 +61,13 @@ import org.springframework.webflow.executor.support.ResponseInstructionHandler; * redirect. Keep the following in mind when developing Portlets using Spring Web Flow: *

    * * @see org.springframework.webflow.executor.FlowExecutor @@ -166,16 +166,14 @@ public class PortletFlowController extends AbstractController implements Initial if (responseInstruction != null) { // found: convert the cached response instruction to model and view for rendering return toModelAndView(responseInstruction); - } - else { + } else { if (argumentHandler.isFlowExecutionKeyPresent(context)) { // this is a request to render an active flow execution -- extract its key String flowExecutionKey = argumentHandler.extractFlowExecutionKey(context); // simply refresh the current view state of the flow execution (happens // when the "refresh" browser button is clicked) return toModelAndView(flowExecutor.refresh(flowExecutionKey, context)); - } - else { + } else { // launch a new flow execution String flowId = argumentHandler.extractFlowId(context); return toModelAndView(flowExecutor.launch(flowId, context)); @@ -200,8 +198,8 @@ public class PortletFlowController extends AbstractController implements Initial // we need to do this because the responseInstruction stored in the session // below will be removed from the session when the next render request // extracts it (see extractActionResponseInstruction) - response.setRenderParameter(argumentHandler.getFlowExecutionKeyArgumentName(), - responseInstruction.getFlowExecutionKey()); + response.setRenderParameter(argumentHandler.getFlowExecutionKeyArgumentName(), responseInstruction + .getFlowExecutionKey()); } // make response instruction available for rendering during the render phase of this portlet request exposeToRenderPhase(responseInstruction, request); @@ -220,8 +218,8 @@ public class PortletFlowController extends AbstractController implements Initial protected void handleFlowExecutionRedirect(FlowExecutionRedirect redirect) throws Exception { // is a flow execution redirect: simply expose key parameter to support refresh during render phase - response.setRenderParameter(argumentHandler.getFlowExecutionKeyArgumentName(), - responseInstruction.getFlowExecutionKey()); + response.setRenderParameter(argumentHandler.getFlowExecutionKeyArgumentName(), responseInstruction + .getFlowExecutionKey()); } protected void handleExternalRedirect(ExternalRedirect redirect) throws Exception { @@ -234,8 +232,8 @@ public class PortletFlowController extends AbstractController implements Initial if (responseInstruction.getFlowExecutionContext().isActive()) { // flow execution is still active // set the flow execution key render parameter to support browser refresh - response.setRenderParameter(argumentHandler.getFlowExecutionKeyArgumentName(), - responseInstruction.getFlowExecutionKey()); + response.setRenderParameter(argumentHandler.getFlowExecutionKeyArgumentName(), responseInstruction + .getFlowExecutionKey()); } // make response instruction available for rendering during the render phase of this portlet request exposeToRenderPhase(responseInstruction, request); @@ -269,8 +267,8 @@ public class PortletFlowController extends AbstractController implements Initial /** * Extract a response instruction stored in the session during the action phase by - * {@link #exposeToRenderPhase(ResponseInstruction, ActionRequest)}. If a response instruction is found, it will - * be removed from the session. + * {@link #exposeToRenderPhase(ResponseInstruction, ActionRequest)}. If a response instruction is found, it will be + * removed from the session. * @param request the portlet request * @return the response instructions found in the session or null if not found */ @@ -296,15 +294,13 @@ public class PortletFlowController extends AbstractController implements Initial // forward to a view as part of an active conversation ApplicationView forward = (ApplicationView) responseInstruction.getViewSelection(); Map model = new HashMap(forward.getModel()); - argumentHandler.exposeFlowExecutionContext(responseInstruction.getFlowExecutionKey(), - responseInstruction.getFlowExecutionContext(), model); + argumentHandler.exposeFlowExecutionContext(responseInstruction.getFlowExecutionKey(), responseInstruction + .getFlowExecutionContext(), model); return new ModelAndView(forward.getViewName(), model); - } - else if (responseInstruction.isNull()) { + } else if (responseInstruction.isNull()) { // no response to issue return null; - } - else { + } else { // we can't render any of the redirect responses since 'sendRedirect' is only // available on ActionResponse during the action phase // furthermore, a FlowExecutionRedirect doesn't really makes sense since the diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/struts/FlowAction.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/struts/FlowAction.java index aec78173..a5e3d13d 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/struts/FlowAction.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/struts/FlowAction.java @@ -44,40 +44,32 @@ import org.springframework.webflow.executor.support.RequestParameterFlowExecutor import org.springframework.webflow.executor.support.ResponseInstructionHandler; /** - * Point of integration between Struts and Spring Web Flow: a Struts Action that - * acts a front controller entry point into the web flow system. A single - * FlowAction may launch any new FlowExecution. In addition, a single Flow - * Action may signal events in any existing/restored FlowExecutions. + * Point of integration between Struts and Spring Web Flow: a Struts Action that acts a front controller entry point + * into the web flow system. A single FlowAction may launch any new FlowExecution. In addition, a single Flow Action may + * signal events in any existing/restored FlowExecutions. *

    - * Requests are managed by and delegated to a {@link FlowExecutor}, which this - * class delegates to using a {@link FlowRequestHandler} (allowing reuse of - * common front flow controller logic in other environments). Consult the + * Requests are managed by and delegated to a {@link FlowExecutor}, which this class delegates to using a + * {@link FlowRequestHandler} (allowing reuse of common front flow controller logic in other environments). Consult the * JavaDoc of those classes for more information on how requests are processed. *

    - *

  • By default, to have this controller launch a new flow execution - * (conversation), have the client send a - * {@link FlowExecutorArgumentHandler#getFlowIdArgumentName()} request - * parameter indicating the flow definition to launch. - *
  • To have this controller participate in an existing flow execution - * (conversation), have the client send a - * {@link FlowExecutorArgumentHandler#getFlowExecutionKeyArgumentName()} - * request parameter identifying the conversation to participate in. + *
  • By default, to have this controller launch a new flow execution (conversation), have the client send a + * {@link FlowExecutorArgumentHandler#getFlowIdArgumentName()} request parameter indicating the flow definition to + * launch. + *
  • To have this controller participate in an existing flow execution (conversation), have the client send a + * {@link FlowExecutorArgumentHandler#getFlowExecutionKeyArgumentName()} request parameter identifying the conversation + * to participate in. *

    - * On each request received by this action, a {@link StrutsExternalContext} - * object is created as input to the web flow system. This external source event - * provides access to the action form, action mapping, and other Struts-specific + * On each request received by this action, a {@link StrutsExternalContext} object is created as input to the web flow + * system. This external source event provides access to the action form, action mapping, and other Struts-specific * constructs. *

    - * This class also is aware of the {@link SpringBindingActionForm} adapter, - * which adapts Spring's data binding infrastructure (based on POJO binding, a - * standard Errors interface, and property editor type conversion) to the Struts - * action form model. This option gives backend web-tier developers full support - * for POJO-based binding with minimal hassel, while still providing consistency - * to view developers who already have a lot of experience with Struts for - * markup and request dispatching. + * This class also is aware of the {@link SpringBindingActionForm} adapter, which adapts Spring's data binding + * infrastructure (based on POJO binding, a standard Errors interface, and property editor type conversion) to the + * Struts action form model. This option gives backend web-tier developers full support for POJO-based binding with + * minimal hassel, while still providing consistency to view developers who already have a lot of experience with Struts + * for markup and request dispatching. *

    - * Below is an example struts-config.xml configuration for a - * FlowAction: + * Below is an example struts-config.xml configuration for a FlowAction: * *

      *     <action path="/userRegistration"
    @@ -86,43 +78,33 @@ import org.springframework.webflow.executor.support.ResponseInstructionHandler;
      *     </action>
      * 
    * - * This example maps the logical request URL /userRegistration.do - * as a Flow controller (FlowAction). It is expected that flows - * to launch be provided in a dynamic fashion by the views (allowing this single - * FlowAction to manage any number of flow executions). A Spring - * binding action form instance is set in request scope, acting as an adapter - * enabling POJO-based binding and validation with Spring. + * This example maps the logical request URL /userRegistration.do as a Flow controller (FlowAction). + * It is expected that flows to launch be provided in a dynamic fashion by the views (allowing this single + * FlowAction to manage any number of flow executions). A Spring binding action form instance is set in + * request scope, acting as an adapter enabling POJO-based binding and validation with Spring. *

    * Other notes regarding Struts/Spring Web Flow integration: *

      - *
    • Logical view names returned when ViewStates and - * EndStates are entered are mapped to physical view templates - * using standard Struts action forwards (typically global forwards).
    • - *
    • Use of the SpringBindingActionForm requires no special - * setup in struts-config.xml: simply declare a form bean in - * request scope of the class - * org.springframework.web.struts.SpringBindingActionForm and use - * it with your FlowAction.
    • - *
    • This class depends on a {@link FlowExecutor} instance to be configured. - * If relying on Spring's {@link DelegatingActionProxy} (which is recommended), - * a FlowExecutor reference can simply be injected using standard Spring - * dependency injection techniques. If you are not using the proxy-based - * approach, this class will attempt a root context lookup on initialization, - * first querying for a bean of instance {@link FlowExecutor} named + *
    • Logical view names returned when ViewStates and EndStates are entered are mapped + * to physical view templates using standard Struts action forwards (typically global forwards).
    • + *
    • Use of the SpringBindingActionForm requires no special setup in struts-config.xml: + * simply declare a form bean in request scope of the class + * org.springframework.web.struts.SpringBindingActionForm and use it with your FlowAction.
    • + *
    • This class depends on a {@link FlowExecutor} instance to be configured. If relying on Spring's + * {@link DelegatingActionProxy} (which is recommended), a FlowExecutor reference can simply be injected using standard + * Spring dependency injection techniques. If you are not using the proxy-based approach, this class will attempt a root + * context lookup on initialization, first querying for a bean of instance {@link FlowExecutor} named * {@link #FLOW_EXECUTOR_BEAN_NAME}.
    • - *
    • The - * {@link org.springframework.webflow.executor.support.FlowExecutorArgumentHandler} - * used by the FlowAction can be configured in the root context using a bean of - * name {@link #FLOW_EXECUTOR_ARGUMENT_HANDLER_BEAN_NAME}. If not explicitly - * specified it will default to a normal - * {@link org.springframework.webflow.executor.support.RequestParameterFlowExecutorArgumentHandler} - * with standard configuration.
    • + *
    • The {@link org.springframework.webflow.executor.support.FlowExecutorArgumentHandler} used by the FlowAction can + * be configured in the root context using a bean of name {@link #FLOW_EXECUTOR_ARGUMENT_HANDLER_BEAN_NAME}. If not + * explicitly specified it will default to a normal + * {@link org.springframework.webflow.executor.support.RequestParameterFlowExecutorArgumentHandler} with standard + * configuration.
    • *
    *

    - * The benefits here are considerable: developers now have a powerful web flow - * capability integrated with Struts, with a consistent-approach to POJO-based - * binding and validation that addresses the proliferation of - * ActionForm classes found in traditional Struts-based apps. + * The benefits here are considerable: developers now have a powerful web flow capability integrated with Struts, with a + * consistent-approach to POJO-based binding and validation that addresses the proliferation of ActionForm + * classes found in traditional Struts-based apps. * * @see org.springframework.webflow.executor.FlowExecutor * @see org.springframework.webflow.executor.support.FlowRequestHandler @@ -135,21 +117,19 @@ import org.springframework.webflow.executor.support.ResponseInstructionHandler; public class FlowAction extends ActionSupport { /** - * The flow executor will be retreived from the application context using - * this bean name if no executor is explicitly set. ("flowExecutor") + * The flow executor will be retreived from the application context using this bean name if no executor is + * explicitly set. ("flowExecutor") */ protected static final String FLOW_EXECUTOR_BEAN_NAME = "flowExecutor"; /** - * The flow executor argument handler will be retreived from the - * application context using this bean name if no argument handler is - * explicitly set. ("argumentHandler") + * The flow executor argument handler will be retreived from the application context using this bean name if no + * argument handler is explicitly set. ("argumentHandler") */ protected static final String FLOW_EXECUTOR_ARGUMENT_HANDLER_BEAN_NAME = "argumentHandler"; /** - * The service responsible for launching and signaling Struts-originating - * events in flow executions. + * The service responsible for launching and signaling Struts-originating events in flow executions. */ private FlowExecutor flowExecutor; @@ -194,9 +174,8 @@ public class FlowAction extends ActionSupport { WebApplicationContext context = getWebApplicationContext(); if (getFlowExecutor() == null) { if (context.containsBean(FLOW_EXECUTOR_BEAN_NAME)) { - setFlowExecutor((FlowExecutor)context.getBean(FLOW_EXECUTOR_BEAN_NAME, FlowExecutor.class)); - } - else { + setFlowExecutor((FlowExecutor) context.getBean(FLOW_EXECUTOR_BEAN_NAME, FlowExecutor.class)); + } else { throw new IllegalStateException("No '" + FLOW_EXECUTOR_BEAN_NAME + "' bean definition could be found; to use Spring Web Flow with Struts you must " + "configure this FlowAction with a FlowExecutor"); @@ -204,10 +183,9 @@ public class FlowAction extends ActionSupport { } if (getArgumentHandler() == null) { if (context.containsBean(FLOW_EXECUTOR_ARGUMENT_HANDLER_BEAN_NAME)) { - setArgumentHandler((FlowExecutorArgumentHandler)context.getBean( + setArgumentHandler((FlowExecutorArgumentHandler) context.getBean( FLOW_EXECUTOR_ARGUMENT_HANDLER_BEAN_NAME, FlowExecutorArgumentHandler.class)); - } - else { + } else { // default argumentHandler = new RequestParameterFlowExecutorArgumentHandler(); } @@ -222,8 +200,7 @@ public class FlowAction extends ActionSupport { } /** - * Factory method that creates a new helper for processing a request into - * this flow controller. + * Factory method that creates a new helper for processing a request into this flow controller. * @return the controller helper */ protected FlowRequestHandler createRequestHandler() { @@ -231,25 +208,24 @@ public class FlowAction extends ActionSupport { } /** - * Return a Struts ActionForward given a ResponseInstruction. Adds all - * attributes from the ResponseInstruction as request attributes. + * Return a Struts ActionForward given a ResponseInstruction. Adds all attributes from the ResponseInstruction as + * request attributes. */ - protected ActionForward toActionForward(final ResponseInstruction responseInstruction, - final ActionMapping mapping, final ActionForm form, - final HttpServletRequest request, final HttpServletResponse response, + protected ActionForward toActionForward(final ResponseInstruction responseInstruction, final ActionMapping mapping, + final ActionForm form, final HttpServletRequest request, final HttpServletResponse response, final ExternalContext context) throws Exception { - return (ActionForward)new ResponseInstructionHandler() { + return (ActionForward) new ResponseInstructionHandler() { protected void handleApplicationView(ApplicationView view) throws Exception { // forward to a view as part of an active conversation Map model = new HashMap(view.getModel()); - argumentHandler.exposeFlowExecutionContext( - responseInstruction.getFlowExecutionKey(), responseInstruction.getFlowExecutionContext(), model); + argumentHandler.exposeFlowExecutionContext(responseInstruction.getFlowExecutionKey(), + responseInstruction.getFlowExecutionContext(), model); WebUtils.exposeRequestAttributes(request, model); if (form instanceof SpringBindingActionForm) { - SpringBindingActionForm bindingForm = (SpringBindingActionForm)form; + SpringBindingActionForm bindingForm = (SpringBindingActionForm) form; // expose the form object and associated errors as the // "current form object" in the request - Errors currentErrors = (Errors)model.get(FormObjectAccessor.getCurrentFormErrorsName()); + Errors currentErrors = (Errors) model.get(FormObjectAccessor.getCurrentFormErrorsName()); bindingForm.expose(currentErrors, request); } setResult(findForward(view, mapping)); @@ -263,15 +239,15 @@ public class FlowAction extends ActionSupport { protected void handleFlowExecutionRedirect(FlowExecutionRedirect redirect) throws Exception { // redirect to active flow execution URL - String flowExecutionUrl = argumentHandler.createFlowExecutionUrl( - responseInstruction.getFlowExecutionKey(), responseInstruction.getFlowExecutionContext(), context); + String flowExecutionUrl = argumentHandler.createFlowExecutionUrl(responseInstruction + .getFlowExecutionKey(), responseInstruction.getFlowExecutionContext(), context); setResult(createRedirectForward(flowExecutionUrl, response)); } protected void handleExternalRedirect(ExternalRedirect redirect) throws Exception { // redirect to external URL - String externalUrl = argumentHandler.createExternalUrl( - redirect, responseInstruction.getFlowExecutionKey(), context); + String externalUrl = argumentHandler.createExternalUrl(redirect, responseInstruction + .getFlowExecutionKey(), context); setResult(createRedirectForward(externalUrl, response)); } @@ -283,8 +259,7 @@ public class FlowAction extends ActionSupport { } /** - * Handles a redirect. This implementation simply calls sendRedirect on the - * response object. + * Handles a redirect. This implementation simply calls sendRedirect on the response object. * @param url the url to redirect to * @param response the http response * @return the redirect forward, this implementation returns null @@ -297,9 +272,8 @@ public class FlowAction extends ActionSupport { } /** - * Find an action forward for given application view. If no suitable forward - * is found in the action mapping using the view name as a key, this method - * will create a new action forward using the view name. + * Find an action forward for given application view. If no suitable forward is found in the action mapping using + * the view name as a key, this method will create a new action forward using the view name. * @param forward the application view to find a forward for * @param mapping the action mapping to use * @return the action forward, never null @@ -313,8 +287,7 @@ public class FlowAction extends ActionSupport { // the 1.2.1 copy constructor would ideally be better to // use, but it is not Struts 1.1 compatible actionForward = new ActionForward(actionForward.getName(), actionForward.getPath(), false); - } - else { + } else { actionForward = new ActionForward(forward.getViewName(), false); } return actionForward; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/struts/StrutsExternalContext.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/struts/StrutsExternalContext.java index 1dc4cf44..9db4bfa5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/struts/StrutsExternalContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/struts/StrutsExternalContext.java @@ -24,8 +24,8 @@ import org.apache.struts.action.ActionMapping; import org.springframework.webflow.context.servlet.ServletExternalContext; /** - * Provides consistent access to a Struts environment from within the Spring Web - * Flow system. Represents the context of a request into SWF from Struts. + * Provides consistent access to a Struts environment from within the Spring Web Flow system. Represents the context of + * a request into SWF from Struts. * * @author Keith Donald */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExposer.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExposer.java index 4f19179b..bff8512c 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExposer.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExposer.java @@ -25,32 +25,28 @@ import org.springframework.webflow.execution.support.FlowExecutionRedirect; import org.springframework.webflow.executor.FlowExecutor; /** - * Helper strategy that can expose {@link FlowExecutor} method arguments in - * a response (view) so that subsequent requests resulting from the response - * can have those arguments extracted again, typically using a + * Helper strategy that can expose {@link FlowExecutor} method arguments in a response (view) so that subsequent + * requests resulting from the response can have those arguments extracted again, typically using a * {@link FlowExecutorArgumentExtractor}. *

    - * Arguments can either be exposed in the model of a view that will be - * rendered or in a URL that will be used to trigger a new request into - * Spring Web Flow, for instance using a redirect. + * Arguments can either be exposed in the model of a view that will be rendered or in a URL that will be used to trigger + * a new request into Spring Web Flow, for instance using a redirect. * * @author Erwin Vervaet */ public interface FlowExecutorArgumentExposer { - + /** * Expose the flow execution context and it's key in given model map. - * @param flowExecutionKey the flow execution key (may be null if the - * conversation has ended) + * @param flowExecutionKey the flow execution key (may be null if the conversation has ended) * @param context the flow execution context * @param model the model map */ public void exposeFlowExecutionContext(String flowExecutionKey, FlowExecutionContext context, Map model); /** - * Create a URL that when redirected to launches a entirely new execution of - * a flow definition (starts a new conversation). Used to support the restart flow - * and redirect to flow use cases. + * Create a URL that when redirected to launches a entirely new execution of a flow definition (starts a new + * conversation). Used to support the restart flow and redirect to flow use cases. * @param flowDefinitionRedirect the flow definition redirect view selection * @param context the external context * @return the relative flow URL path to redirect to @@ -58,10 +54,8 @@ public interface FlowExecutorArgumentExposer { public String createFlowDefinitionUrl(FlowDefinitionRedirect flowDefinitionRedirect, ExternalContext context); /** - * Create a URL path that when redirected to renders the current (or - * last) view selection made by the flow execution identified by the flow - * execution key. Used to support the flow execution redirect use - * case. + * Create a URL path that when redirected to renders the current (or last) view selection made by the flow + * execution identified by the flow execution key. Used to support the flow execution redirect use case. * @param flowExecutionKey the flow execution key * @param flowExecution the flow execution * @param context the external context @@ -72,11 +66,9 @@ public interface FlowExecutorArgumentExposer { ExternalContext context); /** - * Create a URL path that when redirected to communicates with an external - * system outside of Spring Web Flow. + * Create a URL path that when redirected to communicates with an external system outside of Spring Web Flow. * @param redirect the external redirect request - * @param flowExecutionKey the flow execution key to send through the - * redirect (optional) + * @param flowExecutionKey the flow execution key to send through the redirect (optional) * @param context the external context * @return the external URL */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExtractionException.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExtractionException.java index 4e55fe37..68ffe0b7 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExtractionException.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExtractionException.java @@ -18,8 +18,7 @@ package org.springframework.webflow.executor.support; import org.springframework.webflow.core.FlowException; /** - * An exception thrown by a flow executor argument extractor when an - * argument could not be extracted. + * An exception thrown by a flow executor argument extractor when an argument could not be extracted. * * @see org.springframework.webflow.executor.support.FlowExecutorArgumentExtractor * diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExtractor.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExtractor.java index ef097ecb..5ff9b048 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExtractor.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentExtractor.java @@ -20,11 +20,9 @@ import org.springframework.webflow.execution.repository.FlowExecutionKey; import org.springframework.webflow.executor.FlowExecutor; /** - * A helper strategy used by the {@link FlowRequestHandler} to extract - * {@link FlowExecutor} method arguments from a request initiated by - * an {@link ExternalContext}. The extracted arguments were typically - * exposed in the previous response (the response that resulted in - * a new request) using a {@link FlowExecutorArgumentExposer}. + * A helper strategy used by the {@link FlowRequestHandler} to extract {@link FlowExecutor} method arguments from a + * request initiated by an {@link ExternalContext}. The extracted arguments were typically exposed in the previous + * response (the response that resulted in a new request) using a {@link FlowExecutorArgumentExposer}. * * @author Keith Donald * @author Erwin Vervaet @@ -42,8 +40,7 @@ public interface FlowExecutorArgumentExtractor { * Extracts the flow id from the external context. * @param context the context in which a external user event occured * @return the extracted flow id - * @throws FlowExecutorArgumentExtractionException if the flow id could not - * be extracted + * @throws FlowExecutorArgumentExtractionException if the flow id could not be extracted */ public String extractFlowId(ExternalContext context) throws FlowExecutorArgumentExtractionException; @@ -58,8 +55,7 @@ public interface FlowExecutorArgumentExtractor { * Extract the flow execution key from the external context. * @param context the context in which the external user event occured * @return the obtained flow execution key - * @throws FlowExecutorArgumentExtractionException if the flow execution key - * could not be extracted + * @throws FlowExecutorArgumentExtractionException if the flow execution key could not be extracted */ public String extractFlowExecutionKey(ExternalContext context) throws FlowExecutorArgumentExtractionException; @@ -73,12 +69,11 @@ public interface FlowExecutorArgumentExtractor { /** * Extract the flow execution event id from the external context. *

    - * This method should only be called if a {@link FlowExecutionKey} was - * successfully extracted, indicating a request to resume a flow execution. + * This method should only be called if a {@link FlowExecutionKey} was successfully extracted, indicating a request + * to resume a flow execution. * @param context the context in which a external user event occured * @return the event id - * @throws FlowExecutorArgumentExtractionException if the event id could not - * be extracted + * @throws FlowExecutorArgumentExtractionException if the event id could not be extracted */ public String extractEventId(ExternalContext context) throws FlowExecutorArgumentExtractionException; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentHandler.java index 7744383f..a85316aa 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowExecutorArgumentHandler.java @@ -27,18 +27,16 @@ import org.springframework.webflow.execution.support.ExternalRedirect; import org.springframework.webflow.execution.support.FlowDefinitionRedirect; /** - * Abstract base class for objects handling - * {@link org.springframework.webflow.executor.FlowExecutor} arguments. This - * class combines the two argument handling responsabilities of ({@link FlowExecutorArgumentExtractor extraction} - * and {@link FlowExecutorArgumentExposer exposing}) and makes sure they are - * consistent, i.e. that exposed arguments can later be extracted again. + * Abstract base class for objects handling {@link org.springframework.webflow.executor.FlowExecutor} arguments. This + * class combines the two argument handling responsabilities of ({@link FlowExecutorArgumentExtractor extraction} and + * {@link FlowExecutorArgumentExposer exposing}) and makes sure they are consistent, i.e. that exposed arguments can + * later be extracted again. *

    - * All argument names are configurable. Common convenience functionality is also - * provided, e.g. a {@link #applyDefaultFlowId(String) default flow id}, - * {@link #encodeValue(Object) URL encoding} and dealing with - * {@link #makeRedirectUrlContextRelativeIfNecessary(String, ExternalContext) relative URLs}. - * Subclasses are responsible for taking these settings into account when - * implementing actual argument extraction and exposing behavior. + * All argument names are configurable. Common convenience functionality is also provided, e.g. a + * {@link #applyDefaultFlowId(String) default flow id}, {@link #encodeValue(Object) URL encoding} and dealing with + * {@link #makeRedirectUrlContextRelativeIfNecessary(String, ExternalContext) relative URLs}. Subclasses are + * responsible for taking these settings into account when implementing actual argument extraction and exposing + * behavior. * * @see FlowExecutorArgumentExtractor * @see FlowExecutorArgumentExposer @@ -51,45 +49,41 @@ public abstract class FlowExecutorArgumentHandler implements FlowExecutorArgumen // data and behavior related to argument extraction /** - * By default clients can send the id of the flow definition to be launched - * using an argument with this name ("_flowId"). + * By default clients can send the id of the flow definition to be launched using an argument with this name + * ("_flowId"). */ private static final String FLOW_ID_ARGUMENT_NAME = "_flowId"; /** - * By default clients can send the key of a flow execution to be resumed - * using an argument with this name ("_flowExecutionKey"). + * By default clients can send the key of a flow execution to be resumed using an argument with this name + * ("_flowExecutionKey"). */ private static final String FLOW_EXECUTION_KEY_ARGUMENT_NAME = "_flowExecutionKey"; /** - * By default clients can send the event to be signaled in an argument with - * this name ("_eventId"). + * By default clients can send the event to be signaled in an argument with this name ("_eventId"). */ private static final String EVENT_ID_ARGUMENT_NAME = "_eventId"; /** - * Identifies a flow definition to launch a new execution for, defaults to - * {@link #FLOW_ID_ARGUMENT_NAME}. + * Identifies a flow definition to launch a new execution for, defaults to {@link #FLOW_ID_ARGUMENT_NAME}. */ private String flowIdArgumentName = FLOW_ID_ARGUMENT_NAME; /** - * Input argument that identifies an existing flow execution to participate - * in, defaults to {@link #FLOW_EXECUTION_KEY_ARGUMENT_NAME}. + * Input argument that identifies an existing flow execution to participate in, defaults to + * {@link #FLOW_EXECUTION_KEY_ARGUMENT_NAME}. */ private String flowExecutionKeyArgumentName = FLOW_EXECUTION_KEY_ARGUMENT_NAME; /** - * Identifies an event that occured in an existing flow execution, defaults - * to {@link #EVENT_ID_ARGUMENT_NAME}. + * Identifies an event that occured in an existing flow execution, defaults to {@link #EVENT_ID_ARGUMENT_NAME}. */ private String eventIdArgumentName = EVENT_ID_ARGUMENT_NAME; /** - * The flow definition id to use if no flowId argument value can be - * extracted during the {@link #extractFlowId(ExternalContext)} operation. - * Default value is null. + * The flow definition id to use if no flowId argument value can be extracted during the + * {@link #extractFlowId(ExternalContext)} operation. Default value is null. */ private String defaultFlowId; @@ -108,41 +102,36 @@ public abstract class FlowExecutorArgumentHandler implements FlowExecutorArgumen } /** - * Returns the flow execution key argument name, used to request that an - * executing conversation resumes. + * Returns the flow execution key argument name, used to request that an executing conversation resumes. */ public String getFlowExecutionKeyArgumentName() { return flowExecutionKeyArgumentName; } /** - * Sets the flow execution key argument name, used to request that an - * executing conversation resumes. + * Sets the flow execution key argument name, used to request that an executing conversation resumes. */ public void setFlowExecutionKeyArgumentName(String flowExecutionKeyArgumentName) { this.flowExecutionKeyArgumentName = flowExecutionKeyArgumentName; } /** - * Returns the event id argument name, used to signal what user action - * happened within a paused flow execution. + * Returns the event id argument name, used to signal what user action happened within a paused flow execution. */ public String getEventIdArgumentName() { return eventIdArgumentName; } /** - * Sets the event id argument name, used to signal what user action happened - * within a paused flow execution. + * Sets the event id argument name, used to signal what user action happened within a paused flow execution. */ public void setEventIdArgumentName(String eventIdArgumentName) { this.eventIdArgumentName = eventIdArgumentName; } /** - * Returns the default flowId argument value. If no flow id argument - * is provided, the default acts as a fallback. Defaults to - * null. + * Returns the default flowId argument value. If no flow id argument is provided, the default acts as a + * fallback. Defaults to null. */ public String getDefaultFlowId() { return defaultFlowId; @@ -151,8 +140,8 @@ public abstract class FlowExecutorArgumentHandler implements FlowExecutorArgumen /** * Sets the default flowId argument value. *

    - * This value will be used if no flowId argument value can be extracted from - * the request by the {@link #extractFlowId(ExternalContext)} operation. + * This value will be used if no flowId argument value can be extracted from the request by the + * {@link #extractFlowId(ExternalContext)} operation. */ public void setDefaultFlowId(String defaultFlowId) { this.defaultFlowId = defaultFlowId; @@ -161,14 +150,14 @@ public abstract class FlowExecutorArgumentHandler implements FlowExecutorArgumen // data and behavior for response issuance /** - * The string-encoded id of the flow execution will be exposed to the view - * in a model attribute with this name ("flowExecutionKey"). + * The string-encoded id of the flow execution will be exposed to the view in a model attribute with this name + * ("flowExecutionKey"). */ private static final String FLOW_EXECUTION_KEY_ATTRIBUTE = "flowExecutionKey"; /** - * The flow execution context itself will be exposed to the view in a model - * attribute with this name ("flowExecutionContext"). + * The flow execution context itself will be exposed to the view in a model attribute with this name + * ("flowExecutionContext"). */ private static final String FLOW_EXECUTION_CONTEXT_ATTRIBUTE = "flowExecutionContext"; @@ -178,42 +167,40 @@ public abstract class FlowExecutorArgumentHandler implements FlowExecutorArgumen private static final String DEFAULT_URL_ENCODING_SCHEME = "UTF-8"; /** - * Model attribute that identifies the flow execution participated in, - * defaults to {@link #FLOW_EXECUTION_KEY_ATTRIBUTE}. + * Model attribute that identifies the flow execution participated in, defaults to + * {@link #FLOW_EXECUTION_KEY_ATTRIBUTE}. */ private String flowExecutionKeyAttributeName = FLOW_EXECUTION_KEY_ATTRIBUTE; /** - * Model attribute that provides state about the flow execution participated - * in, defaults to {@link #FLOW_EXECUTION_CONTEXT_ATTRIBUTE}. + * Model attribute that provides state about the flow execution participated in, defaults to + * {@link #FLOW_EXECUTION_CONTEXT_ATTRIBUTE}. */ private String flowExecutionContextAttributeName = FLOW_EXECUTION_CONTEXT_ATTRIBUTE; /** - * The url encoding scheme to be used to encode URLs built by this argument - * handler. Defaults to {@link #DEFAULT_URL_ENCODING_SCHEME}. + * The url encoding scheme to be used to encode URLs built by this argument handler. Defaults to + * {@link #DEFAULT_URL_ENCODING_SCHEME}. */ private String urlEncodingScheme = DEFAULT_URL_ENCODING_SCHEME; /** - * A flag indicating whether to interpret a redirect URL that starts with a - * slash ("/") as relative to the current ServletContext, i.e. as relative - * to the web application root, as opposed to absolute. Default is true. + * A flag indicating whether to interpret a redirect URL that starts with a slash ("/") as relative to the current + * ServletContext, i.e. as relative to the web application root, as opposed to absolute. Default is true. */ private boolean redirectContextRelative = true; /** - * Returns the flow execution key attribute name, used as a model attribute - * for identifying the executing flow being participated in. + * Returns the flow execution key attribute name, used as a model attribute for identifying the executing flow being + * participated in. */ public String getFlowExecutionKeyAttributeName() { return flowExecutionKeyAttributeName; } /** - * Sets the flow execution key attribute name, used as a model attribute for - * identifying the current state of the executing flow being participated in - * (typically used by view templates during rendering). + * Sets the flow execution key attribute name, used as a model attribute for identifying the current state of the + * executing flow being participated in (typically used by view templates during rendering). */ public void setFlowExecutionKeyAttributeName(String flowExecutionKeyAttributeName) { this.flowExecutionKeyAttributeName = flowExecutionKeyAttributeName; @@ -234,38 +221,33 @@ public abstract class FlowExecutorArgumentHandler implements FlowExecutorArgumen } /** - * Returns the url encoding scheme to be used to encode URLs built by this - * argument handler. Defaults to "UTF-8". + * Returns the url encoding scheme to be used to encode URLs built by this argument handler. Defaults to "UTF-8". */ public String getUrlEncodingScheme() { return urlEncodingScheme; } /** - * Set the url encoding scheme to be used to encode URLs built by this - * argument handler. Defaults to "UTF-8". + * Set the url encoding scheme to be used to encode URLs built by this argument handler. Defaults to "UTF-8". */ public void setUrlEncodingScheme(String urlEncodingScheme) { this.urlEncodingScheme = urlEncodingScheme; } /** - * Set whether to interpret a given redirect URL that starts with a slash - * ("/") as relative to the current ServletContext, i.e. as relative to the - * web application root. + * Set whether to interpret a given redirect URL that starts with a slash ("/") as relative to the current + * ServletContext, i.e. as relative to the web application root. *

    - * Default is "true": A redirect URL that starts with a slash will be - * interpreted as relative to the web application root, i.e. the context - * path will be prepended to the URL. + * Default is "true": A redirect URL that starts with a slash will be interpreted as relative to the web application + * root, i.e. the context path will be prepended to the URL. */ public void setRedirectContextRelative(boolean redirectContextRelative) { this.redirectContextRelative = redirectContextRelative; } /** - * Return whether to interpret a given redirect URL that starts with a slash - * ("/") as relative to the current ServletContext, i.e. as relative to the - * web application root. + * Return whether to interpret a given redirect URL that starts with a slash ("/") as relative to the current + * ServletContext, i.e. as relative to the web application root. */ public boolean isRedirectContextRelative() { return redirectContextRelative; @@ -303,10 +285,8 @@ public abstract class FlowExecutorArgumentHandler implements FlowExecutorArgumen /** * Apply the configured default flow id to given extracted flow id. - * @param extractedFlowId the extracted flow id, could be null if non was - * available in the external context - * @return the extracted flow id if not empty, the default flow id otherwise - * (which could still be null if not set) + * @param extractedFlowId the extracted flow id, could be null if non was available in the external context + * @return the extracted flow id if not empty, the default flow id otherwise (which could still be null if not set) * @see #getDefaultFlowId() */ protected String applyDefaultFlowId(String extractedFlowId) { @@ -324,9 +304,8 @@ public abstract class FlowExecutorArgumentHandler implements FlowExecutorArgumen } /** - * Make given redirect URL context relative if necessary. If the URL starts - * with a slash ("/") it will be made relative to the current - * ServletContext, i.e. relative to the web application root. + * Make given redirect URL context relative if necessary. If the URL starts with a slash ("/") it will be made + * relative to the current ServletContext, i.e. relative to the web application root. * @param url the original URL * @param context the external context * @return the processed URL @@ -346,9 +325,8 @@ public abstract class FlowExecutorArgumentHandler implements FlowExecutorArgumen /** * URL-encode the given input String with the configured encoding scheme. *

    - * Default implementation uses URLEncoder.encode(input, enc) - * on JDK 1.4+, falling back to URLEncoder.encode(input) - * (which uses the platform default encoding) on JDK 1.3. + * Default implementation uses URLEncoder.encode(input, enc) on JDK 1.4+, falling back to + * URLEncoder.encode(input) (which uses the platform default encoding) on JDK 1.3. * @param input the unencoded input String * @return the encoded output String */ @@ -358,8 +336,7 @@ public abstract class FlowExecutorArgumentHandler implements FlowExecutorArgumen } try { return URLEncoder.encode(input, getUrlEncodingScheme()); - } - catch (UnsupportedEncodingException e) { + } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException("Cannot encode URL " + input); } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowIdMappingArgumentHandlerWrapper.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowIdMappingArgumentHandlerWrapper.java index 21eb9ea2..4aaa0177 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowIdMappingArgumentHandlerWrapper.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowIdMappingArgumentHandlerWrapper.java @@ -31,8 +31,8 @@ import org.springframework.webflow.execution.support.FlowDefinitionRedirect; * For example, when used in combination with {@link RequestPathFlowExecutorArgumentHandler} the url * http://localhost/springair/reservation/booking.html would launch a new execution of the * booking-flow flow, assuming a context path of /springair, a servlet mapping of - * /reservation/* and a flow id mapping of booking->booking-flow - * (the .html suffix would be removed by {@link RequestPathFlowExecutorArgumentHandler#extractFlowId(ExternalContext)}. + * /reservation/* and a flow id mapping of booking->booking-flow (the .html suffix + * would be removed by {@link RequestPathFlowExecutorArgumentHandler#extractFlowId(ExternalContext)}. * * @see RequestParameterFlowExecutorArgumentHandler * @see RequestPathFlowExecutorArgumentHandler @@ -136,8 +136,7 @@ public class FlowIdMappingArgumentHandlerWrapper extends FlowExecutorArgumentHan public boolean isFlowIdPresent(ExternalContext context) { if (argumentHandler.isFlowIdPresent(context)) { return fallback || mappings.containsKey(argumentHandler.extractFlowId(context)); - } - else { + } else { return false; } } @@ -148,8 +147,7 @@ public class FlowIdMappingArgumentHandlerWrapper extends FlowExecutorArgumentHan if (!StringUtils.hasText(flowId)) { if (fallback) { flowId = publicFlowId; - } - else { + } else { throw new FlowExecutorArgumentExtractionException("Unable to extract flow definition id: " + "no mapping was defined for '" + publicFlowId + "'"); } @@ -179,8 +177,7 @@ public class FlowIdMappingArgumentHandlerWrapper extends FlowExecutorArgumentHan if (!StringUtils.hasText(publicFlowId)) { if (fallback) { publicFlowId = flowDefinitionRedirect.getFlowDefinitionId(); - } - else { + } else { // this is a mapping problem throw new IllegalArgumentException("Unable to create a flow definition URL for '" + flowDefinitionRedirect + "': no reverse mapping was defined for flow id '" diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowRequestHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowRequestHandler.java index 5419fcdb..59709987 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowRequestHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/FlowRequestHandler.java @@ -24,23 +24,21 @@ import org.springframework.webflow.executor.FlowExecutor; import org.springframework.webflow.executor.ResponseInstruction; /** - * An immutable helper for flow controllers that encapsulates reusable workflow - * required to launch and resume flow executions using a {@link FlowExecutor}. + * An immutable helper for flow controllers that encapsulates reusable workflow required to launch and resume flow + * executions using a {@link FlowExecutor}. *

    - * The {@link #handleFlowRequest(ExternalContext)} method is the central helper - * operation and implements the following algorithm: + * The {@link #handleFlowRequest(ExternalContext)} method is the central helper operation and implements the following + * algorithm: *

      *
    1. Extract the flow execution id by calling * {@link FlowExecutorArgumentExtractor#extractFlowExecutionKey(ExternalContext)}. - *
    2. If a valid flow execution id was extracted, signal an event in that - * existing execution to resume it. The event to signal is determined by calling - * the {@link FlowExecutorArgumentExtractor#extractEventId(ExternalContext)} - * method. If no event can be extracted, the existing execution will be refreshed. - *
    3. If no flow execution id was extracted, launch a new flow execution. The - * top-level flow definition for which an execution is created is determined by - * extracting the flow id using the method - * {@link FlowExecutorArgumentExtractor#extractFlowId(ExternalContext)}. If no - * valid flow id can be determined, an exception is thrown. + *
    4. If a valid flow execution id was extracted, signal an event in that existing execution to resume it. The event + * to signal is determined by calling the {@link FlowExecutorArgumentExtractor#extractEventId(ExternalContext)} method. + * If no event can be extracted, the existing execution will be refreshed. + *
    5. If no flow execution id was extracted, launch a new flow execution. The top-level flow definition for which an + * execution is created is determined by extracting the flow id using the method + * {@link FlowExecutorArgumentExtractor#extractFlowId(ExternalContext)}. If no valid flow id can be determined, an + * exception is thrown. *
    * * @author Keith Donald @@ -59,14 +57,12 @@ public class FlowRequestHandler { private FlowExecutor flowExecutor; /** - * A helper for extracting arguments of flow executor operations - * from the external context. + * A helper for extracting arguments of flow executor operations from the external context. */ private FlowExecutorArgumentExtractor argumentExtractor; /** - * Creates a new flow controller helper. Will use the default - * {@link RequestParameterFlowExecutorArgumentHandler}. + * Creates a new flow controller helper. Will use the default {@link RequestParameterFlowExecutorArgumentHandler}. * @param flowExecutor the flow execution manager to delegate to */ public FlowRequestHandler(FlowExecutor flowExecutor) { @@ -84,7 +80,7 @@ public class FlowRequestHandler { this.flowExecutor = flowExecutor; this.argumentExtractor = argumentExtractor; } - + /** * Returns the flow executor used by this helper. */ @@ -117,16 +113,14 @@ public class FlowRequestHandler { logger.debug("Returning [resume] " + response); } return response; - } - else { + } else { ResponseInstruction response = flowExecutor.refresh(flowExecutionKey, context); if (logger.isDebugEnabled()) { logger.debug("Returning [refresh] " + response); } return response; } - } - else { + } else { String flowDefinitionId = argumentExtractor.extractFlowId(context); ResponseInstruction response = flowExecutor.launch(flowDefinitionId, context); if (logger.isDebugEnabled()) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/RequestParameterFlowExecutorArgumentHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/RequestParameterFlowExecutorArgumentHandler.java index 94c06373..619f136f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/RequestParameterFlowExecutorArgumentHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/RequestParameterFlowExecutorArgumentHandler.java @@ -28,9 +28,8 @@ import org.springframework.webflow.execution.support.FlowDefinitionRedirect; import org.springframework.webflow.executor.FlowExecutor; /** - * Default {@link FlowExecutor} argument handler that extracts flow executor - * method arguments from the {@link ExternalContext#getRequestParameterMap()} - * and exposes arguments as URL encoded request parameters. + * Default {@link FlowExecutor} argument handler that extracts flow executor method arguments from the + * {@link ExternalContext#getRequestParameterMap()} and exposes arguments as URL encoded request parameters. * * @author Keith Donald * @author Erwin Vervaet @@ -38,33 +37,31 @@ import org.springframework.webflow.executor.FlowExecutor; public class RequestParameterFlowExecutorArgumentHandler extends FlowExecutorArgumentHandler { /** - * The default delimiter used when a parameter value is encoded as part of - * the name of a parameter, e.g. "_eventId_submit" ("_"). + * The default delimiter used when a parameter value is encoded as part of the name of a parameter, e.g. + * "_eventId_submit" ("_"). *

    - * This form is typically used to support multiple HTML buttons on a form - * without resorting to Javascript to communicate the event that corresponds - * to a button. + * This form is typically used to support multiple HTML buttons on a form without resorting to Javascript to + * communicate the event that corresponds to a button. */ private static final String PARAMETER_VALUE_DELIMITER = "_"; /** - * The embedded parameter name/value delimiter, used to parse a parameter - * value when a value is embedded in a parameter name (e.g. - * "_eventId_submit"). Defaults to {@link #PARAMETER_VALUE_DELIMITER}. + * The embedded parameter name/value delimiter, used to parse a parameter value when a value is embedded in a + * parameter name (e.g. "_eventId_submit"). Defaults to {@link #PARAMETER_VALUE_DELIMITER}. */ private String parameterValueDelimiter = PARAMETER_VALUE_DELIMITER; /** - * Returns the delimiter used to parse a parameter value when a value is - * embedded in a parameter name (e.g. "_eventId_submit"). Defaults to "_". + * Returns the delimiter used to parse a parameter value when a value is embedded in a parameter name (e.g. + * "_eventId_submit"). Defaults to "_". */ public String getParameterValueDelimiter() { return parameterValueDelimiter; } /** - * Set the delimiter used to parse a parameter value when a value is - * embedded in a parameter name (e.g. "_eventId_submit"). + * Set the delimiter used to parse a parameter value when a value is embedded in a parameter name (e.g. + * "_eventId_submit"). */ public void setParameterValueDelimiter(String parameterValueDelimiter) { this.parameterValueDelimiter = parameterValueDelimiter; @@ -80,10 +77,9 @@ public class RequestParameterFlowExecutorArgumentHandler extends FlowExecutorArg if (!StringUtils.hasText(flowId)) { throw new FlowExecutorArgumentExtractionException( "Unable to extract the flow definition id parameter: make sure the client provides the '" - + getFlowIdArgumentName() - + "' parameter as input or set the 'defaultFlowId' property; " - + "the parameters provided in this request are: " - + StylerUtils.style(context.getRequestParameterMap())); + + getFlowIdArgumentName() + "' parameter as input or set the 'defaultFlowId' property; " + + "the parameters provided in this request are: " + + StylerUtils.style(context.getRequestParameterMap())); } return flowId; } @@ -97,9 +93,9 @@ public class RequestParameterFlowExecutorArgumentHandler extends FlowExecutorArg if (!StringUtils.hasText(encodedKey)) { throw new FlowExecutorArgumentExtractionException( "Unable to extract the flow execution key parameter: make sure the client provides the '" - + getFlowExecutionKeyArgumentName() - + "' parameter as input; the parameters provided in this request are: " - + StylerUtils.style(context.getRequestParameterMap())); + + getFlowExecutionKeyArgumentName() + + "' parameter as input; the parameters provided in this request are: " + + StylerUtils.style(context.getRequestParameterMap())); } return encodedKey; } @@ -113,38 +109,31 @@ public class RequestParameterFlowExecutorArgumentHandler extends FlowExecutorArg if (!StringUtils.hasText(eventId)) { throw new FlowExecutorArgumentExtractionException( "Unable to extract the event id parameter: make sure the client provides the '" - + getEventIdArgumentName() + "' parameter as input along with the '" - + getFlowExecutionKeyArgumentName() - + "' parameter; the parameters provided in this request are: " - + StylerUtils.style(context.getRequestParameterMap())); + + getEventIdArgumentName() + "' parameter as input along with the '" + + getFlowExecutionKeyArgumentName() + + "' parameter; the parameters provided in this request are: " + + StylerUtils.style(context.getRequestParameterMap())); } return eventId; } /** - * Obtain a named parameter from the request parameters. This method will try - * to obtain a parameter value using the following algorithm: + * Obtain a named parameter from the request parameters. This method will try to obtain a parameter value using the + * following algorithm: *

      - *
    1. Try to get the parameter value using just the given logical - * name. This handles parameters of the form logicalName = value. - * For normal parameters, e.g. submitted using a hidden HTML form field, - * this will return the requested value.
    2. - *
    3. Try to obtain the parameter value from the parameter name, where the - * parameter name in the request is of the form - * logicalName_value = xyz with "_" being the configured - * delimiter. This deals with parameter values submitted using an HTML form - * submit button.
    4. - *
    5. If the value obtained in the previous step has a ".x" or ".y" - * suffix, remove that. This handles cases where the value was submitted - * using an HTML form image button. In this case the parameter in the request - * would actually be of the form logicalName_value.x = 123. - *
    6. + *
    7. Try to get the parameter value using just the given logical name. This handles parameters of the + * form logicalName = value. For normal parameters, e.g. submitted using a hidden HTML form field, this + * will return the requested value.
    8. + *
    9. Try to obtain the parameter value from the parameter name, where the parameter name in the request is of the + * form logicalName_value = xyz with "_" being the configured delimiter. This deals with parameter values + * submitted using an HTML form submit button.
    10. + *
    11. If the value obtained in the previous step has a ".x" or ".y" suffix, remove that. This handles cases where + * the value was submitted using an HTML form image button. In this case the parameter in the request would actually + * be of the form logicalName_value.x = 123.
    12. *
    - * @param logicalParameterName the logical name of the request - * parameter + * @param logicalParameterName the logical name of the request parameter * @param parameters the available parameter map - * @return the value of the parameter, or null if the - * parameter does not exist in given request + * @return the value of the parameter, or null if the parameter does not exist in given request */ protected String findParameter(String logicalParameterName, ParameterMap parameters) { // first try to get it as a normal name=value parameter @@ -156,7 +145,7 @@ public class RequestParameterFlowExecutorArgumentHandler extends FlowExecutorArg String prefix = logicalParameterName + getParameterValueDelimiter(); Iterator paramNames = parameters.asMap().keySet().iterator(); while (paramNames.hasNext()) { - String paramName = (String)paramNames.next(); + String paramName = (String) paramNames.next(); if (paramName.startsWith(prefix)) { String strValue = paramName.substring(prefix.length()); // support images buttons, which would submit parameters as @@ -199,8 +188,7 @@ public class RequestParameterFlowExecutorArgumentHandler extends FlowExecutorArg boolean first = redirect.getUrl().indexOf('?') < 0; if (first) { externalUrl.append('?'); - } - else { + } else { externalUrl.append('&'); } appendQueryParameter(externalUrl, getFlowExecutionKeyArgumentName(), flowExecutionKey); @@ -211,8 +199,7 @@ public class RequestParameterFlowExecutorArgumentHandler extends FlowExecutorArg // helpers /** - * Append the URL path to the flow executor capable of accepting new - * requests. + * Append the URL path to the flow executor capable of accepting new requests. * @param url the url buffer to append to * @param context the context of this request */ @@ -225,15 +212,15 @@ public class RequestParameterFlowExecutorArgumentHandler extends FlowExecutorArg } /** - * Append query parameters to the redirect URL. Stringifies, URL-encodes and - * formats model attributes as query parameters. + * Append query parameters to the redirect URL. Stringifies, URL-encodes and formats model attributes as query + * parameters. * @param url the StringBuffer to append the parameters to * @param parameters Map that contains attributes */ protected void appendQueryParameters(StringBuffer url, Map parameters) { Iterator entries = parameters.entrySet().iterator(); while (entries.hasNext()) { - Map.Entry entry = (Map.Entry)entries.next(); + Map.Entry entry = (Map.Entry) entries.next(); appendQueryParameter(url, entry.getKey(), entry.getValue()); if (entries.hasNext()) { url.append('&'); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/RequestPathFlowExecutorArgumentHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/RequestPathFlowExecutorArgumentHandler.java index 1db07de8..0ffb7ddb 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/RequestPathFlowExecutorArgumentHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/RequestPathFlowExecutorArgumentHandler.java @@ -23,34 +23,27 @@ import org.springframework.webflow.execution.FlowExecutionContext; import org.springframework.webflow.execution.support.FlowDefinitionRedirect; /** - * Flow executor argument handler that extracts arguments from the request path - * and exposes them in the URL path. + * Flow executor argument handler that extracts arguments from the request path and exposes them in the URL path. *

    * This allows for REST-style URLs to launch flows in the general format: * http://${host}/${context path}/${dispatcher path}/${flowId}. *

    - * For example, the URL - * http://localhost/springair/reservation/booking would launch a - * new execution of the booking flow, assuming a context path of - * /springair and a servlet mapping of /reservation/*. + * For example, the URL http://localhost/springair/reservation/booking would launch a new execution of + * the booking flow, assuming a context path of /springair and a servlet mapping of + * /reservation/*. *

    * This also allows for URLs to resume flow executions in the format: * http://${host}/${context path}/${dispatcher path}/${key delimiter}/${flowExecutionKey}. *

    - * For example, the URL - * http://localhost/springair/reservation/k/ABC123XYZ would - * resume flow execution "ABC123XYZ". + * For example, the URL http://localhost/springair/reservation/k/ABC123XYZ would resume flow execution + * "ABC123XYZ". *

    - * Note: this implementation only works with ExternalContext - * implementations that return valid - * {@link ExternalContext#getRequestPathInfo()} such as the - * {@link ServletExternalContext}. Furthermore, it assumes that the controller - * handling flow requests is not identified using request path information. - * For instance, mapping the dispatcher to "*.html" in web.xml would work since - * in this case the flow controller will be identified as part of the dispatcher - * name (e.g. "flows.html"). Mapping the dispatcher to "/html/*" in web.xml - * will not work since that would require the flow controller to be identified - * by the extra request path information (e.g. "/html/flows"). + * Note: this implementation only works with ExternalContext implementations that return valid + * {@link ExternalContext#getRequestPathInfo()} such as the {@link ServletExternalContext}. Furthermore, it assumes + * that the controller handling flow requests is not identified using request path information. For instance, mapping + * the dispatcher to "*.html" in web.xml would work since in this case the flow controller will be identified as part of + * the dispatcher name (e.g. "flows.html"). Mapping the dispatcher to "/html/*" in web.xml will not work since that + * would require the flow controller to be identified by the extra request path information (e.g. "/html/flows"). * * @author Keith Donald */ @@ -67,8 +60,8 @@ public class RequestPathFlowExecutorArgumentHandler extends RequestParameterFlow private static final String KEY_DELIMITER = "k"; /** - * The delimiter that when present in the requestPathInfo indicates the - * flowExecutionKey follows in the URL. Defaults to {@link #KEY_DELIMITER}. + * The delimiter that when present in the requestPathInfo indicates the flowExecutionKey follows in the URL. + * Defaults to {@link #KEY_DELIMITER}. */ private String keyDelimiter = KEY_DELIMITER; @@ -81,8 +74,8 @@ public class RequestPathFlowExecutorArgumentHandler extends RequestParameterFlow } /** - * Sets the delimiter that when present in the requestPathInfo indicates the - * flowExecutionKey follows in the URL. Defaults to "k". + * Sets the delimiter that when present in the requestPathInfo indicates the flowExecutionKey follows in the URL. + * Defaults to "k". * @param keyDelimiter the key delimiter * @see #extractFlowExecutionKey(ExternalContext) */ @@ -112,8 +105,7 @@ public class RequestPathFlowExecutorArgumentHandler extends RequestParameterFlow int index = requestPathInfo.indexOf(keyPath()); if (index != -1) { return requestPathInfo.substring(index + keyPath().length()); - } - else { + } else { return super.extractFlowExecutionKey(context); } } @@ -142,21 +134,21 @@ public class RequestPathFlowExecutorArgumentHandler extends RequestParameterFlow } // internal helpers - + protected void appendFlowExecutorPath(StringBuffer url, ExternalContext context) { url.append(context.getContextPath()); url.append(context.getDispatcherPath()); } /** - * Returns the request path info for given external context. Never returns - * null, an empty string is returned instead. + * Returns the request path info for given external context. Never returns null, an empty string is returned + * instead. */ private String getRequestPathInfo(ExternalContext context) { String requestPathInfo = context.getRequestPathInfo(); return requestPathInfo != null ? requestPathInfo : ""; } - + /** * Returns the flow execution key path in the request path info, e.g. "/k/". */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/ResponseInstructionHandler.java b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/ResponseInstructionHandler.java index 48d6ee9b..9808cd4a 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/executor/support/ResponseInstructionHandler.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/executor/support/ResponseInstructionHandler.java @@ -24,10 +24,9 @@ import org.springframework.webflow.execution.support.FlowExecutionRedirect; import org.springframework.webflow.executor.ResponseInstruction; /** - * Abstract helper class that allows easy handling of all known view - * selection types. Users need to implement each of the hook methods - * dealing with a particular type of view selection, typically in an - * anonymous inner subclass of this class. + * Abstract helper class that allows easy handling of all known view selection types. Users need to implement each of + * the hook methods dealing with a particular type of view selection, typically in an anonymous inner subclass of this + * class. * * @see ViewSelection * @@ -36,79 +35,68 @@ import org.springframework.webflow.executor.ResponseInstruction; * @author Erwin Vervaet */ public abstract class ResponseInstructionHandler { - + private Object result; - + /** - * Set the object resulting from response handling. - * This is optional. + * Set the object resulting from response handling. This is optional. * @param result the result object */ public void setResult(Object result) { this.result = result; } - + /** - * Returns the object resulting from response handling. - * This is optional and will only be set if the subclass - * calls {@link #setResult(Object)} to set the result object. + * Returns the object resulting from response handling. This is optional and will only be set if the subclass calls + * {@link #setResult(Object)} to set the result object. * @return the result object, or null if none */ public Object getResult() { return result; } - + /** - * Issue a response for given response instruction. Will delegate to - * any of the available hook methods depending on the type of view selection - * contained in the response instruction. + * Issue a response for given response instruction. Will delegate to any of the available hook methods depending on + * the type of view selection contained in the response instruction. * @param responseInstruction the response instruction to issue a response for * @return this object, for call chaining * @throws Exception when an error occured */ public final ResponseInstructionHandler handle(ResponseInstruction responseInstruction) throws Exception { if (responseInstruction.isApplicationView()) { - handleApplicationView((ApplicationView)responseInstruction.getViewSelection()); - } - else if (responseInstruction.isFlowDefinitionRedirect()) { - handleFlowDefinitionRedirect((FlowDefinitionRedirect)responseInstruction.getViewSelection()); - } - else if (responseInstruction.isFlowExecutionRedirect()) { - handleFlowExecutionRedirect((FlowExecutionRedirect)responseInstruction.getViewSelection()); - } - else if (responseInstruction.isExternalRedirect()) { - handleExternalRedirect((ExternalRedirect)responseInstruction.getViewSelection()); - } - else if (responseInstruction.isNull()) { + handleApplicationView((ApplicationView) responseInstruction.getViewSelection()); + } else if (responseInstruction.isFlowDefinitionRedirect()) { + handleFlowDefinitionRedirect((FlowDefinitionRedirect) responseInstruction.getViewSelection()); + } else if (responseInstruction.isFlowExecutionRedirect()) { + handleFlowExecutionRedirect((FlowExecutionRedirect) responseInstruction.getViewSelection()); + } else if (responseInstruction.isExternalRedirect()) { + handleExternalRedirect((ExternalRedirect) responseInstruction.getViewSelection()); + } else if (responseInstruction.isNull()) { handleNull(); - } - else { - throw new IllegalArgumentException( - "Don't know how to handle response instruction " + responseInstruction); + } else { + throw new IllegalArgumentException("Don't know how to handle response instruction " + responseInstruction); } return this; } - + /** - * Quietly issue a response for given response instruction, turning any Exception - * raised while handling the response instruction into a RuntimeException. - * Will delegate to any of the available hook methods depending on the type of view selection - * contained in the response instruction. + * Quietly issue a response for given response instruction, turning any Exception raised while handling the response + * instruction into a RuntimeException. Will delegate to any of the available hook methods depending on the type of + * view selection contained in the response instruction. * @param responseInstruction the response instruction to issue a response for * @return this object, for call chaining */ public final ResponseInstructionHandler handleQuietly(ResponseInstruction responseInstruction) { try { return handle(responseInstruction); - } - catch (Exception e) { - throw new RuntimeResponseHandlingException( - "Unexpected exception handling response instruction " + responseInstruction + "", e); + } catch (Exception e) { + throw new RuntimeResponseHandlingException("Unexpected exception handling response instruction " + + responseInstruction + "", e); } } // template methods - + /** * Issue a response for given application view. * @param view the application view to issue a response for @@ -117,7 +105,7 @@ public abstract class ResponseInstructionHandler { * @see ApplicationView */ protected abstract void handleApplicationView(ApplicationView view) throws Exception; - + /** * Issue a response for given flow definition redirect. * @param redirect the flow definition redirect to issue a response for @@ -126,7 +114,7 @@ public abstract class ResponseInstructionHandler { * @see FlowDefinitionRedirect */ protected abstract void handleFlowDefinitionRedirect(FlowDefinitionRedirect redirect) throws Exception; - + /** * Issue a response for given flow execution redirect. * @param redirect the flow execution redirect to issue a response for @@ -135,7 +123,7 @@ public abstract class ResponseInstructionHandler { * @see FlowExecutionRedirect */ protected abstract void handleFlowExecutionRedirect(FlowExecutionRedirect redirect) throws Exception; - + /** * Issue a response for given external redirect. * @param redirect the external redirect to issue a response for diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockExternalContext.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockExternalContext.java index 37aeecea..ce965778 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockExternalContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockExternalContext.java @@ -35,7 +35,7 @@ import org.springframework.webflow.core.collection.SharedAttributeMap; public class MockExternalContext implements ExternalContext { private String contextPath; - + private String dispatcherPath; private String requestPathInfo; @@ -45,22 +45,20 @@ public class MockExternalContext implements ExternalContext { private MutableAttributeMap requestMap = new LocalAttributeMap(); private SharedAttributeMap sessionMap = new LocalSharedAttributeMap(new SharedMapDecorator(new HashMap())); - + private SharedAttributeMap globalSessionMap = sessionMap; private SharedAttributeMap applicationMap = new LocalSharedAttributeMap(new SharedMapDecorator(new HashMap())); /** - * Creates a mock external context with an empty request parameter map. - * Allows for bean style usage. + * Creates a mock external context with an empty request parameter map. Allows for bean style usage. */ public MockExternalContext() { } /** - * Creates a mock external context with the specified parameters in the - * request parameter map. All other properties of the external context - * can be set using the appropriate setter. + * Creates a mock external context with the specified parameters in the request parameter map. All other properties + * of the external context can be set using the appropriate setter. * @param requestParameterMap the request parameters */ public MockExternalContext(ParameterMap requestParameterMap) { @@ -70,11 +68,11 @@ public class MockExternalContext implements ExternalContext { } // implementing external context - + public String getContextPath() { return contextPath; } - + public String getDispatcherPath() { return dispatcherPath; } @@ -98,7 +96,7 @@ public class MockExternalContext implements ExternalContext { public SharedAttributeMap getGlobalSessionMap() { return globalSessionMap; } - + public SharedAttributeMap getApplicationMap() { return applicationMap; } @@ -112,7 +110,7 @@ public class MockExternalContext implements ExternalContext { public void setContextPath(String contextPath) { this.contextPath = contextPath; } - + /** * Set the dispatcher path. * @see ExternalContext#getDispatcherPath() @@ -136,7 +134,7 @@ public class MockExternalContext implements ExternalContext { public void setRequestParameterMap(ParameterMap requestParameterMap) { this.requestParameterMap = requestParameterMap; } - + /** * Set the request attribute map. * @see ExternalContext#getRequestMap() @@ -152,10 +150,10 @@ public class MockExternalContext implements ExternalContext { public void setSessionMap(SharedAttributeMap sessionMap) { this.sessionMap = sessionMap; } - + /** - * Set the global session attribute map. By default the session attribute - * map and the global session attribute map are one and the same. + * Set the global session attribute map. By default the session attribute map and the global session attribute map + * are one and the same. * @see ExternalContext#getGlobalSessionMap() */ public void setGlobalSessionMap(SharedAttributeMap globalSessionMap) { @@ -169,18 +167,17 @@ public class MockExternalContext implements ExternalContext { public void setApplicationMap(SharedAttributeMap applicationMap) { this.applicationMap = applicationMap; } - + // convenience helpers /** - * Returns the request parameter map as a {@link MockParameterMap} - * for convenient access in a unit test. + * Returns the request parameter map as a {@link MockParameterMap} for convenient access in a unit test. * @see #getRequestParameterMap() */ public MockParameterMap getMockRequestParameterMap() { - return (MockParameterMap)requestParameterMap; + return (MockParameterMap) requestParameterMap; } - + /** * Puts a request parameter into the mock parameter map. * @param parameterName the parameter name diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowExecutionContext.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowExecutionContext.java index 5e4a604b..a6e5d7a3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowExecutionContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowExecutionContext.java @@ -41,8 +41,8 @@ public class MockFlowExecutionContext implements FlowExecutionContext { private MutableAttributeMap attributes = new LocalAttributeMap(); /** - * Creates a new mock flow execution context -- automatically installs a root - * flow definition and active flow session. + * Creates a new mock flow execution context -- automatically installs a root flow definition and active flow + * session. */ public MockFlowExecutionContext() { activeSession = new MockFlowSession(); @@ -50,8 +50,7 @@ public class MockFlowExecutionContext implements FlowExecutionContext { } /** - * Creates a new mock flow execution context for the specified root flow - * definition. + * Creates a new mock flow execution context for the specified root flow definition. */ public MockFlowExecutionContext(Flow rootFlow) { this.flow = rootFlow; @@ -82,11 +81,11 @@ public class MockFlowExecutionContext implements FlowExecutionContext { public MutableAttributeMap getConversationScope() { return conversationScope; } - + public AttributeMap getAttributes() { return attributes; } - + // mutators /** @@ -109,14 +108,14 @@ public class MockFlowExecutionContext implements FlowExecutionContext { public void setConversationScope(MutableAttributeMap scope) { this.conversationScope = scope; } - + // convenience accessors /** * Returns the mock active flow session. */ public MockFlowSession getMockActiveSession() { - return (MockFlowSession)activeSession; + return (MockFlowSession) activeSession; } /** @@ -126,7 +125,7 @@ public class MockFlowExecutionContext implements FlowExecutionContext { public MutableAttributeMap getAttributeMap() { return attributes; } - + /** * Puts a execution attribute into the context. * @param attributeName the attribute name diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowServiceLocator.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowServiceLocator.java index 2d070334..3515846f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowServiceLocator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowServiceLocator.java @@ -25,15 +25,13 @@ import org.springframework.webflow.engine.builder.DefaultFlowServiceLocator; /** * A stub flow service locator implementation suitable for a test environment. *

    - * Allows programmatic registration of subflows needed by a flow execution being - * tested, see {@link #registerSubflow(Flow)}. Subflows registered are - * typically stubs that verify parent flow input and output scenarios. + * Allows programmatic registration of subflows needed by a flow execution being tested, see + * {@link #registerSubflow(Flow)}. Subflows registered are typically stubs that verify parent flow input and output + * scenarios. *

    - * Also supports programmatic registration of additional custom services needed - * by a flow (such as Actions) managed in a backing Spring - * {@link ConfigurableBeanFactory}. See the - * {@link #registerBean(String, Object)} method. Beans registered are typically - * mocks or stubs of business services invoked by the flow. + * Also supports programmatic registration of additional custom services needed by a flow (such as Actions) managed in a + * backing Spring {@link ConfigurableBeanFactory}. See the {@link #registerBean(String, Object)} method. Beans + * registered are typically mocks or stubs of business services invoked by the flow. * * @author Keith Donald */ @@ -47,9 +45,8 @@ public class MockFlowServiceLocator extends DefaultFlowServiceLocator { } /** - * Register a subflow definition in the backing flow registry, typically to - * support a flow execution test. For test scenarios, the subflow is often a - * stub used to verify parent flow input and output mapping behavior. + * Register a subflow definition in the backing flow registry, typically to support a flow execution test. For test + * scenarios, the subflow is often a stub used to verify parent flow input and output mapping behavior. * @param subflow the subflow */ public void registerSubflow(Flow subflow) { @@ -57,14 +54,13 @@ public class MockFlowServiceLocator extends DefaultFlowServiceLocator { } /** - * Register a bean in the backing bean factory, typically to support a flow - * execution test. For test scenarios, if the bean is a service invoked by a - * bean invoking action it is often a stub or dynamic mock implementation of - * the service's business interface. + * Register a bean in the backing bean factory, typically to support a flow execution test. For test scenarios, if + * the bean is a service invoked by a bean invoking action it is often a stub or dynamic mock implementation of the + * service's business interface. * @param beanName the bean name * @param bean the singleton instance */ public void registerBean(String beanName, Object bean) { - ((StaticListableBeanFactory)getBeanFactory()).addBean(beanName, bean); + ((StaticListableBeanFactory) getBeanFactory()).addBean(beanName, bean); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowSession.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowSession.java index df9c56fa..09df213f 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowSession.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockFlowSession.java @@ -48,8 +48,8 @@ public class MockFlowSession implements FlowSession { private FlowSession parent; /** - * Creates a new mock flow session that sets a flow with id "mockFlow" as - * the 'active flow' in state "mockState". This session marks itself active. + * Creates a new mock flow session that sets a flow with id "mockFlow" as the 'active flow' in state "mockState". + * This session marks itself active. */ public MockFlowSession() { setDefinition(new Flow("mockFlow")); @@ -59,16 +59,14 @@ public class MockFlowSession implements FlowSession { } /** - * Creates a new mock session in a created state for the specified flow - * definition. + * Creates a new mock session in a created state for the specified flow definition. */ public MockFlowSession(Flow flow) { setDefinition(flow); } /** - * Creates a new mock session in {@link FlowSessionStatus#CREATED} state - * for the specified flow definition. + * Creates a new mock session in {@link FlowSessionStatus#CREATED} state for the specified flow definition. * @param flow the flow definition for the session * @param input initial contents of 'flow scope' */ @@ -76,7 +74,7 @@ public class MockFlowSession implements FlowSession { setDefinition(flow); scope.putAll(input); } - + // implementing FlowSession public FlowDefinition getDefinition() { @@ -106,9 +104,9 @@ public class MockFlowSession implements FlowSession { public boolean isRoot() { return parent == null; } - + // mutators - + /** * Set the flow associated with this flow session. */ @@ -131,16 +129,15 @@ public class MockFlowSession implements FlowSession { } /** - * Set the scope data maintained by this flow session. This will be the flow - * scope data of the ongoing flow execution. + * Set the scope data maintained by this flow session. This will be the flow scope data of the ongoing flow + * execution. */ public void setScope(MutableAttributeMap scope) { this.scope = scope; } /** - * Set the parent flow session of this flow session in the ongoing flow - * execution. + * Set the parent flow session of this flow session in the ongoing flow execution. */ public void setParent(FlowSession parent) { this.parent = parent; @@ -154,7 +151,7 @@ public class MockFlowSession implements FlowSession { public Flow getDefinitionInternal() { return definition; } - + /** * Returns the current state of this session. */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockParameterMap.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockParameterMap.java index c85ca779..06878bb5 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockParameterMap.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockParameterMap.java @@ -21,8 +21,7 @@ import org.springframework.webflow.core.collection.LocalParameterMap; import org.springframework.webflow.core.collection.ParameterMap; /** - * A extension of parameter map that allows for mutation of parameters. Useful - * as a stub for testing. + * A extension of parameter map that allows for mutation of parameters. Useful as a stub for testing. * * @see ParameterMap * diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java index 0497294b..28d9f6ba 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestContext.java @@ -31,8 +31,8 @@ import org.springframework.webflow.execution.FlowSession; import org.springframework.webflow.execution.RequestContext; /** - * Mock implementation of the RequestContext interface to - * facilitate standalone flow artifact (e.g. action) unit tests. + * Mock implementation of the RequestContext interface to facilitate standalone flow artifact (e.g. + * action) unit tests. * * @see org.springframework.webflow.execution.RequestContext * @see org.springframework.webflow.execution.Action @@ -57,12 +57,10 @@ public class MockRequestContext implements RequestContext { /** * Creates a new mock request context with the following defaults: *

      - *
    • A flow execution context with a active session of flow "mockFlow" in - * state "mockState". + *
    • A flow execution context with a active session of flow "mockFlow" in state "mockState". *
    • A mock external context with no request parameters set. *
    - * To add request parameters to this request, use the - * {@link #putRequestParameter(String, String)} method. + * To add request parameters to this request, use the {@link #putRequestParameter(String, String)} method. */ public MockRequestContext() { } @@ -73,18 +71,16 @@ public class MockRequestContext implements RequestContext { *
  • A flow execution context with an active session for the specified flow. *
  • A mock external context with no request parameters set. * - * To add request parameters to this request, use the - * {@link #putRequestParameter(String, String)} method. + * To add request parameters to this request, use the {@link #putRequestParameter(String, String)} method. */ public MockRequestContext(Flow flow) { flowExecutionContext = new MockFlowExecutionContext(flow); } - + /** * Creates a new mock request context with the following defaults: *
      - *
    • A flow execution context with a active session of flow "mockFlow" in - * state "mockState". + *
    • A flow execution context with a active session of flow "mockFlow" in state "mockState". *
    • A mock external context with the provided parameters set. *
    */ @@ -149,13 +145,13 @@ public class MockRequestContext implements RequestContext { public AttributeMap getModel() { return getConversationScope().union(getFlowScope()).union(getFlashScope()).union(getRequestScope()); } - + // mutators /** - * Sets the active flow session of the executing flow associated with this - * request. This will influence {@link #getActiveFlow()} and {@link #getCurrentState()}, - * as well as {@link #getFlowScope()} and {@link #getFlashScope()}. + * Sets the active flow session of the executing flow associated with this request. This will influence + * {@link #getActiveFlow()} and {@link #getCurrentState()}, as well as {@link #getFlowScope()} and + * {@link #getFlashScope()}. */ public void setActiveSession(FlowSession flowSession) { getMockFlowExecutionContext().setActiveSession(flowSession); @@ -207,12 +203,12 @@ public class MockRequestContext implements RequestContext { public void removeAttribute(String attributeName) { attributes.remove(attributeName); } - + // convenience accessors - + /** - * Returns the contained mutable context {@link AttributeMap attribute map} - * allowing setting of mock context attributes. + * Returns the contained mutable context {@link AttributeMap attribute map} allowing setting of mock context + * attributes. * @return the attribute map */ public MutableAttributeMap getAttributeMap() { @@ -223,14 +219,14 @@ public class MockRequestContext implements RequestContext { * Returns the flow execution context as a {@link MockFlowExecutionContext}. */ public MockFlowExecutionContext getMockFlowExecutionContext() { - return (MockFlowExecutionContext)flowExecutionContext; + return (MockFlowExecutionContext) flowExecutionContext; } /** * Returns the external context as a {@link MockExternalContext}. */ public MockExternalContext getMockExternalContext() { - return (MockExternalContext)externalContext; + return (MockExternalContext) externalContext; } /** diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java index 0ae3b6aa..9a1e0fc7 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/MockRequestControlContext.java @@ -27,8 +27,8 @@ import org.springframework.webflow.execution.FlowSessionStatus; import org.springframework.webflow.execution.ViewSelection; /** - * Mock implementation of the {@link RequestControlContext} interface to - * facilitate standalone Flow and State unit tests. + * Mock implementation of the {@link RequestControlContext} interface to facilitate standalone Flow and State unit + * tests. * * @see org.springframework.webflow.execution.RequestContext * @see org.springframework.webflow.execution.FlowSession @@ -39,17 +39,16 @@ import org.springframework.webflow.execution.ViewSelection; public class MockRequestControlContext extends MockRequestContext implements RequestControlContext { /** - * Creates a new mock request control context for controlling a mock execution of the - * provided flow definition. + * Creates a new mock request control context for controlling a mock execution of the provided flow definition. */ public MockRequestControlContext(Flow rootFlow) { super(rootFlow); } - + // implementing RequestControlContext public void setCurrentState(State state) { - State previousState = (State)getCurrentState(); + State previousState = (State) getCurrentState(); getMockFlowExecutionContext().getMockActiveSession().setState(state); if (previousState == null) { getMockFlowExecutionContext().getMockActiveSession().setStatus(FlowSessionStatus.ACTIVE); @@ -65,7 +64,7 @@ public class MockRequestControlContext extends MockRequestContext implements Req public ViewSelection signalEvent(Event event) { setLastEvent(event); - ViewSelection selectedView = ((Flow)getActiveFlow()).onEvent(this); + ViewSelection selectedView = ((Flow) getActiveFlow()).onEvent(this); return selectedView; } @@ -78,6 +77,6 @@ public class MockRequestControlContext extends MockRequestContext implements Req } public ViewSelection execute(Transition transition) { - return transition.execute((TransitionableState)getCurrentState(), this); + return transition.execute((TransitionableState) getCurrentState(), this); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractExternalizedFlowExecutionTests.java b/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractExternalizedFlowExecutionTests.java index 1466fb11..27965caa 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractExternalizedFlowExecutionTests.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractExternalizedFlowExecutionTests.java @@ -34,7 +34,7 @@ import org.springframework.webflow.test.MockFlowServiceLocator; /** * Base class for flow integration tests that verify an externalized flow definition executes as expected. Supports * caching of the flow definition built from an externalized resource to speed up test execution. - * + * * @author Keith Donald */ public abstract class AbstractExternalizedFlowExecutionTests extends AbstractFlowExecutionTests { @@ -136,8 +136,8 @@ public abstract class AbstractExternalizedFlowExecutionTests extends AbstractFlo } /** - * Returns the flow service locator to use during flow definition construction time for accessing externally - * managed flow artifacts such as actions and flows to be used as subflows. + * Returns the flow service locator to use during flow definition construction time for accessing externally managed + * flow artifacts such as actions and flows to be used as subflows. *

    * This implementation just creates a {@link MockFlowServiceLocator} and populates it with services by calling * {@link #registerMockServices(MockFlowServiceLocator)}. @@ -159,9 +159,9 @@ public abstract class AbstractExternalizedFlowExecutionTests extends AbstractFlo } /** - * Factory method to assemble a flow definition from a resource. Called by {@link #getFlowDefinition()} to - * create the "main" flow to test. May also be called by subclasses to create subflow definitions whose executions - * should also be exercised by this test. + * Factory method to assemble a flow definition from a resource. Called by {@link #getFlowDefinition()} to create + * the "main" flow to test. May also be called by subclasses to create subflow definitions whose executions should + * also be exercised by this test. * @param resource the flow definition resource * @return the built flow definition, ready for execution * @see #createFlowBuilder(Resource, FlowServiceLocator) @@ -177,11 +177,13 @@ public abstract class AbstractExternalizedFlowExecutionTests extends AbstractFlo * implement. *

    * Example usage: + * *

     	 * protected FlowDefinitionResource getFlowDefinitionResource() {
     	 * 	return createFlowDefinitionResource("/WEB-INF/flows/order-flow.xml");
     	 * }
     	 * 
    + * * @return the flow definition resource */ protected abstract FlowDefinitionResource getFlowDefinitionResource(); @@ -220,8 +222,8 @@ public abstract class AbstractExternalizedFlowExecutionTests extends AbstractFlo } /** - * Convenient factory method that creates a {@link FlowDefinitionResource} from a file. Typically - * called by subclasses overriding {@link #getFlowDefinitionResource()}. + * Convenient factory method that creates a {@link FlowDefinitionResource} from a file. Typically called by + * subclasses overriding {@link #getFlowDefinitionResource()}. * @param file the file * @return the flow definition resource */ diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractFlowExecutionTests.java b/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractFlowExecutionTests.java index 3c20a57f..bb680e61 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractFlowExecutionTests.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractFlowExecutionTests.java @@ -40,38 +40,29 @@ import org.springframework.webflow.execution.support.FlowExecutionRedirect; import org.springframework.webflow.test.MockExternalContext; /** - * Base class for integration tests that verify a flow executes as expected. - * Flow execution tests captured by subclasses should test that a flow responds - * to all supported transition criteria correctly, transitioning to the correct - * states and producing the expected results on the occurence of possible - * external (user) events. + * Base class for integration tests that verify a flow executes as expected. Flow execution tests captured by subclasses + * should test that a flow responds to all supported transition criteria correctly, transitioning to the correct states + * and producing the expected results on the occurence of possible external (user) events. *

    * More specifically, a typical flow execution test case will test: *

      - *
    • That the flow execution starts as expected given a request from an - * external context containing potential input attributes (see the - * {@link #startFlow(MutableAttributeMap, ExternalContext)} variants). - *
    • That given the set of supported state transition criteria a state - * executes the appropriate transition when a matching event is signaled (with - * potential input request parameters, see the - * {@link #signalEvent(String, ExternalContext)} variants). A test case should - * be coded for each logical event that can occur, where an event drives a - * possible path through the flow. The goal should be to exercise all possible - * paths of the flow. Use a test coverage tool like Clover or Emma to assist - * with measuring your test's effectiveness. - *
    • That given a transition that leads to an interactive state type (a view - * state or an end state) that the view selection returned to the client matches - * what was expected and the current state of the flow matches what is expected. + *
    • That the flow execution starts as expected given a request from an external context containing potential input + * attributes (see the {@link #startFlow(MutableAttributeMap, ExternalContext)} variants). + *
    • That given the set of supported state transition criteria a state executes the appropriate transition when a + * matching event is signaled (with potential input request parameters, see the + * {@link #signalEvent(String, ExternalContext)} variants). A test case should be coded for each logical event that can + * occur, where an event drives a possible path through the flow. The goal should be to exercise all possible paths of + * the flow. Use a test coverage tool like Clover or Emma to assist with measuring your test's effectiveness. + *
    • That given a transition that leads to an interactive state type (a view state or an end state) that the view + * selection returned to the client matches what was expected and the current state of the flow matches what is + * expected. *
    *

    - * A flow execution test can effectively automate and validate the orchestration - * required to drive an end-to-end business task that spans several steps - * involving the user to complete. Such tests are a good way to test your system - * top-down starting at the web-tier and pushing through all the way to the DB - * without having to deploy to a servlet or portlet container. In addition, they - * can be used to effectively test a flow's execution (the web layer) - * standalone, typically with a mock service layer. Both styles of testing are - * valuable and supported. + * A flow execution test can effectively automate and validate the orchestration required to drive an end-to-end + * business task that spans several steps involving the user to complete. Such tests are a good way to test your system + * top-down starting at the web-tier and pushing through all the way to the DB without having to deploy to a servlet or + * portlet container. In addition, they can be used to effectively test a flow's execution (the web layer) standalone, + * typically with a mock service layer. Both styles of testing are valuable and supported. * * @author Keith Donald */ @@ -83,17 +74,15 @@ public abstract class AbstractFlowExecutionTests extends TestCase { private FlowExecutionFactory flowExecutionFactory; /** - * The expression parser for parsing evaluatable model attribute - * expressions. + * The expression parser for parsing evaluatable model attribute expressions. */ private ExpressionParser expressionParser = DefaultExpressionParserFactory.getExpressionParser(); /** - * The flow execution running the flow when the test is active (runtime - * object). + * The flow execution running the flow when the test is active (runtime object). */ private FlowExecution flowExecution; - + /** * Constructs a default flow execution test. * @see #setName(String) @@ -101,7 +90,7 @@ public abstract class AbstractFlowExecutionTests extends TestCase { public AbstractFlowExecutionTests() { super(); } - + /** * Constructs a flow execution test with given name. * @param name the name of the test @@ -112,8 +101,7 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Set the expression parser responsible for parsing expression strings into - * evaluatable expression objects. + * Set the expression parser responsible for parsing expression strings into evaluatable expression objects. */ public void setExpressionParser(ExpressionParser expressionParser) { Assert.notNull(expressionParser, "The expression parser is required"); @@ -121,8 +109,8 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Gets the factory that will create the flow execution to test. This method - * will create the factory if it is not already set. + * Gets the factory that will create the flow execution to test. This method will create the factory if it is not + * already set. * @return the flow execution factory * @see #createFlowExecutionFactory() */ @@ -132,13 +120,11 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } return flowExecutionFactory; } - + /** - * Creates an ExternalContext instance. Defaults to using {@link MockExternalContext}. - * Subclasses can override if they which to use another external context - * implementation. - * @param requestParameters request parameters to put into the - * external context (optional) + * Creates an ExternalContext instance. Defaults to using {@link MockExternalContext}. Subclasses can override if + * they which to use another external context implementation. + * @param requestParameters request parameters to put into the external context (optional) * @return a new ExternalContext instance */ protected ExternalContext createExternalContext(ParameterMap requestParameters) { @@ -151,14 +137,11 @@ public abstract class AbstractFlowExecutionTests extends TestCase { * Convenience operation that starts the execution with: *

      *
    • no input attributes - *
    • an empty {@link ExternalContext} with no environmental request - * parameters set + *
    • an empty {@link ExternalContext} with no environmental request parameters set *
    - * @return the view selection made as a result of starting the flow - * (returned when the first interactive state (a view state or end state) is - * entered) - * @throws FlowExecutionException if an exception was thrown while starting - * the flow execution + * @return the view selection made as a result of starting the flow (returned when the first interactive state (a + * view state or end state) is entered) + * @throws FlowExecutionException if an exception was thrown while starting the flow execution */ protected ViewSelection startFlow() throws FlowExecutionException { return startFlow(null, createExternalContext(null)); @@ -169,18 +152,13 @@ public abstract class AbstractFlowExecutionTests extends TestCase { *

    * Convenience operation that starts the execution with: *

      - *
    • the specified input attributes, eligible for mapping by the root - * flow - *
    • an empty {@link ExternalContext} with no environmental request - * parameters set + *
    • the specified input attributes, eligible for mapping by the root flow + *
    • an empty {@link ExternalContext} with no environmental request parameters set *
    - * @param input the flow execution input attributes eligible for mapping by - * the root flow - * @return the view selection made as a result of starting the flow - * (returned when the first interactive state (a view state or end state) is - * entered) - * @throws FlowExecutionException if an exception was thrown while starting - * the flow execution + * @param input the flow execution input attributes eligible for mapping by the root flow + * @return the view selection made as a result of starting the flow (returned when the first interactive state (a + * view state or end state) is entered) + * @throws FlowExecutionException if an exception was thrown while starting the flow execution */ protected ViewSelection startFlow(MutableAttributeMap input) throws FlowExecutionException { return startFlow(input, createExternalContext(null)); @@ -191,21 +169,16 @@ public abstract class AbstractFlowExecutionTests extends TestCase { *

    * This is the most flexible of the start methods. It allows you to specify: *

      - *
    1. a map of input attributes to pass to the flow execution, eligible - * for mapping by the root flow definition - *
    2. an external context that provides the flow execution being tested - * access to the calling environment for this request + *
    3. a map of input attributes to pass to the flow execution, eligible for mapping by the root flow definition + *
    4. an external context that provides the flow execution being tested access to the calling environment for this + * request *
    - * @param input the flow execution input attributes eligible for mapping by - * the root flow - * @param context the external context providing information about the - * caller's environment, used by the flow execution during the start - * operation - * @return the view selection made as a result of starting the flow - * (returned when the first interactive state (a view state or end state) is - * entered) - * @throws FlowExecutionException if an exception was thrown while starting - * the flow execution + * @param input the flow execution input attributes eligible for mapping by the root flow + * @param context the external context providing information about the caller's environment, used by the flow + * execution during the start operation + * @return the view selection made as a result of starting the flow (returned when the first interactive state (a + * view state or end state) is entered) + * @throws FlowExecutionException if an exception was thrown while starting the flow execution */ protected ViewSelection startFlow(MutableAttributeMap input, ExternalContext context) throws FlowExecutionException { flowExecution = getFlowExecutionFactory().createFlowExecution(getFlowDefinition()); @@ -213,71 +186,56 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Signal an occurence of an event in the current state of the flow - * execution being tested. + * Signal an occurence of an event in the current state of the flow execution being tested. * @param eventId the event that occured - * @throws FlowExecutionException if an exception was thrown within a state - * of the resumed flow execution during event processing + * @throws FlowExecutionException if an exception was thrown within a state of the resumed flow execution during + * event processing */ protected ViewSelection signalEvent(String eventId) throws FlowExecutionException { return signalEvent(eventId, createExternalContext(null)); } /** - * Signal an occurence of an event in the current state of the flow - * execution being tested. + * Signal an occurence of an event in the current state of the flow execution being tested. * @param eventId the event that occured - * @param requestParameters request parameters needed by the flow execution - * to complete event processing - * @throws FlowExecutionException if an exception was thrown within a state - * of the resumed flow execution during event processing + * @param requestParameters request parameters needed by the flow execution to complete event processing + * @throws FlowExecutionException if an exception was thrown within a state of the resumed flow execution during + * event processing */ protected ViewSelection signalEvent(String eventId, ParameterMap requestParameters) throws FlowExecutionException { return signalEvent(eventId, createExternalContext(requestParameters)); } /** - * Signal an occurence of an event in the current state of the flow - * execution being tested. + * Signal an occurence of an event in the current state of the flow execution being tested. *

    - * Note: signaling an event will cause state transitions to occur in a chain - * until control is returned to the caller. Control is returned once an - * "interactive" state type is entered: either a view state when the flow is - * paused or an end state when the flow terminates. Action states are - * executed without returning control, as their result always triggers - * another state transition, executed internally. Action states can also be - * executed in a chain like fashion (e.g. action state 1 (result), action - * state 2 (result), action state 3 (result), view state ). + * Note: signaling an event will cause state transitions to occur in a chain until control is returned to the + * caller. Control is returned once an "interactive" state type is entered: either a view state when the flow is + * paused or an end state when the flow terminates. Action states are executed without returning control, as their + * result always triggers another state transition, executed internally. Action states can also be executed in a + * chain like fashion (e.g. action state 1 (result), action state 2 (result), action state 3 (result), view state + * ). *

    - * If you wish to verify expected behavior on each state transition (and not - * just when the view state triggers return of control back to the client), - * you have a few options: + * If you wish to verify expected behavior on each state transition (and not just when the view state triggers + * return of control back to the client), you have a few options: *

    - * First, you may implement standalone unit tests for your - * {@link org.springframework.webflow.execution.Action} implementations. - * There you can verify that an Action executes its logic properly in - * isolation. When you do this, you may mock or stub out services the Action - * implementation needs that are expensive to initialize. You can also - * verify there that the action puts everything in the flow or request scope - * it was expected to (to meet its contract with the view it is prepping for - * display, for example). + * First, you may implement standalone unit tests for your {@link org.springframework.webflow.execution.Action} + * implementations. There you can verify that an Action executes its logic properly in isolation. When you do this, + * you may mock or stub out services the Action implementation needs that are expensive to initialize. You can also + * verify there that the action puts everything in the flow or request scope it was expected to (to meet its + * contract with the view it is prepping for display, for example). *

    - * Second, you can attach one or more FlowExecutionListeners to the flow - * execution at start time within your test code, which will allow you to - * receive a callback on each state transition (among other points). It is - * recommended you extend - * {@link org.springframework.webflow.execution.FlowExecutionListenerAdapter} - * and only override the callback methods you are interested in. + * Second, you can attach one or more FlowExecutionListeners to the flow execution at start time within your test + * code, which will allow you to receive a callback on each state transition (among other points). It is recommended + * you extend {@link org.springframework.webflow.execution.FlowExecutionListenerAdapter} and only override the + * callback methods you are interested in. * @param eventId the event that occured - * @param context the external context providing information about the - * caller's environment, used by the flow execution during the signal event - * operation - * @return the view selection that was made, returned once control is - * returned to the client (occurs when the flow enters a view state, or an - * end state) - * @throws FlowExecutionException if an exception was thrown within a state - * of the resumed flow execution during event processing + * @param context the external context providing information about the caller's environment, used by the flow + * execution during the signal event operation + * @return the view selection that was made, returned once control is returned to the client (occurs when the flow + * enters a view state, or an end state) + * @throws FlowExecutionException if an exception was thrown within a state of the resumed flow execution during + * event processing */ protected ViewSelection signalEvent(String eventId, ExternalContext context) throws FlowExecutionException { Assert.state(flowExecution != null, "The flow execution to test is [null]; " @@ -286,10 +244,9 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Refresh the flow execution being tested, asking the current view state to - * make a "refresh" view selection. This is idempotent operation that may be - * safely called on an active but currently paused execution. Used to - * simulate a browser flow execution redirect. + * Refresh the flow execution being tested, asking the current view state to make a "refresh" view selection. This + * is idempotent operation that may be safely called on an active but currently paused execution. Used to simulate a + * browser flow execution redirect. * @return the current view selection for this flow execution * @throws FlowExecutionException if an exception was thrown during refresh */ @@ -298,13 +255,11 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Refresh the flow execution being tested, asking the current view state - * state to make a "refresh" view selection. This is idempotent operation - * that may be safely called on an active but currently paused execution. - * Used to simulate a browser flow execution redirect. - * @param context the external context providing information about the - * caller's environment, used by the flow execution during the refresh - * operation + * Refresh the flow execution being tested, asking the current view state state to make a "refresh" view selection. + * This is idempotent operation that may be safely called on an active but currently paused execution. Used to + * simulate a browser flow execution redirect. + * @param context the external context providing information about the caller's environment, used by the flow + * execution during the refresh operation * @return the current view selection for this flow execution * @throws FlowExecutionException if an exception was thrown during refresh */ @@ -328,8 +283,7 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Returns the attribute in conversation scope. Conversation-scoped - * attributes are shared by all flow sessions. + * Returns the attribute in conversation scope. Conversation-scoped attributes are shared by all flow sessions. * @param attributeName the name of the attribute * @return the attribute value */ @@ -338,9 +292,8 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Returns the required attribute in conversation scope; asserts the - * attribute is present. Conversation-scoped attributes are shared by all - * flow sessions. + * Returns the required attribute in conversation scope; asserts the attribute is present. Conversation-scoped + * attributes are shared by all flow sessions. * @param attributeName the name of the attribute * @return the attribute value * @throws IllegalStateException if the attribute was not present @@ -350,13 +303,11 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Returns the required attribute in conversation scope; asserts the - * attribute is present and of the required type. Conversation-scoped - * attributes are shared by all flow sessions. + * Returns the required attribute in conversation scope; asserts the attribute is present and of the required type. + * Conversation-scoped attributes are shared by all flow sessions. * @param attributeName the name of the attribute * @return the attribute value - * @throws IllegalStateException if the attribute was not present or not of - * the required type + * @throws IllegalStateException if the attribute was not present or not of the required type */ protected Object getRequiredConversationAttribute(String attributeName, Class requiredType) throws IllegalStateException { @@ -364,8 +315,7 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Returns the attribute in flow scope. Flow-scoped attributes are local to - * the active flow session. + * Returns the attribute in flow scope. Flow-scoped attributes are local to the active flow session. * @param attributeName the name of the attribute * @return the attribute value */ @@ -374,8 +324,8 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Returns the required attribute in flow scope; asserts the attribute is - * present. Flow-scoped attributes are local to the active flow session. + * Returns the required attribute in flow scope; asserts the attribute is present. Flow-scoped attributes are local + * to the active flow session. * @param attributeName the name of the attribute * @return the attribute value * @throws IllegalStateException if the attribute was not present @@ -385,21 +335,19 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Returns the required attribute in flow scope; asserts the attribute is - * present and of the correct type. Flow-scoped attributes are local to the - * active flow session. + * Returns the required attribute in flow scope; asserts the attribute is present and of the correct type. + * Flow-scoped attributes are local to the active flow session. * @param attributeName the name of the attribute * @return the attribute value - * @throws IllegalStateException if the attribute was not present or was of - * the wrong type + * @throws IllegalStateException if the attribute was not present or was of the wrong type */ protected Object getRequiredFlowAttribute(String attributeName, Class requiredType) throws IllegalStateException { return getFlowExecution().getActiveSession().getScope().getRequired(attributeName, requiredType); } /** - * Returns the attribute in flash scope. Flash-scoped attributes are local to - * the active flow session and cleared on the next user event. + * Returns the attribute in flash scope. Flash-scoped attributes are local to the active flow session and cleared on + * the next user event. * @param attributeName the name of the attribute * @return the attribute value * @since 1.0.2 @@ -409,9 +357,8 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Returns the required attribute in flash scope; asserts the attribute is - * present. Flash-scoped attributes are local to the active flow session and cleared on - * the next user event. + * Returns the required attribute in flash scope; asserts the attribute is present. Flash-scoped attributes are + * local to the active flow session and cleared on the next user event. * @param attributeName the name of the attribute * @return the attribute value * @throws IllegalStateException if the attribute was not present @@ -422,13 +369,11 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Returns the required attribute in flash scope; asserts the attribute is - * present and of the correct type. Flash-scoped attributes are local to the - * active flow session and cleared on the next user event. + * Returns the required attribute in flash scope; asserts the attribute is present and of the correct type. + * Flash-scoped attributes are local to the active flow session and cleared on the next user event. * @param attributeName the name of the attribute * @return the attribute value - * @throws IllegalStateException if the attribute was not present or was of - * the wrong type + * @throws IllegalStateException if the attribute was not present or was of the wrong type */ protected Object getRequiredFlashAttribute(String attributeName, Class requiredType) throws IllegalStateException { return getFlowExecution().getActiveSession().getFlashMap().getRequired(attributeName, requiredType); @@ -438,8 +383,7 @@ public abstract class AbstractFlowExecutionTests extends TestCase { /** * Assert that the active flow session is for the flow with the provided id. - * @param expectedActiveFlowId the flow id that should have a session active - * in the tested flow execution + * @param expectedActiveFlowId the flow id that should have a session active in the tested flow execution */ protected void assertActiveFlowEquals(String expectedActiveFlowId) { assertEquals("The active flow id '" + getFlowExecution().getActiveSession().getDefinition().getId() @@ -448,24 +392,21 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Assert that the entire flow execution is active; that is, it has not - * ended and has been started. + * Assert that the entire flow execution is active; that is, it has not ended and has been started. */ protected void assertFlowExecutionActive() { assertTrue("The flow execution is not active but it should be", getFlowExecution().isActive()); } /** - * Assert that the entire flow execution has ended; that is, it is no longer - * active. + * Assert that the entire flow execution has ended; that is, it is no longer active. */ protected void assertFlowExecutionEnded() { assertTrue("The flow execution is still active but it should have ended", !getFlowExecution().isActive()); } /** - * Assert that the current state of the flow execution equals the provided - * state id. + * Assert that the current state of the flow execution equals the provided state id. * @param expectedCurrentStateId the expected current state */ protected void assertCurrentStateEquals(String expectedCurrentStateId) { @@ -484,12 +425,10 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Assert that the selected view contains the specified model attribute with - * the provided expected value. + * Assert that the selected view contains the specified model attribute with the provided expected value. * @param expectedValue the expected value * @param attributeName the attribute name (can be an expression) - * @param viewSelection the selected view with a model attribute map to - * assert against + * @param viewSelection the selected view with a model attribute map to assert against */ protected void assertModelAttributeEquals(Object expectedValue, String attributeName, ApplicationView viewSelection) { assertEquals("The model attribute '" + attributeName + "' value is wrong:", expectedValue, @@ -497,25 +436,22 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Assert that the selected view contains the specified collection model - * attribute with the provided expected size. + * Assert that the selected view contains the specified collection model attribute with the provided expected size. * @param expectedSize the expected size * @param attributeName the collection attribute name (can be an expression - * @param viewSelection the selected view with a model attribute map to - * assert against + * @param viewSelection the selected view with a model attribute map to assert against */ protected void assertModelAttributeCollectionSize(int expectedSize, String attributeName, ApplicationView viewSelection) { assertModelAttributeNotNull(attributeName, viewSelection); - Collection c = (Collection)evaluateModelAttributeExpression(attributeName, viewSelection.getModel()); + Collection c = (Collection) evaluateModelAttributeExpression(attributeName, viewSelection.getModel()); assertEquals("The model attribute '" + attributeName + "' collection size is wrong:", expectedSize, c.size()); } /** * Assert that the selected view contains the specified model attribute. * @param attributeName the attribute name (can be an expression) - * @param viewSelection the selected view with a model attribute map to - * assert against + * @param viewSelection the selected view with a model attribute map to assert against */ protected void assertModelAttributeNotNull(String attributeName, ApplicationView viewSelection) { assertNotNull("The model attribute '" + attributeName + "' is null but should not be; model contents are " @@ -524,11 +460,9 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Assert that the selected view does not contain the specified model - * attribute. + * Assert that the selected view does not contain the specified model attribute. * @param attributeName the attribute name (can be an expression) - * @param viewSelection the selected view with a model attribute map to - * assert against + * @param viewSelection the selected view with a model attribute map to assert against */ protected void assertModelAttributeNull(String attributeName, ApplicationView viewSelection) { assertNull("The model attribute '" + attributeName + "' is not null but should be; model contents are " @@ -539,48 +473,43 @@ public abstract class AbstractFlowExecutionTests extends TestCase { // other helpers /** - * Assert that the returned view selection is an instance of - * {@link ApplicationView}. + * Assert that the returned view selection is an instance of {@link ApplicationView}. * @param viewSelection the view selection */ protected ApplicationView applicationView(ViewSelection viewSelection) { Assert.isInstanceOf(ApplicationView.class, viewSelection, "Unexpected class of view selection: "); - return (ApplicationView)viewSelection; + return (ApplicationView) viewSelection; } /** - * Assert that the returned view selection is an instance of - * {@link FlowExecutionRedirect}. + * Assert that the returned view selection is an instance of {@link FlowExecutionRedirect}. * @param viewSelection the view selection */ protected FlowExecutionRedirect flowExecutionRedirect(ViewSelection viewSelection) { Assert.isInstanceOf(FlowExecutionRedirect.class, viewSelection, "Unexpected class of view selection: "); - return (FlowExecutionRedirect)viewSelection; + return (FlowExecutionRedirect) viewSelection; } /** - * Assert that the returned view selection is an instance of - * {@link FlowDefinitionRedirect}. + * Assert that the returned view selection is an instance of {@link FlowDefinitionRedirect}. * @param viewSelection the view selection */ protected FlowDefinitionRedirect flowDefinitionRedirect(ViewSelection viewSelection) { Assert.isInstanceOf(FlowDefinitionRedirect.class, viewSelection, "Unexpected class of view selection: "); - return (FlowDefinitionRedirect)viewSelection; + return (FlowDefinitionRedirect) viewSelection; } /** - * Assert that the returned view selection is an instance of - * {@link ExternalRedirect}. + * Assert that the returned view selection is an instance of {@link ExternalRedirect}. * @param viewSelection the view selection */ protected ExternalRedirect externalRedirect(ViewSelection viewSelection) { Assert.isInstanceOf(ExternalRedirect.class, viewSelection, "Unexpected class of view selection: "); - return (ExternalRedirect)viewSelection; + return (ExternalRedirect) viewSelection; } /** - * Assert that the returned view selection is the - * {@link ViewSelection#NULL_VIEW}. + * Assert that the returned view selection is the {@link ViewSelection#NULL_VIEW}. * @param viewSelection the view selection */ protected void nullView(ViewSelection viewSelection) { @@ -598,23 +527,18 @@ public abstract class AbstractFlowExecutionTests extends TestCase { } /** - * Factory method to create the flow execution factory. Subclasses - * could override this if they want to use a custom flow execution factory - * or custom configuration of the flow execution factory, registering - * flow execution listeners for instance. - * The default implementation just returns a {@link FlowExecutionImplFactory} - * instance. + * Factory method to create the flow execution factory. Subclasses could override this if they want to use a custom + * flow execution factory or custom configuration of the flow execution factory, registering flow execution + * listeners for instance. The default implementation just returns a {@link FlowExecutionImplFactory} instance. * @return the flow execution factory */ protected FlowExecutionFactory createFlowExecutionFactory() { return new FlowExecutionImplFactory(); } - + /** - * Directly update the flow execution used by the test by setting - * it to given flow execution. Use this if you have somehow manipulated - * the flow execution being tested and want to continue the test - * with another flow execution. + * Directly update the flow execution used by the test by setting it to given flow execution. Use this if you have + * somehow manipulated the flow execution being tested and want to continue the test with another flow execution. * @param flowExecution the flow execution to use */ protected void updateFlowExecution(FlowExecution flowExecution) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractXmlFlowExecutionTests.java b/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractXmlFlowExecutionTests.java index 36c54924..297df5be 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractXmlFlowExecutionTests.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/test/execution/AbstractXmlFlowExecutionTests.java @@ -23,35 +23,33 @@ import org.springframework.webflow.engine.builder.FlowServiceLocator; import org.springframework.webflow.engine.builder.xml.XmlFlowBuilder; /** - * Base class for flow integration tests that verify an XML flow definition - * executes as expected. + * Base class for flow integration tests that verify an XML flow definition executes as expected. *

    * Example usage: - * + * *

      * public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests {
    - *
    - *     protected FlowDefinitionResource getFlowDefinitionResource() {
    - *         return createFlowDefinitionResource("src/main/webapp/WEB-INF/flows/search-flow.xml");
    - *     }
    - *
    - *     public void testStartFlow() {
    - *         startFlow();
    - *         assertCurrentStateEquals("displaySearchCriteria");
    - *     }
    - *
    - *     public void testDisplayCriteriaSubmitSuccess() {
    - *         startFlow();
    - *         MockParameterMap parameters = new MockParameterMap();
    - *         parameters.put("firstName", "Keith");
    - *         parameters.put("lastName", "Donald");
    - *         ViewSelection view = signalEvent("search", parameters);
    - *         assertCurrentStateEquals("displaySearchResults");
    - *         assertModelAttributeCollectionSize(1, "results", view);
    - *     }
    + * 	protected FlowDefinitionResource getFlowDefinitionResource() {
    + * 		return createFlowDefinitionResource("src/main/webapp/WEB-INF/flows/search-flow.xml");
    + * 	}
    + * 
    + * 	public void testStartFlow() {
    + * 		startFlow();
    + * 		assertCurrentStateEquals("displaySearchCriteria");
    + * 	}
    + * 
    + * 	public void testDisplayCriteriaSubmitSuccess() {
    + * 		startFlow();
    + * 		MockParameterMap parameters = new MockParameterMap();
    + * 		parameters.put("firstName", "Keith");
    + * 		parameters.put("lastName", "Donald");
    + * 		ViewSelection view = signalEvent("search", parameters);
    + * 		assertCurrentStateEquals("displaySearchResults");
    + * 		assertModelAttributeCollectionSize(1, "results", view);
    + * 	}
      * }
      * 
    - * + * * @author Keith Donald * @author Erwin Vervaet */ @@ -83,11 +81,11 @@ public abstract class AbstractXmlFlowExecutionTests extends AbstractExternalized } /** - * Template method subclasses may override to register mock implementations of - * services used locally by the flow being tested. + * Template method subclasses may override to register mock implementations of services used locally by the flow + * being tested. * @param flow the flow to register the services for - * @param beanFactory the local flow service registry; register mock services with it - * using {@link ConfigurableBeanFactory#registerSingleton(String, Object)} + * @param beanFactory the local flow service registry; register mock services with it using + * {@link ConfigurableBeanFactory#registerSingleton(String, Object)} * @since 1.0.4 */ protected void registerLocalMockServices(Flow flow, ConfigurableBeanFactory beanFactory) { diff --git a/spring-webflow/src/main/java/org/springframework/webflow/util/Base64.java b/spring-webflow/src/main/java/org/springframework/webflow/util/Base64.java index 89355976..fd32528b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/util/Base64.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/util/Base64.java @@ -18,157 +18,143 @@ package org.springframework.webflow.util; /** * Encodes and decodes to and from Base64 notation. *

    - * Based on Base64 encoder and decoder version 2.2.1 written by Robert Harder - * (http://iharder.net/base64). - * Modified by Erwin Vervaet to use the '.' character as padding character - * when using URL safe encoding, like in the Bouncy Castle URLBase64 encoder - * (http://www.bouncycastle.org/java.html). - * + * Based on Base64 encoder and decoder version 2.2.1 written by Robert Harder (http://iharder.net/base64). Modified by Erwin Vervaet to use the '.' character + * as padding character when using URL safe encoding, like in the Bouncy Castle URLBase64 encoder (http://www.bouncycastle.org/java.html). + * * @author Robert Harder * @author Erwin Vervaet */ public class Base64 { - - /* static data used by the encoding and decoding algorithm - - /* The equals sign (=) as a byte. */ - private static final byte EQUALS_SIGN = (byte)'='; + + /* + * static data used by the encoding and decoding algorithm + * /* The equals sign (=) as a byte. + */ + private static final byte EQUALS_SIGN = (byte) '='; /* The dot (.) as a byte. */ - private static final byte DOT = (byte)'.'; - + private static final byte DOT = (byte) '.'; + private static final byte WHITE_SPACE_ENC = -5; // Indicates white space in encoding private static final byte PADDING_CHAR_ENC = -1; // Indicates padding char in encoding - - - /* ******** S T A N D A R D B A S E 6 4 A L P H A B E T ******** */ - + + /* ******** S T A N D A R D B A S E 6 4 A L P H A B E T ******** */ + /** The 64 valid Base64 values. */ /* Host platform may be something funny like EBCDIC, so we hardcode these values. */ - private static final byte[] STANDARD_ALPHABET = { - (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', - (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', - (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', - (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', - (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', - (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', - (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', - (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', - (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', - (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'+', (byte)'/' - }; + private static final byte[] STANDARD_ALPHABET = { (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', + (byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N', + (byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U', (byte) 'V', (byte) 'W', + (byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', + (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j', (byte) 'k', (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o', + (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't', (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', + (byte) 'y', (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', + (byte) '7', (byte) '8', (byte) '9', (byte) '+', (byte) '/' }; - /** - * Translates a Base64 value to either its 6-bit reconstruction value - * or a negative number indicating some other meaning. - **/ - private static final byte[] STANDARD_DECODABET = { - -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8 - -5,-5, // Whitespace: Tab and Linefeed - -9,-9, // Decimal 11 - 12 - -5, // Whitespace: Carriage Return - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26 - -9,-9,-9,-9,-9, // Decimal 27 - 31 - -5, // Whitespace: Space - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42 - 62, // Plus sign at decimal 43 - -9,-9,-9, // Decimal 44 - 46 - 63, // Slash at decimal 47 - 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine - -9,-9,-9, // Decimal 58 - 60 - -1, // Equals sign at decimal 61 - -9,-9,-9, // Decimal 62 - 64 - 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N' - 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z' - -9,-9,-9,-9,-9,-9, // Decimal 91 - 96 - 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm' - 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z' - -9,-9,-9,-9 // Decimal 123 - 126 - }; - - /* ******** U R L S A F E B A S E 6 4 A L P H A B E T ******** */ - /** - * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548: - * http://www.faqs.org/rfcs/rfc3548.html. - * Notice that the last two bytes become "hyphen" and "underscore" instead of "plus" and "slash." + * Translates a Base64 value to either its 6-bit reconstruction value or a negative number indicating some other + * meaning. */ - private static final byte[] URL_SAFE_ALPHABET = { - (byte)'A', (byte)'B', (byte)'C', (byte)'D', (byte)'E', (byte)'F', (byte)'G', - (byte)'H', (byte)'I', (byte)'J', (byte)'K', (byte)'L', (byte)'M', (byte)'N', - (byte)'O', (byte)'P', (byte)'Q', (byte)'R', (byte)'S', (byte)'T', (byte)'U', - (byte)'V', (byte)'W', (byte)'X', (byte)'Y', (byte)'Z', - (byte)'a', (byte)'b', (byte)'c', (byte)'d', (byte)'e', (byte)'f', (byte)'g', - (byte)'h', (byte)'i', (byte)'j', (byte)'k', (byte)'l', (byte)'m', (byte)'n', - (byte)'o', (byte)'p', (byte)'q', (byte)'r', (byte)'s', (byte)'t', (byte)'u', - (byte)'v', (byte)'w', (byte)'x', (byte)'y', (byte)'z', - (byte)'0', (byte)'1', (byte)'2', (byte)'3', (byte)'4', (byte)'5', - (byte)'6', (byte)'7', (byte)'8', (byte)'9', (byte)'-', (byte)'_' + private static final byte[] STANDARD_DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 0 - 8 + -5, -5, // Whitespace: Tab and Linefeed + -9, -9, // Decimal 11 - 12 + -5, // Whitespace: Carriage Return + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 14 - 26 + -9, -9, -9, -9, -9, // Decimal 27 - 31 + -5, // Whitespace: Space + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 33 - 42 + 62, // Plus sign at decimal 43 + -9, -9, -9, // Decimal 44 - 46 + 63, // Slash at decimal 47 + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // Numbers zero through nine + -9, -9, -9, // Decimal 58 - 60 + -1, // Equals sign at decimal 61 + -9, -9, -9, // Decimal 62 - 64 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, // Letters 'A' through 'N' + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // Letters 'O' through 'Z' + -9, -9, -9, -9, -9, -9, // Decimal 91 - 96 + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // Letters 'a' through 'm' + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // Letters 'n' through 'z' + -9, -9, -9, -9 // Decimal 123 - 126 }; - + + /* ******** U R L S A F E B A S E 6 4 A L P H A B E T ******** */ + + /** + * Used in the URL- and Filename-safe dialect described in Section 4 of RFC3548: http://www.faqs.org/rfcs/rfc3548.html. Notice that the last two + * bytes become "hyphen" and "underscore" instead of "plus" and "slash." + */ + private static final byte[] URL_SAFE_ALPHABET = { (byte) 'A', (byte) 'B', (byte) 'C', (byte) 'D', (byte) 'E', + (byte) 'F', (byte) 'G', (byte) 'H', (byte) 'I', (byte) 'J', (byte) 'K', (byte) 'L', (byte) 'M', (byte) 'N', + (byte) 'O', (byte) 'P', (byte) 'Q', (byte) 'R', (byte) 'S', (byte) 'T', (byte) 'U', (byte) 'V', (byte) 'W', + (byte) 'X', (byte) 'Y', (byte) 'Z', (byte) 'a', (byte) 'b', (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f', + (byte) 'g', (byte) 'h', (byte) 'i', (byte) 'j', (byte) 'k', (byte) 'l', (byte) 'm', (byte) 'n', (byte) 'o', + (byte) 'p', (byte) 'q', (byte) 'r', (byte) 's', (byte) 't', (byte) 'u', (byte) 'v', (byte) 'w', (byte) 'x', + (byte) 'y', (byte) 'z', (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', (byte) '6', + (byte) '7', (byte) '8', (byte) '9', (byte) '-', (byte) '_' }; + /** * Used in decoding URL- and Filename-safe dialects of Base64. */ - private static final byte[] URL_SAFE_DECODABET = { - -9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 0 - 8 - -5,-5, // Whitespace: Tab and Linefeed - -9,-9, // Decimal 11 - 12 - -5, // Whitespace: Carriage Return - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 14 - 26 - -9,-9,-9,-9,-9, // Decimal 27 - 31 - -5, // Whitespace: Space - -9,-9,-9,-9,-9,-9,-9,-9,-9,-9, // Decimal 33 - 42 - -9, // Plus sign at decimal 43 - -9, // Decimal 44 - 62, // Minus sign at decimal 45 - -1, // Dot at decimal 46 - -9, // Slash at decimal 47 - 52,53,54,55,56,57,58,59,60,61, // Numbers zero through nine - -9,-9,-9, // Decimal 58 - 60 - -9, // Equals sign at decimal 61 - -9,-9,-9, // Decimal 62 - 64 - 0,1,2,3,4,5,6,7,8,9,10,11,12,13, // Letters 'A' through 'N' - 14,15,16,17,18,19,20,21,22,23,24,25, // Letters 'O' through 'Z' - -9,-9,-9,-9, // Decimal 91 - 94 - 63, // Underscore at decimal 95 - -9, // Decimal 96 - 26,27,28,29,30,31,32,33,34,35,36,37,38, // Letters 'a' through 'm' - 39,40,41,42,43,44,45,46,47,48,49,50,51, // Letters 'n' through 'z' - -9,-9,-9,-9 // Decimal 123 - 126 + private static final byte[] URL_SAFE_DECODABET = { -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 0 - 8 + -5, -5, // Whitespace: Tab and Linefeed + -9, -9, // Decimal 11 - 12 + -5, // Whitespace: Carriage Return + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 14 - 26 + -9, -9, -9, -9, -9, // Decimal 27 - 31 + -5, // Whitespace: Space + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, // Decimal 33 - 42 + -9, // Plus sign at decimal 43 + -9, // Decimal 44 + 62, // Minus sign at decimal 45 + -1, // Dot at decimal 46 + -9, // Slash at decimal 47 + 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, // Numbers zero through nine + -9, -9, -9, // Decimal 58 - 60 + -9, // Equals sign at decimal 61 + -9, -9, -9, // Decimal 62 - 64 + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, // Letters 'A' through 'N' + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, // Letters 'O' through 'Z' + -9, -9, -9, -9, // Decimal 91 - 94 + 63, // Underscore at decimal 95 + -9, // Decimal 96 + 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, // Letters 'a' through 'm' + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, // Letters 'n' through 'z' + -9, -9, -9, -9 // Decimal 123 - 126 }; - + // instance members - - /** - * Encode using Base64-like encoding that is URL- and Filename-safe as described - * in Section 4 of RFC3548: - * http://www.faqs.org/rfcs/rfc3548.html. + + /** + * Encode using Base64-like encoding that is URL- and Filename-safe as described in Section 4 of RFC3548: http://www.faqs.org/rfcs/rfc3548.html. */ private boolean urlSafe; - + private byte[] ALPHABET; private byte[] DECODABET; private byte PADDING_CHAR; - + /** - * Create a new Base64 encoder and decoder using the standard Base64 alphabet. - * Note that the resulting encoded strings are not URL-safe: they will - * can contain characters that are subject to URL encoding. + * Create a new Base64 encoder and decoder using the standard Base64 alphabet. Note that the resulting encoded + * strings are not URL-safe: they will can contain characters that are subject to URL encoding. */ public Base64() { this(false); } - + /** * Create a new Base64 encoder and decoder. - *

    Allows Base64-like encoding that is URL- and Filename-safe as described - * in Section 4 of RFC3548: - * http://www.faqs.org/rfcs/rfc3548.html. - * When URL-safe encoding is used, the standard "=" Base64 padding character is replaced - * with the '.' character. *

    - * It is important to note that data encoded this way is not officially valid Base64, - * or at the very least should not be called Base64 without also specifying that is - * was encoded using the URL- and Filename-safe dialect + * Allows Base64-like encoding that is URL- and Filename-safe as described in Section 4 of RFC3548: http://www.faqs.org/rfcs/rfc3548.html. When URL-safe encoding + * is used, the standard "=" Base64 padding character is replaced with the '.' character. + *

    + * It is important to note that data encoded this way is not officially valid Base64, or at the very + * least should not be called Base64 without also specifying that is was encoded using the URL- and Filename-safe + * dialect * * @param urlSafe if true, URL safe encoding and decoding will be used */ @@ -178,46 +164,40 @@ public class Base64 { ALPHABET = URL_SAFE_ALPHABET; DECODABET = URL_SAFE_DECODABET; PADDING_CHAR = DOT; - } - else { + } else { ALPHABET = STANDARD_ALPHABET; DECODABET = STANDARD_DECODABET; PADDING_CHAR = EQUALS_SIGN; } } - + /** - * Returns whether or not this coder is using Base64-like encoding that is URL- and Filename-safe - * as described in Section 4 of RFC3548: - * http://www.faqs.org/rfcs/rfc3548.html. - * When URL-safe encoding is used, the standard "=" Base64 padding character is replaced - * with the '.' character. + * Returns whether or not this coder is using Base64-like encoding that is URL- and Filename-safe as described in + * Section 4 of RFC3548: http://www.faqs.org/rfcs/rfc3548.html. + * When URL-safe encoding is used, the standard "=" Base64 padding character is replaced with the '.' character. *

    - * It is important to note that data encoded this way is not officially valid Base64, - * or at the very least should not be called Base64 without also specifying that is - * was encoded using the URL- and Filename-safe dialect. + * It is important to note that data encoded this way is not officially valid Base64, or at the very + * least should not be called Base64 without also specifying that is was encoded using the URL- and Filename-safe + * dialect. * @return true or false */ public boolean isUrlSafe() { return urlSafe; } - /* ******** E N C O D I N G M E T H O D S ******** */ + /* ******** E N C O D I N G M E T H O D S ******** */ /** - * Encodes up to three bytes of the array source - * and writes the resulting four Base64 bytes to destination. - * The source and destination arrays can be manipulated - * anywhere along their length by specifying - * srcOffset and destOffset. - * This method does not check to make sure your arrays - * are large enough to accomodate srcOffset + 3 for - * the source array or destOffset + 4 for - * the destination array. - * The actual number of significant bytes in your array is - * given by numSigBytes.

    - *

    This is the lowest level of the encoding methods with - * all possible parameters.

    + * Encodes up to three bytes of the array source and writes the resulting four Base64 bytes to + * destination. The source and destination arrays can be manipulated anywhere along their length by + * specifying srcOffset and destOffset. This method does not check to make sure your arrays + * are large enough to accomodate srcOffset + 3 for the source array or destOffset + + * 4 for the destination array. The actual number of significant bytes in your array is given by + * numSigBytes. + *

    + *

    + * This is the lowest level of the encoding methods with all possible parameters. + *

    * @param source the array to convert * @param srcOffset the index where conversion begins * @param numSigBytes the number of significant bytes in your array @@ -226,45 +206,45 @@ public class Base64 { * @return the destination array */ private byte[] encode3to4(byte[] source, int srcOffset, int numSigBytes, byte[] destination, int destOffset) { - // 1 2 3 + // 1 2 3 // 01234567890123456789012345678901 Bit position // --------000000001111111122222222 Array position from threeBytes - // --------| || || || | Six bit groups to index ALPHABET - // >>18 >>12 >> 6 >> 0 Right shift necessary - // 0x3f 0x3f 0x3f Additional AND - + // --------| || || || | Six bit groups to index ALPHABET + // >>18 >>12 >> 6 >> 0 Right shift necessary + // 0x3f 0x3f 0x3f Additional AND + // Create buffer with zero-padding if there are only one or two // significant bytes passed in the array. // We have to shift left 24 in order to flush out the 1's that appear // when Java treats a value as negative that is cast from a byte to an int. - int inBuff = ( numSigBytes > 0 ? ((source[ srcOffset ] << 24) >>> 8) : 0 ) - | ( numSigBytes > 1 ? ((source[ srcOffset + 1 ] << 24) >>> 16) : 0 ) - | ( numSigBytes > 2 ? ((source[ srcOffset + 2 ] << 24) >>> 24) : 0 ); + int inBuff = (numSigBytes > 0 ? ((source[srcOffset] << 24) >>> 8) : 0) + | (numSigBytes > 1 ? ((source[srcOffset + 1] << 24) >>> 16) : 0) + | (numSigBytes > 2 ? ((source[srcOffset + 2] << 24) >>> 24) : 0); switch (numSigBytes) { - case 3: - destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ]; - destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ]; - destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ]; - destination[ destOffset + 3 ] = ALPHABET[ (inBuff ) & 0x3f ]; - return destination; - - case 2: - destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ]; - destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ]; - destination[ destOffset + 2 ] = ALPHABET[ (inBuff >>> 6) & 0x3f ]; - destination[ destOffset + 3 ] = PADDING_CHAR; - return destination; - - case 1: - destination[ destOffset ] = ALPHABET[ (inBuff >>> 18) ]; - destination[ destOffset + 1 ] = ALPHABET[ (inBuff >>> 12) & 0x3f ]; - destination[ destOffset + 2 ] = PADDING_CHAR; - destination[ destOffset + 3 ] = PADDING_CHAR; - return destination; - - default: - return destination; + case 3: + destination[destOffset] = ALPHABET[(inBuff >>> 18)]; + destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f]; + destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f]; + destination[destOffset + 3] = ALPHABET[(inBuff) & 0x3f]; + return destination; + + case 2: + destination[destOffset] = ALPHABET[(inBuff >>> 18)]; + destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f]; + destination[destOffset + 2] = ALPHABET[(inBuff >>> 6) & 0x3f]; + destination[destOffset + 3] = PADDING_CHAR; + return destination; + + case 1: + destination[destOffset] = ALPHABET[(inBuff >>> 18)]; + destination[destOffset + 1] = ALPHABET[(inBuff >>> 12) & 0x3f]; + destination[destOffset + 2] = PADDING_CHAR; + destination[destOffset + 3] = PADDING_CHAR; + return destination; + + default: + return destination; } } @@ -275,27 +255,27 @@ public class Base64 { * @param len length of data to convert * @return the encoded data */ - public final byte[] encode(byte[] source, int off, int len) { - int len43 = len * 4 / 3; - byte[] outBuff = new byte[ ( len43 ) // main 4:3 - + ( (len % 3) > 0 ? 4 : 0 ) ]; // account for padding + public final byte[] encode(byte[] source, int off, int len) { + int len43 = len * 4 / 3; + byte[] outBuff = new byte[(len43) // main 4:3 + + ((len % 3) > 0 ? 4 : 0)]; // account for padding int d = 0; int e = 0; int len2 = len - 2; int lineLength = 0; - for (; d < len2; d+=3, e+=4) { - encode3to4(source, d+off, 3, outBuff, e); + for (; d < len2; d += 3, e += 4) { + encode3to4(source, d + off, 3, outBuff, e); lineLength += 4; } // end for: each piece of array if (d < len) { - encode3to4(source, d+off, len - d, outBuff, e); + encode3to4(source, d + off, len - d, outBuff, e); e += 4; } // end if: some padding needed - + byte[] out = new byte[e]; - System.arraycopy(outBuff, 0, out, 0, e); + System.arraycopy(outBuff, 0, out, 0, e); return out; } @@ -307,10 +287,10 @@ public class Base64 { public final byte[] encode(byte[] source) { return encode(source, 0, source.length); } - + /** - * Encodes a byte array into Base64 notation. The resulting string will - * be created using the platform default encoding. + * Encodes a byte array into Base64 notation. The resulting string will be created using the platform default + * encoding. * @param source the source data to encode * @return the encoded data */ @@ -318,23 +298,18 @@ public class Base64 { return new String(encode(source)); } - /* ******** D E C O D I N G M E T H O D S ******** */ - + /* ******** D E C O D I N G M E T H O D S ******** */ + /** - * Decodes four bytes from array source - * and writes the resulting bytes (up to three of them) - * to destination. - * The source and destination arrays can be manipulated - * anywhere along their length by specifying - * srcOffset and destOffset. - * This method does not check to make sure your arrays - * are large enough to accomodate srcOffset + 4 for - * the source array or destOffset + 3 for - * the destination array. - * This method returns the actual number of bytes that - * were converted from the Base64 encoding. - *

    This is the lowest level of the decoding methods with - * all possible parameters.

    + * Decodes four bytes from array source and writes the resulting bytes (up to three of them) to + * destination. The source and destination arrays can be manipulated anywhere along their length by + * specifying srcOffset and destOffset. This method does not check to make sure your arrays + * are large enough to accomodate srcOffset + 4 for the source array or destOffset + + * 3 for the destination array. This method returns the actual number of bytes that were converted from + * the Base64 encoding. + *

    + * This is the lowest level of the decoding methods with all possible parameters. + *

    * @param source the array to convert * @param srcOffset the index where conversion begins * @param destination the array to hold the conversion @@ -343,69 +318,67 @@ public class Base64 { */ private final int decode4to3(byte[] source, int srcOffset, byte[] destination, int destOffset) { // Example: Dk== or Dk.. - if (source[ srcOffset + 2] == PADDING_CHAR) { - int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 ) - | ( ( DECODABET[ source[ srcOffset + 1] ] & 0xFF ) << 12 ); - - destination[ destOffset ] = (byte)( outBuff >>> 16 ); + if (source[srcOffset + 2] == PADDING_CHAR) { + int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) + | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12); + + destination[destOffset] = (byte) (outBuff >>> 16); return 1; } - + // Example: DkL= or DkL. - else if (source[ srcOffset + 3 ] == PADDING_CHAR) { - int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 ) - | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 ) - | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6 ); - - destination[ destOffset ] = (byte)( outBuff >>> 16 ); - destination[ destOffset + 1 ] = (byte)( outBuff >>> 8 ); + else if (source[srcOffset + 3] == PADDING_CHAR) { + int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) + | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) + | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6); + + destination[destOffset] = (byte) (outBuff >>> 16); + destination[destOffset + 1] = (byte) (outBuff >>> 8); return 2; } - + // Example: DkLE else { - int outBuff = ( ( DECODABET[ source[ srcOffset ] ] & 0xFF ) << 18 ) - | ( ( DECODABET[ source[ srcOffset + 1 ] ] & 0xFF ) << 12 ) - | ( ( DECODABET[ source[ srcOffset + 2 ] ] & 0xFF ) << 6) - | ( ( DECODABET[ source[ srcOffset + 3 ] ] & 0xFF ) ); + int outBuff = ((DECODABET[source[srcOffset]] & 0xFF) << 18) + | ((DECODABET[source[srcOffset + 1]] & 0xFF) << 12) + | ((DECODABET[source[srcOffset + 2]] & 0xFF) << 6) | ((DECODABET[source[srcOffset + 3]] & 0xFF)); - destination[ destOffset ] = (byte)( outBuff >> 16 ); - destination[ destOffset + 1 ] = (byte)( outBuff >> 8 ); - destination[ destOffset + 2 ] = (byte)( outBuff ); + destination[destOffset] = (byte) (outBuff >> 16); + destination[destOffset + 1] = (byte) (outBuff >> 8); + destination[destOffset + 2] = (byte) (outBuff); return 3; } } - + /** - * Very low-level access to decoding ASCII characters in - * the form of a byte array. + * Very low-level access to decoding ASCII characters in the form of a byte array. * @param source the Base64 encoded data * @param off the offset of where to begin decoding * @param len the length of characters to decode * @return decoded data */ public final byte[] decode(byte[] source, int off, int len) { - int len34 = len * 3 / 4; + int len34 = len * 3 / 4; byte[] outBuff = new byte[len34]; // upper limit on size of output - int outBuffPosn = 0; - + int outBuffPosn = 0; + byte[] b4 = new byte[4]; - int b4Posn = 0; - int i = 0; + int b4Posn = 0; + int i = 0; byte sbiCrop = 0; byte sbiDecode = 0; for (i = off; i < off + len; i++) { - sbiCrop = (byte)(source[i] & 0x7f); // only the low seven bits + sbiCrop = (byte) (source[i] & 0x7f); // only the low seven bits sbiDecode = DECODABET[sbiCrop]; - + if (sbiDecode >= WHITE_SPACE_ENC) { // white space, equals sign or better if (sbiDecode >= PADDING_CHAR_ENC) { b4[b4Posn++] = sbiCrop; if (b4Posn > 3) { outBuffPosn += decode4to3(b4, 0, outBuff, outBuffPosn); b4Posn = 0; - + // if that was the padding char, break out of 'for' loop if (sbiCrop == PADDING_CHAR) { break; @@ -414,15 +387,15 @@ public class Base64 { } // end if: equals sign or better } // end if: white space, equals sign or better else { - //discard - } + // discard + } } // each input character - + byte[] out = new byte[outBuffPosn]; - System.arraycopy(outBuff, 0, out, 0, outBuffPosn); + System.arraycopy(outBuff, 0, out, 0, outBuffPosn); return out; } - + /** * Decodes data from Base64 notation. * @param source the source data @@ -431,14 +404,13 @@ public class Base64 { public final byte[] decode(byte[] source) { return decode(source, 0, source.length); } - + /** - * Decodes data from Base64 notation. Uses the platform default - * character set to obtain bytes from given string. + * Decodes data from Base64 notation. Uses the platform default character set to obtain bytes from given string. * @param s the string to decode * @return the decoded data */ - public final byte[] decodeFromString(String s) { + public final byte[] decodeFromString(String s) { return decode(s.getBytes()); - } + } } diff --git a/spring-webflow/src/main/java/org/springframework/webflow/util/DispatchMethodInvoker.java b/spring-webflow/src/main/java/org/springframework/webflow/util/DispatchMethodInvoker.java index bd6bd924..d1f58b74 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/util/DispatchMethodInvoker.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/util/DispatchMethodInvoker.java @@ -26,9 +26,8 @@ import org.springframework.util.Assert; import org.springframework.util.CachingMapDecorator; /** - * Invoker and cache for dispatch methods that all share the same target object. - * The dispatch methods typically share the same form, but multiple exist per - * target object, and they only differ in name. + * Invoker and cache for dispatch methods that all share the same target object. The dispatch methods typically share + * the same form, but multiple exist per target object, and they only differ in name. * * @author Keith Donald * @author Ben Hale @@ -50,11 +49,10 @@ public class DispatchMethodInvoker { */ private Map methodCache = new CachingMapDecorator() { public Object create(Object key) { - String methodName = (String)key; + String methodName = (String) key; try { return new MethodKey(target.getClass(), methodName, parameterTypes).getMethod(); - } - catch (InvalidMethodKeyException e) { + } catch (InvalidMethodKeyException e) { throw new MethodLookupException("Unable to resolve dispatch method " + e.getMethodKey() + "'; make sure the method name is correct and such a method is defined on targetClass " + target.getClass().getName(), e); @@ -65,8 +63,7 @@ public class DispatchMethodInvoker { /** * Creates a dispatch method invoker. * @param target the target to dispatch to - * @param parameterTypes the parameter types defining the argument signature - * of the dispatch methods + * @param parameterTypes the parameter types defining the argument signature of the dispatch methods */ public DispatchMethodInvoker(Object target, Class[] parameterTypes) { Assert.notNull(target, "The target of a dispatch method invocation is required"); @@ -82,8 +79,7 @@ public class DispatchMethodInvoker { } /** - * Returns the parameter types defining the argument signature of the - * dispatch methods. + * Returns the parameter types defining the argument signature of the dispatch methods. */ public Class[] getParameterTypes() { return parameterTypes; @@ -101,28 +97,26 @@ public class DispatchMethodInvoker { try { Method dispatchMethod = getDispatchMethod(methodName); return dispatchMethod.invoke(target, arguments); - } - catch (InvocationTargetException e) { + } catch (InvocationTargetException e) { // the invoked method threw an exception; have it propagate to the caller Throwable t = e.getTargetException(); if (t instanceof Exception) { - throw (Exception)e.getTargetException(); - } - else { - throw (Error)e.getTargetException(); + throw (Exception) e.getTargetException(); + } else { + throw (Error) e.getTargetException(); } } } /** - * Get a handle to the method of the specified name, with the signature - * defined by the configured parameter types and return type. + * Get a handle to the method of the specified name, with the signature defined by the configured parameter types + * and return type. * @param methodName the method name * @return the method * @throws MethodLookupException when the method cannot be resolved */ private Method getDispatchMethod(String methodName) throws MethodLookupException { - return (Method)methodCache.get(methodName); + return (Method) methodCache.get(methodName); } /** diff --git a/spring-webflow/src/main/java/org/springframework/webflow/util/RandomGuid.java b/spring-webflow/src/main/java/org/springframework/webflow/util/RandomGuid.java index 67eec201..876a7570 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/util/RandomGuid.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/util/RandomGuid.java @@ -17,20 +17,14 @@ package org.springframework.webflow.util; /* * RandomGUID from http://www.javaexchange.com/aboutRandomGUID.html - * @version 1.2.1 11/05/02 - * @author Marc A. Mnich - * + * @version 1.2.1 11/05/02 @author Marc A. Mnich + * * From www.JavaExchange.com, Open Software licensing - * - * 11/05/02 -- Performance enhancement from Mike Dubman. - * Moved InetAddr.getLocal to static block. Mike has measured - * a 10 fold improvement in run time. - * 01/29/02 -- Bug fix: Improper seeding of nonsecure Random object - * caused duplicate GUIDs to be produced. Random object - * is now only created once per JVM. - * 01/19/02 -- Modified random seeding and added new constructor - * to allow secure random feature. - * 01/14/02 -- Added random function seeding with JVM run time + * + * 11/05/02 -- Performance enhancement from Mike Dubman. Moved InetAddr.getLocal to static block. Mike has measured a 10 + * fold improvement in run time. 01/29/02 -- Bug fix: Improper seeding of nonsecure Random object caused duplicate GUIDs + * to be produced. Random object is now only created once per JVM. 01/19/02 -- Modified random seeding and added new + * constructor to allow secure random feature. 01/14/02 -- Added random function seeding with JVM run time */ import java.net.InetAddress; @@ -43,62 +37,48 @@ import java.util.Random; /** * Globally unique identifier generator. *

    - * In the multitude of java GUID generators, I found none that guaranteed - * randomness. GUIDs are guaranteed to be globally unique by using ethernet - * MACs, IP addresses, time elements, and sequential numbers. GUIDs are not - * expected to be random and most often are easy/possible to guess given a - * sample from a given generator. SQL Server, for example generates GUID that - * are unique but sequencial within a given instance. + * In the multitude of java GUID generators, I found none that guaranteed randomness. GUIDs are guaranteed to be + * globally unique by using ethernet MACs, IP addresses, time elements, and sequential numbers. GUIDs are not expected + * to be random and most often are easy/possible to guess given a sample from a given generator. SQL Server, for example + * generates GUID that are unique but sequencial within a given instance. *

    - * GUIDs can be used as security devices to hide things such as files within a - * filesystem where listings are unavailable (e.g. files that are served up from - * a Web server with indexing turned off). This may be desireable in cases where - * standard authentication is not appropriate. In this scenario, the RandomGuids - * are used as directories. Another example is the use of GUIDs for primary keys - * in a database where you want to ensure that the keys are secret. Random GUIDs - * can then be used in a URL to prevent hackers (or users) from accessing - * records by guessing or simply by incrementing sequential numbers. + * GUIDs can be used as security devices to hide things such as files within a filesystem where listings are unavailable + * (e.g. files that are served up from a Web server with indexing turned off). This may be desireable in cases where + * standard authentication is not appropriate. In this scenario, the RandomGuids are used as directories. Another + * example is the use of GUIDs for primary keys in a database where you want to ensure that the keys are secret. Random + * GUIDs can then be used in a URL to prevent hackers (or users) from accessing records by guessing or simply by + * incrementing sequential numbers. *

    - * There are many other possiblities of using GUIDs in the realm of security and - * encryption where the element of randomness is important. This class was - * written for these purposes but can also be used as a general purpose GUID + * There are many other possiblities of using GUIDs in the realm of security and encryption where the element of + * randomness is important. This class was written for these purposes but can also be used as a general purpose GUID * generator as well. *

    - * RandomGuid generates truly random GUIDs by using the system's IP address - * (name/IP), system time in milliseconds (as an integer), and a very large - * random number joined together in a single String that is passed through an - * MD5 hash. The IP address and system time make the MD5 seed globally unique - * and the random number guarantees that the generated GUIDs will have no - * discernable pattern and cannot be guessed given any number of previously - * generated GUIDs. It is generally not possible to access the seed information - * (IP, time, random number) from the resulting GUIDs as the MD5 hash algorithm - * provides one way encryption. + * RandomGuid generates truly random GUIDs by using the system's IP address (name/IP), system time in milliseconds (as + * an integer), and a very large random number joined together in a single String that is passed through an MD5 hash. + * The IP address and system time make the MD5 seed globally unique and the random number guarantees that the generated + * GUIDs will have no discernable pattern and cannot be guessed given any number of previously generated GUIDs. It is + * generally not possible to access the seed information (IP, time, random number) from the resulting GUIDs as the MD5 + * hash algorithm provides one way encryption. *

    - * Security of RandomGuid: RandomGuid can be called one of two ways -- - * with the basic java Random number generator or a cryptographically strong - * random generator (SecureRandom). The choice is offered because the secure - * random generator takes about 3.5 times longer to generate its random numbers - * and this performance hit may not be worth the added security especially - * considering the basic generator is seeded with a cryptographically strong - * random seed. + * Security of RandomGuid: RandomGuid can be called one of two ways -- with the basic java Random number + * generator or a cryptographically strong random generator (SecureRandom). The choice is offered because the secure + * random generator takes about 3.5 times longer to generate its random numbers and this performance hit may not be + * worth the added security especially considering the basic generator is seeded with a cryptographically strong random + * seed. *

    - * Seeding the basic generator in this way effectively decouples the random - * numbers from the time component making it virtually impossible to predict the - * random number component even if one had absolute knowledge of the System - * time. Thanks to Ashutosh Narhari for the suggestion of using the static - * method to prime the basic random generator. + * Seeding the basic generator in this way effectively decouples the random numbers from the time component making it + * virtually impossible to predict the random number component even if one had absolute knowledge of the System time. + * Thanks to Ashutosh Narhari for the suggestion of using the static method to prime the basic random generator. *

    - * Using the secure random option, this class complies with the statistical - * random number generator tests specified in FIPS 140-2, Security Requirements - * for Cryptographic Modules, secition 4.9.1. + * Using the secure random option, this class complies with the statistical random number generator tests specified in + * FIPS 140-2, Security Requirements for Cryptographic Modules, secition 4.9.1. *

    - * I converted all the pieces of the seed to a String before handing it over to - * the MD5 hash so that you could print it out to make sure it contains the data - * you expect to see and to give a nice warm fuzzy. If you need better + * I converted all the pieces of the seed to a String before handing it over to the MD5 hash so that you could print it + * out to make sure it contains the data you expect to see and to give a nice warm fuzzy. If you need better * performance, you may want to stick to byte[] arrays. *

    - * I believe that it is important that the algorithm for generating random GUIDs - * be open for inspection and modification. This class is free for all uses. + * I believe that it is important that the algorithm for generating random GUIDs be open for inspection and + * modification. This class is free for all uses. * * @version 1.2.1 11/05/02 * @author Marc A. Mnich @@ -114,10 +94,9 @@ public class RandomGuid { private String guid; /* - * Static block to take care of one time secureRandom seed. It takes a few - * seconds to initialize SecureRandom. You might want to consider removing - * this static block or replacing it with a "time since first loaded" seed - * to reduce this time. This block will run only once per JVM instance. + * Static block to take care of one time secureRandom seed. It takes a few seconds to initialize SecureRandom. You + * might want to consider removing this static block or replacing it with a "time since first loaded" seed to reduce + * this time. This block will run only once per JVM instance. */ static { secureRandom = new SecureRandom(); @@ -125,25 +104,23 @@ public class RandomGuid { random = new Random(secureInitializer); try { id = InetAddress.getLocalHost().toString(); - } - catch (UnknownHostException e) { + } catch (UnknownHostException e) { throw new RuntimeException(e); } } /** - * Default constructor. With no specification of security option, this - * constructor defaults to lower security, high performance. + * Default constructor. With no specification of security option, this constructor defaults to lower security, high + * performance. */ public RandomGuid() { getRandomGuid(false); } /** - * Constructor with security option. Setting secure true enables each random - * number generated to be cryptographically strong. Secure false defaults to - * the standard Random function seeded with a single cryptographically - * strong random number. + * Constructor with security option. Setting secure true enables each random number generated to be + * cryptographically strong. Secure false defaults to the standard Random function seeded with a single + * cryptographically strong random number. */ public RandomGuid(boolean secure) { getRandomGuid(secure); @@ -158,8 +135,7 @@ public class RandomGuid { try { md5 = MessageDigest.getInstance("MD5"); - } - catch (NoSuchAlgorithmException e) { + } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } @@ -168,8 +144,7 @@ public class RandomGuid { if (secure) { rand = secureRandom.nextLong(); - } - else { + } else { rand = random.nextLong(); } @@ -200,9 +175,8 @@ public class RandomGuid { } /** - * Convert to the standard format for GUID (Useful for SQL Server - * UniqueIdentifiers, etc). - * Example: "C2FEEEAC-CFCD-11D1-8B05-00600806D9B6". + * Convert to the standard format for GUID (Useful for SQL Server UniqueIdentifiers, etc). Example: + * "C2FEEEAC-CFCD-11D1-8B05-00600806D9B6". */ public String toString() { String raw = guid.toUpperCase(); diff --git a/spring-webflow/src/main/java/org/springframework/webflow/util/RandomGuidUidGenerator.java b/spring-webflow/src/main/java/org/springframework/webflow/util/RandomGuidUidGenerator.java index 08cc18f4..3846880b 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/util/RandomGuidUidGenerator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/util/RandomGuidUidGenerator.java @@ -18,8 +18,7 @@ package org.springframework.webflow.util; import java.io.Serializable; /** - * A key generator that uses the RandomGuid support class. The default - * implementation used by the webflow system. + * A key generator that uses the RandomGuid support class. The default implementation used by the webflow system. * * @author Keith Donald */ @@ -31,17 +30,15 @@ public class RandomGuidUidGenerator implements UidGenerator, Serializable { private boolean secure; /** - * Returns whether or not the generated random numbers are - * secure, meaning cryptographically strong. + * Returns whether or not the generated random numbers are secure, meaning cryptographically strong. */ public boolean isSecure() { return secure; } /** - * Sets whether or not the generated random numbers should be - * secure. If set to true, generated GUIDs are cryptographically - * strong. + * Sets whether or not the generated random numbers should be secure. If set to true, generated GUIDs are + * cryptographically strong. */ public void setSecure(boolean secure) { this.secure = secure; diff --git a/spring-webflow/src/main/java/org/springframework/webflow/util/ReflectionUtils.java b/spring-webflow/src/main/java/org/springframework/webflow/util/ReflectionUtils.java index cd64db7a..0cf57818 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/util/ReflectionUtils.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/util/ReflectionUtils.java @@ -19,60 +19,54 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; /** - * Simple utility class for working with the java reflection API. Only intended for - * internal use. Will likely disappear in a future release of Spring Web Flow and - * simply rely on {@link org.springframework.util.ReflectionUtils} if necessary. + * Simple utility class for working with the java reflection API. Only intended for internal use. Will likely disappear + * in a future release of Spring Web Flow and simply rely on {@link org.springframework.util.ReflectionUtils} if + * necessary. * * @author Keith Donald */ public class ReflectionUtils { /** - * Invoke the specified {@link Method} against the supplied target object - * with no arguments. The target object can be null when - * invoking a static {@link Method}. All exceptions are treated as fatal and will be - * converted to unchecked exceptions. + * Invoke the specified {@link Method} against the supplied target object with no arguments. The target object can + * be null when invoking a static {@link Method}. All exceptions are treated as fatal and will be + * converted to unchecked exceptions. * @see #invokeMethod(java.lang.reflect.Method, Object, Object[]) - * @throws RuntimeException when something goes wrong invoking the method or - * when the method itself throws an exception + * @throws RuntimeException when something goes wrong invoking the method or when the method itself throws an + * exception */ public static Object invokeMethod(Method method, Object target) throws RuntimeException { return invokeMethod(method, target, null); } /** - * Invoke the specified {@link Method} against the supplied target object - * with the supplied arguments. The target object can be null when invoking a - * static {@link Method}. All exceptions are treated as fatal and will be - * converted to unchecked exceptions. + * Invoke the specified {@link Method} against the supplied target object with the supplied arguments. The target + * object can be null when invoking a static {@link Method}. All exceptions are treated as fatal and will be + * converted to unchecked exceptions. * @see #invokeMethod(java.lang.reflect.Method, Object, Object[]) - * @throws RuntimeException when something goes wrong invoking the method or - * when the method itself throws an exception + * @throws RuntimeException when something goes wrong invoking the method or when the method itself throws an + * exception */ public static Object invokeMethod(Method method, Object target, Object[] args) throws RuntimeException { try { return method.invoke(target, args); - } - catch (IllegalAccessException ex) { + } catch (IllegalAccessException ex) { handleReflectionException(ex); throw new IllegalStateException("Unexpected reflection exception - " + ex.getClass().getName() + ": " + ex.getMessage()); - } - catch (InvocationTargetException ex) { + } catch (InvocationTargetException ex) { handleReflectionException(ex); throw new IllegalStateException("Unexpected reflection exception - " + ex.getClass().getName() + ": " + ex.getMessage()); } } - + /** - * Handle the given reflection exception. - * Should only be called if no checked exception is expected to - * be thrown by the target method. + * Handle the given reflection exception. Should only be called if no checked exception is expected to be thrown by + * the target method. *

    - * Throws the underlying RuntimeException or Error in case - * of an InvocationTargetException with such a root cause. Throws - * an IllegalStateException with an appropriate message else. + * Throws the underlying RuntimeException or Error in case of an InvocationTargetException with such a root cause. + * Throws an IllegalStateException with an appropriate message else. * @param ex the reflection exception to handle */ private static void handleReflectionException(Exception ex) { @@ -85,17 +79,16 @@ public class ReflectionUtils { if (ex instanceof InvocationTargetException) { handleInvocationTargetException((InvocationTargetException) ex); } - throw new IllegalStateException( - "Unexpected reflection exception - " + ex.getClass().getName() + ": " + ex.getMessage()); + throw new IllegalStateException("Unexpected reflection exception - " + ex.getClass().getName() + ": " + + ex.getMessage()); } - + /** - * Handle the given invocation target exception. - * Should only be called if no checked exception is expected to - * be thrown by the target method. + * Handle the given invocation target exception. Should only be called if no checked exception is expected to be + * thrown by the target method. *

    - * Throws the underlying RuntimeException or Error in case - * of such a root cause. Throws an IllegalStateException else. + * Throws the underlying RuntimeException or Error in case of such a root cause. Throws an IllegalStateException + * else. * @param ex the invocation target exception to handle */ private static void handleInvocationTargetException(InvocationTargetException ex) { @@ -105,8 +98,7 @@ public class ReflectionUtils { if (ex.getTargetException() instanceof Error) { throw (Error) ex.getTargetException(); } - throw new IllegalStateException( - "Unexpected exception thrown by method - " + ex.getTargetException().getClass().getName() + - ": " + ex.getTargetException().getMessage()); + throw new IllegalStateException("Unexpected exception thrown by method - " + + ex.getTargetException().getClass().getName() + ": " + ex.getTargetException().getMessage()); } } \ No newline at end of file diff --git a/spring-webflow/src/main/java/org/springframework/webflow/util/ResourceHolder.java b/spring-webflow/src/main/java/org/springframework/webflow/util/ResourceHolder.java index 3fdffe52..f404a6c3 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/util/ResourceHolder.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/util/ResourceHolder.java @@ -18,9 +18,8 @@ package org.springframework.webflow.util; import org.springframework.core.io.Resource; /** - * Simple interface for all objects (typically flow builders) that hold on to a - * resource defining a flow (e.g. an XML file). Provides a way to access - * information about the underlying resource like the last modified date. + * Simple interface for all objects (typically flow builders) that hold on to a resource defining a flow (e.g. an XML + * file). Provides a way to access information about the underlying resource like the last modified date. * * @see org.springframework.webflow.engine.builder.FlowBuilder * diff --git a/spring-webflow/src/main/java/org/springframework/webflow/util/UidGenerator.java b/spring-webflow/src/main/java/org/springframework/webflow/util/UidGenerator.java index d26e0a5b..e9897134 100644 --- a/spring-webflow/src/main/java/org/springframework/webflow/util/UidGenerator.java +++ b/spring-webflow/src/main/java/org/springframework/webflow/util/UidGenerator.java @@ -18,8 +18,8 @@ package org.springframework.webflow.util; import java.io.Serializable; /** - * A strategy for generating ids for uniquely identifying execution artifacts - * such as FlowExecutions and any other uniquely identified flow artifact. + * A strategy for generating ids for uniquely identifying execution artifacts such as FlowExecutions and any other + * uniquely identified flow artifact. * * @author Keith Donald */ diff --git a/spring-webflow/src/test/java/org/springframework/webflow/TestBean.java b/spring-webflow/src/test/java/org/springframework/webflow/TestBean.java index d0c70875..a69964fd 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/TestBean.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/TestBean.java @@ -18,11 +18,10 @@ package org.springframework.webflow; import java.io.Serializable; /** - * Simple test bean used by some test cases. - * Note that this bean has value semantics. + * Simple test bean used by some test cases. Note that this bean has value semantics. */ public class TestBean implements Serializable { - + public String datum1 = ""; public int datum2; @@ -61,11 +60,11 @@ public class TestBean implements Serializable { if (!(obj instanceof TestBean)) { return false; } - TestBean other = (TestBean)obj; + TestBean other = (TestBean) obj; return datum1.equals(other.datum1) && datum2 == other.datum2 && executed == other.executed; } public int hashCode() { - return (datum1.hashCode() + datum2 + (executed ? 1:0)) * 29; - } + return (datum1.hashCode() + datum2 + (executed ? 1 : 0)) * 29; + } } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/TestBeanWithMap.java b/spring-webflow/src/test/java/org/springframework/webflow/TestBeanWithMap.java index 2c54cade..2a3b35db 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/TestBeanWithMap.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/TestBeanWithMap.java @@ -23,9 +23,9 @@ import java.util.Map; * Simple test bean with a Map property. */ public class TestBeanWithMap implements Serializable { - + private Map map = new HashMap(); - + public Map getMap() { return map; } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/UnitTestTemplate.java b/spring-webflow/src/test/java/org/springframework/webflow/UnitTestTemplate.java index 98808b58..2ddcd403 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/UnitTestTemplate.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/UnitTestTemplate.java @@ -18,8 +18,8 @@ package org.springframework.webflow; import junit.framework.TestCase; /** - * Keith likes to have these little cut & paste examples in the source - * repositories. If only he knew the power of code templates in Eclipse... + * Keith likes to have these little cut & paste examples in the source repositories. If only he knew the power of code + * templates in Eclipse... */ public class UnitTestTemplate extends TestCase { diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/AbstractActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/AbstractActionTests.java index 873f5712..da8259cb 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/AbstractActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/AbstractActionTests.java @@ -44,8 +44,7 @@ public class AbstractActionTests extends TestCase { try { action.afterPropertiesSet(); fail("Should've failed initialization"); - } - catch (BeanInitializationException e) { + } catch (BeanInitializationException e) { assertFalse(action.initialized); } } @@ -65,8 +64,7 @@ public class AbstractActionTests extends TestCase { try { action.execute(new MockRequestContext()); fail("Should've failed execute"); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/AttributeMapperActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/AttributeMapperActionTests.java index b1f71577..87eb6b6e 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/AttributeMapperActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/AttributeMapperActionTests.java @@ -29,8 +29,7 @@ import org.springframework.webflow.test.MockRequestContext; */ public class AttributeMapperActionTests extends TestCase { - private MappingBuilder mappingBuilder = new MappingBuilder(DefaultExpressionParserFactory - .getExpressionParser()); + private MappingBuilder mappingBuilder = new MappingBuilder(DefaultExpressionParserFactory.getExpressionParser()); public void testMapping() throws Exception { DefaultAttributeMapper mapper = new DefaultAttributeMapper(); @@ -48,14 +47,13 @@ public class AttributeMapperActionTests extends TestCase { assertEquals(1, context.getFlowScope().size()); assertEquals("value", context.getFlowScope().get("bar")); } - + public void testNullIllegalArgument() { try { new AttributeMapperAction(null); fail("Should've thrown illegal argument"); - } - catch (IllegalArgumentException e) { - + } catch (IllegalArgumentException e) { + } } } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/CompositeActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/CompositeActionTests.java index aa0e62a1..cd9b7f72 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/CompositeActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/CompositeActionTests.java @@ -37,7 +37,7 @@ public class CompositeActionTests extends TestCase { protected void setUp() throws Exception { super.setUp(); - actionMock = (Action)EasyMock.createMock(Action.class); + actionMock = (Action) EasyMock.createMock(Action.class); Action[] actions = new Action[] { actionMock }; tested = new CompositeAction(actions); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/EvaluateActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/EvaluateActionTests.java index 676ff47d..04033755 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/EvaluateActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/EvaluateActionTests.java @@ -52,7 +52,7 @@ public class EvaluateActionTests extends TestCase { assertEquals("bar", result.getId()); assertEquals("bar", context.getFlowScope().get("baz")); } - + public void testBeanResult() throws Exception { EvaluateAction action = new EvaluateAction(parser.parseExpression("flowScope.bean"), new ActionResultExposer( "baz", ScopeType.FLOW)); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionBindingTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionBindingTests.java index e31398ae..df2c3842 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionBindingTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionBindingTests.java @@ -69,7 +69,7 @@ public class FormActionBindingTests extends TestCase { assertEquals(0, formActionErrors.getGlobalErrorCount()); assertEquals(1, formActionErrors.getFieldErrorCount("prop")); } - + public void testFieldBinding() throws Exception { FormAction formAction = new FormAction() { protected Object createFormObject(RequestContext context) throws Exception { @@ -78,31 +78,30 @@ public class FormActionBindingTests extends TestCase { res.otherProp = "initialValue"; return res; } - + protected void initBinder(RequestContext context, DataBinder binder) { binder.initDirectFieldAccess(); } }; formAction.setFormObjectName("formObject"); - + MockRequestContext context = new MockRequestContext(); - + context.setAttribute("method", "setupForm"); formAction.execute(context); Errors errors = new FormObjectAccessor(context).getFormErrors("formObject", ScopeType.FLASH); assertNotNull(errors); assertEquals(new Long(-1), errors.getFieldValue("prop")); - - //this fails because of SWF-193 + + // this fails because of SWF-193 assertEquals("initialValue", errors.getFieldValue("otherProp")); - + context.putRequestParameter("prop", "1"); context.putRequestParameter("otherProp", "value"); context.setAttribute("method", "bind"); formAction.execute(context); - - TestBean formObject = (TestBean) - new FormObjectAccessor(context).getFormObject("formObject", ScopeType.FLOW); + + TestBean formObject = (TestBean) new FormObjectAccessor(context).getFormObject("formObject", ScopeType.FLOW); errors = new FormObjectAccessor(context).getFormErrors("formObject", ScopeType.FLASH); assertNotNull(formObject); assertEquals(new Long(1), formObject.getProp()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java index d12d5e0c..570aa82b 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/FormActionTests.java @@ -71,7 +71,7 @@ public class FormActionTests extends TestCase { public static class TestBeanValidator implements Validator { private boolean invoked; - + public boolean supports(Class clazz) { return TestBean.class.equals(clazz); } @@ -120,7 +120,6 @@ public class FormActionTests extends TestCase { return map; } - public void testSetupFormWithExistingFormObject() throws Exception { MockRequestContext context = new MockRequestContext(parameters()); @@ -276,13 +275,13 @@ public class FormActionTests extends TestCase { public void testGetFormObject() throws Exception { MockRequestContext context = new MockRequestContext(parameters()); FormAction action = createFormAction("test"); - TestBean formObject = (TestBean)action.getFormObject(context); + TestBean formObject = (TestBean) action.getFormObject(context); assertNotNull(formObject); formObject = new TestBean(); TestBean testBean = formObject; new FormObjectAccessor(context).putFormObject(formObject, action.getFormObjectName(), action .getFormObjectScope()); - formObject = (TestBean)action.getFormObject(context); + formObject = (TestBean) action.getFormObject(context); assertSame(formObject, testBean); } @@ -335,7 +334,7 @@ public class FormActionTests extends TestCase { assertEquals(action.getEventFactorySupport().getSuccessEventId(), action.setupForm(context).getId()); Object formObject = getFormObject(context); - BindException errors = (BindException)getErrors(context); + BindException errors = (BindException) getErrors(context); assertTrue(formObject instanceof TestBean); assertTrue(errors.getTarget() instanceof TestBean); @@ -354,7 +353,7 @@ public class FormActionTests extends TestCase { assertEquals(action.getEventFactorySupport().getSuccessEventId(), otherAction.setupForm(context).getId()); formObject = context.getFlowScope().get("test"); - errors = (BindException)getErrors(context); + errors = (BindException) getErrors(context); assertTrue(formObject instanceof OtherTestBean); assertSame(freshBean, formObject); @@ -368,13 +367,13 @@ public class FormActionTests extends TestCase { FormAction action1 = createFormAction("test1"); action1.setupForm(context); - TestBean test1 = (TestBean)context.getFlowScope().get("test1"); + TestBean test1 = (TestBean) context.getFlowScope().get("test1"); assertNotNull(test1); assertSame(test1, new FormObjectAccessor(context).getCurrentFormObject()); FormAction action2 = createFormAction("test2"); action2.setupForm(context); - TestBean test2 = (TestBean)context.getFlowScope().get("test2"); + TestBean test2 = (TestBean) context.getFlowScope().get("test2"); assertNotNull(test2); assertSame(test2, new FormObjectAccessor(context).getCurrentFormObject()); @@ -382,7 +381,7 @@ public class FormActionTests extends TestCase { parameters.put("prop", "12345"); context.setExternalContext(new MockExternalContext(parameters)); action1.bindAndValidate(context); - TestBean test11 = (TestBean)context.getFlowScope().get("test1"); + TestBean test11 = (TestBean) context.getFlowScope().get("test1"); assertSame(test1, test11); assertEquals("12345", test1.getProp()); assertSame(test1, new FormObjectAccessor(context).getCurrentFormObject()); @@ -391,7 +390,7 @@ public class FormActionTests extends TestCase { parameters.put("prop", "123456"); context.setExternalContext(new MockExternalContext(parameters)); action2.bindAndValidate(context); - TestBean test22 = (TestBean)context.getFlowScope().get("test2"); + TestBean test22 = (TestBean) context.getFlowScope().get("test2"); assertSame(test22, test2); assertEquals("123456", test2.getProp()); assertSame(test2, new FormObjectAccessor(context).getCurrentFormObject()); @@ -414,7 +413,7 @@ public class FormActionTests extends TestCase { assertSame(testBean, getFormObject(context)); assertEquals("bla", getFormObject(context).getProp()); assertNotNull(getErrors(context)); - assertSame(testBean, ((BindException)getErrors(context)).getTarget()); + assertSame(testBean, ((BindException) getErrors(context)).getTarget()); assertFalse(getErrors(context).hasErrors()); } @@ -431,7 +430,7 @@ public class FormActionTests extends TestCase { result = action.bindAndValidate(context); assertEquals("success", result.getId()); assertSame(formObject, action.getFormObject(context)); - assertEquals(true, ((TestBeanValidator)action.getValidator()).invoked); + assertEquals(true, ((TestBeanValidator) action.getValidator()).invoked); } public void testFormActionWithValidatorAndNoFormActionClass() throws Exception { @@ -447,12 +446,12 @@ public class FormActionTests extends TestCase { Event result = action.setupForm(context); assertEquals("success", result.getId()); - + context.putRequestParameter("prop", "foo"); context.getAttributeMap().put("validatorMethod", "validateTestBean"); result = action.bindAndValidate(context); } - + // helpers private FormAction createFormAction(String formObjectName) { @@ -479,6 +478,6 @@ public class FormActionTests extends TestCase { } private TestBean getFormObject(RequestContext context, String formObjectName) { - return (TestBean)context.getFlowScope().get(formObjectName); + return (TestBean) context.getFlowScope().get(formObjectName); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/LocalBeanInvokingActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/LocalBeanInvokingActionTests.java index b42ed23a..9f099a7e 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/LocalBeanInvokingActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/LocalBeanInvokingActionTests.java @@ -54,8 +54,7 @@ public class LocalBeanInvokingActionTests extends TestCase { try { action = new LocalBeanInvokingAction(new MethodSignature("execute"), null); fail("Should've failed with iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/MultiActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/MultiActionTests.java index 1c447c70..e7dfb917 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/MultiActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/MultiActionTests.java @@ -29,7 +29,7 @@ import org.springframework.webflow.util.DispatchMethodInvoker.MethodLookupExcept * Unit tests for {@link MultiAction}. */ public class MultiActionTests extends TestCase { - + private TestMultiAction action = new TestMultiAction(); private MockRequestContext context = new MockRequestContext(); @@ -45,8 +45,7 @@ public class MultiActionTests extends TestCase { try { action.execute(context); fail("Should've failed with no such method"); - } - catch (MethodLookupException e) { + } catch (MethodLookupException e) { } } @@ -62,8 +61,7 @@ public class MultiActionTests extends TestCase { try { action.execute(context); fail("Should've failed with no such method"); - } - catch (MethodLookupException e) { + } catch (MethodLookupException e) { } } @@ -73,8 +71,7 @@ public class MultiActionTests extends TestCase { context.getMockFlowExecutionContext().getMockActiveSession().setState(null); action.execute(context); fail("Should've failed with illegal state"); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectBasedEventFactoryTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectBasedEventFactoryTests.java index 254fbcc0..4b35bf93 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectBasedEventFactoryTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/ResultObjectBasedEventFactoryTests.java @@ -29,21 +29,21 @@ import org.springframework.webflow.test.MockRequestContext; * @author Erwin Vervaet */ public class ResultObjectBasedEventFactoryTests extends TestCase { - + private ResultObjectBasedEventFactory factory = new ResultObjectBasedEventFactory(); - + public void testNull() { Event event = factory.createResultEvent(this, null, new MockRequestContext()); assertEquals(factory.getNullEventId(), event.getId()); } - + public void testBoolean() { Event event = factory.createResultEvent(this, Boolean.TRUE, new MockRequestContext()); assertEquals(factory.getYesEventId(), event.getId()); event = factory.createResultEvent(this, Boolean.FALSE, new MockRequestContext()); assertEquals(factory.getNoEventId(), event.getId()); } - + public void testLabeledEnum() { Event event = factory.createResultEvent(this, MyLabeledEnum.A, new MockRequestContext()); assertEquals("A", event.getId()); @@ -53,50 +53,41 @@ public class ResultObjectBasedEventFactoryTests extends TestCase { public static class MyLabeledEnum extends StaticLabeledEnum { public static final MyLabeledEnum A = new MyLabeledEnum(0, "A"); public static final MyLabeledEnum B = new MyLabeledEnum(0, "B"); - + private MyLabeledEnum(int code, String label) { super(code, label); } - + public String toString() { return "MyLabeledEnum " + getLabel(); } } -/* - public void testJava5Enum() { - Event event = factory.createResultEvent(this, MyEnum.A, new MockRequestContext()); - assertEquals("A", event.getId()); - assertSame(MyEnum.A, event.getAttributes().get("result")); - } + /* + * public void testJava5Enum() { Event event = factory.createResultEvent(this, MyEnum.A, new MockRequestContext()); + * assertEquals("A", event.getId()); assertSame(MyEnum.A, event.getAttributes().get("result")); } + * + * public static enum MyEnum { A, B; + * + * public String toString() { return "MyEnum " + name(); } } + */ - public static enum MyEnum { - A, - B; - - public String toString() { - return "MyEnum " + name(); - } - } -*/ - public void testString() { Event event = factory.createResultEvent(this, "foobar", new MockRequestContext()); assertEquals("foobar", event.getId()); } - + public void testEvent() { Event orig = new Event(this, "test"); Event event = factory.createResultEvent(this, orig, new MockRequestContext()); assertSame(orig, event); } - + public void testUnsupported() { try { - factory.createResultEvent(this, new Date(), new MockRequestContext()); + factory.createResultEvent(this, new Date(), new MockRequestContext()); fail(); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { // expected } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/SetActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/SetActionTests.java index 4848ef3f..a0a6168d 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/SetActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/SetActionTests.java @@ -31,22 +31,22 @@ import org.springframework.webflow.test.MockRequestContext; * Unit tests for {@link SetAction}. */ public class SetActionTests extends TestCase { - + private ExpressionParser parser = DefaultExpressionParserFactory.getExpressionParser(); private MockRequestContext context = new MockRequestContext(); public void testSetActionWithBooleanValue() throws Exception { context.getFlowScope().put("bean", new TestBean()); - + SettableExpression attr = parser.parseSettableExpression("bean.executed"); Expression value = parser.parseExpression("true"); SetAction action = new SetAction(attr, ScopeType.FLOW, value); Event outcome = action.execute(context); assertEquals("success", outcome.getId()); - assertEquals(true, ((TestBean)context.getFlowScope().get("bean")).executed); + assertEquals(true, ((TestBean) context.getFlowScope().get("bean")).executed); } - + public void testSetActionWithStringValue() throws Exception { SettableExpression attr = parser.parseSettableExpression("backState"); Expression value = parser.parseExpression("'otherState'"); // ${'otherState'} also works @@ -54,13 +54,13 @@ public class SetActionTests extends TestCase { assertEquals("success", action.execute(context).getId()); assertEquals("otherState", context.getFlowScope().get("backState")); } - + public void testSetActionWithValueFromMap() throws Exception { TestBeanWithMap beanWithMap = new TestBeanWithMap(); beanWithMap.getMap().put("key1", "value1"); beanWithMap.getMap().put("key2", "value2"); context.getFlowScope().put("beanWithMap", beanWithMap); - + SettableExpression attr = parser.parseSettableExpression("key"); Expression value = parser.parseExpression("${flowScope.beanWithMap.map['key1']}"); SetAction action = new SetAction(attr, ScopeType.FLASH, value); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/action/portlet/SetPortletModeActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/action/portlet/SetPortletModeActionTests.java index 4415e6ae..7c4950dd 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/action/portlet/SetPortletModeActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/action/portlet/SetPortletModeActionTests.java @@ -49,8 +49,8 @@ public class SetPortletModeActionTests extends TestCase { public void testDoExecute() throws Exception { MockActionResponse mockActionResponse = new MockActionResponse(); - PortletExternalContext externalContext = new PortletExternalContext( - new MockPortletContext(), new MockActionRequest(), mockActionResponse); + PortletExternalContext externalContext = new PortletExternalContext(new MockPortletContext(), + new MockActionRequest(), mockActionResponse); MockRequestContext mockRequestContext = new MockRequestContext(); mockRequestContext.setExternalContext(externalContext); @@ -63,8 +63,8 @@ public class SetPortletModeActionTests extends TestCase { public void testDoExecuteWithPortletModeAsAttribute() throws Exception { MockActionResponse mockActionResponse = new MockActionResponse(); - PortletExternalContext externalContext = new PortletExternalContext( - new MockPortletContext(), new MockActionRequest(), mockActionResponse); + PortletExternalContext externalContext = new PortletExternalContext(new MockPortletContext(), + new MockActionRequest(), mockActionResponse); MockRequestContext mockRequestContext = new MockRequestContext(); mockRequestContext.setExternalContext(externalContext); mockRequestContext.setAttribute(SetPortletModeAction.PORTLET_MODE_ATTRIBUTE, PortletMode.HELP); @@ -78,8 +78,8 @@ public class SetPortletModeActionTests extends TestCase { public void testDoExecuteWithWrongResponseClass() throws Exception { MockRenderResponse mockRenderResponse = new MockRenderResponse(); - PortletExternalContext externalContext = new PortletExternalContext( - new MockPortletContext(), new MockRenderRequest(), mockRenderResponse); + PortletExternalContext externalContext = new PortletExternalContext(new MockPortletContext(), + new MockRenderRequest(), mockRenderResponse); MockRequestContext mockRequestContext = new MockRequestContext(); mockRequestContext.setExternalContext(externalContext); mockRequestContext.setAttribute(SetPortletModeAction.PORTLET_MODE_ATTRIBUTE, PortletMode.HELP); @@ -88,8 +88,7 @@ public class SetPortletModeActionTests extends TestCase { try { tested.doExecute(mockRequestContext); fail("ActionExecutionException expected"); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { // expected } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/config/BeanConfigTests.java b/spring-webflow/src/test/java/org/springframework/webflow/config/BeanConfigTests.java index 59296545..9dc918fc 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/config/BeanConfigTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/config/BeanConfigTests.java @@ -22,27 +22,26 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.webflow.executor.mvc.FlowController; /** - * Test case that illustrates configuration of a FlowController and its - * associated artefacts using classic spring bean configuration information. - * This test case does not really test much but serves more as an example. + * Test case that illustrates configuration of a FlowController and its associated artefacts using classic spring bean + * configuration information. This test case does not really test much but serves more as an example. * * @author Erwin Vervaet */ public class BeanConfigTests extends TestCase { private BeanFactory beanFactory; - + protected void setUp() throws Exception { beanFactory = new ClassPathXmlApplicationContext("webflow-config-classic.xml", BeanConfigTests.class); } - + public void testFlowControllerConfig() { - FlowController flowController = (FlowController)beanFactory.getBean("flowController"); + FlowController flowController = (FlowController) beanFactory.getBean("flowController"); assertEquals("test-flow", flowController.getArgumentHandler().getDefaultFlowId()); } - + public void testFlowControllerBeanConfig() { - FlowController flowController = (FlowController)beanFactory.getBean("flowController-bean"); + FlowController flowController = (FlowController) beanFactory.getBean("flowController-bean"); assertEquals("test-flow", flowController.getArgumentHandler().getDefaultFlowId()); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/config/FlowExecutorFactoryBeanTests.java b/spring-webflow/src/test/java/org/springframework/webflow/config/FlowExecutorFactoryBeanTests.java index 09fefe23..86b40cf4 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/config/FlowExecutorFactoryBeanTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/config/FlowExecutorFactoryBeanTests.java @@ -34,80 +34,77 @@ import org.springframework.webflow.executor.FlowExecutorImpl; * @author Erwin Vervaet */ public class FlowExecutorFactoryBeanTests extends TestCase { - + private ApplicationContext applicationContext; - + protected void setUp() throws Exception { - this.applicationContext = - new ClassPathXmlApplicationContext("flow-executor-factory-bean.xml", BeanConfigTests.class); + this.applicationContext = new ClassPathXmlApplicationContext("flow-executor-factory-bean.xml", + BeanConfigTests.class); } - + public void testSetMaxConversationsAndMaxContinuations() { - FlowExecutorImpl flowExecutor = (FlowExecutorImpl)applicationContext.getBean("flowExecutor0"); + FlowExecutorImpl flowExecutor = (FlowExecutorImpl) applicationContext.getBean("flowExecutor0"); assertTrue(flowExecutor.getExecutionRepository() instanceof ContinuationFlowExecutionRepository); - ContinuationFlowExecutionRepository repo = - (ContinuationFlowExecutionRepository)flowExecutor.getExecutionRepository(); - SessionBindingConversationManager conversationManager = - (SessionBindingConversationManager)repo.getConversationManager(); + ContinuationFlowExecutionRepository repo = (ContinuationFlowExecutionRepository) flowExecutor + .getExecutionRepository(); + SessionBindingConversationManager conversationManager = (SessionBindingConversationManager) repo + .getConversationManager(); assertEquals(1, conversationManager.getMaxConversations()); assertEquals(10, repo.getMaxContinuations()); } - + public void testRepoConfigurationWithDefaultConversationManager() throws Exception { - SimpleFlowExecutionRepository simple = - (SimpleFlowExecutionRepository)setupRepo(RepositoryType.SIMPLE, null); + SimpleFlowExecutionRepository simple = (SimpleFlowExecutionRepository) setupRepo(RepositoryType.SIMPLE, null); assertTrue(simple.getConversationManager() instanceof SessionBindingConversationManager); assertTrue(simple.isAlwaysGenerateNewNextKey()); - - SimpleFlowExecutionRepository singleKey = - (SimpleFlowExecutionRepository)setupRepo(RepositoryType.SINGLEKEY, null); + + SimpleFlowExecutionRepository singleKey = (SimpleFlowExecutionRepository) setupRepo(RepositoryType.SINGLEKEY, + null); assertTrue(singleKey.getConversationManager() instanceof SessionBindingConversationManager); assertFalse(singleKey.isAlwaysGenerateNewNextKey()); - - ContinuationFlowExecutionRepository continuation = - (ContinuationFlowExecutionRepository)setupRepo(RepositoryType.CONTINUATION, null); + + ContinuationFlowExecutionRepository continuation = (ContinuationFlowExecutionRepository) setupRepo( + RepositoryType.CONTINUATION, null); assertTrue(continuation.getConversationManager() instanceof SessionBindingConversationManager); - - ClientContinuationFlowExecutionRepository client = - (ClientContinuationFlowExecutionRepository)setupRepo(RepositoryType.CLIENT, null); - assertFalse( - "Client repo does not use SessionBindingConversationManager by default", - client.getConversationManager() instanceof SessionBindingConversationManager); + + ClientContinuationFlowExecutionRepository client = (ClientContinuationFlowExecutionRepository) setupRepo( + RepositoryType.CLIENT, null); + assertFalse("Client repo does not use SessionBindingConversationManager by default", client + .getConversationManager() instanceof SessionBindingConversationManager); } - + public void testRepoConfiguration() throws Exception { ConversationManager cm = new CustomConversationManager(); - - SimpleFlowExecutionRepository simple = - (SimpleFlowExecutionRepository)setupRepo(RepositoryType.SIMPLE, cm); + + SimpleFlowExecutionRepository simple = (SimpleFlowExecutionRepository) setupRepo(RepositoryType.SIMPLE, cm); assertTrue(simple.getConversationManager() instanceof CustomConversationManager); assertTrue(simple.isAlwaysGenerateNewNextKey()); - - SimpleFlowExecutionRepository singleKey = - (SimpleFlowExecutionRepository)setupRepo(RepositoryType.SINGLEKEY, cm); + + SimpleFlowExecutionRepository singleKey = (SimpleFlowExecutionRepository) setupRepo(RepositoryType.SINGLEKEY, + cm); assertTrue(singleKey.getConversationManager() instanceof CustomConversationManager); assertFalse(singleKey.isAlwaysGenerateNewNextKey()); - - ContinuationFlowExecutionRepository continuation = - (ContinuationFlowExecutionRepository)setupRepo(RepositoryType.CONTINUATION, cm); + + ContinuationFlowExecutionRepository continuation = (ContinuationFlowExecutionRepository) setupRepo( + RepositoryType.CONTINUATION, cm); assertTrue(continuation.getConversationManager() instanceof CustomConversationManager); - - ClientContinuationFlowExecutionRepository client = - (ClientContinuationFlowExecutionRepository)setupRepo(RepositoryType.CLIENT, cm); + + ClientContinuationFlowExecutionRepository client = (ClientContinuationFlowExecutionRepository) setupRepo( + RepositoryType.CLIENT, cm); assertTrue(client.getConversationManager() instanceof CustomConversationManager); } - - private FlowExecutionRepository setupRepo( - RepositoryType repoType, ConversationManager conversationManager) throws Exception { + + private FlowExecutionRepository setupRepo(RepositoryType repoType, ConversationManager conversationManager) + throws Exception { FlowExecutorFactoryBean flowExecutorFactoryBean = new FlowExecutorFactoryBean(); - flowExecutorFactoryBean.setDefinitionLocator( - (FlowDefinitionLocator)applicationContext.getBean("flowRegistry")); + flowExecutorFactoryBean + .setDefinitionLocator((FlowDefinitionLocator) applicationContext.getBean("flowRegistry")); flowExecutorFactoryBean.setRepositoryType(repoType); if (conversationManager != null) { flowExecutorFactoryBean.setConversationManager(conversationManager); } flowExecutorFactoryBean.afterPropertiesSet(); - FlowExecutorImpl flowExecutor = (FlowExecutorImpl)flowExecutorFactoryBean.getObject(); + FlowExecutorImpl flowExecutor = (FlowExecutorImpl) flowExecutorFactoryBean.getObject(); return flowExecutor.getExecutionRepository(); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/config/TestFlowExecutionListenerCriteria.java b/spring-webflow/src/test/java/org/springframework/webflow/config/TestFlowExecutionListenerCriteria.java index 62a8c985..64459d94 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/config/TestFlowExecutionListenerCriteria.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/config/TestFlowExecutionListenerCriteria.java @@ -19,8 +19,7 @@ import org.springframework.webflow.definition.FlowDefinition; import org.springframework.webflow.execution.factory.FlowExecutionListenerCriteria; /** - * Dummy test implementation of a FlowExecutionListenerCriteria. - * Not intended for actual use. + * Dummy test implementation of a FlowExecutionListenerCriteria. Not intended for actual use. * * @author Erwin Vervaet */ diff --git a/spring-webflow/src/test/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandlerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandlerTests.java index 8e36480a..92ebfbad 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandlerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/config/WebFlowConfigNamespaceHandlerTests.java @@ -51,69 +51,70 @@ public class WebFlowConfigNamespaceHandlerTests extends TestCase { super.setUp(); this.beanFactory = new DefaultListableBeanFactory(); XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(this.beanFactory); - reader.loadBeanDefinitions(new ClassPathResource("org/springframework/webflow/config/webflow-config-namespace.xml")); + reader.loadBeanDefinitions(new ClassPathResource( + "org/springframework/webflow/config/webflow-config-namespace.xml")); } public void testRegistryWithPath() { - FlowDefinitionRegistry registry = (FlowDefinitionRegistry)this.beanFactory.getBean("withPath"); + FlowDefinitionRegistry registry = (FlowDefinitionRegistry) this.beanFactory.getBean("withPath"); assertEquals("Incorrect number of flows loaded", 1, registry.getFlowDefinitionCount()); } public void testRegistryWithoutPath() { - FlowDefinitionRegistry registry = (FlowDefinitionRegistry)this.beanFactory.getBean("withoutPath"); + FlowDefinitionRegistry registry = (FlowDefinitionRegistry) this.beanFactory.getBean("withoutPath"); assertEquals("Incorrect number of flows loaded", 0, registry.getFlowDefinitionCount()); } public void testRegistryWithPathWithWildcards() { - FlowDefinitionRegistry registry = (FlowDefinitionRegistry)this.beanFactory.getBean("withPathWithWildcards"); + FlowDefinitionRegistry registry = (FlowDefinitionRegistry) this.beanFactory.getBean("withPathWithWildcards"); assertEquals("Incorrect number of flows loaded", 0, registry.getFlowDefinitionCount()); } public void testDefaultExecutor() { - FlowExecutorImpl flowExecutor = (FlowExecutorImpl)this.beanFactory.getBean("defaultExecutor"); + FlowExecutorImpl flowExecutor = (FlowExecutorImpl) this.beanFactory.getBean("defaultExecutor"); assertTrue(flowExecutor.getExecutionRepository() instanceof ContinuationFlowExecutionRepository); assertSame(this.beanFactory.getBean("withPathWithWildcards"), flowExecutor.getDefinitionLocator()); - AttributeMap attribs = ((FlowExecutionImplFactory)flowExecutor.getExecutionFactory()).getExecutionAttributes(); + AttributeMap attribs = ((FlowExecutionImplFactory) flowExecutor.getExecutionFactory()).getExecutionAttributes(); assertEquals(1, attribs.size()); // defaults have been applied assertEquals(new Boolean(true), attribs.get(ApplicationViewSelector.ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE)); } public void testSimpleExecutor() { - FlowExecutorImpl flowExecutor = (FlowExecutorImpl)this.beanFactory.getBean("simpleExecutor"); + FlowExecutorImpl flowExecutor = (FlowExecutorImpl) this.beanFactory.getBean("simpleExecutor"); assertSame(this.beanFactory.getBean("withPathWithWildcards"), flowExecutor.getDefinitionLocator()); assertTrue(flowExecutor.getExecutionRepository() instanceof SimpleFlowExecutionRepository); - assertTrue(((SimpleFlowExecutionRepository)flowExecutor.getExecutionRepository()).isAlwaysGenerateNewNextKey()); - AttributeMap attribs = ((FlowExecutionImplFactory)flowExecutor.getExecutionFactory()).getExecutionAttributes(); + assertTrue(((SimpleFlowExecutionRepository) flowExecutor.getExecutionRepository()).isAlwaysGenerateNewNextKey()); + AttributeMap attribs = ((FlowExecutionImplFactory) flowExecutor.getExecutionFactory()).getExecutionAttributes(); assertEquals(3, attribs.size()); assertEquals(new Boolean(true), attribs.get(ApplicationViewSelector.ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE)); assertEquals("test", attribs.get("test")); assertEquals(new Integer(1), attribs.get("test1")); - assertSame(StaticFlowExecutionListenerLoader.EMPTY_INSTANCE, - ((FlowExecutionImplFactory)flowExecutor.getExecutionFactory()).getExecutionListenerLoader()); + assertSame(StaticFlowExecutionListenerLoader.EMPTY_INSTANCE, ((FlowExecutionImplFactory) flowExecutor + .getExecutionFactory()).getExecutionListenerLoader()); } public void testContinuationExecutor() { - FlowExecutorImpl flowExecutor = (FlowExecutorImpl)this.beanFactory.getBean("continuationExecutor"); + FlowExecutorImpl flowExecutor = (FlowExecutorImpl) this.beanFactory.getBean("continuationExecutor"); assertSame(this.beanFactory.getBean("withPathWithWildcards"), flowExecutor.getDefinitionLocator()); assertTrue(flowExecutor.getExecutionRepository() instanceof ContinuationFlowExecutionRepository); - AttributeMap attribs = ((FlowExecutionImplFactory)flowExecutor.getExecutionFactory()).getExecutionAttributes(); + AttributeMap attribs = ((FlowExecutionImplFactory) flowExecutor.getExecutionFactory()).getExecutionAttributes(); assertEquals(1, attribs.size()); assertEquals(new Boolean(false), attribs.get(ApplicationViewSelector.ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE)); - ConditionalFlowExecutionListenerLoader ll = (ConditionalFlowExecutionListenerLoader) - ((FlowExecutionImplFactory)flowExecutor.getExecutionFactory()).getExecutionListenerLoader(); + ConditionalFlowExecutionListenerLoader ll = (ConditionalFlowExecutionListenerLoader) ((FlowExecutionImplFactory) flowExecutor + .getExecutionFactory()).getExecutionListenerLoader(); assertEquals(1, ll.getListeners(new Flow("test")).length); assertSame(this.beanFactory.getBean("listener1"), ll.getListeners(new Flow("test"))[0]); } public void testClientExecutor() { - FlowExecutorImpl flowExecutor = (FlowExecutorImpl)this.beanFactory.getBean("clientExecutor"); + FlowExecutorImpl flowExecutor = (FlowExecutorImpl) this.beanFactory.getBean("clientExecutor"); assertSame(this.beanFactory.getBean("withPathWithWildcards"), flowExecutor.getDefinitionLocator()); assertTrue(flowExecutor.getExecutionRepository() instanceof ClientContinuationFlowExecutionRepository); - AttributeMap attribs = ((FlowExecutionImplFactory)flowExecutor.getExecutionFactory()).getExecutionAttributes(); + AttributeMap attribs = ((FlowExecutionImplFactory) flowExecutor.getExecutionFactory()).getExecutionAttributes(); assertEquals(1, attribs.size()); assertEquals(new Boolean(true), attribs.get(ApplicationViewSelector.ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE)); - ConditionalFlowExecutionListenerLoader ll = (ConditionalFlowExecutionListenerLoader) - ((FlowExecutionImplFactory)flowExecutor.getExecutionFactory()).getExecutionListenerLoader(); + ConditionalFlowExecutionListenerLoader ll = (ConditionalFlowExecutionListenerLoader) ((FlowExecutionImplFactory) flowExecutor + .getExecutionFactory()).getExecutionListenerLoader(); assertEquals(2, ll.getListeners(new Flow("flow1")).length); assertSame(this.beanFactory.getBean("listener1"), ll.getListeners(new Flow("flow1"))[0]); assertSame(this.beanFactory.getBean("listener2"), ll.getListeners(new Flow("flow1"))[1]); @@ -124,15 +125,16 @@ public class WebFlowConfigNamespaceHandlerTests extends TestCase { } public void testSingleKeyExecutor() { - FlowExecutorImpl flowExecutor = (FlowExecutorImpl)this.beanFactory.getBean("singleKeyExecutor"); + FlowExecutorImpl flowExecutor = (FlowExecutorImpl) this.beanFactory.getBean("singleKeyExecutor"); assertSame(this.beanFactory.getBean("withPathWithWildcards"), flowExecutor.getDefinitionLocator()); assertTrue(flowExecutor.getExecutionRepository() instanceof SimpleFlowExecutionRepository); - assertFalse(((SimpleFlowExecutionRepository)flowExecutor.getExecutionRepository()).isAlwaysGenerateNewNextKey()); - AttributeMap attribs = ((FlowExecutionImplFactory)flowExecutor.getExecutionFactory()).getExecutionAttributes(); + assertFalse(((SimpleFlowExecutionRepository) flowExecutor.getExecutionRepository()) + .isAlwaysGenerateNewNextKey()); + AttributeMap attribs = ((FlowExecutionImplFactory) flowExecutor.getExecutionFactory()).getExecutionAttributes(); assertEquals(1, attribs.size()); assertEquals(new Boolean(true), attribs.get(ApplicationViewSelector.ALWAYS_REDIRECT_ON_PAUSE_ATTRIBUTE)); - assertSame(StaticFlowExecutionListenerLoader.EMPTY_INSTANCE, - ((FlowExecutionImplFactory)flowExecutor.getExecutionFactory()).getExecutionListenerLoader()); + assertSame(StaticFlowExecutionListenerLoader.EMPTY_INSTANCE, ((FlowExecutionImplFactory) flowExecutor + .getExecutionFactory()).getExecutionListenerLoader()); } public void testDuplicateRepositoryType() { @@ -142,7 +144,7 @@ public class WebFlowConfigNamespaceHandlerTests extends TestCase { reader.setProblemReporter(problemReporter); reader.loadBeanDefinitions(new ClassPathResource("org/springframework/webflow/config/namespace-error-1.xml")); assertNotNull("Should have created an error", problemReporter.getLastProblem()); - assertTrue(problemReporter.getLastProblem().getMessage().contains("repositoryType")); + assertTrue(problemReporter.getLastProblem().getMessage().contains("repositoryType")); } public void testConversationManagerRef() { @@ -152,7 +154,7 @@ public class WebFlowConfigNamespaceHandlerTests extends TestCase { reader.setProblemReporter(problemReporter); reader.loadBeanDefinitions(new ClassPathResource("org/springframework/webflow/config/namespace-error-2.xml")); assertNotNull("Should have created an error", problemReporter.getLastProblem()); - assertTrue(problemReporter.getLastProblem().getMessage().contains("conversation")); + assertTrue(problemReporter.getLastProblem().getMessage().contains("conversation")); } public void testMaxContinuation() { @@ -162,55 +164,62 @@ public class WebFlowConfigNamespaceHandlerTests extends TestCase { reader.setProblemReporter(problemReporter); reader.loadBeanDefinitions(new ClassPathResource("org/springframework/webflow/config/namespace-error-3.xml")); assertNotNull("Should have created an error", problemReporter.getLastProblem()); - assertTrue(problemReporter.getLastProblem().getMessage().contains("continuation")); + assertTrue(problemReporter.getLastProblem().getMessage().contains("continuation")); } public void testContinuationExtended() { FlowExecutorImpl flowExecutor = (FlowExecutorImpl) this.beanFactory.getBean("continuationExtended"); - assertTrue("Repository type should be ContinuationFlowExecutionRepository", flowExecutor.getExecutionRepository() instanceof ContinuationFlowExecutionRepository); + assertTrue("Repository type should be ContinuationFlowExecutionRepository", flowExecutor + .getExecutionRepository() instanceof ContinuationFlowExecutionRepository); } public void testClientExtended() { FlowExecutorImpl flowExecutor = (FlowExecutorImpl) this.beanFactory.getBean("clientExtended"); - assertTrue("Repository type should be ClientContinuationFlowExecutionRepository", flowExecutor.getExecutionRepository() instanceof ClientContinuationFlowExecutionRepository); + assertTrue("Repository type should be ClientContinuationFlowExecutionRepository", flowExecutor + .getExecutionRepository() instanceof ClientContinuationFlowExecutionRepository); } public void testSimpleExtended() { FlowExecutorImpl flowExecutor = (FlowExecutorImpl) this.beanFactory.getBean("simpleExtended"); - assertTrue("Repository type should be SimpleFlowExecutionRepository", flowExecutor.getExecutionRepository() instanceof SimpleFlowExecutionRepository); + assertTrue("Repository type should be SimpleFlowExecutionRepository", + flowExecutor.getExecutionRepository() instanceof SimpleFlowExecutionRepository); } public void testSinglekeyExtended() { FlowExecutorImpl flowExecutor = (FlowExecutorImpl) this.beanFactory.getBean("singlekeyExtended"); - assertTrue("Repository type should be SimpleFlowExecutionRepository", flowExecutor.getExecutionRepository() instanceof SimpleFlowExecutionRepository); + assertTrue("Repository type should be SimpleFlowExecutionRepository", + flowExecutor.getExecutionRepository() instanceof SimpleFlowExecutionRepository); } public void testConversationManagerExtended() { FlowExecutorImpl flowExecutor = (FlowExecutorImpl) this.beanFactory.getBean("conversationManagerExtended"); - assertTrue("Repository type should be SimpleFlowExecutionRepository", flowExecutor.getExecutionRepository() instanceof SimpleFlowExecutionRepository); - AbstractConversationFlowExecutionRepository repository = (AbstractConversationFlowExecutionRepository) flowExecutor.getExecutionRepository(); + assertTrue("Repository type should be SimpleFlowExecutionRepository", + flowExecutor.getExecutionRepository() instanceof SimpleFlowExecutionRepository); + AbstractConversationFlowExecutionRepository repository = (AbstractConversationFlowExecutionRepository) flowExecutor + .getExecutionRepository(); ConversationManager conversationManager = (ConversationManager) this.beanFactory.getBean("conversationManager"); - assertSame("The conversation manager in the repository should be the one explicitly wired", conversationManager, repository.getConversationManager()); + assertSame("The conversation manager in the repository should be the one explicitly wired", + conversationManager, repository.getConversationManager()); } - + /** * {@link ProblemReporter} implementation that simply stores the last reported error */ static class DefaultProblemReporter implements ProblemReporter { - + private Problem problem; - + public Problem getLastProblem() { return this.problem; } - + public void error(Problem problem) { this.problem = problem; } public void fatal(Problem problem) { this.problem = problem; - + } public void warning(Problem problem) { diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletContextMapTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletContextMapTests.java index 5258b5d6..fb0dde40 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletContextMapTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletContextMapTests.java @@ -71,7 +71,7 @@ public class PortletContextMapTests extends TestCase { Iterator names = tested.getAttributeNames(); assertNotNull("Null result unexpected", names); assertTrue("More elements", names.hasNext()); - String name = (String)names.next(); + String name = (String) names.next(); assertEquals("Some key", name); } } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletExternalContextTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletExternalContextTests.java index a2512de7..eda1a959 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletExternalContextTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletExternalContextTests.java @@ -25,10 +25,10 @@ import org.springframework.mock.web.portlet.MockPortletResponse; * Unit tests for {@link PortletExternalContext}. */ public class PortletExternalContextTests extends TestCase { - + private PortletExternalContext context = new PortletExternalContext(new MockPortletContext(), new MockPortletRequest(), new MockPortletResponse()); - + public void testApplicationMap() { assertEquals(1, context.getApplicationMap().size()); context.getApplicationMap().put("foo", "bar"); @@ -49,7 +49,7 @@ public class PortletExternalContextTests extends TestCase { assertEquals("bar", context.getRequestMap().get("foo")); assertEquals("bar", context.getRequest().getAttribute("foo")); } - + public void testOther() { assertNull(context.getRequestPathInfo()); assertNull(context.getDispatcherPath()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletRequestMapTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletRequestMapTests.java index 19ef1d41..12d122f7 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletRequestMapTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletRequestMapTests.java @@ -71,7 +71,7 @@ public class PortletRequestMapTests extends TestCase { Iterator names = tested.getAttributeNames(); assertNotNull("Null result unexpected", names); assertTrue("More elements", names.hasNext()); - String name = (String)names.next(); + String name = (String) names.next(); assertEquals("Some key", name); } } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletRequestParameterMapTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletRequestParameterMapTests.java index f8c49b30..00100092 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletRequestParameterMapTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletRequestParameterMapTests.java @@ -56,8 +56,7 @@ public class PortletRequestParameterMapTests extends TestCase { try { tested.setAttribute("Some key", "Some value"); fail("UnsupportedOperationException expected"); - } - catch (UnsupportedOperationException expected) { + } catch (UnsupportedOperationException expected) { // expected } } @@ -68,8 +67,7 @@ public class PortletRequestParameterMapTests extends TestCase { try { tested.removeAttribute("Some param"); fail("UnsupportedOperationException expected"); - } - catch (UnsupportedOperationException expected) { + } catch (UnsupportedOperationException expected) { // expected } } @@ -80,7 +78,7 @@ public class PortletRequestParameterMapTests extends TestCase { Iterator names = tested.getAttributeNames(); assertNotNull("Null result unexpected", names); assertTrue("More elements", names.hasNext()); - String name = (String)names.next(); + String name = (String) names.next(); assertEquals("Some param", name); } } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletSessionMapTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletSessionMapTests.java index 353ff270..24027925 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletSessionMapTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/portlet/PortletSessionMapTests.java @@ -87,7 +87,7 @@ public class PortletSessionMapTests extends TestCase { Iterator names = tested.getAttributeNames(); assertNotNull("Null result unexpected", names); assertTrue("More elements", names.hasNext()); - String name = (String)names.next(); + String name = (String) names.next(); assertEquals("Some key", name); } @@ -98,7 +98,7 @@ public class PortletSessionMapTests extends TestCase { assertNotNull("Null result unexpected", names); assertFalse("No elements expected", names.hasNext()); } - + public void testGetSessionAsMutex() { Object mutex = tested.getMutex(); assertSame(mutex, request.getPortletSession()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletContextMapTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletContextMapTests.java index a287d206..df28ba97 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletContextMapTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletContextMapTests.java @@ -95,7 +95,7 @@ public class HttpServletContextMapTests extends TestCase { public void testPutAll() { Map otherMap = new HashMap(); otherMap.put("SomeOtherKey", "SomeOtherValue"); - otherMap.put("SomeKey", "SomeUpdatedValue"); + otherMap.put("SomeKey", "SomeUpdatedValue"); tested.putAll(otherMap); assertEquals("SomeOtherValue", tested.get("SomeOtherKey")); assertEquals("SomeUpdatedValue", tested.get("SomeKey")); @@ -118,7 +118,7 @@ public class HttpServletContextMapTests extends TestCase { public void testEntrySet() { assertEquals(1, tested.entrySet().size()); - assertEquals("SomeKey", ((Entry)tested.entrySet().iterator().next()).getKey()); - assertEquals("SomeValue", ((Entry)tested.entrySet().iterator().next()).getValue()); + assertEquals("SomeKey", ((Entry) tested.entrySet().iterator().next()).getKey()); + assertEquals("SomeValue", ((Entry) tested.entrySet().iterator().next()).getValue()); } } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletRequestMapTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletRequestMapTests.java index 22221f51..efd9cd5c 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletRequestMapTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletRequestMapTests.java @@ -71,7 +71,7 @@ public class HttpServletRequestMapTests extends TestCase { Iterator names = tested.getAttributeNames(); assertNotNull("Null result unexpected", names); assertTrue("More elements", names.hasNext()); - String name = (String)names.next(); + String name = (String) names.next(); assertEquals("Some key", name); } } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletRequestParameterMapTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletRequestParameterMapTests.java index 83e33395..c1ef6c45 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletRequestParameterMapTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpServletRequestParameterMapTests.java @@ -56,8 +56,7 @@ public class HttpServletRequestParameterMapTests extends TestCase { try { tested.setAttribute("Some key", "Some value"); fail("UnsupportedOperationException expected"); - } - catch (UnsupportedOperationException expected) { + } catch (UnsupportedOperationException expected) { // expected } } @@ -68,8 +67,7 @@ public class HttpServletRequestParameterMapTests extends TestCase { try { tested.removeAttribute("Some param"); fail("UnsupportedOperationException expected"); - } - catch (UnsupportedOperationException expected) { + } catch (UnsupportedOperationException expected) { // expected } } @@ -80,7 +78,7 @@ public class HttpServletRequestParameterMapTests extends TestCase { Iterator names = tested.getAttributeNames(); assertNotNull("Null result unexpected", names); assertTrue("More elements", names.hasNext()); - String name = (String)names.next(); + String name = (String) names.next(); assertEquals("Some param", name); } } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpSessionMapBindingListenerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpSessionMapBindingListenerTests.java index ed87b2d5..a38bd762 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpSessionMapBindingListenerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpSessionMapBindingListenerTests.java @@ -30,17 +30,17 @@ import org.springframework.webflow.core.collection.AttributeMapBindingListener; * @author Erwin Vervaet */ public class HttpSessionMapBindingListenerTests extends TestCase { - + private HttpServletRequest request; private HttpSession session; private TestAttributeMapBindingListener value; - + protected void setUp() throws Exception { request = new MockHttpServletRequest(); session = request.getSession(true); value = new TestAttributeMapBindingListener(); } - + public void testValueBoundUnBound() { value.valueBoundEvent = null; value.valueUnboundEvent = null; @@ -53,18 +53,18 @@ public class HttpSessionMapBindingListenerTests extends TestCase { assertNull(value.valueBoundEvent); assertNotNull(value.valueUnboundEvent); } - + private static class TestAttributeMapBindingListener implements AttributeMapBindingListener { - + public AttributeMapBindingEvent valueBoundEvent; public AttributeMapBindingEvent valueUnboundEvent; - + public void valueBound(AttributeMapBindingEvent event) { this.valueBoundEvent = event; assertEquals("key", event.getAttributeName()); assertSame(event.getAttributeValue(), this); } - + public void valueUnbound(AttributeMapBindingEvent event) { this.valueUnboundEvent = event; assertEquals("key", event.getAttributeName()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpSessionMapTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpSessionMapTests.java index 410bb15d..b93108b7 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpSessionMapTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/HttpSessionMapTests.java @@ -85,7 +85,7 @@ public class HttpSessionMapTests extends TestCase { Iterator names = tested.getAttributeNames(); assertNotNull("Null result unexpected", names); assertTrue("More elements", names.hasNext()); - String name = (String)names.next(); + String name = (String) names.next(); assertEquals("Some key", name); } @@ -96,7 +96,7 @@ public class HttpSessionMapTests extends TestCase { assertNotNull("Null result unexpected", names); assertFalse("No elements expected", names.hasNext()); } - + public void testGetSessionAsMutex() { Object mutex = tested.getMutex(); assertSame(mutex, request.getSession()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/ServletExternalContextTests.java b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/ServletExternalContextTests.java index c79ca01a..bd8b5e4e 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/ServletExternalContextTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/context/servlet/ServletExternalContextTests.java @@ -25,10 +25,10 @@ import org.springframework.mock.web.MockServletContext; * Unit tests for {@link ServletExternalContext}. */ public class ServletExternalContextTests extends TestCase { - + private ServletExternalContext context = new ServletExternalContext(new MockServletContext(), new MockHttpServletRequest(), new MockHttpServletResponse()); - + public void testApplicationMap() { assertEquals(1, context.getApplicationMap().size()); context.getApplicationMap().put("foo", "bar"); @@ -49,7 +49,7 @@ public class ServletExternalContextTests extends TestCase { assertEquals("bar", context.getRequestMap().get("foo")); assertEquals("bar", context.getRequest().getAttribute("foo")); } - + public void testOther() { assertEquals(null, context.getRequestPathInfo()); assertEquals("", context.getDispatcherPath()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/conversation/impl/ConversationSizeTests.java b/spring-webflow/src/test/java/org/springframework/webflow/conversation/impl/ConversationSizeTests.java index 6bd0293c..bf264bd3 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/conversation/impl/ConversationSizeTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/conversation/impl/ConversationSizeTests.java @@ -40,19 +40,18 @@ import org.springframework.webflow.test.MockExternalContext; * @author Erwin Vervaet */ public class ConversationSizeTests extends TestCase { - + private SessionBindingConversationManager conversationManager; - private FlowExecutor flowExecutor; + private FlowExecutor flowExecutor; protected void setUp() throws Exception { - AbstractFlowBuilderFlowRegistryFactoryBean flowRegistryFactory = - new SizeTestFlowRegistry(); + AbstractFlowBuilderFlowRegistryFactoryBean flowRegistryFactory = new SizeTestFlowRegistry(); flowRegistryFactory.setBeanFactory(new StaticListableBeanFactory()); flowRegistryFactory.afterPropertiesSet(); FlowDefinitionRegistry flowRegistry = flowRegistryFactory.getRegistry(); - + conversationManager = new SessionBindingConversationManager(); - + FlowExecutorFactoryBean flowExecutorFactory = new FlowExecutorFactoryBean(); flowExecutorFactory.setDefinitionLocator(flowRegistry); flowExecutorFactory.setConversationManager(conversationManager); @@ -60,70 +59,70 @@ public class ConversationSizeTests extends TestCase { flowExecutorFactory.afterPropertiesSet(); flowExecutor = flowExecutorFactory.getFlowExecutor(); } - + public void testConversationSize() throws Exception { MockExternalContext context = new MockExternalContext(); SharedAttributeMap session = context.getSessionMap(); - + // initially the session is empty assertTrue(session.isEmpty()); - + ResponseInstruction ri = flowExecutor.launch("size-test-flow", context); assertTrue(ri.getFlowExecutionContext().isActive()); assertTrue(ri.getViewSelection() instanceof FlowExecutionRedirect); // alwaysRedirectOnPause - + // the launch has stored a ConversationContainer in the session since we're using // SessionBindingConversationManager assertEquals(1, session.size()); - ConversationContainer conversationContainer = (ConversationContainer)session.get( - conversationManager.getSessionKey()); + ConversationContainer conversationContainer = (ConversationContainer) session.get(conversationManager + .getSessionKey()); assertNotNull(conversationContainer); assertEquals(1, conversationContainer.size()); int initialSize = getSerializedSize(conversationContainer); - + ri = flowExecutor.refresh(ri.getFlowExecutionKey(), context); assertTrue(ri.getFlowExecutionContext().isActive()); - assertEquals("view", ((ApplicationView)ri.getViewSelection()).getViewName()); - + assertEquals("view", ((ApplicationView) ri.getViewSelection()).getViewName()); + // the refresh did not impact the size of the session assertEquals(1, session.size()); assertSame(conversationContainer, session.get(conversationManager.getSessionKey())); assertEquals(1, conversationContainer.size()); - + ri = flowExecutor.resume(ri.getFlowExecutionKey(), "end", context); assertFalse(ri.getFlowExecutionContext().isActive()); assertTrue(ri.isNull()); - + // the conversation ended but the ConversationContainer is still in the session assertEquals(1, session.size()); assertSame(conversationContainer, session.get(conversationManager.getSessionKey())); assertEquals(0, conversationContainer.size()); int inactiveSize = getSerializedSize(conversationContainer); - + assertTrue(inactiveSize < initialSize); } - + // helpers - + private int getSerializedSize(Object obj) throws Exception { ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(bout); oout.writeObject(obj); oout.flush(); int objSize = bout.toByteArray().length; - - //System.out.println(">>>> serialized size of '" + obj + "' is " + objSize); - + + // System.out.println(">>>> serialized size of '" + obj + "' is " + objSize); + return objSize; } - + private static class SizeTestFlowBuilder extends AbstractFlowBuilder { public void buildStates() throws FlowBuilderException { addViewState("view", "view", transition(on("end"), to("end"))); addEndState("end"); } } - + private static class SizeTestFlowRegistry extends AbstractFlowBuilderFlowRegistryFactoryBean { protected void doPopulate(FlowDefinitionRegistry registry) { registerFlowDefinition(registry, "size-test-flow", new SizeTestFlowBuilder()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/conversation/impl/SessionBindingConversationManagerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/conversation/impl/SessionBindingConversationManagerTests.java index e5857c9c..71d54787 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/conversation/impl/SessionBindingConversationManagerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/conversation/impl/SessionBindingConversationManagerTests.java @@ -34,21 +34,21 @@ import org.springframework.webflow.test.MockExternalContext; * Unit tests for {@link SessionBindingConversationManager}. */ public class SessionBindingConversationManagerTests extends TestCase { - + private SessionBindingConversationManager conversationManager; - + protected void setUp() throws Exception { conversationManager = new SessionBindingConversationManager(); } - + protected void tearDown() throws Exception { ExternalContextHolder.setExternalContext(null); } - + public void testConversationLifeCycle() { ExternalContextHolder.setExternalContext(new MockExternalContext()); - Conversation conversation = conversationManager.beginConversation( - new ConversationParameters("test", "test", "test")); + Conversation conversation = conversationManager.beginConversation(new ConversationParameters("test", "test", + "test")); ConversationId conversationId = conversation.getId(); assertNotNull(conversationManager.getConversation(conversationId)); conversation.lock(); @@ -57,19 +57,18 @@ public class SessionBindingConversationManagerTests extends TestCase { try { conversationManager.getConversation(conversationId); fail("Conversation should have ben removed"); - } - catch (ConversationException e) { + } catch (ConversationException e) { } } - + public void testNoPassivation() { ExternalContextHolder.setExternalContext(new MockExternalContext()); - Conversation conversation = conversationManager.beginConversation( - new ConversationParameters("test", "test", "test")); + Conversation conversation = conversationManager.beginConversation(new ConversationParameters("test", "test", + "test")); conversation.lock(); conversation.putAttribute("testAttribute", "testValue"); ConversationId conversationId = conversation.getId(); - + Conversation conversation2 = conversationManager.getConversation(conversationId); assertSame(conversation, conversation2); conversation2.lock(); @@ -78,21 +77,21 @@ public class SessionBindingConversationManagerTests extends TestCase { conversation.unlock(); conversation2.unlock(); } - + public void testPassivation() throws Exception { MockExternalContext externalContext = new MockExternalContext(); ExternalContextHolder.setExternalContext(externalContext); - Conversation conversation = conversationManager.beginConversation( - new ConversationParameters("test", "test", "test")); + Conversation conversation = conversationManager.beginConversation(new ConversationParameters("test", "test", + "test")); conversation.lock(); conversation.putAttribute("testAttribute", "testValue"); ConversationId conversationId = conversation.getId(); ExternalContextHolder.setExternalContext(null); byte[] passiveSession = passivate(externalContext.getSessionMap()); - + String id = conversationId.toString(); conversationId = conversationManager.parseConversationId(id); - + externalContext.setSessionMap(activate(passiveSession)); ExternalContextHolder.setExternalContext(externalContext); Conversation conversation2 = conversationManager.getConversation(conversationId); @@ -101,32 +100,31 @@ public class SessionBindingConversationManagerTests extends TestCase { conversation.end(); conversation.unlock(); } - + public void testMaxConversations() { conversationManager.setMaxConversations(2); ExternalContextHolder.setExternalContext(new MockExternalContext()); - Conversation conversation1 = conversationManager.beginConversation( - new ConversationParameters("test", "test", "test")); + Conversation conversation1 = conversationManager.beginConversation(new ConversationParameters("test", "test", + "test")); conversation1.lock(); assertNotNull(conversationManager.getConversation(conversation1.getId())); - Conversation conversation2 = conversationManager.beginConversation( - new ConversationParameters("test", "test", "test")); + Conversation conversation2 = conversationManager.beginConversation(new ConversationParameters("test", "test", + "test")); assertNotNull(conversationManager.getConversation(conversation1.getId())); assertNotNull(conversationManager.getConversation(conversation2.getId())); - Conversation conversation3 = conversationManager.beginConversation( - new ConversationParameters("test", "test", "test")); + Conversation conversation3 = conversationManager.beginConversation(new ConversationParameters("test", "test", + "test")); try { conversation1.end(); conversation1.unlock(); conversationManager.getConversation(conversation1.getId()); fail(); - } - catch (ConversationException e) { + } catch (ConversationException e) { } assertNotNull(conversationManager.getConversation(conversation2.getId())); assertNotNull(conversationManager.getConversation(conversation3.getId())); } - + private byte[] passivate(SharedAttributeMap session) throws Exception { // session is serialized out ByteArrayOutputStream bout = new ByteArrayOutputStream(); @@ -134,10 +132,10 @@ public class SessionBindingConversationManagerTests extends TestCase { oout.writeObject(session); return bout.toByteArray(); } - + private SharedAttributeMap activate(byte[] sessionData) throws Exception { // session is serialized back in - return (SharedAttributeMap)new ObjectInputStream(new ByteArrayInputStream(sessionData)).readObject(); + return (SharedAttributeMap) new ObjectInputStream(new ByteArrayInputStream(sessionData)).readObject(); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/core/WebFlowOgnlExpressionParserTests.java b/spring-webflow/src/test/java/org/springframework/webflow/core/WebFlowOgnlExpressionParserTests.java index 00bfe934..f91739a9 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/core/WebFlowOgnlExpressionParserTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/core/WebFlowOgnlExpressionParserTests.java @@ -36,7 +36,7 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { public void testEvalSimpleExpression() { ArrayList list = new ArrayList(); Expression exp = parser.parseExpression("size()"); - Integer size = (Integer)exp.evaluate(list, null); + Integer size = (Integer) exp.evaluate(list, null); assertEquals(0, size.intValue()); } @@ -49,7 +49,7 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { } }; Expression exp = parser.parseExpression("size"); - Integer size = (Integer)exp.evaluate(adaptable, null); + Integer size = (Integer) exp.evaluate(adaptable, null); assertEquals(0, size.intValue()); } @@ -57,12 +57,12 @@ public class WebFlowOgnlExpressionParserTests extends TestCase { LocalAttributeMap map = new LocalAttributeMap(); map.put("size", new Integer(0)); Expression exp = parser.parseExpression("size"); - Integer size = (Integer)exp.evaluate(map, null); + Integer size = (Integer) exp.evaluate(map, null); assertEquals(0, size.intValue()); assertTrue(exp instanceof SettableExpression); - SettableExpression sexp = (SettableExpression)exp; + SettableExpression sexp = (SettableExpression) exp; sexp.evaluateToSet(map, new Integer(1), null); - size = (Integer)exp.evaluate(map, null); + size = (Integer) exp.evaluate(map, null); assertEquals(1, size.intValue()); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/CollectionUtilsTests.java b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/CollectionUtilsTests.java index 19b956b4..6013a47e 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/CollectionUtilsTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/CollectionUtilsTests.java @@ -21,7 +21,7 @@ import junit.framework.TestCase; * Unit tests for {@link CollectionUtils}. */ public class CollectionUtilsTests extends TestCase { - + public void testSingleEntryMap() { AttributeMap map1 = CollectionUtils.singleEntryMap("foo", "bar"); AttributeMap map2 = CollectionUtils.singleEntryMap("foo", "bar"); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalAttributeMapTests.java b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalAttributeMapTests.java index 367c4b7d..a38fa0a1 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalAttributeMapTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalAttributeMapTests.java @@ -26,7 +26,7 @@ import junit.framework.TestCase; * Unit tests for {@link LocalAttributeMap}. */ public class LocalAttributeMapTests extends TestCase { - + private LocalAttributeMap attributeMap = new LocalAttributeMap(); public void setUp() { @@ -43,17 +43,17 @@ public class LocalAttributeMapTests extends TestCase { } public void testGet() { - TestBean bean = (TestBean)attributeMap.get("bean"); + TestBean bean = (TestBean) attributeMap.get("bean"); assertNotNull(bean); } public void testGetNull() { - TestBean bean = (TestBean)attributeMap.get("bogus"); + TestBean bean = (TestBean) attributeMap.get("bogus"); assertNull(bean); } public void testGetRequiredType() { - TestBean bean = (TestBean)attributeMap.get("bean", TestBean.class); + TestBean bean = (TestBean) attributeMap.get("bean", TestBean.class); assertNotNull(bean); } @@ -61,27 +61,26 @@ public class LocalAttributeMapTests extends TestCase { try { attributeMap.get("bean", String.class); fail("Should've failed iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } public void testGetWithDefaultOption() { TestBean d = new TestBean(); - TestBean bean = (TestBean)attributeMap.get("bean", d); + TestBean bean = (TestBean) attributeMap.get("bean", d); assertNotNull(bean); assertNotSame(bean, d); } public void testGetWithDefault() { TestBean d = new TestBean(); - TestBean bean = (TestBean)attributeMap.get("bogus", d); + TestBean bean = (TestBean) attributeMap.get("bogus", d); assertSame(bean, d); } public void testGetRequired() { - TestBean bean = (TestBean)attributeMap.getRequired("bean"); + TestBean bean = (TestBean) attributeMap.getRequired("bean"); assertNotNull(bean); } @@ -89,14 +88,13 @@ public class LocalAttributeMapTests extends TestCase { try { attributeMap.getRequired("bogus"); fail("Should've failed iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } public void testGetRequiredOfType() { - TestBean bean = (TestBean)attributeMap.getRequired("bean", TestBean.class); + TestBean bean = (TestBean) attributeMap.getRequired("bean", TestBean.class); assertNotNull(bean); } @@ -104,14 +102,13 @@ public class LocalAttributeMapTests extends TestCase { try { attributeMap.getRequired("bean", String.class); fail("Should've failed iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } public void testGetNumber() { - BigDecimal bd = (BigDecimal)attributeMap.getNumber("bigDecimal", BigDecimal.class); + BigDecimal bd = (BigDecimal) attributeMap.getNumber("bigDecimal", BigDecimal.class); assertEquals(new BigDecimal("12345.67"), bd); } @@ -119,28 +116,27 @@ public class LocalAttributeMapTests extends TestCase { try { attributeMap.getNumber("bigDecimal", Integer.class); fail("Should've failed iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } public void testGetNumberWithDefaultOption() { BigDecimal d = new BigDecimal("1"); - BigDecimal bd = (BigDecimal)attributeMap.getNumber("bigDecimal", BigDecimal.class, d); + BigDecimal bd = (BigDecimal) attributeMap.getNumber("bigDecimal", BigDecimal.class, d); assertEquals(new BigDecimal("12345.67"), bd); assertNotSame(d, bd); } public void testGetNumberWithDefault() { BigDecimal d = new BigDecimal("1"); - BigDecimal bd = (BigDecimal)attributeMap.getNumber("bogus", BigDecimal.class, d); + BigDecimal bd = (BigDecimal) attributeMap.getNumber("bogus", BigDecimal.class, d); assertEquals(d, bd); assertSame(d, bd); } public void testGetNumberRequired() { - BigDecimal bd = (BigDecimal)attributeMap.getRequiredNumber("bigDecimal", BigDecimal.class); + BigDecimal bd = (BigDecimal) attributeMap.getRequiredNumber("bigDecimal", BigDecimal.class); assertEquals(new BigDecimal("12345.67"), bd); } @@ -148,8 +144,7 @@ public class LocalAttributeMapTests extends TestCase { try { attributeMap.getRequiredNumber("bogus", BigDecimal.class); fail("Should've failed iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } @@ -173,8 +168,7 @@ public class LocalAttributeMapTests extends TestCase { try { attributeMap.getRequiredInteger("bogus"); fail("Should've failed iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } @@ -198,8 +192,7 @@ public class LocalAttributeMapTests extends TestCase { try { attributeMap.getRequiredLong("bogus"); fail("Should've failed iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } @@ -223,8 +216,7 @@ public class LocalAttributeMapTests extends TestCase { try { attributeMap.getRequiredString("bogus"); fail("Should've failed iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } @@ -248,24 +240,23 @@ public class LocalAttributeMapTests extends TestCase { try { attributeMap.getRequiredBoolean("bogus"); fail("Should've failed iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } public void testGetArray() { - String[] i = (String[])attributeMap.getArray("stringArray", String[].class); + String[] i = (String[]) attributeMap.getArray("stringArray", String[].class); assertEquals(3, i.length); } public void testGetArrayNull() { - String[] i = (String[])attributeMap.getArray("A bogus array", String[].class); + String[] i = (String[]) attributeMap.getArray("A bogus array", String[].class); assertNull(i); } public void testGetArrayRequired() { - String[] i = (String[])attributeMap.getRequiredArray("stringArray", String[].class); + String[] i = (String[]) attributeMap.getRequiredArray("stringArray", String[].class); assertEquals(3, i.length); } @@ -273,24 +264,23 @@ public class LocalAttributeMapTests extends TestCase { try { attributeMap.getRequiredArray("A bogus array", String[].class); fail("Should've failed iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } public void testGetCollection() { - LinkedList i = (LinkedList)attributeMap.getCollection("collection", List.class); + LinkedList i = (LinkedList) attributeMap.getCollection("collection", List.class); assertEquals(0, i.size()); } public void testGetCollectionNull() { - LinkedList i = (LinkedList)attributeMap.getCollection("bogus", List.class); + LinkedList i = (LinkedList) attributeMap.getCollection("bogus", List.class); assertNull(i); } public void testGetCollectionRequired() { - LinkedList i = (LinkedList)attributeMap.getRequiredCollection("collection", List.class); + LinkedList i = (LinkedList) attributeMap.getRequiredCollection("collection", List.class); assertEquals(0, i.size()); } @@ -298,8 +288,7 @@ public class LocalAttributeMapTests extends TestCase { try { attributeMap.getRequiredCollection("A bogus collection"); fail("Should've failed iae"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalParameterMapTests.java b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalParameterMapTests.java index b03843fd..19283f51 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalParameterMapTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/LocalParameterMapTests.java @@ -62,15 +62,14 @@ public class LocalParameterMapTests extends TestCase { } public void testGetRequiredWithConversion() { - Integer value = (Integer)parameterMap.getRequired("integer", Integer.class); + Integer value = (Integer) parameterMap.getRequired("integer", Integer.class); assertEquals(new Integer(12345), value); } public void testGetRequiredNotPresent() { try { parameterMap.getRequired("bogus"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } @@ -94,8 +93,7 @@ public class LocalParameterMapTests extends TestCase { try { parameterMap.get("bogus", Integer.class, "1"); fail("'1' isn't a integer"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } @@ -121,7 +119,7 @@ public class LocalParameterMapTests extends TestCase { } public void getArrayWithConversion() { - Integer[] values = (Integer[])parameterMap.getArray("stringArray", Integer.class); + Integer[] values = (Integer[]) parameterMap.getArray("stringArray", Integer.class); assertEquals(new Integer(1), values[0]); assertEquals(new Integer(2), values[1]); assertEquals(new Integer(3), values[2]); @@ -130,8 +128,7 @@ public class LocalParameterMapTests extends TestCase { public void testGetRequiredArrayNotPresent() { try { parameterMap.getRequiredArray("bogus"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } @@ -158,7 +155,7 @@ public class LocalParameterMapTests extends TestCase { } public void testGetArrayConversion() { - Integer[] i = (Integer[])parameterMap.getArray("stringArray", Integer.class); + Integer[] i = (Integer[]) parameterMap.getArray("stringArray", Integer.class); assertEquals(i.length, 3); assertEquals(new Integer(1), i[0]); assertEquals(new Integer(2), i[1]); @@ -166,24 +163,24 @@ public class LocalParameterMapTests extends TestCase { } public void getRequiredArrayWithConversion() { - Integer[] values = (Integer[])parameterMap.getRequiredArray("stringArray", Integer.class); + Integer[] values = (Integer[]) parameterMap.getRequiredArray("stringArray", Integer.class); assertEquals(new Integer(1), values[0]); assertEquals(new Integer(2), values[1]); assertEquals(new Integer(3), values[2]); } public void testGetNumber() { - Integer value = (Integer)parameterMap.getNumber("integer", Integer.class); + Integer value = (Integer) parameterMap.getNumber("integer", Integer.class); assertEquals(new Integer(12345), value); } public void testGetRequiredNumber() { - Integer value = (Integer)parameterMap.getRequiredNumber("integer", Integer.class); + Integer value = (Integer) parameterMap.getRequiredNumber("integer", Integer.class); assertEquals(new Integer(12345), value); } public void testGetNumberWithDefault() { - Integer value = (Integer)parameterMap.getNumber("bogus", Integer.class, new Integer(12345)); + Integer value = (Integer) parameterMap.getNumber("bogus", Integer.class, new Integer(12345)); assertEquals(new Integer(12345), value); } @@ -241,7 +238,7 @@ public class LocalParameterMapTests extends TestCase { MultipartFile file = parameterMap.getRequiredMultipartFile("multipartFile"); assertNotNull(file); } - + public void testEquality() { LocalParameterMap map1 = new LocalParameterMap(new HashMap(parameterMap.asMap())); assertEquals(parameterMap, map1); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/TestBean.java b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/TestBean.java index b690472e..795e4679 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/core/collection/TestBean.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/core/collection/TestBean.java @@ -21,7 +21,7 @@ import java.io.Serializable; * Test bean used in unit tests. */ public class TestBean implements Serializable { - + private int amount = 0; public int getAmount() { @@ -36,7 +36,7 @@ public class TestBean implements Serializable { if (!(o instanceof TestBean)) { return false; } - return amount == ((TestBean)o).amount; + return amount == ((TestBean) o).amount; } public int hashCode() { diff --git a/spring-webflow/src/test/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImplTests.java b/spring-webflow/src/test/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImplTests.java index 3f6227a1..9639bf15 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImplTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/definition/registry/FlowDefinitionRegistryImplTests.java @@ -25,7 +25,7 @@ import org.springframework.webflow.definition.StateDefinition; * Unit tests for {@link FlowDefinitionRegistryImpl}. */ public class FlowDefinitionRegistryImplTests extends TestCase { - + private FlowDefinitionRegistryImpl registry = new FlowDefinitionRegistryImpl(); private FlowDefinition fooFlow; @@ -44,8 +44,7 @@ public class FlowDefinitionRegistryImplTests extends TestCase { try { registry.getFlowDefinition("bogus"); fail("Should've bombed with NoSuchFlow"); - } - catch (NoSuchFlowDefinitionException e) { + } catch (NoSuchFlowDefinitionException e) { } } @@ -82,7 +81,7 @@ public class FlowDefinitionRegistryImplTests extends TestCase { assertEquals(2, registry.getFlowDefinitionCount()); assertSame(fooFlow, registry.getFlowDefinition("foo")); } - + public void testRefreshValidFlow() { testRegisterMultipleFlows(); registry.refresh("foo"); @@ -95,12 +94,11 @@ public class FlowDefinitionRegistryImplTests extends TestCase { try { registry.refresh("bogus"); fail("Should've bombed with NoSuchFlow"); - } - catch (NoSuchFlowDefinitionException e) { + } catch (NoSuchFlowDefinitionException e) { } } - + public void testParentHierarchy() { testRegisterMultipleFlows(); FlowDefinitionRegistryImpl child = new FlowDefinitionRegistryImpl(); @@ -113,7 +111,7 @@ public class FlowDefinitionRegistryImplTests extends TestCase { private static class FooFlow implements FlowDefinition { private String id = "foo"; - + public AttributeMap getAttributes() { return null; } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/ActionExecutorTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/ActionExecutorTests.java index 26bcf5d1..9944f5a6 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/ActionExecutorTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/ActionExecutorTests.java @@ -41,8 +41,7 @@ public class ActionExecutorTests extends TestCase { try { ActionExecutor.execute(action, new MockRequestContext()); fail("Should've failed"); - } - catch (ActionExecutionException e) { + } catch (ActionExecutionException e) { assertTrue(e.getCause() instanceof IllegalStateException); } } @@ -60,8 +59,7 @@ public class ActionExecutorTests extends TestCase { try { ActionExecutor.execute(action, context); fail("Should've failed"); - } - catch (ActionExecutionException e) { + } catch (ActionExecutionException e) { assertTrue(e.getCause() instanceof IllegalStateException); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/ActionStateTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/ActionStateTests.java index 5321b537..1a961002 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/ActionStateTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/ActionStateTests.java @@ -40,7 +40,7 @@ public class ActionStateTests extends TestCase { new EndState(flow, "finish"); FlowExecution flowExecution = new FlowExecutionImpl(flow); flowExecution.start(null, new MockExternalContext()); - assertEquals(1, ((TestAction)state.getActionList().get(0)).getExecutionCount()); + assertEquals(1, ((TestAction) state.getActionList().get(0)).getExecutionCount()); } public void testActionAttributesChain() { @@ -56,7 +56,7 @@ public class ActionStateTests extends TestCase { flowExecution.start(null, new MockExternalContext()); Action[] actions = state.getActionList().toArray(); for (int i = 0; i < actions.length; i++) { - TestAction action = (TestAction)actions[i]; + TestAction action = (TestAction) actions[i]; assertEquals(1, action.getExecutionCount()); } } @@ -74,8 +74,7 @@ public class ActionStateTests extends TestCase { try { flowExecution.start(null, new MockExternalContext()); fail("Should not have matched to another state transition"); - } - catch (NoMatchingTransitionException e) { + } catch (NoMatchingTransitionException e) { // expected } } @@ -98,8 +97,8 @@ public class ActionStateTests extends TestCase { assertTrue(!flowExecution.isActive()); Action[] actions = state.getActionList().toArray(); for (int i = 0; i < actions.length; i++) { - AnnotatedAction action = (AnnotatedAction)actions[i]; - assertEquals(1, ((TestAction)(action.getTargetAction())).getExecutionCount()); + AnnotatedAction action = (AnnotatedAction) actions[i]; + assertEquals(1, ((TestAction) (action.getTargetAction())).getExecutionCount()); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/AnnotatedObjectTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/AnnotatedObjectTests.java index 5f57758e..46b940f0 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/AnnotatedObjectTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/AnnotatedObjectTests.java @@ -20,7 +20,7 @@ import junit.framework.TestCase; public class AnnotatedObjectTests extends TestCase { private AnnotatedObject object = new Flow("foo"); - + public void testSetCaption() { object.setCaption("caption"); assertEquals("caption", object.getCaption()); @@ -30,7 +30,7 @@ public class AnnotatedObjectTests extends TestCase { object.setDescription("description"); assertEquals("description", object.getDescription()); } - + public void testPutCustomAttributes() { object.getAttributeMap().put("foo", "bar"); assertEquals("bar", object.getAttributeMap().get("foo")); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/DecisionStateTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/DecisionStateTests.java index 55a3fe2a..9ca73fac 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/DecisionStateTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/DecisionStateTests.java @@ -62,12 +62,11 @@ public class DecisionStateTests extends TestCase { try { state.enter(context); fail("Expected no matching"); - } - catch (NoMatchingTransitionException e) { + } catch (NoMatchingTransitionException e) { } } - + protected TargetStateResolver to(String stateId) { return new DefaultTargetStateResolver(stateId); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/EndStateTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/EndStateTests.java index d7d27e3d..7c6dc709 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/EndStateTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/EndStateTests.java @@ -47,7 +47,7 @@ public class EndStateTests extends TestCase { EndState state = new EndState(flow, "finish"); state.setViewSelector(view("myViewName")); FlowExecution flowExecution = new FlowExecutionImpl(flow); - ApplicationView view = (ApplicationView)flowExecution.start(null, new MockExternalContext()); + ApplicationView view = (ApplicationView) flowExecution.start(null, new MockExternalContext()); assertFalse(flowExecution.isActive()); assertEquals("myViewName", view.getViewName()); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/EventTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/EventTests.java index ef66721e..0ea3f64f 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/EventTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/EventTests.java @@ -15,7 +15,6 @@ */ package org.springframework.webflow.engine; - import junit.framework.TestCase; import org.springframework.webflow.core.collection.LocalAttributeMap; @@ -34,13 +33,13 @@ public class EventTests extends TestCase { assertTrue(event.getTimestamp() > 0); assertTrue(event.getAttributes().isEmpty()); } - + public void testEventNullSource() { try { new Event(null, "id"); fail("null source"); } catch (IllegalArgumentException e) { - + } } @@ -49,10 +48,10 @@ public class EventTests extends TestCase { new Event(this, null); fail("null id"); } catch (IllegalArgumentException e) { - + } } - + public void testNewEventWithAttributes() { LocalAttributeMap attrs = new LocalAttributeMap(); attrs.put("name", "value"); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java index 1e98247a..69f283b0 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/FlowTests.java @@ -80,8 +80,7 @@ public class FlowTests extends TestCase { try { new EndState(flow, "myState1"); fail("Duplicate state added"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { // expected } } @@ -92,8 +91,7 @@ public class FlowTests extends TestCase { try { flow.add(state); fail("Should have failed"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } assertEquals("State count wrong:", 1, flow.getStateCount()); @@ -106,8 +104,7 @@ public class FlowTests extends TestCase { try { flow.add(state); fail("Added state part of another flow"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { // expected } } @@ -117,8 +114,7 @@ public class FlowTests extends TestCase { try { flow.getStartState(); fail("Retrieved start state when no such state"); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { // expected } } @@ -127,8 +123,7 @@ public class FlowTests extends TestCase { try { flow.getState("myState3"); fail("Returned a state that doesn't exist"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { // expected } } @@ -142,14 +137,12 @@ public class FlowTests extends TestCase { try { flow.getTransitionableState("myState2"); fail("End states aren't transtionable"); - } - catch (ClassCastException e) { + } catch (ClassCastException e) { // expected } try { flow.getTransitionableState("doesNotExist"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { // expected } } @@ -234,8 +227,7 @@ public class FlowTests extends TestCase { try { context.setLastEvent(event); flow.onEvent(context); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { } } @@ -248,8 +240,7 @@ public class FlowTests extends TestCase { try { context.setLastEvent(event); flow.onEvent(context); - } - catch (IllegalStateException e) { + } catch (IllegalStateException e) { } } @@ -284,8 +275,7 @@ public class FlowTests extends TestCase { try { context.setLastEvent(event); flow.onEvent(context); - } - catch (NoMatchingTransitionException e) { + } catch (NoMatchingTransitionException e) { } } @@ -318,7 +308,7 @@ public class FlowTests extends TestCase { context.setCurrentState(flow.getStateInstance("myState1")); FlowExecutionException e = new FlowExecutionException(flow.getId(), flow.getStartState().getId(), "Oops!", new TestException()); - ApplicationView selectedView = (ApplicationView)flow.handleException(e, context); + ApplicationView selectedView = (ApplicationView) flow.handleException(e, context); assertFalse(context.getFlowExecutionContext().isActive()); assertNotNull("Should not have been null", selectedView); assertEquals("Wrong selected view", "myView2", selectedView.getViewName()); @@ -330,8 +320,7 @@ public class FlowTests extends TestCase { new TestException()); try { flow.handleException(e, context); - } - catch (FlowExecutionException ex) { + } catch (FlowExecutionException ex) { // expected } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/StateExceptionHandlerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/StateExceptionHandlerTests.java index cd6225cd..652b19dc 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/StateExceptionHandlerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/StateExceptionHandlerTests.java @@ -27,69 +27,66 @@ import org.springframework.webflow.execution.support.ApplicationView; * @author Erwin Vervaet */ public class StateExceptionHandlerTests extends TestCase { - + public void testHandleException() { FlowExecutionExceptionHandlerSet handlerSet = new FlowExecutionExceptionHandlerSet(); - + handlerSet.add(new TestStateExceptionHandler(NullPointerException.class, new ApplicationView("NOK", null))); handlerSet.add(new TestStateExceptionHandler(FlowExecutionException.class, new ApplicationView("OK", null))); handlerSet.add(new TestStateExceptionHandler(FlowExecutionException.class, new ApplicationView("NOK", null))); - + FlowExecutionException testException = new FlowExecutionException("flowId", "stateId", "Test"); - assertNotNull( - "First handler should have been ignored since it does not handle StateException", - handlerSet.handleException(testException, null)); + assertNotNull("First handler should have been ignored since it does not handle StateException", handlerSet + .handleException(testException, null)); assertEquals( "Third handler should not have been reached since second handler handles excpetion and returns not-null", - "OK", ((ApplicationView)handlerSet.handleException(testException, null)).getViewName()); + "OK", ((ApplicationView) handlerSet.handleException(testException, null)).getViewName()); } - + public void testHandleExceptionWithNulls() { FlowExecutionExceptionHandlerSet handlerSet = new FlowExecutionExceptionHandlerSet(); - + handlerSet.add(new TestStateExceptionHandler(FlowExecutionException.class, null)); handlerSet.add(new TestStateExceptionHandler(FlowExecutionException.class, new ApplicationView("OK", null))); handlerSet.add(new TestStateExceptionHandler(FlowExecutionException.class, new ApplicationView("NOK", null))); - + FlowExecutionException testException = new FlowExecutionException("flowId", "stateId", "Test"); - assertNotNull( - "First handler should have been ignored since it return null", - handlerSet.handleException(testException, null)); + assertNotNull("First handler should have been ignored since it return null", handlerSet.handleException( + testException, null)); assertEquals( "Third handler should not have been reached since second handler handles excpetion and returns not-null", - "OK", ((ApplicationView)handlerSet.handleException(testException, null)).getViewName()); + "OK", ((ApplicationView) handlerSet.handleException(testException, null)).getViewName()); } - + public void testHandleExceptionNoMatch() { FlowExecutionExceptionHandlerSet handlerSet = new FlowExecutionExceptionHandlerSet(); - + handlerSet.add(new TestStateExceptionHandler(FlowExecutionException.class, null)); handlerSet.add(new TestStateExceptionHandler(NullPointerException.class, new ApplicationView("NOK", null))); - + FlowExecutionException testException = new FlowExecutionException("flowId", "stateId", "Test"); - assertNull( - "First handler should have been ignored since it return null, " + - "second handler should have been ignored since it does not handle the exception", - handlerSet.handleException(testException, null)); + assertNull("First handler should have been ignored since it return null, " + + "second handler should have been ignored since it does not handle the exception", handlerSet + .handleException(testException, null)); } - + /** * State exception handler used in tests. */ public static class TestStateExceptionHandler implements FlowExecutionExceptionHandler { - + private Class typeToHandle; private ViewSelection handleResult; - + public TestStateExceptionHandler(Class typeToHandle, ViewSelection handleResult) { this.typeToHandle = typeToHandle; this.handleResult = handleResult; } - + public boolean handles(FlowExecutionException exception) { return typeToHandle.isInstance(exception); } - + public ViewSelection handle(FlowExecutionException exception, RequestControlContext context) { return handleResult; } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/SubflowStateTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/SubflowStateTests.java index 58370888..5ce63db6 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/SubflowStateTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/SubflowStateTests.java @@ -54,11 +54,11 @@ public class SubflowStateTests extends TestCase { state3.setViewSelector(view("myParentFlowEndingViewName")); FlowExecution flowExecution = new FlowExecutionImpl(flow); - ApplicationView view = (ApplicationView)flowExecution.start(null, new MockExternalContext()); + ApplicationView view = (ApplicationView) flowExecution.start(null, new MockExternalContext()); assertEquals("mySubFlow", flowExecution.getActiveSession().getDefinition().getId()); assertEquals("subFlowViewState", flowExecution.getActiveSession().getState().getId()); assertEquals("mySubFlowViewName", view.getViewName()); - view = (ApplicationView)flowExecution.signalEvent("submit", new MockExternalContext()); + view = (ApplicationView) flowExecution.signalEvent("submit", new MockExternalContext()); assertEquals("myParentFlowEndingViewName", view.getViewName()); assertTrue(!flowExecution.isActive()); } @@ -96,12 +96,12 @@ public class SubflowStateTests extends TestCase { FlowExecution flowExecution = new FlowExecutionImpl(flow); MockParameterMap input = new MockParameterMap(); input.put("parentInputAttribute", "attributeValue"); - ApplicationView view = (ApplicationView)flowExecution.start(null, new MockExternalContext(input)); + ApplicationView view = (ApplicationView) flowExecution.start(null, new MockExternalContext(input)); assertEquals("mySubFlow", flowExecution.getActiveSession().getDefinition().getId()); assertEquals("subFlowViewState", flowExecution.getActiveSession().getState().getId()); assertEquals("mySubFlowViewName", view.getViewName()); assertEquals("attributeValue", flowExecution.getActiveSession().getScope().get("childInputAttribute")); - view = (ApplicationView)flowExecution.signalEvent("submit", new MockExternalContext()); + view = (ApplicationView) flowExecution.signalEvent("submit", new MockExternalContext()); assertEquals("myParentFlowEndingViewName", view.getViewName()); assertTrue(!flowExecution.isActive()); assertEquals("attributeValue", view.getModel().get("parentOutputAttribute")); @@ -114,7 +114,7 @@ public class SubflowStateTests extends TestCase { protected TargetStateResolver to(String stateId) { return new DefaultTargetStateResolver(stateId); } - + protected ViewSelector view(String viewName) { return new ApplicationViewSelector(new StaticExpression(viewName)); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/TransitionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/TransitionTests.java index 41484d33..8eb8bdc6 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/TransitionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/TransitionTests.java @@ -62,7 +62,7 @@ public class TransitionTests extends TestCase { assertEquals(context.getCurrentState(), source); assertEquals(0, action.getExecutionCount()); } - + protected TargetStateResolver to(String stateId) { return new DefaultTargetStateResolver(stateId); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/ViewStateTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/ViewStateTests.java index 28c568f6..2802cbcc 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/ViewStateTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/ViewStateTests.java @@ -42,7 +42,7 @@ public class ViewStateTests extends TestCase { state.getTransitionSet().add(new Transition(on("submit"), to("finish"))); new EndState(flow, "finish"); FlowExecution flowExecution = new FlowExecutionImpl(flow); - ApplicationView view = (ApplicationView)flowExecution.start(null, new MockExternalContext()); + ApplicationView view = (ApplicationView) flowExecution.start(null, new MockExternalContext()); assertEquals("viewState", flowExecution.getActiveSession().getState().getId()); assertNotNull(view); assertEquals("myViewName", view.getViewName()); @@ -107,7 +107,7 @@ public class ViewStateTests extends TestCase { protected TargetStateResolver to(String stateId) { return new DefaultTargetStateResolver(stateId); } - + public static ViewSelector view(String viewName) { return new ApplicationViewSelector(new StaticExpression(viewName)); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderParameterizationTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderParameterizationTests.java index bafd3234..6cff6850 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderParameterizationTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderParameterizationTests.java @@ -27,15 +27,15 @@ import org.springframework.webflow.execution.support.ApplicationView; import org.springframework.webflow.test.MockRequestControlContext; /** - * Test parameterization of flow built using an AbstractFlowBuilder when - * registering the flows with a FlowDefinitionRegistry. + * Test parameterization of flow built using an AbstractFlowBuilder when registering the flows with a + * FlowDefinitionRegistry. * * @author Erwin Vervaet */ public class AbstractFlowBuilderParameterizationTests extends TestCase { - + private FlowDefinitionRegistry registry; - + protected void setUp() throws Exception { TestFlowRegistryFactoryBean registryFactory = new TestFlowRegistryFactoryBean(); StaticListableBeanFactory beanFactory = new StaticListableBeanFactory(); @@ -44,42 +44,42 @@ public class AbstractFlowBuilderParameterizationTests extends TestCase { registryFactory.afterPropertiesSet(); registry = registryFactory.getRegistry(); } - + public void testFlowParameterization() { assertEquals(2, registry.getFlowDefinitionCount()); assertTrue(registry.containsFlowDefinition("flowA")); - Flow flowA = (Flow)registry.getFlowDefinition("flowA"); + Flow flowA = (Flow) registry.getFlowDefinition("flowA"); assertEquals(2, flowA.getAttributes().size()); assertEquals("A", flowA.getAttributes().get("name")); assertEquals("someValue", flowA.getAttributes().get("someKey")); assertNull(flowA.getAttributes().get("someOtherKey")); - + assertTrue(registry.containsFlowDefinition("flowB")); - Flow flowB = (Flow)registry.getFlowDefinition("flowB"); + Flow flowB = (Flow) registry.getFlowDefinition("flowB"); assertEquals(2, flowB.getAttributes().size()); assertEquals("B", flowB.getAttributes().get("name")); assertEquals("someOtherValue", flowB.getAttributes().get("someOtherKey")); assertNull(flowB.getAttributes().get("someKey")); } - + public void testFlowParameterizationAtRuntime() { - Flow flowA = (Flow)registry.getFlowDefinition("flowA"); + Flow flowA = (Flow) registry.getFlowDefinition("flowA"); ViewSelection viewSelection = flowA.start(new MockRequestControlContext(flowA), null); - assertEquals("A", ((ApplicationView)viewSelection).getViewName()); - - Flow flowB = (Flow)registry.getFlowDefinition("flowB"); + assertEquals("A", ((ApplicationView) viewSelection).getViewName()); + + Flow flowB = (Flow) registry.getFlowDefinition("flowB"); viewSelection = flowB.start(new MockRequestControlContext(flowB), null); - assertEquals("B", ((ApplicationView)viewSelection).getViewName()); + assertEquals("B", ((ApplicationView) viewSelection).getViewName()); } - + public class TestFlowBuilder extends AbstractFlowBuilder { - + public void buildStates() throws FlowBuilderException { addActionState("test", action("testAction"), transition(on(success()), to("finish"))); addEndState("finish", "${activeFlow.attributes['name']}"); } } - + public class TestFlowRegistryFactoryBean extends AbstractFlowBuilderFlowRegistryFactoryBean { protected void doPopulate(FlowDefinitionRegistry registry) { @@ -87,7 +87,7 @@ public class AbstractFlowBuilderParameterizationTests extends TestCase { attributes.put("name", "A"); attributes.put("someKey", "someValue"); registerFlowDefinition(registry, "flowA", attributes, new TestFlowBuilder()); - + attributes = new LocalAttributeMap(); attributes.put("name", "B"); attributes.put("someOtherKey", "someOtherValue"); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderTests.java index f2a1d800..c8426fc5 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/AbstractFlowBuilderTests.java @@ -56,7 +56,7 @@ public class AbstractFlowBuilderTests extends TestCase { private static String PERSON_DETAILS = "person.Detail"; private AbstractFlowBuilder builder = createBuilder(); - + protected AbstractFlowBuilder createBuilder() { return new AbstractFlowBuilder() { public void buildStates() { @@ -64,7 +64,7 @@ public class AbstractFlowBuilderTests extends TestCase { } }; } - + public void testDependencyLookup() { TestMasterFlowBuilderLookupById master = new TestMasterFlowBuilderLookupById(); master.setFlowServiceLocator(new BaseFlowServiceLocator() { @@ -74,8 +74,7 @@ public class AbstractFlowBuilderTests extends TestCase { builder.setFlowServiceLocator(this); FlowAssembler assembler = new FlowAssembler(PERSON_DETAILS, builder); return assembler.assembleFlow(); - } - else { + } else { throw new FlowArtifactLookupException(id, Flow.class); } } @@ -87,8 +86,7 @@ public class AbstractFlowBuilderTests extends TestCase { public FlowAttributeMapper getAttributeMapper(String id) throws FlowArtifactLookupException { if (id.equals("id.attributeMapper")) { return new PersonIdMapper(); - } - else { + } else { throw new FlowArtifactLookupException(id, FlowAttributeMapper.class); } } @@ -115,8 +113,7 @@ public class AbstractFlowBuilderTests extends TestCase { FlowAssembler assembler = new FlowAssembler(PERSONS_LIST, master); assembler.assembleFlow(); fail("Should have failed, artifact lookup not supported"); - } - catch (UnsupportedOperationException e) { + } catch (UnsupportedOperationException e) { // expected } } @@ -204,20 +201,20 @@ public class AbstractFlowBuilderTests extends TestCase { return new Event(this, "success"); } } - + public void testConfigureMultiAction() throws Exception { MultiAction multiAction = new MultiAction(new MultiActionTarget()); AnnotatedAction action = builder.invoke("foo", multiAction); assertEquals("foo", action.getAttributeMap().get(AnnotatedAction.METHOD_ATTRIBUTE)); assertEquals("success", action.execute(new MockRequestContext()).getId()); } - + public static class MultiActionTarget { public Event foo(RequestContext context) { return new Event(this, "success"); } } - + public void testEndStateRefresh() { FlowBuilder builder = new AbstractFlowBuilder() { public void buildStates() throws FlowBuilderException { @@ -226,13 +223,13 @@ public class AbstractFlowBuilderTests extends TestCase { }; Flow testFlow = new FlowAssembler("testFlow", builder).assembleFlow(); assertTrue(testFlow.getStartState() instanceof EndState); - assertTrue(((EndState)testFlow.getStartState()).getViewSelector() instanceof ApplicationViewSelector); - assertTrue(((ApplicationViewSelector)((EndState)testFlow.getStartState()).getViewSelector()).isRedirect()); - + assertTrue(((EndState) testFlow.getStartState()).getViewSelector() instanceof ApplicationViewSelector); + assertTrue(((ApplicationViewSelector) ((EndState) testFlow.getStartState()).getViewSelector()).isRedirect()); + FlowExecution execution = new FlowExecutionImplFactory().createFlowExecution(testFlow); ViewSelection viewSelection = execution.start(null, new MockExternalContext()); assertTrue("redirect: should be ignored for end states", viewSelection instanceof ApplicationView); - assertEquals("endView", ((ApplicationView)viewSelection).getViewName()); + assertEquals("endView", ((ApplicationView) viewSelection).getViewName()); assertFalse(execution.isActive()); } } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/BaseFlowServiceLocatorTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/BaseFlowServiceLocatorTests.java index 8d0e5a3e..06978c91 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/BaseFlowServiceLocatorTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/BaseFlowServiceLocatorTests.java @@ -28,22 +28,22 @@ import junit.framework.TestCase; * @author Erwin Vervaet */ public class BaseFlowServiceLocatorTests extends TestCase { - + public void testWithCustomConversionService() { BaseFlowServiceLocator serviceLocator = new BaseFlowServiceLocator(); - + GenericConversionService conversionService = new GenericConversionService(); conversionService.addConverter(new TextToBoolean("ja", "nee")); conversionService.addConverter(new CustomTextToViewSelector(serviceLocator)); - + serviceLocator.setConversionService(conversionService); - - assertEquals(Boolean.TRUE, serviceLocator.getConversionService().getConversionExecutor( - String.class, Boolean.class).execute("ja")); - assertSame(NullViewSelector.INSTANCE, serviceLocator.getConversionService().getConversionExecutor( - String.class, ViewSelector.class).execute("custom:")); + + assertEquals(Boolean.TRUE, serviceLocator.getConversionService().getConversionExecutor(String.class, + Boolean.class).execute("ja")); + assertSame(NullViewSelector.INSTANCE, serviceLocator.getConversionService().getConversionExecutor(String.class, + ViewSelector.class).execute("custom:")); } - + public static class CustomTextToViewSelector extends TextToViewSelector { public CustomTextToViewSelector(FlowServiceLocator flowServiceLocator) { diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/ParameterizationTestAction.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/ParameterizationTestAction.java index 64f57b3f..2e36aef3 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/ParameterizationTestAction.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/ParameterizationTestAction.java @@ -31,20 +31,18 @@ public class ParameterizationTestAction extends AbstractAction { protected Event doExecute(RequestContext context) throws Exception { if ("flowA".equals(context.getActiveFlow().getId())) { - Flow flowA = (Flow)context.getActiveFlow(); + Flow flowA = (Flow) context.getActiveFlow(); Assert.assertEquals(2, flowA.getAttributes().size()); Assert.assertEquals("A", flowA.getAttributes().get("name")); Assert.assertEquals("someValue", flowA.getAttributes().get("someKey")); Assert.assertNull(flowA.getAttributes().get("someOtherKey")); - } - else if ("flowB".equals(context.getActiveFlow().getId())) { - Flow flowB = (Flow)context.getActiveFlow(); + } else if ("flowB".equals(context.getActiveFlow().getId())) { + Flow flowB = (Flow) context.getActiveFlow(); Assert.assertEquals(2, flowB.getAttributes().size()); Assert.assertEquals("B", flowB.getAttributes().get("name")); Assert.assertEquals("someOtherValue", flowB.getAttributes().get("someOtherKey")); Assert.assertNull(flowB.getAttributes().get("someKey")); - } - else { + } else { throw new IllegalStateException(); } return success(); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/RefreshableFlowDefinitionHolderTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/RefreshableFlowDefinitionHolderTests.java index bfbe3346..57a6a89b 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/RefreshableFlowDefinitionHolderTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/RefreshableFlowDefinitionHolderTests.java @@ -53,7 +53,7 @@ public class RefreshableFlowDefinitionHolderTests extends TestCase { assertEquals(lastModified, holder.getLastModified()); assertSame(flow1, flow2); } - + public void testReloadOnChange() throws Exception { MockFlowBuilder mockFlowBuilder = new MockFlowBuilder(); FlowAssembler assembler = new FlowAssembler("mockFlow", mockFlowBuilder); @@ -77,20 +77,20 @@ public class RefreshableFlowDefinitionHolderTests extends TestCase { holder.refresh(); assertEquals(4, mockFlowBuilder.buildCallCount); } - + private class MockFlowBuilder extends AbstractFlowBuilder implements ResourceHolder { - + public int buildCallCount = 0; public long lastModified = 0L; - + public void buildStates() throws FlowBuilderException { addEndState("end"); buildCallCount++; } - + public Resource getResource() { return new AbstractResource() { - + public File getFile() throws IOException { return new File("mock") { public long lastModified() { @@ -98,17 +98,16 @@ public class RefreshableFlowDefinitionHolderTests extends TestCase { } }; } - + public String getDescription() { return null; } - + public InputStream getInputStream() throws IOException { return null; } }; } } - - + } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/TextToTransitionCriteriaTests.java b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/TextToTransitionCriteriaTests.java index b07d3e56..0701ec55 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/TextToTransitionCriteriaTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/engine/builder/TextToTransitionCriteriaTests.java @@ -35,44 +35,43 @@ public class TextToTransitionCriteriaTests extends TestCase { public void testAny() { String expression = "*"; - TransitionCriteria criterion = (TransitionCriteria)converter.convert(expression); + TransitionCriteria criterion = (TransitionCriteria) converter.convert(expression); RequestContext ctx = getRequestContext(); assertTrue("Criterion should evaluate to true", criterion.test(ctx)); - + assertSame(WildcardTransitionCriteria.INSTANCE, converter.convert("*")); assertSame(WildcardTransitionCriteria.INSTANCE, converter.convert("")); } public void testStaticEventId() { String expression = "sample"; - TransitionCriteria criterion = (TransitionCriteria)converter.convert(expression); + TransitionCriteria criterion = (TransitionCriteria) converter.convert(expression); RequestContext ctx = getRequestContext(); assertTrue("Criterion should evaluate to true", criterion.test(ctx)); } public void testTrueEvaluation() throws Exception { String expression = "${flowScope.foo == 'bar'}"; - TransitionCriteria criterion = (TransitionCriteria)converter.convert(expression); + TransitionCriteria criterion = (TransitionCriteria) converter.convert(expression); RequestContext ctx = getRequestContext(); assertTrue("Criterion should evaluate to true", criterion.test(ctx)); } public void testFalseEvaluation() throws Exception { String expression = "${flowScope.foo != 'bar'}"; - TransitionCriteria criterion = (TransitionCriteria)converter.convert(expression); + TransitionCriteria criterion = (TransitionCriteria) converter.convert(expression); RequestContext ctx = getRequestContext(); assertFalse("Criterion should evaluate to false", criterion.test(ctx)); } public void testNonBooleanEvaluation() throws Exception { String expression = "${flowScope.foo}"; - TransitionCriteria criterion = (TransitionCriteria)converter.convert(expression); + TransitionCriteria criterion = (TransitionCriteria) converter.convert(expression); RequestContext ctx = getRequestContext(); try { criterion.test(ctx); fail("Non-boolean evaluations are not allowed"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { // success } } @@ -82,22 +81,21 @@ public class TextToTransitionCriteriaTests extends TestCase { String expression = "${&foo<FlowExecutionListener interface for - * use in unit tests. + * Mock implementation of the FlowExecutionListener interface for use in unit tests. * * @author Keith Donald * @author Erwin Vervaet @@ -31,7 +30,7 @@ import org.springframework.webflow.definition.StateDefinition; public class MockFlowExecutionListener extends FlowExecutionListenerAdapter { private boolean sessionStarting; - + private boolean started; private boolean executing; @@ -49,11 +48,11 @@ public class MockFlowExecutionListener extends FlowExecutionListenerAdapter { private int eventsSignaled; private boolean stateEntering; - + private int stateTransitions; private boolean sessionEnding; - + private int exceptionsThrown; /** @@ -78,17 +77,16 @@ public class MockFlowExecutionListener extends FlowExecutionListenerAdapter { } /** - * Returns the nesting level of the currently active flow in the flow - * execution. The root flow is at level 0, a sub flow of the root flow is at - * level 1, and so on. + * Returns the nesting level of the currently active flow in the flow execution. The root flow is at level 0, a sub + * flow of the root flow is at level 1, and so on. */ public int getFlowNestingLevel() { return flowNestingLevel; } /** - * Checks if a request is in process. A request is in process if it was - * submitted but has not yet completed processing. + * Checks if a request is in process. A request is in process if it was submitted but has not yet completed + * processing. */ public boolean isRequestInProcess() { return requestInProcess; @@ -144,27 +142,25 @@ public class MockFlowExecutionListener extends FlowExecutionListenerAdapter { } sessionStarting = true; } - + public void sessionCreated(RequestContext context, FlowSession session) { Assert.state(sessionStarting, "The session should've been starting..."); if (session.isRoot()) { Assert.state(!started, "The flow execution was already started"); executing = true; - } - else { + } else { assertStarted(); flowNestingLevel++; - } + } } - + public void sessionStarted(RequestContext context, FlowSession session) { Assert.state(sessionStarting, "The session should've been starting..."); sessionStarting = false; if (session.isRoot()) { Assert.state(!started, "The flow execution was already started"); started = true; - } - else { + } else { assertStarted(); } } @@ -202,7 +198,7 @@ public class MockFlowExecutionListener extends FlowExecutionListenerAdapter { public void sessionEnding(RequestContext context, FlowSession session, MutableAttributeMap output) { sessionEnding = true; } - + public void sessionEnded(RequestContext context, FlowSession session, AttributeMap output) { assertStarted(); Assert.state(sessionEnding, "Should have been ending"); @@ -211,8 +207,7 @@ public class MockFlowExecutionListener extends FlowExecutionListenerAdapter { Assert.state(flowNestingLevel == 0, "The flow execution should have ended"); started = false; executing = false; - } - else { + } else { flowNestingLevel--; Assert.state(started, "The flow execution prematurely ended"); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/TestAction.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/TestAction.java index 50dbf9b9..8061795e 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/TestAction.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/TestAction.java @@ -22,7 +22,7 @@ import org.springframework.webflow.action.AbstractAction; * Test action for use in unit tests. */ public class TestAction extends AbstractAction { - + private Event result = new Event(this, "success"); private boolean executed; @@ -36,8 +36,7 @@ public class TestAction extends AbstractAction { public TestAction(String result) { if (StringUtils.hasText(result)) { this.result = new Event(this, result); - } - else { + } else { this.result = null; } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerLoaderTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerLoaderTests.java index 3bf90eac..1f3a605f 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerLoaderTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/factory/ConditionalFlowExecutionListenerLoaderTests.java @@ -95,8 +95,7 @@ public class ConditionalFlowExecutionListenerLoaderTests extends TestCase { try { loader.getListeners(null); fail("Should have failed"); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/ClientContinuationFlowExecutionRepositoryTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/ClientContinuationFlowExecutionRepositoryTests.java index 4b9b9b09..8b3485e2 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/ClientContinuationFlowExecutionRepositoryTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/ClientContinuationFlowExecutionRepositoryTests.java @@ -42,7 +42,7 @@ public class ClientContinuationFlowExecutionRepositoryTests extends TestCase { private FlowExecution execution; private FlowExecutionKey key; - + private FlowExecutionLock lock; protected void setUp() throws Exception { @@ -50,7 +50,8 @@ public class ClientContinuationFlowExecutionRepositoryTests extends TestCase { registry.registerFlowDefinition(new StaticFlowDefinitionHolder(new SimpleFlow())); execution = new FlowExecutionImplFactory().createFlowExecution(registry.getFlowDefinition("simpleFlow")); FlowExecutionStateRestorer stateRestorer = new FlowExecutionImplStateRestorer(registry); - repository = new ClientContinuationFlowExecutionRepository(stateRestorer, new SessionBindingConversationManager()); + repository = new ClientContinuationFlowExecutionRepository(stateRestorer, + new SessionBindingConversationManager()); ExternalContextHolder.setExternalContext(new MockExternalContext()); } @@ -98,8 +99,7 @@ public class ClientContinuationFlowExecutionRepositoryTests extends TestCase { try { repository.getFlowExecution(key); fail("should've throw nsfee"); - } - catch (NoSuchFlowExecutionException e) { + } catch (NoSuchFlowExecutionException e) { } lock.unlock(); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/ContinuationFlowExecutionRepositoryTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/ContinuationFlowExecutionRepositoryTests.java index c9ac2073..ae3ea127 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/ContinuationFlowExecutionRepositoryTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/ContinuationFlowExecutionRepositoryTests.java @@ -42,7 +42,7 @@ public class ContinuationFlowExecutionRepositoryTests extends TestCase { private FlowExecution execution; private FlowExecutionKey key; - + private FlowExecutionLock lock; protected void setUp() throws Exception { @@ -98,8 +98,7 @@ public class ContinuationFlowExecutionRepositoryTests extends TestCase { try { repository.getFlowExecution(key); fail("should've throw nsfee"); - } - catch (NoSuchFlowExecutionException e) { + } catch (NoSuchFlowExecutionException e) { } lock.unlock(); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationGroupTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationGroupTests.java index bec8549a..4951ee58 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationGroupTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/FlowExecutionContinuationGroupTests.java @@ -48,7 +48,7 @@ import org.springframework.webflow.test.MockExternalContext; * @author Erwin Vervaet */ public class FlowExecutionContinuationGroupTests extends TestCase { - + public void testUpdateFlowExecution() { FlowExecutionContinuationGroup group = new FlowExecutionContinuationGroup(-1); assertEquals(0, group.getContinuationCount()); @@ -67,7 +67,7 @@ public class FlowExecutionContinuationGroupTests extends TestCase { assertSame(continuation1, group.get("1")); assertSame(updatedContinuation2, group.get("2")); } - + public void testUpdateFlowExecutionWithMaxContinuations() { FlowExecutionContinuationGroup group = new FlowExecutionContinuationGroup(2); FlowExecutionContinuation continuation1 = new TestFlowExecutionContinuation(); @@ -88,8 +88,7 @@ public class FlowExecutionContinuationGroupTests extends TestCase { try { group.get("1"); fail(); - } - catch (ContinuationNotFoundException e) { + } catch (ContinuationNotFoundException e) { // expected } assertSame(updatedContinuation2, group.get("2")); @@ -102,81 +101,79 @@ public class FlowExecutionContinuationGroupTests extends TestCase { try { group.get("3"); fail(); - } - catch (ContinuationNotFoundException e) { + } catch (ContinuationNotFoundException e) { // expected } assertSame(updatedContinuation2, group.get("2")); assertSame(continuation4, group.get("4")); } - + public void testViaFlowExecutor() throws Exception { FlowDefinitionRegistry registry = new FlowDefinitionRegistryImpl(); FlowDefinition testFlow = new FlowAssembler("testFlow", new TestFlowBuilder()).assembleFlow(); registry.registerFlowDefinition(new StaticFlowDefinitionHolder(testFlow)); - + ConversationManager conversationManager = new SessionBindingConversationManager(); - + FlowExecutorFactoryBean flowExecutorFactory = new FlowExecutorFactoryBean(); flowExecutorFactory.setDefinitionLocator(registry); flowExecutorFactory.setConversationManager(conversationManager); flowExecutorFactory.afterPropertiesSet(); - FlowExecutor flowExecutor = (FlowExecutor)flowExecutorFactory.getObject(); + FlowExecutor flowExecutor = (FlowExecutor) flowExecutorFactory.getObject(); MockExternalContext externalContext = new MockExternalContext(); - + GroupGetter groupGetter = new GroupGetter(registry, conversationManager); - //obtain continuation group + // obtain continuation group ResponseInstruction response = flowExecutor.launch("testFlow", externalContext); externalContext.putRequestParameter("_flowExecutionKey", response.getFlowExecutionKey()); FlowExecutionContinuationGroup group = groupGetter.getContinuationGroup(externalContext); assertNotNull(group); - + assertTrue(response.getViewSelection() instanceof FlowExecutionRedirect); assertEquals(1, group.getContinuationCount()); externalContext.putRequestParameter("_flowExecutionKey", response.getFlowExecutionKey()); response = flowExecutor.refresh(response.getFlowExecutionKey(), externalContext); - assertEquals("viewName", ((ApplicationView)response.getViewSelection()).getViewName()); + assertEquals("viewName", ((ApplicationView) response.getViewSelection()).getViewName()); assertEquals(1, group.getContinuationCount()); - + externalContext.putRequestParameter("_flowExecutionKey", response.getFlowExecutionKey()); response = flowExecutor.resume(response.getFlowExecutionKey(), "next", externalContext); assertTrue(response.getViewSelection() instanceof FlowExecutionRedirect); assertEquals(2, group.getContinuationCount()); externalContext.putRequestParameter("_flowExecutionKey", response.getFlowExecutionKey()); response = flowExecutor.refresh(response.getFlowExecutionKey(), externalContext); - assertEquals("nextViewName", ((ApplicationView)response.getViewSelection()).getViewName()); + assertEquals("nextViewName", ((ApplicationView) response.getViewSelection()).getViewName()); assertEquals(2, group.getContinuationCount()); - + externalContext.putRequestParameter("_flowExecutionKey", response.getFlowExecutionKey()); response = flowExecutor.refresh(response.getFlowExecutionKey(), externalContext); - assertEquals("nextViewName", ((ApplicationView)response.getViewSelection()).getViewName()); + assertEquals("nextViewName", ((ApplicationView) response.getViewSelection()).getViewName()); assertEquals(2, group.getContinuationCount()); externalContext.putRequestParameter("_flowExecutionKey", response.getFlowExecutionKey()); response = flowExecutor.resume(response.getFlowExecutionKey(), "end", externalContext); - + try { groupGetter.getContinuationGroup(externalContext); fail(); - } - catch (NoSuchFlowExecutionException e) { + } catch (NoSuchFlowExecutionException e) { // expected } } - + private static class TestFlowExecutionContinuation extends FlowExecutionContinuation { - + public FlowExecution unmarshal() throws ContinuationUnmarshalException { return null; } - + public byte[] toByteArray() { return new byte[0]; } } - + private static class TestFlowBuilder extends AbstractFlowBuilder { public void buildStates() throws FlowBuilderException { addViewState("viewState", "viewName", transition(on("next"), to("nextViewState"))); @@ -184,28 +181,26 @@ public class FlowExecutionContinuationGroupTests extends TestCase { addEndState("endState"); } } - + private static class GroupGetter extends ContinuationFlowExecutionRepository { - + public GroupGetter(FlowDefinitionLocator definitionLocator, ConversationManager conversationManager) { super(new FlowExecutionImplStateRestorer(definitionLocator), conversationManager); } - + public FlowExecutionContinuationGroup getContinuationGroup(ExternalContext externalContext) { ExternalContextHolder.setExternalContext(externalContext); try { - FlowExecutionKey key = parseFlowExecutionKey( - new RequestParameterFlowExecutorArgumentHandler().extractFlowExecutionKey(externalContext)); + FlowExecutionKey key = parseFlowExecutionKey(new RequestParameterFlowExecutorArgumentHandler() + .extractFlowExecutionKey(externalContext)); FlowExecutionLock lock = getLock(key); lock.lock(); try { return getContinuationGroup(key); - } - finally { + } finally { lock.unlock(); } - } - finally { + } finally { ExternalContextHolder.setExternalContext(null); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuationTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuationTests.java index 00c80cbf..9c103d9b 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuationTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/continuation/SerializedFlowExecutionContinuationTests.java @@ -32,7 +32,7 @@ import org.springframework.webflow.test.MockExternalContext; * @author Keith Donald */ public class SerializedFlowExecutionContinuationTests extends TestCase { - + public void testCreate() throws Exception { FlowDefinition flow = new SimpleFlow(); FlowExecution execution = new FlowExecutionImplFactory().createFlowExecution(flow); @@ -41,16 +41,15 @@ public class SerializedFlowExecutionContinuationTests extends TestCase { assertTrue(c.isCompressed()); byte[] array = c.toByteArray(); execution = c.unmarshal(); - - ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(array)); - try { - c = (SerializedFlowExecutionContinuation)ois.readObject(); - assertTrue(c.isCompressed()); - execution = c.unmarshal(); - } - finally { - ois.close(); - } + + ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(array)); + try { + c = (SerializedFlowExecutionContinuation) ois.readObject(); + assertTrue(c.isCompressed()); + execution = c.unmarshal(); + } finally { + ois.close(); + } } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/support/SimpleFlowExecutionRepositoryTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/support/SimpleFlowExecutionRepositoryTests.java index df641b55..120465b8 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/support/SimpleFlowExecutionRepositoryTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/repository/support/SimpleFlowExecutionRepositoryTests.java @@ -42,7 +42,7 @@ public class SimpleFlowExecutionRepositoryTests extends TestCase { private FlowExecution execution; private FlowExecutionKey key; - + private FlowExecutionLock lock; protected void setUp() throws Exception { @@ -91,8 +91,7 @@ public class SimpleFlowExecutionRepositoryTests extends TestCase { try { repository.getFlowExecution(key); fail("Should've failed"); - } - catch (PermissionDeniedFlowExecutionAccessException e) { + } catch (PermissionDeniedFlowExecutionAccessException e) { } lock.unlock(); } @@ -111,8 +110,7 @@ public class SimpleFlowExecutionRepositoryTests extends TestCase { try { repository.getFlowExecution(key); fail("should've throw nsfee"); - } - catch (NoSuchFlowExecutionException e) { + } catch (NoSuchFlowExecutionException e) { } lock.unlock(); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/support/ApplicationViewTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/support/ApplicationViewTests.java index d25f0efd..dd5d83cb 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/support/ApplicationViewTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/support/ApplicationViewTests.java @@ -35,10 +35,10 @@ public class ApplicationViewTests extends TestCase { try { view.getModel().put("foo", "bar"); } catch (UnsupportedOperationException e) { - + } } - + public void testNullParams() { ApplicationView view = new ApplicationView(null, null); assertEquals(0, view.getModel().size()); @@ -46,7 +46,7 @@ public class ApplicationViewTests extends TestCase { ApplicationView view2 = new ApplicationView(null, null); assertEquals(view, view2); } - + public void testMapLookup() { ApplicationView view = new ApplicationView("view", null); Map map = new HashMap(); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/support/EventFactorySupportTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/support/EventFactorySupportTests.java index d1818f88..b52031ae 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/support/EventFactorySupportTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/support/EventFactorySupportTests.java @@ -25,9 +25,9 @@ import org.springframework.webflow.execution.Event; public class EventFactorySupportTests extends TestCase { private EventFactorySupport support = new EventFactorySupport(); - + private Object source = new Object(); - + protected void setUp() throws Exception { } @@ -36,7 +36,7 @@ public class EventFactorySupportTests extends TestCase { assertEquals("success", e.getId()); assertSame(source, e.getSource()); } - + public void testSuccessWithResult() { Object result = new Object(); Event e = support.success(source, result); @@ -58,7 +58,7 @@ public class EventFactorySupportTests extends TestCase { assertSame(source, e.getSource()); assertSame(ex, e.getAttributes().get("exception")); } - + public void testYes() { Event e = support.yes(source); assertEquals("yes", e.getId()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/support/ExternalRedirectTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/support/ExternalRedirectTests.java index b3cc9484..76732867 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/support/ExternalRedirectTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/support/ExternalRedirectTests.java @@ -23,7 +23,7 @@ import junit.framework.TestCase; public class ExternalRedirectTests extends TestCase { private ExternalRedirect redirect; - + protected void setUp() throws Exception { } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/execution/support/FlowDefinitionRedirectTests.java b/spring-webflow/src/test/java/org/springframework/webflow/execution/support/FlowDefinitionRedirectTests.java index 21cd0a77..91f592fe 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/execution/support/FlowDefinitionRedirectTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/execution/support/FlowDefinitionRedirectTests.java @@ -35,20 +35,20 @@ public class FlowDefinitionRedirectTests extends TestCase { try { redirect.getExecutionInput().put("foo", "bar"); } catch (UnsupportedOperationException e) { - + } } - + public void testNullParams() { try { new FlowDefinitionRedirect(null, null); fail("was null"); } catch (IllegalArgumentException e) { - + } } - + public void testMapLookup() { FlowDefinitionRedirect redirect = new FlowDefinitionRedirect("foo", null); Map map = new HashMap(); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/FlowExecutorIntegrationTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/FlowExecutorIntegrationTests.java index 32532e05..f9bfb7b6 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/FlowExecutorIntegrationTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/FlowExecutorIntegrationTests.java @@ -36,7 +36,8 @@ public class FlowExecutorIntegrationTests extends AbstractDependencyInjectionSpr } protected String[] getConfigLocations() { - return new String[] { "org/springframework/webflow/executor/context.xml", "org/springframework/webflow/executor/repository-simple.xml" }; + return new String[] { "org/springframework/webflow/executor/context.xml", + "org/springframework/webflow/executor/repository-simple.xml" }; } public void testConfigurationOk() { @@ -50,7 +51,7 @@ public class FlowExecutorIntegrationTests extends AbstractDependencyInjectionSpr assertTrue(response.getFlowExecutionContext().isActive()); assertEquals("viewState1", response.getFlowExecutionContext().getActiveSession().getState().getId()); assertTrue(response.isApplicationView()); - ApplicationView view = (ApplicationView)response.getViewSelection(); + ApplicationView view = (ApplicationView) response.getViewSelection(); assertEquals("view1", view.getViewName()); assertEquals(0, view.getModel().size()); } @@ -61,8 +62,7 @@ public class FlowExecutorIntegrationTests extends AbstractDependencyInjectionSpr new MockHttpServletRequest(), new MockHttpServletResponse()); flowExecutor.launch("bogus", context); fail("no such flow expected"); - } - catch (NoSuchFlowDefinitionException e) { + } catch (NoSuchFlowDefinitionException e) { assertEquals("bogus", e.getFlowId()); } } @@ -78,11 +78,11 @@ public class FlowExecutorIntegrationTests extends AbstractDependencyInjectionSpr assertEquals("viewState2", response.getFlowExecutionContext().getActiveSession().getState().getId()); assertTrue(response.isApplicationView()); assertNotNull(response.getFlowExecutionKey()); - ApplicationView view = (ApplicationView)response.getViewSelection(); + ApplicationView view = (ApplicationView) response.getViewSelection(); assertEquals("view2", view.getViewName()); assertEquals(0, view.getModel().size()); response = flowExecutor.resume(response.getFlowExecutionKey(), "event1", context); - view = (ApplicationView)response.getViewSelection(); + view = (ApplicationView) response.getViewSelection(); assertFalse(response.getFlowExecutionContext().isActive()); assertTrue(response.isApplicationView()); assertNull(response.getFlowExecutionKey()); @@ -91,8 +91,7 @@ public class FlowExecutorIntegrationTests extends AbstractDependencyInjectionSpr try { flowExecutor.resume(key, "event1", context); fail("Should've been removed"); - } - catch (NoSuchFlowExecutionException e) { + } catch (NoSuchFlowExecutionException e) { } } @@ -109,8 +108,7 @@ public class FlowExecutorIntegrationTests extends AbstractDependencyInjectionSpr try { flowExecutor.resume("_cbogus_kbogus", "bogus", new MockExternalContext()); fail("Should've failed"); - } - catch (NoSuchFlowExecutionException e) { + } catch (NoSuchFlowExecutionException e) { assertEquals("_cbogus_kbogus", e.getFlowExecutionKey().toString()); } } @@ -123,8 +121,7 @@ public class FlowExecutorIntegrationTests extends AbstractDependencyInjectionSpr try { flowExecutor.resume(key, "bogus", context); fail("Should've been removed"); - } - catch (NoMatchingTransitionException e) { + } catch (NoMatchingTransitionException e) { assertEquals("flow", e.getFlowId()); assertEquals("viewState1", e.getStateId()); assertEquals("bogus", e.getEvent().getId()); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowNavigationHandlerArgumentExtractorTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowNavigationHandlerArgumentExtractorTests.java index 65de8fca..3b1671c3 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowNavigationHandlerArgumentExtractorTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowNavigationHandlerArgumentExtractorTests.java @@ -20,11 +20,11 @@ import junit.framework.TestCase; import org.springframework.webflow.executor.support.FlowExecutorArgumentExtractionException; public class FlowNavigationHandlerArgumentExtractorTests extends TestCase { - + private FlowNavigationHandlerArgumentExtractor extractor; - + private MockFacesContext facesContext; - + protected void setUp() throws Exception { extractor = new FlowNavigationHandlerArgumentExtractor(); facesContext = new MockFacesContext(); @@ -44,8 +44,7 @@ public class FlowNavigationHandlerArgumentExtractorTests extends TestCase { try { extractor.extractFlowId(context); fail(); - } - catch (FlowExecutorArgumentExtractionException e) { + } catch (FlowExecutorArgumentExtractionException e) { // expected } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowPropertyResolverTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowPropertyResolverTests.java index d6fdf2c7..ae0998ff 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowPropertyResolverTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowPropertyResolverTests.java @@ -38,7 +38,7 @@ public class FlowPropertyResolverTests extends TestCase { protected void setUp() throws Exception { resolver = new FlowPropertyResolver(new OriginalPropertyResolver()); - flowEx = (FlowExecution)EasyMock.createMock(FlowExecution.class); + flowEx = (FlowExecution) EasyMock.createMock(FlowExecution.class); } protected void tearDown() throws Exception { @@ -64,8 +64,7 @@ public class FlowPropertyResolverTests extends TestCase { try { resolver.getValue(flowEx, 2); fail("not legal to get flow property by index"); - } - catch (ReferenceSyntaxException e) { + } catch (ReferenceSyntaxException e) { // expected } } @@ -84,8 +83,7 @@ public class FlowPropertyResolverTests extends TestCase { try { resolver.setValue(flowEx, 2, "whatever"); fail("not legal to set flow property by index"); - } - catch (ReferenceSyntaxException e) { + } catch (ReferenceSyntaxException e) { // expected } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowVariableResolverTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowVariableResolverTests.java index 64138c95..9c6752d1 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowVariableResolverTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/FlowVariableResolverTests.java @@ -59,15 +59,14 @@ public class FlowVariableResolverTests extends TestCase { try { tested.resolveVariable(mockFacesContext, "flowScope"); fail("EvaluationException expected"); - } - catch (EvaluationException expected) { - + } catch (EvaluationException expected) { + } assertFalse("resolved using delegate", variableResolver.resolvedUsingDelegate); } public void testResolveVariableFlowScopeWithThreadLocal() { - FlowExecution flowExecutionMock = (FlowExecution)EasyMock.createMock(FlowExecution.class); + FlowExecution flowExecutionMock = (FlowExecution) EasyMock.createMock(FlowExecution.class); FlowExecutionKey key = null; FlowExecutionHolder holder = new FlowExecutionHolder(key, flowExecutionMock, null); FlowExecutionHolderUtils.setFlowExecutionHolder(holder, mockFacesContext); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/MockFacesContext.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/MockFacesContext.java index cfefb09c..5d50247e 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/MockFacesContext.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/jsf/MockFacesContext.java @@ -28,15 +28,12 @@ import javax.faces.context.ResponseWriter; import javax.faces.render.RenderKit; /** - * Mock implementation of the FacesContext class to facilitate - * standalone Action unit tests. + * Mock implementation of the FacesContext class to facilitate standalone Action unit tests. *

    - * NOT intended to be used for anything but standalone unit tests. This is a - * simple state holder, a stub implementation, at least if you follow Martin - * Fowler's reasoning. This class is called MockFacesContext to be - * consistent with the naming convention in the rest of the Spring framework - * (e.g. MockHttpServletRequest, ...). + * NOT intended to be used for anything but standalone unit tests. This is a simple state holder, a stub + * implementation, at least if you follow Martin + * Fowler's reasoning. This class is called MockFacesContext to be consistent with the naming convention in + * the rest of the Spring framework (e.g. MockHttpServletRequest, ...). * * @see javax.faces.context.FacesContext * diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/mvc/FlowControllerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/mvc/FlowControllerTests.java index d24e937a..bf476ec1 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/mvc/FlowControllerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/mvc/FlowControllerTests.java @@ -36,7 +36,7 @@ import org.springframework.webflow.executor.FlowExecutorImpl; * Unit tests for {@link FlowController}. */ public class FlowControllerTests extends TestCase { - + private FlowController controller = new FlowController(); public void setUp() { @@ -65,12 +65,12 @@ public class FlowControllerTests extends TestCase { MockHttpServletResponse response = new MockHttpServletResponse(); request.addParameter("_flowId", "simpleFlow"); ModelAndView mv = controller.handleRequestInternal(request, response); - request.addParameter("_flowExecutionKey", (String)mv.getModel().get("flowExecutionKey")); + request.addParameter("_flowExecutionKey", (String) mv.getModel().get("flowExecutionKey")); request.addParameter("_eventId", "submit"); mv = controller.handleRequest(request, response); assertNull(mv.getViewName()); assertTrue(mv.getView() instanceof RedirectView); - RedirectView rv = (RedirectView)mv.getView(); + RedirectView rv = (RedirectView) mv.getView(); assertEquals("confirm", rv.getUrl()); assertNull(mv.getModel().get("flowExecutionKey")); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/mvc/PortletFlowControllerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/mvc/PortletFlowControllerTests.java index d25b419d..040a987d 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/mvc/PortletFlowControllerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/mvc/PortletFlowControllerTests.java @@ -37,7 +37,7 @@ import org.springframework.webflow.executor.FlowExecutorImpl; * Unit tests for {@link PortletFlowController}. */ public class PortletFlowControllerTests extends TestCase { - + private PortletFlowController controller = new PortletFlowController(); public void setUp() { @@ -71,12 +71,11 @@ public class PortletFlowControllerTests extends TestCase { actionRequest.setSession(renderRequest.getPortletSession()); actionRequest.setContextPath("/app"); MockActionResponse actionResponse = new MockActionResponse(); - actionRequest.addParameter("_flowExecutionKey", (String)mv.getModel().get("flowExecutionKey")); + actionRequest.addParameter("_flowExecutionKey", (String) mv.getModel().get("flowExecutionKey")); actionRequest.addParameter("_eventId", "submit"); try { controller.handleActionRequest(actionRequest, actionResponse); - } - catch (IllegalArgumentException e) { + } catch (IllegalArgumentException e) { } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/struts/FlowActionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/struts/FlowActionTests.java index 2f76b26d..585bbdb3 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/struts/FlowActionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/struts/FlowActionTests.java @@ -41,7 +41,7 @@ import org.springframework.webflow.executor.FlowExecutorImpl; * Unit tests for {@link FlowAction}. */ public class FlowActionTests extends TestCase { - + private FlowAction action; public void setUp() { diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/support/FlowIdMappingArgumentHandlerWrapperTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/support/FlowIdMappingArgumentHandlerWrapperTests.java index 7b93d02c..9f3ecbce 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/support/FlowIdMappingArgumentHandlerWrapperTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/support/FlowIdMappingArgumentHandlerWrapperTests.java @@ -30,9 +30,9 @@ import org.springframework.webflow.test.MockExternalContext; * @author Erwin Vervaet */ public class FlowIdMappingArgumentHandlerWrapperTests extends TestCase { - + private FlowIdMappingArgumentHandlerWrapper argumentHandler; - + protected void setUp() throws Exception { this.argumentHandler = new FlowIdMappingArgumentHandlerWrapper(); this.argumentHandler.setArgumentHandler(new RequestPathFlowExecutorArgumentHandler()); @@ -42,10 +42,10 @@ public class FlowIdMappingArgumentHandlerWrapperTests extends TestCase { argumentHandler.setMappings(mappings); argumentHandler.addMapping("C", "X"); } - + public void testMappingNoFallback() { argumentHandler.setFallback(false); - + assertTrue(argumentHandler.isFlowIdPresent(context("A"))); assertEquals("X", argumentHandler.extractFlowId(context("A"))); assertTrue(argumentHandler.isFlowIdPresent(context("B"))); @@ -57,22 +57,20 @@ public class FlowIdMappingArgumentHandlerWrapperTests extends TestCase { try { argumentHandler.extractFlowId(context("X")); fail(); - } - catch (FlowExecutorArgumentExtractionException e) { + } catch (FlowExecutorArgumentExtractionException e) { // expected } try { argumentHandler.extractFlowId(context("")); fail(); - } - catch (FlowExecutorArgumentExtractionException e) { + } catch (FlowExecutorArgumentExtractionException e) { // expected } } - + public void testMappingFallback() { argumentHandler.setFallback(true); - + assertTrue(argumentHandler.isFlowIdPresent(context("A"))); assertEquals("X", argumentHandler.extractFlowId(context("A"))); assertTrue(argumentHandler.isFlowIdPresent(context("B"))); @@ -86,52 +84,50 @@ public class FlowIdMappingArgumentHandlerWrapperTests extends TestCase { try { argumentHandler.extractFlowId(context("")); fail(); - } - catch (FlowExecutorArgumentExtractionException e) { - //expected - } - } - - public void testReverseMappingNoFallBack() { - argumentHandler.setFallback(false); - - assertEquals("/app/flows/C", argumentHandler.createFlowDefinitionUrl(redirect("X"), context())); - assertEquals("/app/flows/B", argumentHandler.createFlowDefinitionUrl(redirect("Y"), context())); - - try { - argumentHandler.createFlowDefinitionUrl(redirect("Z"), context()); - fail(); - } - catch (IllegalArgumentException e) { + } catch (FlowExecutorArgumentExtractionException e) { // expected } } - + + public void testReverseMappingNoFallBack() { + argumentHandler.setFallback(false); + + assertEquals("/app/flows/C", argumentHandler.createFlowDefinitionUrl(redirect("X"), context())); + assertEquals("/app/flows/B", argumentHandler.createFlowDefinitionUrl(redirect("Y"), context())); + + try { + argumentHandler.createFlowDefinitionUrl(redirect("Z"), context()); + fail(); + } catch (IllegalArgumentException e) { + // expected + } + } + public void testReverseMappingFallback() { argumentHandler.setFallback(true); - + assertEquals("/app/flows/C", argumentHandler.createFlowDefinitionUrl(redirect("X"), context())); assertEquals("/app/flows/B", argumentHandler.createFlowDefinitionUrl(redirect("Y"), context())); assertEquals("/app/flows/Z", argumentHandler.createFlowDefinitionUrl(redirect("Z"), context())); } - + public void testWithRequestParameters() { argumentHandler.setArgumentHandler(new RequestParameterFlowExecutorArgumentHandler()); // mapping assertTrue(argumentHandler.isFlowIdPresent(contextWithParam("A"))); assertEquals("X", argumentHandler.extractFlowId(contextWithParam("A"))); - + // reverse mapping assertEquals("/app/flows?_flowId=C", argumentHandler.createFlowDefinitionUrl(redirect("X"), context())); } // internal helpers - + private MockExternalContext context() { return context(""); } - + private MockExternalContext context(String flowId) { MockExternalContext context = new MockExternalContext(); context.setContextPath("/app"); @@ -141,13 +137,13 @@ public class FlowIdMappingArgumentHandlerWrapperTests extends TestCase { } return context; } - + private MockExternalContext contextWithParam(String flowId) { MockExternalContext context = context(); context.putRequestParameter("_flowId", flowId); return context; } - + private FlowDefinitionRedirect redirect(String flowId) { return new FlowDefinitionRedirect(flowId, Collections.EMPTY_MAP); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/support/FlowRequestHandlerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/support/FlowRequestHandlerTests.java index 18fb8c4d..bdbf075d 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/support/FlowRequestHandlerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/support/FlowRequestHandlerTests.java @@ -92,7 +92,7 @@ public class FlowRequestHandlerTests extends TestCase { assertEquals("flow", response.getFlowExecutionContext().getDefinition().getId()); assertEquals("view", response.getFlowExecutionContext().getActiveSession().getState().getId()); } - + protected TargetStateResolver to(String stateId) { return new DefaultTargetStateResolver(stateId); } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/support/RequestParameterFlowExecutorArgumentHandlerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/support/RequestParameterFlowExecutorArgumentHandlerTests.java index 84f85cb2..80a07234 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/support/RequestParameterFlowExecutorArgumentHandlerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/support/RequestParameterFlowExecutorArgumentHandlerTests.java @@ -30,7 +30,7 @@ import org.springframework.webflow.test.MockFlowExecutionContext; * Unit tests for {@link RequestParameterFlowExecutorArgumentHandler}. */ public class RequestParameterFlowExecutorArgumentHandlerTests extends TestCase { - + private MockExternalContext context; private FlowExecutorArgumentHandler argumentHandler; @@ -57,8 +57,7 @@ public class RequestParameterFlowExecutorArgumentHandlerTests extends TestCase { try { argumentHandler.extractFlowId(context); fail("no flow id provided"); - } - catch (FlowExecutorArgumentExtractionException e) { + } catch (FlowExecutorArgumentExtractionException e) { } } @@ -72,8 +71,7 @@ public class RequestParameterFlowExecutorArgumentHandlerTests extends TestCase { try { argumentHandler.extractFlowExecutionKey(context); fail("no flow execution key provided"); - } - catch (FlowExecutorArgumentExtractionException e) { + } catch (FlowExecutorArgumentExtractionException e) { } } @@ -93,20 +91,15 @@ public class RequestParameterFlowExecutorArgumentHandlerTests extends TestCase { try { argumentHandler.extractEventId(context); fail("no event id provided"); - } - catch (FlowExecutorArgumentExtractionException e) { + } catch (FlowExecutorArgumentExtractionException e) { } } public void testCreateFlowUrl() { /* - * Scenario: - * Context root: /app - * Dispatcher mapping in web.xml: *.htm - * Controller mapping: /flows.htm - * So full request URI will be - * /app/flows.htm + * Scenario: Context root: /app Dispatcher mapping in web.xml: *.htm Controller mapping: /flows.htm So full + * request URI will be /app/flows.htm */ context.setContextPath("/app"); context.setDispatcherPath("/flows.htm"); @@ -117,12 +110,8 @@ public class RequestParameterFlowExecutorArgumentHandlerTests extends TestCase { public void testCreateFlowUrlRequestPath() { /* - * Scenario: - * Context root: /app - * Dispatcher mapping in web.xml: /system/* - * Controller mapping: /flows.htm - * So full request URI will be - * /app/system/flows.htm + * Scenario: Context root: /app Dispatcher mapping in web.xml: /system/* Controller mapping: /flows.htm So full + * request URI will be /app/system/flows.htm */ context.setContextPath("/app"); context.setDispatcherPath("/system"); @@ -140,18 +129,14 @@ public class RequestParameterFlowExecutorArgumentHandlerTests extends TestCase { input.put("baz", new Integer(3)); FlowDefinitionRedirect redirect = new FlowDefinitionRedirect("flow", input); String url = argumentHandler.createFlowDefinitionUrl(redirect, context); - assertTrue("/app/flows.htm?_flowId=flow&foo=bar&baz=3".equals(url) || - "/app/flows.htm?_flowId=flow&baz=3&foo=bar".equals(url)); + assertTrue("/app/flows.htm?_flowId=flow&foo=bar&baz=3".equals(url) + || "/app/flows.htm?_flowId=flow&baz=3&foo=bar".equals(url)); } public void testCreateFlowExecutionUrl() { /* - * Scenario: - * Context root: /app - * Dispatcher mapping in web.xml: *.htm - * Controller mapping: /flows.htm - * So full request URI will be - * /app/flows.htm + * Scenario: Context root: /app Dispatcher mapping in web.xml: *.htm Controller mapping: /flows.htm So full + * request URI will be /app/flows.htm */ context.setContextPath("/app"); context.setDispatcherPath("/flows.htm"); @@ -162,12 +147,8 @@ public class RequestParameterFlowExecutorArgumentHandlerTests extends TestCase { public void testCreateFlowExecutionUrlRequestPath() { /* - * Scenario: - * Context root: /app - * Dispatcher mapping in web.xml: /system/* - * Controller mapping: /flows.htm - * So full request URI will be - * /app/system/flows.htm + * Scenario: Context root: /app Dispatcher mapping in web.xml: /system/* Controller mapping: /flows.htm So full + * request URI will be /app/system/flows.htm */ context.setContextPath("/app"); context.setDispatcherPath("/system"); @@ -176,7 +157,7 @@ public class RequestParameterFlowExecutorArgumentHandlerTests extends TestCase { String url = argumentHandler.createFlowExecutionUrl(flowExecutionKey, flowExecution, context); assertEquals("/app/system/flows.htm?_flowExecutionKey=_c12345_k12345", url); } - + public void testCreateExternalUrlAbsolute() { context.setContextPath("/app"); context.setDispatcherPath("/flows.htm"); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/executor/support/RequestPathFlowExecutorArgumentHandlerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/executor/support/RequestPathFlowExecutorArgumentHandlerTests.java index 0cf4dcd9..6a7f8edb 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/executor/support/RequestPathFlowExecutorArgumentHandlerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/executor/support/RequestPathFlowExecutorArgumentHandlerTests.java @@ -29,7 +29,7 @@ import org.springframework.webflow.test.MockFlowExecutionContext; * Unit tests for {@link RequestPathFlowExecutorArgumentHandler}. */ public class RequestPathFlowExecutorArgumentHandlerTests extends TestCase { - + private MockExternalContext context = new MockExternalContext(); private RequestPathFlowExecutorArgumentHandler argumentHandler; @@ -56,8 +56,7 @@ public class RequestPathFlowExecutorArgumentHandlerTests extends TestCase { try { argumentHandler.extractFlowId(new MockExternalContext()); fail("should've failed"); - } - catch (FlowExecutorArgumentExtractionException e) { + } catch (FlowExecutorArgumentExtractionException e) { } } @@ -87,7 +86,7 @@ public class RequestPathFlowExecutorArgumentHandlerTests extends TestCase { String url = argumentHandler.createFlowExecutionUrl(flowExecutionKey, flowExecution, context); assertEquals("/app/flows/k/_c12345_k12345", url); } - + public void testIsFlowExecutionKeyPresent() { context.setContextPath("/app"); context.setDispatcherPath("/flows"); @@ -96,7 +95,7 @@ public class RequestPathFlowExecutorArgumentHandlerTests extends TestCase { context.setRequestPathInfo("/sellitem"); assertFalse(argumentHandler.isFlowExecutionKeyPresent(context)); } - + public void testExtractFlowExecutionKey() { context.setContextPath("/app"); context.setDispatcherPath("/flows"); diff --git a/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java b/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java index c63ea978..4aa9283f 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/test/SearchFlowExecutionTests.java @@ -69,15 +69,16 @@ public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests { } protected FlowDefinitionResource getFlowDefinitionResource() { - return new FlowDefinitionResource("search-flow", - new ClassPathResource("search-flow.xml", SearchFlowExecutionTests.class)); + return new FlowDefinitionResource("search-flow", new ClassPathResource("search-flow.xml", + SearchFlowExecutionTests.class)); } protected void registerMockServices(MockFlowServiceLocator serviceRegistry) { 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 @@ -86,9 +87,9 @@ public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests { serviceRegistry.registerSubflow(mockDetailFlow); serviceRegistry.registerBean("phonebook", new TestPhoneBook()); } - + public static class TestPhoneBook { - + public List search(Object criteria) { ArrayList res = new ArrayList(); res.add(new Object()); @@ -102,7 +103,7 @@ public class SearchFlowExecutionTests extends AbstractXmlFlowExecutionTests { public Object getPerson(String userId) { return new Object(); } - + } } \ No newline at end of file diff --git a/spring-webflow/src/test/java/org/springframework/webflow/util/Base64Tests.java b/spring-webflow/src/test/java/org/springframework/webflow/util/Base64Tests.java index 04c92363..5545ccf7 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/util/Base64Tests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/util/Base64Tests.java @@ -23,8 +23,7 @@ import java.util.Random; import junit.framework.TestCase; /** - * Test case for {@link Base64}. - * Based on Base64Test from Jakarta Commons Codec 1.3. + * Test case for {@link Base64}. Based on Base64Test from Jakarta Commons Codec 1.3. * * @author Erwin Vervaet */ @@ -45,18 +44,18 @@ public class Base64Tests extends TestCase { assertEquals("A", new String(new Base64().decodeFromString("QQ=="))); assertEquals("A", new String(new Base64(true).decodeFromString("QQ.."))); } - + public void testDecodePadMarkerIndex3() { assertEquals("AA", new String(new Base64().decodeFromString("QUE="))); assertEquals("AAA", new String(new Base64().decodeFromString("QUFB"))); assertEquals("AA", new String(new Base64(true).decodeFromString("QUE."))); assertEquals("AAA", new String(new Base64(true).decodeFromString("QUFB"))); } - + public void testEncodeEmptyString() { assertEquals("", new Base64().encodeToString("".getBytes())); } - + public void testDecodeEmptyString() { assertEquals("", new String(new Base64().decodeFromString(""))); } @@ -68,445 +67,445 @@ public class Base64Tests extends TestCase { this.getRandom().nextBytes(data); byte[] enc = new Base64().encode(data); byte[] data2 = new Base64().decode(enc); - assertTrue(Arrays.equals(data,data2)); + assertTrue(Arrays.equals(data, data2)); } } // encode/decode a large random array public void testEncodeDecodeRandom() { - for(int i = 1;i < 5; i++) { + for (int i = 1; i < 5; i++) { byte[] data = new byte[this.getRandom().nextInt(10000) + 1]; this.getRandom().nextBytes(data); byte[] enc = new Base64().encode(data); byte[] data2 = new Base64().decode(enc); - assertTrue(Arrays.equals(data,data2)); + assertTrue(Arrays.equals(data, data2)); } } public void testSingletons() { - assertEquals("AA==", new String(new Base64().encode(new byte[] { (byte)0 }))); - assertEquals("AQ==", new String(new Base64().encode(new byte[] { (byte)1 }))); - assertEquals("Ag==", new String(new Base64().encode(new byte[] { (byte)2 }))); - assertEquals("Aw==", new String(new Base64().encode(new byte[] { (byte)3 }))); - assertEquals("BA==", new String(new Base64().encode(new byte[] { (byte)4 }))); - assertEquals("BQ==", new String(new Base64().encode(new byte[] { (byte)5 }))); - assertEquals("Bg==", new String(new Base64().encode(new byte[] { (byte)6 }))); - assertEquals("Bw==", new String(new Base64().encode(new byte[] { (byte)7 }))); - assertEquals("CA==", new String(new Base64().encode(new byte[] { (byte)8 }))); - assertEquals("CQ==", new String(new Base64().encode(new byte[] { (byte)9 }))); - assertEquals("Cg==", new String(new Base64().encode(new byte[] { (byte)10 }))); - assertEquals("Cw==", new String(new Base64().encode(new byte[] { (byte)11 }))); - assertEquals("DA==", new String(new Base64().encode(new byte[] { (byte)12 }))); - assertEquals("DQ==", new String(new Base64().encode(new byte[] { (byte)13 }))); - assertEquals("Dg==", new String(new Base64().encode(new byte[] { (byte)14 }))); - assertEquals("Dw==", new String(new Base64().encode(new byte[] { (byte)15 }))); - assertEquals("EA==", new String(new Base64().encode(new byte[] { (byte)16 }))); - assertEquals("EQ==", new String(new Base64().encode(new byte[] { (byte)17 }))); - assertEquals("Eg==", new String(new Base64().encode(new byte[] { (byte)18 }))); - assertEquals("Ew==", new String(new Base64().encode(new byte[] { (byte)19 }))); - assertEquals("FA==", new String(new Base64().encode(new byte[] { (byte)20 }))); - assertEquals("FQ==", new String(new Base64().encode(new byte[] { (byte)21 }))); - assertEquals("Fg==", new String(new Base64().encode(new byte[] { (byte)22 }))); - assertEquals("Fw==", new String(new Base64().encode(new byte[] { (byte)23 }))); - assertEquals("GA==", new String(new Base64().encode(new byte[] { (byte)24 }))); - assertEquals("GQ==", new String(new Base64().encode(new byte[] { (byte)25 }))); - assertEquals("Gg==", new String(new Base64().encode(new byte[] { (byte)26 }))); - assertEquals("Gw==", new String(new Base64().encode(new byte[] { (byte)27 }))); - assertEquals("HA==", new String(new Base64().encode(new byte[] { (byte)28 }))); - assertEquals("HQ==", new String(new Base64().encode(new byte[] { (byte)29 }))); - assertEquals("Hg==", new String(new Base64().encode(new byte[] { (byte)30 }))); - assertEquals("Hw==", new String(new Base64().encode(new byte[] { (byte)31 }))); - assertEquals("IA==", new String(new Base64().encode(new byte[] { (byte)32 }))); - assertEquals("IQ==", new String(new Base64().encode(new byte[] { (byte)33 }))); - assertEquals("Ig==", new String(new Base64().encode(new byte[] { (byte)34 }))); - assertEquals("Iw==", new String(new Base64().encode(new byte[] { (byte)35 }))); - assertEquals("JA==", new String(new Base64().encode(new byte[] { (byte)36 }))); - assertEquals("JQ==", new String(new Base64().encode(new byte[] { (byte)37 }))); - assertEquals("Jg==", new String(new Base64().encode(new byte[] { (byte)38 }))); - assertEquals("Jw==", new String(new Base64().encode(new byte[] { (byte)39 }))); - assertEquals("KA==", new String(new Base64().encode(new byte[] { (byte)40 }))); - assertEquals("KQ==", new String(new Base64().encode(new byte[] { (byte)41 }))); - assertEquals("Kg==", new String(new Base64().encode(new byte[] { (byte)42 }))); - assertEquals("Kw==", new String(new Base64().encode(new byte[] { (byte)43 }))); - assertEquals("LA==", new String(new Base64().encode(new byte[] { (byte)44 }))); - assertEquals("LQ==", new String(new Base64().encode(new byte[] { (byte)45 }))); - assertEquals("Lg==", new String(new Base64().encode(new byte[] { (byte)46 }))); - assertEquals("Lw==", new String(new Base64().encode(new byte[] { (byte)47 }))); - assertEquals("MA==", new String(new Base64().encode(new byte[] { (byte)48 }))); - assertEquals("MQ==", new String(new Base64().encode(new byte[] { (byte)49 }))); - assertEquals("Mg==", new String(new Base64().encode(new byte[] { (byte)50 }))); - assertEquals("Mw==", new String(new Base64().encode(new byte[] { (byte)51 }))); - assertEquals("NA==", new String(new Base64().encode(new byte[] { (byte)52 }))); - assertEquals("NQ==", new String(new Base64().encode(new byte[] { (byte)53 }))); - assertEquals("Ng==", new String(new Base64().encode(new byte[] { (byte)54 }))); - assertEquals("Nw==", new String(new Base64().encode(new byte[] { (byte)55 }))); - assertEquals("OA==", new String(new Base64().encode(new byte[] { (byte)56 }))); - assertEquals("OQ==", new String(new Base64().encode(new byte[] { (byte)57 }))); - assertEquals("Og==", new String(new Base64().encode(new byte[] { (byte)58 }))); - assertEquals("Ow==", new String(new Base64().encode(new byte[] { (byte)59 }))); - assertEquals("PA==", new String(new Base64().encode(new byte[] { (byte)60 }))); - assertEquals("PQ==", new String(new Base64().encode(new byte[] { (byte)61 }))); - assertEquals("Pg==", new String(new Base64().encode(new byte[] { (byte)62 }))); - assertEquals("Pw==", new String(new Base64().encode(new byte[] { (byte)63 }))); - assertEquals("QA==", new String(new Base64().encode(new byte[] { (byte)64 }))); - assertEquals("QQ==", new String(new Base64().encode(new byte[] { (byte)65 }))); - assertEquals("Qg==", new String(new Base64().encode(new byte[] { (byte)66 }))); - assertEquals("Qw==", new String(new Base64().encode(new byte[] { (byte)67 }))); - assertEquals("RA==", new String(new Base64().encode(new byte[] { (byte)68 }))); - assertEquals("RQ==", new String(new Base64().encode(new byte[] { (byte)69 }))); - assertEquals("Rg==", new String(new Base64().encode(new byte[] { (byte)70 }))); - assertEquals("Rw==", new String(new Base64().encode(new byte[] { (byte)71 }))); - assertEquals("SA==", new String(new Base64().encode(new byte[] { (byte)72 }))); - assertEquals("SQ==", new String(new Base64().encode(new byte[] { (byte)73 }))); - assertEquals("Sg==", new String(new Base64().encode(new byte[] { (byte)74 }))); - assertEquals("Sw==", new String(new Base64().encode(new byte[] { (byte)75 }))); - assertEquals("TA==", new String(new Base64().encode(new byte[] { (byte)76 }))); - assertEquals("TQ==", new String(new Base64().encode(new byte[] { (byte)77 }))); - assertEquals("Tg==", new String(new Base64().encode(new byte[] { (byte)78 }))); - assertEquals("Tw==", new String(new Base64().encode(new byte[] { (byte)79 }))); - assertEquals("UA==", new String(new Base64().encode(new byte[] { (byte)80 }))); - assertEquals("UQ==", new String(new Base64().encode(new byte[] { (byte)81 }))); - assertEquals("Ug==", new String(new Base64().encode(new byte[] { (byte)82 }))); - assertEquals("Uw==", new String(new Base64().encode(new byte[] { (byte)83 }))); - assertEquals("VA==", new String(new Base64().encode(new byte[] { (byte)84 }))); - assertEquals("VQ==", new String(new Base64().encode(new byte[] { (byte)85 }))); - assertEquals("Vg==", new String(new Base64().encode(new byte[] { (byte)86 }))); - assertEquals("Vw==", new String(new Base64().encode(new byte[] { (byte)87 }))); - assertEquals("WA==", new String(new Base64().encode(new byte[] { (byte)88 }))); - assertEquals("WQ==", new String(new Base64().encode(new byte[] { (byte)89 }))); - assertEquals("Wg==", new String(new Base64().encode(new byte[] { (byte)90 }))); - assertEquals("Ww==", new String(new Base64().encode(new byte[] { (byte)91 }))); - assertEquals("XA==", new String(new Base64().encode(new byte[] { (byte)92 }))); - assertEquals("XQ==", new String(new Base64().encode(new byte[] { (byte)93 }))); - assertEquals("Xg==", new String(new Base64().encode(new byte[] { (byte)94 }))); - assertEquals("Xw==", new String(new Base64().encode(new byte[] { (byte)95 }))); - assertEquals("YA==", new String(new Base64().encode(new byte[] { (byte)96 }))); - assertEquals("YQ==", new String(new Base64().encode(new byte[] { (byte)97 }))); - assertEquals("Yg==", new String(new Base64().encode(new byte[] { (byte)98 }))); - assertEquals("Yw==", new String(new Base64().encode(new byte[] { (byte)99 }))); - assertEquals("ZA==", new String(new Base64().encode(new byte[] { (byte)100 }))); - assertEquals("ZQ==", new String(new Base64().encode(new byte[] { (byte)101 }))); - assertEquals("Zg==", new String(new Base64().encode(new byte[] { (byte)102 }))); - assertEquals("Zw==", new String(new Base64().encode(new byte[] { (byte)103 }))); - assertEquals("aA==", new String(new Base64().encode(new byte[] { (byte)104 }))); + assertEquals("AA==", new String(new Base64().encode(new byte[] { (byte) 0 }))); + assertEquals("AQ==", new String(new Base64().encode(new byte[] { (byte) 1 }))); + assertEquals("Ag==", new String(new Base64().encode(new byte[] { (byte) 2 }))); + assertEquals("Aw==", new String(new Base64().encode(new byte[] { (byte) 3 }))); + assertEquals("BA==", new String(new Base64().encode(new byte[] { (byte) 4 }))); + assertEquals("BQ==", new String(new Base64().encode(new byte[] { (byte) 5 }))); + assertEquals("Bg==", new String(new Base64().encode(new byte[] { (byte) 6 }))); + assertEquals("Bw==", new String(new Base64().encode(new byte[] { (byte) 7 }))); + assertEquals("CA==", new String(new Base64().encode(new byte[] { (byte) 8 }))); + assertEquals("CQ==", new String(new Base64().encode(new byte[] { (byte) 9 }))); + assertEquals("Cg==", new String(new Base64().encode(new byte[] { (byte) 10 }))); + assertEquals("Cw==", new String(new Base64().encode(new byte[] { (byte) 11 }))); + assertEquals("DA==", new String(new Base64().encode(new byte[] { (byte) 12 }))); + assertEquals("DQ==", new String(new Base64().encode(new byte[] { (byte) 13 }))); + assertEquals("Dg==", new String(new Base64().encode(new byte[] { (byte) 14 }))); + assertEquals("Dw==", new String(new Base64().encode(new byte[] { (byte) 15 }))); + assertEquals("EA==", new String(new Base64().encode(new byte[] { (byte) 16 }))); + assertEquals("EQ==", new String(new Base64().encode(new byte[] { (byte) 17 }))); + assertEquals("Eg==", new String(new Base64().encode(new byte[] { (byte) 18 }))); + assertEquals("Ew==", new String(new Base64().encode(new byte[] { (byte) 19 }))); + assertEquals("FA==", new String(new Base64().encode(new byte[] { (byte) 20 }))); + assertEquals("FQ==", new String(new Base64().encode(new byte[] { (byte) 21 }))); + assertEquals("Fg==", new String(new Base64().encode(new byte[] { (byte) 22 }))); + assertEquals("Fw==", new String(new Base64().encode(new byte[] { (byte) 23 }))); + assertEquals("GA==", new String(new Base64().encode(new byte[] { (byte) 24 }))); + assertEquals("GQ==", new String(new Base64().encode(new byte[] { (byte) 25 }))); + assertEquals("Gg==", new String(new Base64().encode(new byte[] { (byte) 26 }))); + assertEquals("Gw==", new String(new Base64().encode(new byte[] { (byte) 27 }))); + assertEquals("HA==", new String(new Base64().encode(new byte[] { (byte) 28 }))); + assertEquals("HQ==", new String(new Base64().encode(new byte[] { (byte) 29 }))); + assertEquals("Hg==", new String(new Base64().encode(new byte[] { (byte) 30 }))); + assertEquals("Hw==", new String(new Base64().encode(new byte[] { (byte) 31 }))); + assertEquals("IA==", new String(new Base64().encode(new byte[] { (byte) 32 }))); + assertEquals("IQ==", new String(new Base64().encode(new byte[] { (byte) 33 }))); + assertEquals("Ig==", new String(new Base64().encode(new byte[] { (byte) 34 }))); + assertEquals("Iw==", new String(new Base64().encode(new byte[] { (byte) 35 }))); + assertEquals("JA==", new String(new Base64().encode(new byte[] { (byte) 36 }))); + assertEquals("JQ==", new String(new Base64().encode(new byte[] { (byte) 37 }))); + assertEquals("Jg==", new String(new Base64().encode(new byte[] { (byte) 38 }))); + assertEquals("Jw==", new String(new Base64().encode(new byte[] { (byte) 39 }))); + assertEquals("KA==", new String(new Base64().encode(new byte[] { (byte) 40 }))); + assertEquals("KQ==", new String(new Base64().encode(new byte[] { (byte) 41 }))); + assertEquals("Kg==", new String(new Base64().encode(new byte[] { (byte) 42 }))); + assertEquals("Kw==", new String(new Base64().encode(new byte[] { (byte) 43 }))); + assertEquals("LA==", new String(new Base64().encode(new byte[] { (byte) 44 }))); + assertEquals("LQ==", new String(new Base64().encode(new byte[] { (byte) 45 }))); + assertEquals("Lg==", new String(new Base64().encode(new byte[] { (byte) 46 }))); + assertEquals("Lw==", new String(new Base64().encode(new byte[] { (byte) 47 }))); + assertEquals("MA==", new String(new Base64().encode(new byte[] { (byte) 48 }))); + assertEquals("MQ==", new String(new Base64().encode(new byte[] { (byte) 49 }))); + assertEquals("Mg==", new String(new Base64().encode(new byte[] { (byte) 50 }))); + assertEquals("Mw==", new String(new Base64().encode(new byte[] { (byte) 51 }))); + assertEquals("NA==", new String(new Base64().encode(new byte[] { (byte) 52 }))); + assertEquals("NQ==", new String(new Base64().encode(new byte[] { (byte) 53 }))); + assertEquals("Ng==", new String(new Base64().encode(new byte[] { (byte) 54 }))); + assertEquals("Nw==", new String(new Base64().encode(new byte[] { (byte) 55 }))); + assertEquals("OA==", new String(new Base64().encode(new byte[] { (byte) 56 }))); + assertEquals("OQ==", new String(new Base64().encode(new byte[] { (byte) 57 }))); + assertEquals("Og==", new String(new Base64().encode(new byte[] { (byte) 58 }))); + assertEquals("Ow==", new String(new Base64().encode(new byte[] { (byte) 59 }))); + assertEquals("PA==", new String(new Base64().encode(new byte[] { (byte) 60 }))); + assertEquals("PQ==", new String(new Base64().encode(new byte[] { (byte) 61 }))); + assertEquals("Pg==", new String(new Base64().encode(new byte[] { (byte) 62 }))); + assertEquals("Pw==", new String(new Base64().encode(new byte[] { (byte) 63 }))); + assertEquals("QA==", new String(new Base64().encode(new byte[] { (byte) 64 }))); + assertEquals("QQ==", new String(new Base64().encode(new byte[] { (byte) 65 }))); + assertEquals("Qg==", new String(new Base64().encode(new byte[] { (byte) 66 }))); + assertEquals("Qw==", new String(new Base64().encode(new byte[] { (byte) 67 }))); + assertEquals("RA==", new String(new Base64().encode(new byte[] { (byte) 68 }))); + assertEquals("RQ==", new String(new Base64().encode(new byte[] { (byte) 69 }))); + assertEquals("Rg==", new String(new Base64().encode(new byte[] { (byte) 70 }))); + assertEquals("Rw==", new String(new Base64().encode(new byte[] { (byte) 71 }))); + assertEquals("SA==", new String(new Base64().encode(new byte[] { (byte) 72 }))); + assertEquals("SQ==", new String(new Base64().encode(new byte[] { (byte) 73 }))); + assertEquals("Sg==", new String(new Base64().encode(new byte[] { (byte) 74 }))); + assertEquals("Sw==", new String(new Base64().encode(new byte[] { (byte) 75 }))); + assertEquals("TA==", new String(new Base64().encode(new byte[] { (byte) 76 }))); + assertEquals("TQ==", new String(new Base64().encode(new byte[] { (byte) 77 }))); + assertEquals("Tg==", new String(new Base64().encode(new byte[] { (byte) 78 }))); + assertEquals("Tw==", new String(new Base64().encode(new byte[] { (byte) 79 }))); + assertEquals("UA==", new String(new Base64().encode(new byte[] { (byte) 80 }))); + assertEquals("UQ==", new String(new Base64().encode(new byte[] { (byte) 81 }))); + assertEquals("Ug==", new String(new Base64().encode(new byte[] { (byte) 82 }))); + assertEquals("Uw==", new String(new Base64().encode(new byte[] { (byte) 83 }))); + assertEquals("VA==", new String(new Base64().encode(new byte[] { (byte) 84 }))); + assertEquals("VQ==", new String(new Base64().encode(new byte[] { (byte) 85 }))); + assertEquals("Vg==", new String(new Base64().encode(new byte[] { (byte) 86 }))); + assertEquals("Vw==", new String(new Base64().encode(new byte[] { (byte) 87 }))); + assertEquals("WA==", new String(new Base64().encode(new byte[] { (byte) 88 }))); + assertEquals("WQ==", new String(new Base64().encode(new byte[] { (byte) 89 }))); + assertEquals("Wg==", new String(new Base64().encode(new byte[] { (byte) 90 }))); + assertEquals("Ww==", new String(new Base64().encode(new byte[] { (byte) 91 }))); + assertEquals("XA==", new String(new Base64().encode(new byte[] { (byte) 92 }))); + assertEquals("XQ==", new String(new Base64().encode(new byte[] { (byte) 93 }))); + assertEquals("Xg==", new String(new Base64().encode(new byte[] { (byte) 94 }))); + assertEquals("Xw==", new String(new Base64().encode(new byte[] { (byte) 95 }))); + assertEquals("YA==", new String(new Base64().encode(new byte[] { (byte) 96 }))); + assertEquals("YQ==", new String(new Base64().encode(new byte[] { (byte) 97 }))); + assertEquals("Yg==", new String(new Base64().encode(new byte[] { (byte) 98 }))); + assertEquals("Yw==", new String(new Base64().encode(new byte[] { (byte) 99 }))); + assertEquals("ZA==", new String(new Base64().encode(new byte[] { (byte) 100 }))); + assertEquals("ZQ==", new String(new Base64().encode(new byte[] { (byte) 101 }))); + assertEquals("Zg==", new String(new Base64().encode(new byte[] { (byte) 102 }))); + assertEquals("Zw==", new String(new Base64().encode(new byte[] { (byte) 103 }))); + assertEquals("aA==", new String(new Base64().encode(new byte[] { (byte) 104 }))); - assertEquals("AA..", new String(new Base64(true).encode(new byte[] { (byte)0 }))); - assertEquals("AQ..", new String(new Base64(true).encode(new byte[] { (byte)1 }))); - assertEquals("Ag..", new String(new Base64(true).encode(new byte[] { (byte)2 }))); - assertEquals("Aw..", new String(new Base64(true).encode(new byte[] { (byte)3 }))); - assertEquals("BA..", new String(new Base64(true).encode(new byte[] { (byte)4 }))); - assertEquals("BQ..", new String(new Base64(true).encode(new byte[] { (byte)5 }))); - assertEquals("Bg..", new String(new Base64(true).encode(new byte[] { (byte)6 }))); - assertEquals("Bw..", new String(new Base64(true).encode(new byte[] { (byte)7 }))); - assertEquals("CA..", new String(new Base64(true).encode(new byte[] { (byte)8 }))); - assertEquals("CQ..", new String(new Base64(true).encode(new byte[] { (byte)9 }))); - assertEquals("Cg..", new String(new Base64(true).encode(new byte[] { (byte)10 }))); - assertEquals("Cw..", new String(new Base64(true).encode(new byte[] { (byte)11 }))); - assertEquals("DA..", new String(new Base64(true).encode(new byte[] { (byte)12 }))); - assertEquals("DQ..", new String(new Base64(true).encode(new byte[] { (byte)13 }))); - assertEquals("Dg..", new String(new Base64(true).encode(new byte[] { (byte)14 }))); - assertEquals("Dw..", new String(new Base64(true).encode(new byte[] { (byte)15 }))); - assertEquals("EA..", new String(new Base64(true).encode(new byte[] { (byte)16 }))); - assertEquals("EQ..", new String(new Base64(true).encode(new byte[] { (byte)17 }))); - assertEquals("Eg..", new String(new Base64(true).encode(new byte[] { (byte)18 }))); - assertEquals("Ew..", new String(new Base64(true).encode(new byte[] { (byte)19 }))); - assertEquals("FA..", new String(new Base64(true).encode(new byte[] { (byte)20 }))); - assertEquals("FQ..", new String(new Base64(true).encode(new byte[] { (byte)21 }))); - assertEquals("Fg..", new String(new Base64(true).encode(new byte[] { (byte)22 }))); - assertEquals("Fw..", new String(new Base64(true).encode(new byte[] { (byte)23 }))); - assertEquals("GA..", new String(new Base64(true).encode(new byte[] { (byte)24 }))); - assertEquals("GQ..", new String(new Base64(true).encode(new byte[] { (byte)25 }))); - assertEquals("Gg..", new String(new Base64(true).encode(new byte[] { (byte)26 }))); - assertEquals("Gw..", new String(new Base64(true).encode(new byte[] { (byte)27 }))); - assertEquals("HA..", new String(new Base64(true).encode(new byte[] { (byte)28 }))); - assertEquals("HQ..", new String(new Base64(true).encode(new byte[] { (byte)29 }))); - assertEquals("Hg..", new String(new Base64(true).encode(new byte[] { (byte)30 }))); - assertEquals("Hw..", new String(new Base64(true).encode(new byte[] { (byte)31 }))); - assertEquals("IA..", new String(new Base64(true).encode(new byte[] { (byte)32 }))); - assertEquals("IQ..", new String(new Base64(true).encode(new byte[] { (byte)33 }))); - assertEquals("Ig..", new String(new Base64(true).encode(new byte[] { (byte)34 }))); - assertEquals("Iw..", new String(new Base64(true).encode(new byte[] { (byte)35 }))); - assertEquals("JA..", new String(new Base64(true).encode(new byte[] { (byte)36 }))); - assertEquals("JQ..", new String(new Base64(true).encode(new byte[] { (byte)37 }))); - assertEquals("Jg..", new String(new Base64(true).encode(new byte[] { (byte)38 }))); - assertEquals("Jw..", new String(new Base64(true).encode(new byte[] { (byte)39 }))); - assertEquals("KA..", new String(new Base64(true).encode(new byte[] { (byte)40 }))); - assertEquals("KQ..", new String(new Base64(true).encode(new byte[] { (byte)41 }))); - assertEquals("Kg..", new String(new Base64(true).encode(new byte[] { (byte)42 }))); - assertEquals("Kw..", new String(new Base64(true).encode(new byte[] { (byte)43 }))); - assertEquals("LA..", new String(new Base64(true).encode(new byte[] { (byte)44 }))); - assertEquals("LQ..", new String(new Base64(true).encode(new byte[] { (byte)45 }))); - assertEquals("Lg..", new String(new Base64(true).encode(new byte[] { (byte)46 }))); - assertEquals("Lw..", new String(new Base64(true).encode(new byte[] { (byte)47 }))); - assertEquals("MA..", new String(new Base64(true).encode(new byte[] { (byte)48 }))); - assertEquals("MQ..", new String(new Base64(true).encode(new byte[] { (byte)49 }))); - assertEquals("Mg..", new String(new Base64(true).encode(new byte[] { (byte)50 }))); - assertEquals("Mw..", new String(new Base64(true).encode(new byte[] { (byte)51 }))); - assertEquals("NA..", new String(new Base64(true).encode(new byte[] { (byte)52 }))); - assertEquals("NQ..", new String(new Base64(true).encode(new byte[] { (byte)53 }))); - assertEquals("Ng..", new String(new Base64(true).encode(new byte[] { (byte)54 }))); - assertEquals("Nw..", new String(new Base64(true).encode(new byte[] { (byte)55 }))); - assertEquals("OA..", new String(new Base64(true).encode(new byte[] { (byte)56 }))); - assertEquals("OQ..", new String(new Base64(true).encode(new byte[] { (byte)57 }))); - assertEquals("Og..", new String(new Base64(true).encode(new byte[] { (byte)58 }))); - assertEquals("Ow..", new String(new Base64(true).encode(new byte[] { (byte)59 }))); - assertEquals("PA..", new String(new Base64(true).encode(new byte[] { (byte)60 }))); - assertEquals("PQ..", new String(new Base64(true).encode(new byte[] { (byte)61 }))); - assertEquals("Pg..", new String(new Base64(true).encode(new byte[] { (byte)62 }))); - assertEquals("Pw..", new String(new Base64(true).encode(new byte[] { (byte)63 }))); - assertEquals("QA..", new String(new Base64(true).encode(new byte[] { (byte)64 }))); - assertEquals("QQ..", new String(new Base64(true).encode(new byte[] { (byte)65 }))); - assertEquals("Qg..", new String(new Base64(true).encode(new byte[] { (byte)66 }))); - assertEquals("Qw..", new String(new Base64(true).encode(new byte[] { (byte)67 }))); - assertEquals("RA..", new String(new Base64(true).encode(new byte[] { (byte)68 }))); - assertEquals("RQ..", new String(new Base64(true).encode(new byte[] { (byte)69 }))); - assertEquals("Rg..", new String(new Base64(true).encode(new byte[] { (byte)70 }))); - assertEquals("Rw..", new String(new Base64(true).encode(new byte[] { (byte)71 }))); - assertEquals("SA..", new String(new Base64(true).encode(new byte[] { (byte)72 }))); - assertEquals("SQ..", new String(new Base64(true).encode(new byte[] { (byte)73 }))); - assertEquals("Sg..", new String(new Base64(true).encode(new byte[] { (byte)74 }))); - assertEquals("Sw..", new String(new Base64(true).encode(new byte[] { (byte)75 }))); - assertEquals("TA..", new String(new Base64(true).encode(new byte[] { (byte)76 }))); - assertEquals("TQ..", new String(new Base64(true).encode(new byte[] { (byte)77 }))); - assertEquals("Tg..", new String(new Base64(true).encode(new byte[] { (byte)78 }))); - assertEquals("Tw..", new String(new Base64(true).encode(new byte[] { (byte)79 }))); - assertEquals("UA..", new String(new Base64(true).encode(new byte[] { (byte)80 }))); - assertEquals("UQ..", new String(new Base64(true).encode(new byte[] { (byte)81 }))); - assertEquals("Ug..", new String(new Base64(true).encode(new byte[] { (byte)82 }))); - assertEquals("Uw..", new String(new Base64(true).encode(new byte[] { (byte)83 }))); - assertEquals("VA..", new String(new Base64(true).encode(new byte[] { (byte)84 }))); - assertEquals("VQ..", new String(new Base64(true).encode(new byte[] { (byte)85 }))); - assertEquals("Vg..", new String(new Base64(true).encode(new byte[] { (byte)86 }))); - assertEquals("Vw..", new String(new Base64(true).encode(new byte[] { (byte)87 }))); - assertEquals("WA..", new String(new Base64(true).encode(new byte[] { (byte)88 }))); - assertEquals("WQ..", new String(new Base64(true).encode(new byte[] { (byte)89 }))); - assertEquals("Wg..", new String(new Base64(true).encode(new byte[] { (byte)90 }))); - assertEquals("Ww..", new String(new Base64(true).encode(new byte[] { (byte)91 }))); - assertEquals("XA..", new String(new Base64(true).encode(new byte[] { (byte)92 }))); - assertEquals("XQ..", new String(new Base64(true).encode(new byte[] { (byte)93 }))); - assertEquals("Xg..", new String(new Base64(true).encode(new byte[] { (byte)94 }))); - assertEquals("Xw..", new String(new Base64(true).encode(new byte[] { (byte)95 }))); - assertEquals("YA..", new String(new Base64(true).encode(new byte[] { (byte)96 }))); - assertEquals("YQ..", new String(new Base64(true).encode(new byte[] { (byte)97 }))); - assertEquals("Yg..", new String(new Base64(true).encode(new byte[] { (byte)98 }))); - assertEquals("Yw..", new String(new Base64(true).encode(new byte[] { (byte)99 }))); - assertEquals("ZA..", new String(new Base64(true).encode(new byte[] { (byte)100 }))); - assertEquals("ZQ..", new String(new Base64(true).encode(new byte[] { (byte)101 }))); - assertEquals("Zg..", new String(new Base64(true).encode(new byte[] { (byte)102 }))); - assertEquals("Zw..", new String(new Base64(true).encode(new byte[] { (byte)103 }))); - assertEquals("aA..", new String(new Base64(true).encode(new byte[] { (byte)104 }))); + assertEquals("AA..", new String(new Base64(true).encode(new byte[] { (byte) 0 }))); + assertEquals("AQ..", new String(new Base64(true).encode(new byte[] { (byte) 1 }))); + assertEquals("Ag..", new String(new Base64(true).encode(new byte[] { (byte) 2 }))); + assertEquals("Aw..", new String(new Base64(true).encode(new byte[] { (byte) 3 }))); + assertEquals("BA..", new String(new Base64(true).encode(new byte[] { (byte) 4 }))); + assertEquals("BQ..", new String(new Base64(true).encode(new byte[] { (byte) 5 }))); + assertEquals("Bg..", new String(new Base64(true).encode(new byte[] { (byte) 6 }))); + assertEquals("Bw..", new String(new Base64(true).encode(new byte[] { (byte) 7 }))); + assertEquals("CA..", new String(new Base64(true).encode(new byte[] { (byte) 8 }))); + assertEquals("CQ..", new String(new Base64(true).encode(new byte[] { (byte) 9 }))); + assertEquals("Cg..", new String(new Base64(true).encode(new byte[] { (byte) 10 }))); + assertEquals("Cw..", new String(new Base64(true).encode(new byte[] { (byte) 11 }))); + assertEquals("DA..", new String(new Base64(true).encode(new byte[] { (byte) 12 }))); + assertEquals("DQ..", new String(new Base64(true).encode(new byte[] { (byte) 13 }))); + assertEquals("Dg..", new String(new Base64(true).encode(new byte[] { (byte) 14 }))); + assertEquals("Dw..", new String(new Base64(true).encode(new byte[] { (byte) 15 }))); + assertEquals("EA..", new String(new Base64(true).encode(new byte[] { (byte) 16 }))); + assertEquals("EQ..", new String(new Base64(true).encode(new byte[] { (byte) 17 }))); + assertEquals("Eg..", new String(new Base64(true).encode(new byte[] { (byte) 18 }))); + assertEquals("Ew..", new String(new Base64(true).encode(new byte[] { (byte) 19 }))); + assertEquals("FA..", new String(new Base64(true).encode(new byte[] { (byte) 20 }))); + assertEquals("FQ..", new String(new Base64(true).encode(new byte[] { (byte) 21 }))); + assertEquals("Fg..", new String(new Base64(true).encode(new byte[] { (byte) 22 }))); + assertEquals("Fw..", new String(new Base64(true).encode(new byte[] { (byte) 23 }))); + assertEquals("GA..", new String(new Base64(true).encode(new byte[] { (byte) 24 }))); + assertEquals("GQ..", new String(new Base64(true).encode(new byte[] { (byte) 25 }))); + assertEquals("Gg..", new String(new Base64(true).encode(new byte[] { (byte) 26 }))); + assertEquals("Gw..", new String(new Base64(true).encode(new byte[] { (byte) 27 }))); + assertEquals("HA..", new String(new Base64(true).encode(new byte[] { (byte) 28 }))); + assertEquals("HQ..", new String(new Base64(true).encode(new byte[] { (byte) 29 }))); + assertEquals("Hg..", new String(new Base64(true).encode(new byte[] { (byte) 30 }))); + assertEquals("Hw..", new String(new Base64(true).encode(new byte[] { (byte) 31 }))); + assertEquals("IA..", new String(new Base64(true).encode(new byte[] { (byte) 32 }))); + assertEquals("IQ..", new String(new Base64(true).encode(new byte[] { (byte) 33 }))); + assertEquals("Ig..", new String(new Base64(true).encode(new byte[] { (byte) 34 }))); + assertEquals("Iw..", new String(new Base64(true).encode(new byte[] { (byte) 35 }))); + assertEquals("JA..", new String(new Base64(true).encode(new byte[] { (byte) 36 }))); + assertEquals("JQ..", new String(new Base64(true).encode(new byte[] { (byte) 37 }))); + assertEquals("Jg..", new String(new Base64(true).encode(new byte[] { (byte) 38 }))); + assertEquals("Jw..", new String(new Base64(true).encode(new byte[] { (byte) 39 }))); + assertEquals("KA..", new String(new Base64(true).encode(new byte[] { (byte) 40 }))); + assertEquals("KQ..", new String(new Base64(true).encode(new byte[] { (byte) 41 }))); + assertEquals("Kg..", new String(new Base64(true).encode(new byte[] { (byte) 42 }))); + assertEquals("Kw..", new String(new Base64(true).encode(new byte[] { (byte) 43 }))); + assertEquals("LA..", new String(new Base64(true).encode(new byte[] { (byte) 44 }))); + assertEquals("LQ..", new String(new Base64(true).encode(new byte[] { (byte) 45 }))); + assertEquals("Lg..", new String(new Base64(true).encode(new byte[] { (byte) 46 }))); + assertEquals("Lw..", new String(new Base64(true).encode(new byte[] { (byte) 47 }))); + assertEquals("MA..", new String(new Base64(true).encode(new byte[] { (byte) 48 }))); + assertEquals("MQ..", new String(new Base64(true).encode(new byte[] { (byte) 49 }))); + assertEquals("Mg..", new String(new Base64(true).encode(new byte[] { (byte) 50 }))); + assertEquals("Mw..", new String(new Base64(true).encode(new byte[] { (byte) 51 }))); + assertEquals("NA..", new String(new Base64(true).encode(new byte[] { (byte) 52 }))); + assertEquals("NQ..", new String(new Base64(true).encode(new byte[] { (byte) 53 }))); + assertEquals("Ng..", new String(new Base64(true).encode(new byte[] { (byte) 54 }))); + assertEquals("Nw..", new String(new Base64(true).encode(new byte[] { (byte) 55 }))); + assertEquals("OA..", new String(new Base64(true).encode(new byte[] { (byte) 56 }))); + assertEquals("OQ..", new String(new Base64(true).encode(new byte[] { (byte) 57 }))); + assertEquals("Og..", new String(new Base64(true).encode(new byte[] { (byte) 58 }))); + assertEquals("Ow..", new String(new Base64(true).encode(new byte[] { (byte) 59 }))); + assertEquals("PA..", new String(new Base64(true).encode(new byte[] { (byte) 60 }))); + assertEquals("PQ..", new String(new Base64(true).encode(new byte[] { (byte) 61 }))); + assertEquals("Pg..", new String(new Base64(true).encode(new byte[] { (byte) 62 }))); + assertEquals("Pw..", new String(new Base64(true).encode(new byte[] { (byte) 63 }))); + assertEquals("QA..", new String(new Base64(true).encode(new byte[] { (byte) 64 }))); + assertEquals("QQ..", new String(new Base64(true).encode(new byte[] { (byte) 65 }))); + assertEquals("Qg..", new String(new Base64(true).encode(new byte[] { (byte) 66 }))); + assertEquals("Qw..", new String(new Base64(true).encode(new byte[] { (byte) 67 }))); + assertEquals("RA..", new String(new Base64(true).encode(new byte[] { (byte) 68 }))); + assertEquals("RQ..", new String(new Base64(true).encode(new byte[] { (byte) 69 }))); + assertEquals("Rg..", new String(new Base64(true).encode(new byte[] { (byte) 70 }))); + assertEquals("Rw..", new String(new Base64(true).encode(new byte[] { (byte) 71 }))); + assertEquals("SA..", new String(new Base64(true).encode(new byte[] { (byte) 72 }))); + assertEquals("SQ..", new String(new Base64(true).encode(new byte[] { (byte) 73 }))); + assertEquals("Sg..", new String(new Base64(true).encode(new byte[] { (byte) 74 }))); + assertEquals("Sw..", new String(new Base64(true).encode(new byte[] { (byte) 75 }))); + assertEquals("TA..", new String(new Base64(true).encode(new byte[] { (byte) 76 }))); + assertEquals("TQ..", new String(new Base64(true).encode(new byte[] { (byte) 77 }))); + assertEquals("Tg..", new String(new Base64(true).encode(new byte[] { (byte) 78 }))); + assertEquals("Tw..", new String(new Base64(true).encode(new byte[] { (byte) 79 }))); + assertEquals("UA..", new String(new Base64(true).encode(new byte[] { (byte) 80 }))); + assertEquals("UQ..", new String(new Base64(true).encode(new byte[] { (byte) 81 }))); + assertEquals("Ug..", new String(new Base64(true).encode(new byte[] { (byte) 82 }))); + assertEquals("Uw..", new String(new Base64(true).encode(new byte[] { (byte) 83 }))); + assertEquals("VA..", new String(new Base64(true).encode(new byte[] { (byte) 84 }))); + assertEquals("VQ..", new String(new Base64(true).encode(new byte[] { (byte) 85 }))); + assertEquals("Vg..", new String(new Base64(true).encode(new byte[] { (byte) 86 }))); + assertEquals("Vw..", new String(new Base64(true).encode(new byte[] { (byte) 87 }))); + assertEquals("WA..", new String(new Base64(true).encode(new byte[] { (byte) 88 }))); + assertEquals("WQ..", new String(new Base64(true).encode(new byte[] { (byte) 89 }))); + assertEquals("Wg..", new String(new Base64(true).encode(new byte[] { (byte) 90 }))); + assertEquals("Ww..", new String(new Base64(true).encode(new byte[] { (byte) 91 }))); + assertEquals("XA..", new String(new Base64(true).encode(new byte[] { (byte) 92 }))); + assertEquals("XQ..", new String(new Base64(true).encode(new byte[] { (byte) 93 }))); + assertEquals("Xg..", new String(new Base64(true).encode(new byte[] { (byte) 94 }))); + assertEquals("Xw..", new String(new Base64(true).encode(new byte[] { (byte) 95 }))); + assertEquals("YA..", new String(new Base64(true).encode(new byte[] { (byte) 96 }))); + assertEquals("YQ..", new String(new Base64(true).encode(new byte[] { (byte) 97 }))); + assertEquals("Yg..", new String(new Base64(true).encode(new byte[] { (byte) 98 }))); + assertEquals("Yw..", new String(new Base64(true).encode(new byte[] { (byte) 99 }))); + assertEquals("ZA..", new String(new Base64(true).encode(new byte[] { (byte) 100 }))); + assertEquals("ZQ..", new String(new Base64(true).encode(new byte[] { (byte) 101 }))); + assertEquals("Zg..", new String(new Base64(true).encode(new byte[] { (byte) 102 }))); + assertEquals("Zw..", new String(new Base64(true).encode(new byte[] { (byte) 103 }))); + assertEquals("aA..", new String(new Base64(true).encode(new byte[] { (byte) 104 }))); } public void testTriplets() { - assertEquals("AAAA", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)0 }))); - assertEquals("AAAB", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)1 }))); - assertEquals("AAAC", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)2 }))); - assertEquals("AAAD", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)3 }))); - assertEquals("AAAE", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)4 }))); - assertEquals("AAAF", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)5 }))); - assertEquals("AAAG", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)6 }))); - assertEquals("AAAH", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)7 }))); - assertEquals("AAAI", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)8 }))); - assertEquals("AAAJ", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)9 }))); - assertEquals("AAAK", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)10 }))); - assertEquals("AAAL", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)11 }))); - assertEquals("AAAM", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)12 }))); - assertEquals("AAAN", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)13 }))); - assertEquals("AAAO", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)14 }))); - assertEquals("AAAP", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)15 }))); - assertEquals("AAAQ", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)16 }))); - assertEquals("AAAR", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)17 }))); - assertEquals("AAAS", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)18 }))); - assertEquals("AAAT", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)19 }))); - assertEquals("AAAU", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)20 }))); - assertEquals("AAAV", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)21 }))); - assertEquals("AAAW", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)22 }))); - assertEquals("AAAX", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)23 }))); - assertEquals("AAAY", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)24 }))); - assertEquals("AAAZ", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)25 }))); - assertEquals("AAAa", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)26 }))); - assertEquals("AAAb", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)27 }))); - assertEquals("AAAc", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)28 }))); - assertEquals("AAAd", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)29 }))); - assertEquals("AAAe", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)30 }))); - assertEquals("AAAf", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)31 }))); - assertEquals("AAAg", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)32 }))); - assertEquals("AAAh", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)33 }))); - assertEquals("AAAi", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)34 }))); - assertEquals("AAAj", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)35 }))); - assertEquals("AAAk", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)36 }))); - assertEquals("AAAl", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)37 }))); - assertEquals("AAAm", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)38 }))); - assertEquals("AAAn", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)39 }))); - assertEquals("AAAo", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)40 }))); - assertEquals("AAAp", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)41 }))); - assertEquals("AAAq", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)42 }))); - assertEquals("AAAr", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)43 }))); - assertEquals("AAAs", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)44 }))); - assertEquals("AAAt", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)45 }))); - assertEquals("AAAu", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)46 }))); - assertEquals("AAAv", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)47 }))); - assertEquals("AAAw", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)48 }))); - assertEquals("AAAx", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)49 }))); - assertEquals("AAAy", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)50 }))); - assertEquals("AAAz", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)51 }))); - assertEquals("AAA0", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)52 }))); - assertEquals("AAA1", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)53 }))); - assertEquals("AAA2", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)54 }))); - assertEquals("AAA3", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)55 }))); - assertEquals("AAA4", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)56 }))); - assertEquals("AAA5", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)57 }))); - assertEquals("AAA6", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)58 }))); - assertEquals("AAA7", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)59 }))); - assertEquals("AAA8", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)60 }))); - assertEquals("AAA9", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)61 }))); - assertEquals("AAA+", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)62 }))); - assertEquals("AAA/", new String(new Base64().encode(new byte[] { (byte)0, (byte)0, (byte)63 }))); + assertEquals("AAAA", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 0 }))); + assertEquals("AAAB", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 1 }))); + assertEquals("AAAC", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 2 }))); + assertEquals("AAAD", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 3 }))); + assertEquals("AAAE", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 4 }))); + assertEquals("AAAF", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 5 }))); + assertEquals("AAAG", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 6 }))); + assertEquals("AAAH", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 7 }))); + assertEquals("AAAI", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 8 }))); + assertEquals("AAAJ", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 9 }))); + assertEquals("AAAK", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 10 }))); + assertEquals("AAAL", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 11 }))); + assertEquals("AAAM", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 12 }))); + assertEquals("AAAN", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 13 }))); + assertEquals("AAAO", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 14 }))); + assertEquals("AAAP", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 15 }))); + assertEquals("AAAQ", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 16 }))); + assertEquals("AAAR", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 17 }))); + assertEquals("AAAS", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 18 }))); + assertEquals("AAAT", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 19 }))); + assertEquals("AAAU", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 20 }))); + assertEquals("AAAV", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 21 }))); + assertEquals("AAAW", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 22 }))); + assertEquals("AAAX", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 23 }))); + assertEquals("AAAY", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 24 }))); + assertEquals("AAAZ", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 25 }))); + assertEquals("AAAa", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 26 }))); + assertEquals("AAAb", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 27 }))); + assertEquals("AAAc", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 28 }))); + assertEquals("AAAd", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 29 }))); + assertEquals("AAAe", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 30 }))); + assertEquals("AAAf", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 31 }))); + assertEquals("AAAg", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 32 }))); + assertEquals("AAAh", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 33 }))); + assertEquals("AAAi", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 34 }))); + assertEquals("AAAj", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 35 }))); + assertEquals("AAAk", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 36 }))); + assertEquals("AAAl", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 37 }))); + assertEquals("AAAm", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 38 }))); + assertEquals("AAAn", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 39 }))); + assertEquals("AAAo", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 40 }))); + assertEquals("AAAp", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 41 }))); + assertEquals("AAAq", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 42 }))); + assertEquals("AAAr", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 43 }))); + assertEquals("AAAs", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 44 }))); + assertEquals("AAAt", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 45 }))); + assertEquals("AAAu", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 46 }))); + assertEquals("AAAv", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 47 }))); + assertEquals("AAAw", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 48 }))); + assertEquals("AAAx", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 49 }))); + assertEquals("AAAy", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 50 }))); + assertEquals("AAAz", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 51 }))); + assertEquals("AAA0", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 52 }))); + assertEquals("AAA1", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 53 }))); + assertEquals("AAA2", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 54 }))); + assertEquals("AAA3", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 55 }))); + assertEquals("AAA4", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 56 }))); + assertEquals("AAA5", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 57 }))); + assertEquals("AAA6", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 58 }))); + assertEquals("AAA7", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 59 }))); + assertEquals("AAA8", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 60 }))); + assertEquals("AAA9", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 61 }))); + assertEquals("AAA+", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 62 }))); + assertEquals("AAA/", new String(new Base64().encode(new byte[] { (byte) 0, (byte) 0, (byte) 63 }))); - assertEquals("AAAA", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)0 }))); - assertEquals("AAAB", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)1 }))); - assertEquals("AAAC", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)2 }))); - assertEquals("AAAD", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)3 }))); - assertEquals("AAAE", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)4 }))); - assertEquals("AAAF", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)5 }))); - assertEquals("AAAG", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)6 }))); - assertEquals("AAAH", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)7 }))); - assertEquals("AAAI", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)8 }))); - assertEquals("AAAJ", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)9 }))); - assertEquals("AAAK", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)10 }))); - assertEquals("AAAL", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)11 }))); - assertEquals("AAAM", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)12 }))); - assertEquals("AAAN", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)13 }))); - assertEquals("AAAO", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)14 }))); - assertEquals("AAAP", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)15 }))); - assertEquals("AAAQ", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)16 }))); - assertEquals("AAAR", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)17 }))); - assertEquals("AAAS", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)18 }))); - assertEquals("AAAT", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)19 }))); - assertEquals("AAAU", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)20 }))); - assertEquals("AAAV", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)21 }))); - assertEquals("AAAW", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)22 }))); - assertEquals("AAAX", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)23 }))); - assertEquals("AAAY", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)24 }))); - assertEquals("AAAZ", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)25 }))); - assertEquals("AAAa", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)26 }))); - assertEquals("AAAb", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)27 }))); - assertEquals("AAAc", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)28 }))); - assertEquals("AAAd", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)29 }))); - assertEquals("AAAe", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)30 }))); - assertEquals("AAAf", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)31 }))); - assertEquals("AAAg", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)32 }))); - assertEquals("AAAh", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)33 }))); - assertEquals("AAAi", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)34 }))); - assertEquals("AAAj", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)35 }))); - assertEquals("AAAk", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)36 }))); - assertEquals("AAAl", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)37 }))); - assertEquals("AAAm", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)38 }))); - assertEquals("AAAn", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)39 }))); - assertEquals("AAAo", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)40 }))); - assertEquals("AAAp", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)41 }))); - assertEquals("AAAq", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)42 }))); - assertEquals("AAAr", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)43 }))); - assertEquals("AAAs", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)44 }))); - assertEquals("AAAt", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)45 }))); - assertEquals("AAAu", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)46 }))); - assertEquals("AAAv", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)47 }))); - assertEquals("AAAw", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)48 }))); - assertEquals("AAAx", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)49 }))); - assertEquals("AAAy", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)50 }))); - assertEquals("AAAz", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)51 }))); - assertEquals("AAA0", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)52 }))); - assertEquals("AAA1", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)53 }))); - assertEquals("AAA2", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)54 }))); - assertEquals("AAA3", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)55 }))); - assertEquals("AAA4", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)56 }))); - assertEquals("AAA5", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)57 }))); - assertEquals("AAA6", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)58 }))); - assertEquals("AAA7", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)59 }))); - assertEquals("AAA8", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)60 }))); - assertEquals("AAA9", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)61 }))); - assertEquals("AAA-", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)62 }))); - assertEquals("AAA_", new String(new Base64(true).encode(new byte[] { (byte)0, (byte)0, (byte)63 }))); + assertEquals("AAAA", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 0 }))); + assertEquals("AAAB", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 1 }))); + assertEquals("AAAC", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 2 }))); + assertEquals("AAAD", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 3 }))); + assertEquals("AAAE", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 4 }))); + assertEquals("AAAF", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 5 }))); + assertEquals("AAAG", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 6 }))); + assertEquals("AAAH", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 7 }))); + assertEquals("AAAI", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 8 }))); + assertEquals("AAAJ", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 9 }))); + assertEquals("AAAK", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 10 }))); + assertEquals("AAAL", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 11 }))); + assertEquals("AAAM", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 12 }))); + assertEquals("AAAN", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 13 }))); + assertEquals("AAAO", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 14 }))); + assertEquals("AAAP", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 15 }))); + assertEquals("AAAQ", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 16 }))); + assertEquals("AAAR", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 17 }))); + assertEquals("AAAS", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 18 }))); + assertEquals("AAAT", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 19 }))); + assertEquals("AAAU", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 20 }))); + assertEquals("AAAV", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 21 }))); + assertEquals("AAAW", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 22 }))); + assertEquals("AAAX", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 23 }))); + assertEquals("AAAY", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 24 }))); + assertEquals("AAAZ", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 25 }))); + assertEquals("AAAa", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 26 }))); + assertEquals("AAAb", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 27 }))); + assertEquals("AAAc", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 28 }))); + assertEquals("AAAd", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 29 }))); + assertEquals("AAAe", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 30 }))); + assertEquals("AAAf", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 31 }))); + assertEquals("AAAg", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 32 }))); + assertEquals("AAAh", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 33 }))); + assertEquals("AAAi", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 34 }))); + assertEquals("AAAj", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 35 }))); + assertEquals("AAAk", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 36 }))); + assertEquals("AAAl", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 37 }))); + assertEquals("AAAm", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 38 }))); + assertEquals("AAAn", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 39 }))); + assertEquals("AAAo", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 40 }))); + assertEquals("AAAp", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 41 }))); + assertEquals("AAAq", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 42 }))); + assertEquals("AAAr", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 43 }))); + assertEquals("AAAs", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 44 }))); + assertEquals("AAAt", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 45 }))); + assertEquals("AAAu", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 46 }))); + assertEquals("AAAv", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 47 }))); + assertEquals("AAAw", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 48 }))); + assertEquals("AAAx", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 49 }))); + assertEquals("AAAy", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 50 }))); + assertEquals("AAAz", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 51 }))); + assertEquals("AAA0", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 52 }))); + assertEquals("AAA1", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 53 }))); + assertEquals("AAA2", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 54 }))); + assertEquals("AAA3", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 55 }))); + assertEquals("AAA4", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 56 }))); + assertEquals("AAA5", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 57 }))); + assertEquals("AAA6", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 58 }))); + assertEquals("AAA7", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 59 }))); + assertEquals("AAA8", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 60 }))); + assertEquals("AAA9", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 61 }))); + assertEquals("AAA-", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 62 }))); + assertEquals("AAA_", new String(new Base64(true).encode(new byte[] { (byte) 0, (byte) 0, (byte) 63 }))); } public void testKnownEncodings() { - assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==", - new Base64().encodeToString("The quick brown fox jumped over the lazy dogs.".getBytes())); - assertEquals("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg==", - new Base64().encodeToString("It was the best of times, it was the worst of times.".getBytes())); - assertEquals("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw==", - new Base64().encodeToString("http://jakarta.apache.org/commmons".getBytes())); - assertEquals("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg==", - new Base64().encodeToString("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz".getBytes())); - assertEquals("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0=", - new Base64().encodeToString("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }".getBytes())); + assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg==", new Base64() + .encodeToString("The quick brown fox jumped over the lazy dogs.".getBytes())); + assertEquals("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg==", new Base64() + .encodeToString("It was the best of times, it was the worst of times.".getBytes())); + assertEquals("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw==", new Base64() + .encodeToString("http://jakarta.apache.org/commmons".getBytes())); + assertEquals("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg==", new Base64() + .encodeToString("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz".getBytes())); + assertEquals("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0=", new Base64() + .encodeToString("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }".getBytes())); assertEquals("eHl6enkh", new String(new Base64().encode("xyzzy!".getBytes()))); - assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg..", - new Base64(true).encodeToString("The quick brown fox jumped over the lazy dogs.".getBytes())); - assertEquals("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg..", - new Base64(true).encodeToString("It was the best of times, it was the worst of times.".getBytes())); - assertEquals("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw..", - new Base64(true).encodeToString("http://jakarta.apache.org/commmons".getBytes())); - assertEquals("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg..", - new Base64(true).encodeToString("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz".getBytes())); - assertEquals("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0.", - new Base64(true).encodeToString("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }".getBytes())); + assertEquals("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg..", new Base64(true) + .encodeToString("The quick brown fox jumped over the lazy dogs.".getBytes())); + assertEquals("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg..", new Base64(true) + .encodeToString("It was the best of times, it was the worst of times.".getBytes())); + assertEquals("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw..", new Base64(true) + .encodeToString("http://jakarta.apache.org/commmons".getBytes())); + assertEquals("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg..", new Base64(true) + .encodeToString("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz".getBytes())); + assertEquals("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0.", new Base64(true) + .encodeToString("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }".getBytes())); assertEquals("eHl6enkh", new String(new Base64(true).encode("xyzzy!".getBytes()))); } public void testKnownDecodings() { - assertEquals("The quick brown fox jumped over the lazy dogs.", - new String(new Base64().decodeFromString("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg=="))); - assertEquals("It was the best of times, it was the worst of times.", - new String(new Base64().decodeFromString("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg=="))); - assertEquals("http://jakarta.apache.org/commmons", - new String(new Base64().decodeFromString("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw=="))); - assertEquals("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz", - new String(new Base64().decodeFromString("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg=="))); - assertEquals("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }", - new String(new Base64().decodeFromString("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0="))); - assertEquals("xyzzy!", - new String(new Base64().decodeFromString("eHl6enkh"))); + assertEquals("The quick brown fox jumped over the lazy dogs.", new String(new Base64() + .decodeFromString("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg=="))); + assertEquals("It was the best of times, it was the worst of times.", new String(new Base64() + .decodeFromString("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg=="))); + assertEquals("http://jakarta.apache.org/commmons", new String(new Base64() + .decodeFromString("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw=="))); + assertEquals("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz", new String(new Base64() + .decodeFromString("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg=="))); + assertEquals("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }", new String(new Base64() + .decodeFromString("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0="))); + assertEquals("xyzzy!", new String(new Base64().decodeFromString("eHl6enkh"))); - assertEquals("The quick brown fox jumped over the lazy dogs.", - new String(new Base64(true).decodeFromString("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg.."))); - assertEquals("It was the best of times, it was the worst of times.", - new String(new Base64(true).decodeFromString("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg.."))); - assertEquals("http://jakarta.apache.org/commmons", - new String(new Base64(true).decodeFromString("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw.."))); - assertEquals("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz", - new String(new Base64(true).decodeFromString("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg.."))); - assertEquals("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }", - new String(new Base64(true).decodeFromString("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0."))); - assertEquals("xyzzy!", - new String(new Base64(true).decodeFromString("eHl6enkh"))); - } + assertEquals("The quick brown fox jumped over the lazy dogs.", new String(new Base64(true) + .decodeFromString("VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg.."))); + assertEquals("It was the best of times, it was the worst of times.", new String(new Base64(true) + .decodeFromString("SXQgd2FzIHRoZSBiZXN0IG9mIHRpbWVzLCBpdCB3YXMgdGhlIHdvcnN0IG9mIHRpbWVzLg.."))); + assertEquals("http://jakarta.apache.org/commmons", new String(new Base64(true) + .decodeFromString("aHR0cDovL2pha2FydGEuYXBhY2hlLm9yZy9jb21tbW9ucw.."))); + assertEquals("AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz", new String(new Base64(true) + .decodeFromString("QWFCYkNjRGRFZUZmR2dIaElpSmpLa0xsTW1Obk9vUHBRcVJyU3NUdFV1VnZXd1h4WXlaeg.."))); + assertEquals("{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }", new String(new Base64(true) + .decodeFromString("eyAwLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCA4LCA5IH0."))); + assertEquals("xyzzy!", new String(new Base64(true).decodeFromString("eHl6enkh"))); + } public void testNonBase64Test() throws Exception { byte[] bArray = { '%' }; - + try { byte[] result = new Base64().decode(bArray); - assertTrue("The result should be empty as the test encoded content did " + - "not contain any valid base 64 characters", result.length == 0); - } - catch (Exception e) { - fail("Exception was thrown when trying to decode " + - "invalid base64 encoded data - RFC 2045 requires that all " + - "non base64 character be discarded, an exception should not" + - " have been thrown"); + assertTrue("The result should be empty as the test encoded content did " + + "not contain any valid base 64 characters", result.length == 0); + } catch (Exception e) { + fail("Exception was thrown when trying to decode " + + "invalid base64 encoded data - RFC 2045 requires that all " + + "non base64 character be discarded, an exception should not" + " have been thrown"); } } - - public void testIgnoringNonBase64InDecode() throws Exception { - assertEquals("The quick brown fox jumped over the lazy dogs.", - new String(new Base64().decodeFromString( - "VGhlIH@$#$@%F1aWN@#@#@@rIGJyb3duIGZve\n\r\t%#%#%#%CBqd##$#$W1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg=="))); - assertEquals("The quick brown fox jumped over the lazy dogs.", - new String(new Base64(true).decodeFromString( - "VGhlIH@$#$@%F1aWN@#@#@@rIGJyb3duIGZve\n\r\t%#%#%#%CBqd##$#$W1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg.."))); + public void testIgnoringNonBase64InDecode() throws Exception { + assertEquals( + "The quick brown fox jumped over the lazy dogs.", + new String( + new Base64() + .decodeFromString("VGhlIH@$#$@%F1aWN@#@#@@rIGJyb3duIGZve\n\r\t%#%#%#%CBqd##$#$W1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg=="))); + + assertEquals( + "The quick brown fox jumped over the lazy dogs.", + new String( + new Base64(true) + .decodeFromString("VGhlIH@$#$@%F1aWN@#@#@@rIGJyb3duIGZve\n\r\t%#%#%#%CBqd##$#$W1wZWQgb3ZlciB0aGUgbGF6eSBkb2dzLg.."))); } public void testDecodeWithWhitespace() throws Exception { @@ -515,10 +514,10 @@ public class Base64Tests extends TestCase { byte[] encodedArray = new Base64().encode(orig.getBytes()); StringBuffer intermediate = new StringBuffer(new String(encodedArray)); - intermediate.insert( 2, ' ' ); - intermediate.insert( 5, '\t' ); - intermediate.insert( 10, '\r' ); - intermediate.insert( 15, '\n' ); + intermediate.insert(2, ' '); + intermediate.insert(5, '\t'); + intermediate.insert(10, '\r'); + intermediate.insert(15, '\n'); byte[] encodedWithWhitespace = intermediate.toString().getBytes(); byte[] decodedWithWhitespace = new Base64().decode(encodedWithWhitespace); @@ -527,18 +526,18 @@ public class Base64Tests extends TestCase { assertEquals(orig, dest); } - + public void testEncodePaddingChar() { assertEquals("=", new String(new Base64().decode(new Base64().encode("=".getBytes())))); assertEquals(".", new String(new Base64().decode(new Base64().encode(".".getBytes())))); assertEquals("=", new String(new Base64(true).decode(new Base64(true).encode("=".getBytes())))); assertEquals(".", new String(new Base64(true).decode(new Base64(true).encode(".".getBytes())))); } - + public void testUrlSafety() throws Exception { byte[] bytes = new byte[256]; - for (int i = 0; i < 256; i++) { - bytes[i] = (byte)i; + for (int i = 0; i < 256; i++) { + bytes[i] = (byte) i; } byte[] encoded = new Base64(true).encode(bytes); String encodedString = new String(encoded, "UTF-8"); @@ -548,7 +547,7 @@ public class Base64Tests extends TestCase { assertEquals(encodedString, urlDecoded); byte[] decoded = new Base64(true).decode(urlDecoded.getBytes("UTF-8")); assertEquals(bytes.length, decoded.length); - for (int i = 0; i < 256; i++) { + for (int i = 0; i < 256; i++) { assertEquals(bytes[i], decoded[i]); } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/util/DispatchMethodInvokerTests.java b/spring-webflow/src/test/java/org/springframework/webflow/util/DispatchMethodInvokerTests.java index cd75f6c6..c4ecf459 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/util/DispatchMethodInvokerTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/util/DispatchMethodInvokerTests.java @@ -73,8 +73,7 @@ public class DispatchMethodInvokerTests extends TestCase { try { invoker.invoke("exceptionMethod", new Object[] { "testValue" }); fail("Should have thrown an exception"); - } - catch (Exception e) { + } catch (Exception e) { } } diff --git a/spring-webflow/src/test/java/org/springframework/webflow/util/ReflectionUtilsTests.java b/spring-webflow/src/test/java/org/springframework/webflow/util/ReflectionUtilsTests.java index 17f52720..1a44912f 100644 --- a/spring-webflow/src/test/java/org/springframework/webflow/util/ReflectionUtilsTests.java +++ b/spring-webflow/src/test/java/org/springframework/webflow/util/ReflectionUtilsTests.java @@ -29,59 +29,55 @@ import junit.framework.TestCase; * @author Erwin Vervaet */ public class ReflectionUtilsTests extends TestCase { - - public void testInvokeStatic() throws Exception { - Method currentTimeMillis = System.class.getMethod("currentTimeMillis", null); - Object res = ReflectionUtils.invokeMethod(currentTimeMillis, null); - assertNotNull(res); - assertTrue(res instanceof Long); - } - - public void testInvoke() throws Exception { - Method substring = String.class.getMethod("substring", new Class[] { Integer.TYPE }); - Object res = ReflectionUtils.invokeMethod(substring, "abc123", new Object[] { new Integer(3) }); - assertNotNull(res); - assertTrue(res instanceof String); - assertEquals("123", res); - } - - public void testInvokeProblem() throws Exception { - Method substring = String.class.getMethod("substring", new Class[] { Integer.TYPE }); - try { - ReflectionUtils.invokeMethod(substring, new Date()); - fail(); - } - catch (RuntimeException e) { - } - - try { - ReflectionUtils.invokeMethod(substring, "abc"); - } - catch (RuntimeException e) { - } - } - - public void testInvokeRuntimeException() throws Exception { - Method substring = String.class.getMethod("substring", new Class[] { Integer.TYPE }); - try { - ReflectionUtils.invokeMethod(substring, "abc", new Object[] { new Integer(10) }); - fail(); - } - catch (IndexOutOfBoundsException e) { - } - } - - public void testInvokeCheckedException() throws Exception { - Method m = ReflectionUtilsTests.class.getMethod("methodThatThrowsCheckedException", null); - try { - ReflectionUtils.invokeMethod(m, null); - fail(); - } - catch (RuntimeException e) { - } - } - - public static void methodThatThrowsCheckedException() throws IOException { - new FileInputStream(new File("bogus")); - } + + public void testInvokeStatic() throws Exception { + Method currentTimeMillis = System.class.getMethod("currentTimeMillis", null); + Object res = ReflectionUtils.invokeMethod(currentTimeMillis, null); + assertNotNull(res); + assertTrue(res instanceof Long); + } + + public void testInvoke() throws Exception { + Method substring = String.class.getMethod("substring", new Class[] { Integer.TYPE }); + Object res = ReflectionUtils.invokeMethod(substring, "abc123", new Object[] { new Integer(3) }); + assertNotNull(res); + assertTrue(res instanceof String); + assertEquals("123", res); + } + + public void testInvokeProblem() throws Exception { + Method substring = String.class.getMethod("substring", new Class[] { Integer.TYPE }); + try { + ReflectionUtils.invokeMethod(substring, new Date()); + fail(); + } catch (RuntimeException e) { + } + + try { + ReflectionUtils.invokeMethod(substring, "abc"); + } catch (RuntimeException e) { + } + } + + public void testInvokeRuntimeException() throws Exception { + Method substring = String.class.getMethod("substring", new Class[] { Integer.TYPE }); + try { + ReflectionUtils.invokeMethod(substring, "abc", new Object[] { new Integer(10) }); + fail(); + } catch (IndexOutOfBoundsException e) { + } + } + + public void testInvokeCheckedException() throws Exception { + Method m = ReflectionUtilsTests.class.getMethod("methodThatThrowsCheckedException", null); + try { + ReflectionUtils.invokeMethod(m, null); + fail(); + } catch (RuntimeException e) { + } + } + + public static void methodThatThrowsCheckedException() throws IOException { + new FileInputStream(new File("bogus")); + } }