summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Campo2008-02-29 06:32:33 (EST)
committerChristian Campo2008-02-29 06:32:33 (EST)
commite7a49aefa076501706cfe06ff9aacee09ebd588d (patch)
tree9ac6c7b15d1b3fc25c37f62c9bdade19923e8978
parentab6af28c25d25f11f13b70dfc9e353783594c76f (diff)
downloadorg.eclipse.riena-e7a49aefa076501706cfe06ff9aacee09ebd588d.zip
org.eclipse.riena-e7a49aefa076501706cfe06ff9aacee09ebd588d.tar.gz
org.eclipse.riena-e7a49aefa076501706cfe06ff9aacee09ebd588d.tar.bz2
new feature objecttransaction
-rw-r--r--org.eclipse.riena.objecttransaction/.classpath7
-rw-r--r--org.eclipse.riena.objecttransaction/.project28
-rw-r--r--org.eclipse.riena.objecttransaction/.settings/org.eclipse.jdt.core.prefs276
-rw-r--r--org.eclipse.riena.objecttransaction/.settings/org.eclipse.jdt.ui.prefs73
-rw-r--r--org.eclipse.riena.objecttransaction/.settings/org.eclipse.pde.core.prefs4
-rw-r--r--org.eclipse.riena.objecttransaction/META-INF/MANIFEST.MF16
-rw-r--r--org.eclipse.riena.objecttransaction/build.properties4
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/Activator.java79
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionExtractImpl.java86
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionFactoryImpl.java56
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionImpl.java1362
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionManagerImpl.java45
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/AbstractTransactedManager.java175
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/AbstractTransactedObject.java108
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectId.java35
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransaction.java392
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionExtract.java45
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionFactory.java37
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionManager.java36
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ITransactedObject.java49
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/InvalidTransactedObjectFailure.java27
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/InvalidTransactionFailure.java27
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionFactoryAccessor.java40
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionFailure.java37
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionManagerAccessor.java41
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/BasicContextCarrier.java57
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextFailure.java44
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextHelper.java60
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextProxy.java133
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContext.java39
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContextCarrier.java26
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContextProvider.java24
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IObjectTransactionContext.java32
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ObjectTransactionContext.java107
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ObjectTransactionContextFailure.java33
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/AbstractBaseChange.java47
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/MultipleChange.java93
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/MultipleChangeEntry.java50
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/SingleChange.java48
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/TransactionDelta.java227
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/Action.java92
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/InvalidActionFailure.java28
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/State.java99
-rw-r--r--org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/StateMachine.java131
44 files changed, 4455 insertions, 0 deletions
diff --git a/org.eclipse.riena.objecttransaction/.classpath b/org.eclipse.riena.objecttransaction/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.riena.objecttransaction/.project b/org.eclipse.riena.objecttransaction/.project
new file mode 100644
index 0000000..4a513f6
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.riena.objecttransaction</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.riena.objecttransaction/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.riena.objecttransaction/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..8f732bc
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,276 @@
+#Mon Feb 04 14:53:13 CET 2008
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not 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_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=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_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=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_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=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_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=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_closing_angle_bracket_in_type_arguments=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_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=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_and_in_type_parameter=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_assignment_operator=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_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=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.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.classpathVariable.JRE_SRCROOT=
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.lineSplit=120
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=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_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.classpathVariable.JRE_SRC=C\:/Develop/j2sdk5/src.zip
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=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_new_line_before_closing_brace_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_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=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_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.classpathVariable.ECLIPSE_HOME=C\:/Develop/RCPLabs-SDK/eclipse-3.3
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+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_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=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_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.codeComplete.visibilityCheck=enabled
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=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_labeled_statement=do not 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_type_parameters=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_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=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_while=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_for_increments=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_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.classpathVariable.JRE_LIB=C\:/Develop/j2sdk5/jre/lib/rt.jar
diff --git a/org.eclipse.riena.objecttransaction/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.riena.objecttransaction/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..d9e4253
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,73 @@
+#Mon Feb 04 14:53:13 CET 2008
+sp_cleanup.add_missing_override_annotations=true
+org.eclipse.jdt.ui.formatterprofiles=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?>\r\n<profiles version\="11">\r\n<profile kind\="CodeFormatterProfile" name\="Eclipse Riena [built-in]" version\="11">\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value\="end_of_line"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.blank_lines_before_field" value\="0"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value\="80"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_binary_operator" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value\="end_of_line"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.blank_lines_after_package" value\="1"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.continuation_indentation" value\="2"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value\="1"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_binary_operator" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.blank_lines_before_package" value\="0"/>\r\n<setting id\="org.eclipse.jdt.core.compiler.source" value\="1.5"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.format_line_comments" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value\="1"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.lineSplit" value\="120"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value\="0"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.indentation.size" value\="4"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_assignment" value\="0"/>\r\n<setting id\="org.eclipse.jdt.core.compiler.problem.assertIdentifier" value\="error"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.tabulation.char" value\="tab"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.blank_lines_before_method" value\="1"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value\="end_of_line"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.brace_position_for_switch" value\="end_of_line"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.compiler.problem.enumIdentifier" value\="error"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.brace_position_for_block" value\="end_of_line"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value\="end_of_line"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.compact_else_if" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value\="end_of_line"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.tabulation.size" value\="4"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.indent_empty_lines" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value\="end_of_line"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value\="1"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.compiler.compliance" value\="1.5"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value\="2"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_binary_expression" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value\="end_of_line"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode" value\="enabled"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.line_length" value\="80"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value\="1"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value\="end_of_line"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value\="0"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.wrap_before_binary_operator" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value\="1"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value\="1"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.format_html" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.format_source_code" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value\="16"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.compiler.codegen.targetPlatform" value\="1.5"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.format_header" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.comment.format_block_comments" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value\="0"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value\="end_of_line"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value\="1"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value\="true"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value\="insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value\="do not insert"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value\="false"/>\r\n<setting id\="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value\="false"/>\r\n</profile>\r\n</profiles>\r\n
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************\r\n * Copyright (c) 2007, 2008 compeople AG and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * compeople AG - initial API and implementation\r\n *******************************************************************************/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n *\r\n * ${tags}\r\n */</template></templates>
+org.eclipse.jdt.ui.javadoc=true
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+useQuickDiffPrefPage=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+org.eclipse.jdt.ui.overrideannotation=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.remove_unused_private_methods=true
+useAnnotationsPrefPage=true
+sp_cleanup.sort_members=false
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.make_parameters_final=false
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.use_this_for_non_static_method_access=false
+spelling_locale_initialized=true
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.add_missing_deprecated_annotations=true
+fontPropagated=true
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.editor.tab.width=
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.never_use_parentheses_in_expressions=true
+org.eclipse.jdt.ui.text.code_templates_migrated=true
+formatter_profile=_Eclipse Riena [built-in]
+sp_cleanup.organize_imports=true
+org.eclipse.jdt.ui.text.templates_migrated=true
+org.eclipse.jdt.ui.gettersetter.use.is=true
+sp_cleanup.always_use_blocks=true
+org.eclipse.jface.textfont=1|Courier New|10.0|0|WINDOWS|1|0|0|0|0|0|0|0|0|1|0|0|0|0|Courier New;
+sp_cleanup.use_blocks=false
+sp_cleanup.use_this_for_non_static_field_access=false
+tabWidthPropagated=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+content_assist_lru_history=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><history maxLHS\="100" maxRHS\="10"/>
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members_all=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+org.eclipse.jdt.ui.javadoclocations.migrated=true
+eclipse.preferences.version=1
+org.eclipse.jdt.ui.formatterprofiles.version=11
+content_assist_disabled_computers=org.eclipse.jdt.ui.javaNoTypeProposalCategory\u0000org.eclipse.jdt.ui.spellingProposalCategory\u0000org.eclipse.jdt.ui.textProposalCategory\u0000org.eclipse.jdt.ui.templateProposalCategory\u0000org.eclipse.jdt.ui.javaTypeProposalCategory\u0000
+sp_cleanup.format_source_code=true
+proposalOrderMigrated=true
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.remove_unused_local_variables=false
+org.eclipse.jdt.ui.text.custom_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.remove_unused_private_fields=true
+formatter_settings_version=11
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.add_serial_version_id=false
diff --git a/org.eclipse.riena.objecttransaction/.settings/org.eclipse.pde.core.prefs b/org.eclipse.riena.objecttransaction/.settings/org.eclipse.pde.core.prefs
new file mode 100644
index 0000000..603d4ca
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/.settings/org.eclipse.pde.core.prefs
@@ -0,0 +1,4 @@
+#Thu Sep 13 17:30:47 CEST 2007
+eclipse.preferences.version=1
+pluginProject.extensions=false
+resolve.requirebundle=false
diff --git a/org.eclipse.riena.objecttransaction/META-INF/MANIFEST.MF b/org.eclipse.riena.objecttransaction/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..9837f3b
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/META-INF/MANIFEST.MF
@@ -0,0 +1,16 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Objecttransaction Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.riena.objecttransaction
+Bundle-Version: 1.0.0.M2
+Bundle-Activator: org.eclipse.riena.internal.objecttransaction.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.riena.core
+Eclipse-LazyStart: true
+Import-Package: org.eclipse.equinox.log,
+ org.osgi.service.log;version="1.3.0"
+Export-Package: org.eclipse.riena.internal.objecttransaction.impl;x-friends:="de.compeople.scp.tests",
+ org.eclipse.riena.objecttransaction,
+ org.eclipse.riena.objecttransaction.context,
+ org.eclipse.riena.objecttransaction.delta,
+ org.eclipse.riena.objecttransaction.state
diff --git a/org.eclipse.riena.objecttransaction/build.properties b/org.eclipse.riena.objecttransaction/build.properties
new file mode 100644
index 0000000..34d2e4d
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/build.properties
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/Activator.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/Activator.java
new file mode 100644
index 0000000..76c5f47
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/Activator.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.objecttransaction;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.equinox.log.Logger;
+import org.eclipse.riena.core.logging.LogUtil;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends Plugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.riena.objecttransaction";
+
+ // The shared instance
+ private static Activator plugin;
+ private static BundleContext CONTEXT;
+ private LogUtil logUtil;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ CONTEXT = context;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ CONTEXT = null;
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public static BundleContext getContext() {
+ return CONTEXT;
+ }
+
+ public Logger getLogger(String name) {
+ if (logUtil == null) {
+ logUtil = new LogUtil(CONTEXT);
+ }
+ return logUtil.getLogger(name);
+ }
+
+}
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionExtractImpl.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionExtractImpl.java
new file mode 100644
index 0000000..420f403
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionExtractImpl.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.objecttransaction.impl;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.riena.objecttransaction.IObjectId;
+import org.eclipse.riena.objecttransaction.IObjectTransactionExtract;
+import org.eclipse.riena.objecttransaction.ITransactedObject;
+import org.eclipse.riena.objecttransaction.delta.TransactionDelta;
+import org.eclipse.riena.objecttransaction.state.State;
+
+/**
+ * Implements the ObjectTransactionExtract which contains all modified
+ * properties from one ObjectTransaction
+ *
+ */
+public class ObjectTransactionExtractImpl implements IObjectTransactionExtract {
+
+ private ArrayList<TransactionDelta> deltas = new ArrayList<TransactionDelta>();
+
+ /**
+ * @param deltas
+ */
+ protected ObjectTransactionExtractImpl() {
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransactionExtract#getDeltas()
+ */
+ public TransactionDelta[] getDeltas() {
+ return deltas.toArray(new TransactionDelta[0]);
+ }
+
+ /*
+ * @see org.eclipse.riena.objecttransaction.IObjectTransactionExtract#addTransactedObject(org.eclipse.riena.objecttransaction.ITransactedObject)
+ */
+ public void addCleanTransactedObject(ITransactedObject transObject) {
+ Assert.isTrue((!contains(transObject.getObjectId())), "object must not exist in extract");
+ deltas.add(new TransactionDelta(transObject.getObjectId(), State.CLEAN, transObject.getVersion()));
+ }
+
+ /*
+ * @see org.eclipse.riena.objecttransaction.IObjectTransactionExtract#contains(org.eclipse.riena.objecttransaction.IObjectId)
+ */
+ public boolean contains(IObjectId objectid) {
+ for (int i = 0; i < deltas.size(); i++) {
+ if (deltas.get(i).getObjectId().equals(objectid)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Internal method to add deltas to the extract
+ *
+ * @param delta
+ */
+ protected void addDelta(TransactionDelta delta) {
+ deltas.add(delta);
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("----------extract--------------------\n");
+ for (int i = 0; i < deltas.size(); i++) {
+ sb.append(deltas.get(i));
+ }
+ sb.append("----------extract--------------------\n");
+ return sb.toString();
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionFactoryImpl.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionFactoryImpl.java
new file mode 100644
index 0000000..1ea6e52
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionFactoryImpl.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.objecttransaction.impl;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.riena.objecttransaction.IObjectTransaction;
+import org.eclipse.riena.objecttransaction.IObjectTransactionFactory;
+import org.eclipse.riena.objecttransaction.IObjectTransactionManager;
+
+/**
+ * ObjectTransactionFactoryImpl contains the Factory for creating new
+ * ObjectTransactions
+ *
+ */
+public class ObjectTransactionFactoryImpl implements IObjectTransactionFactory {
+
+ private IObjectTransactionManager objectTransactionManager;
+
+ /**
+ * Create ObjectTranactionFactory setting the objecttransactionmanger in the
+ * constructor
+ *
+ * @param otm
+ * objecttransactionmanager
+ */
+ public ObjectTransactionFactoryImpl(IObjectTransactionManager otm) {
+ this.objectTransactionManager = otm;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransactionFactory#createObjectTransaction()
+ */
+ public IObjectTransaction createObjectTransaction() {
+ IObjectTransaction objectTransaction = new ObjectTransactionImpl();
+ objectTransactionManager.setCurrent(objectTransaction);
+ return objectTransaction;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransactionFactory#createSubObjectTransaction(org.eclipse.riena.objecttransaction.IObjectTransaction)
+ */
+ public IObjectTransaction createSubObjectTransaction(IObjectTransaction parentObjectTransaction) {
+ Assert.isNotNull(parentObjectTransaction, "Parameter 'parentObjectTransaction' must not be null.");
+
+ IObjectTransaction objectTransaction = parentObjectTransaction.createSubObjectTransaction();
+ return objectTransaction;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionImpl.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionImpl.java
new file mode 100644
index 0000000..08f65b2
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionImpl.java
@@ -0,0 +1,1362 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.objecttransaction.impl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.equinox.log.Logger;
+import org.eclipse.riena.internal.objecttransaction.Activator;
+import org.eclipse.riena.objecttransaction.IObjectId;
+import org.eclipse.riena.objecttransaction.IObjectTransaction;
+import org.eclipse.riena.objecttransaction.IObjectTransactionExtract;
+import org.eclipse.riena.objecttransaction.ITransactedObject;
+import org.eclipse.riena.objecttransaction.InvalidTransactionFailure;
+import org.eclipse.riena.objecttransaction.ObjectTransactionFailure;
+import org.eclipse.riena.objecttransaction.ObjectTransactionManagerAccessor;
+import org.eclipse.riena.objecttransaction.delta.AbstractBaseChange;
+import org.eclipse.riena.objecttransaction.delta.MultipleChange;
+import org.eclipse.riena.objecttransaction.delta.MultipleChangeEntry;
+import org.eclipse.riena.objecttransaction.delta.SingleChange;
+import org.eclipse.riena.objecttransaction.delta.TransactionDelta;
+import org.eclipse.riena.objecttransaction.state.Action;
+import org.eclipse.riena.objecttransaction.state.State;
+import org.eclipse.riena.objecttransaction.state.StateMachine;
+import org.osgi.service.log.LogService;
+
+/**
+ * Implements the IObjectTransaction interface. Contains all the logic for
+ * maintaining property values, references between object, state of objects.
+ *
+ */
+public class ObjectTransactionImpl implements IObjectTransaction {
+
+ // Map of the TransactionDelta entries in this objectTransaction, key is
+ // IObjectId
+ private Map<IObjectId, TransactionDelta> changesInTransaction;
+ // Map of the ITransactedObjects registered in this objectTransaction key is
+ // IObjectId
+ private Map<IObjectId, ITransactedObject> involvedTransactedObjects;
+ // set to true if this objectTransaction is the root transaction
+ private boolean rootTransaction = true;
+ /**
+ * contains a reference to the next higher object transaction. Usually this
+ * field is null, if this is a object transaction. However for root
+ * transactions this field is used to reference a hidden transaction that
+ * contains all the changes that were committed against the database.
+ */
+ private ObjectTransactionImpl parentTransaction;
+ // is this objectTransaction is cleanModus ? then changes do not get
+ // recorded in this objectTransaction
+ private boolean cleanModus;
+ // is this objectTransaction invalid ? (because it was committed) then no
+ // calls are possible
+ private boolean invalidTransaction = false;
+ /**
+ * do we have preRegistered ITransactedObjects ? The application program
+ * tried to register them at a time where no IObjectId was set in the
+ * business object. The preregistered objects are registered as soon as
+ * their IObjectId is set.
+ */
+ private List<ITransactedObject> preRegisteredCleanObjects = null;
+ private boolean strictModus = false;
+ private boolean allowRegister = true;
+
+ private static final Logger LOGGER = Activator.getDefault().getLogger(ObjectTransactionImpl.class.getName());
+
+ /**
+ * constructor that creates a new objectTransaction
+ */
+ public ObjectTransactionImpl() {
+ super();
+ changesInTransaction = new HashMap<IObjectId, TransactionDelta>();
+ involvedTransactedObjects = new HashMap<IObjectId, ITransactedObject>();
+ this.cleanModus = false;
+ }
+
+ /**
+ * constructor that creates a new objectTransaction with setting a
+ * difference objectTransaction as parent
+ *
+ * @param parentTransaction
+ */
+ public ObjectTransactionImpl(IObjectTransaction parentTransaction) {
+ this();
+ this.parentTransaction = (ObjectTransactionImpl) parentTransaction;
+ this.rootTransaction = false;
+ }
+
+ /**
+ * create a new objectTransaction as interface method
+ *
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#createSubObjectTransaction()
+ */
+ public IObjectTransaction createSubObjectTransaction() {
+ IObjectTransaction objectTransaction = new ObjectTransactionImpl(this);
+ ObjectTransactionManagerAccessor.fetchObjectTransactionManager().setCurrent(objectTransaction);
+ return objectTransaction;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#register(org.eclipse.riena.objecttransaction.ITransactedObject)
+ */
+ public void register(ITransactedObject object) {
+ if (!allowRegister) {
+ return;
+ }
+ Assert.isNotNull(object, "object must not be null");
+ // objects can only be registered once, so check if is already
+ // registered
+ Assert.isTrue((object.getObjectId() != null && !isRegistered(object)) || object.getObjectId() == null, "object cannot be registered a second time");
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+
+ keepReferenceOf(object);
+ // if ObjectId is not set, preregister, otherwise set object state to
+ // CLEAN (unchanged)
+ if (object.getObjectId() == null) {
+ addPreRegisteredClean(object);
+ } else {
+ setObjectState(object, State.CLEAN);
+ }
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#registerNew(org.eclipse.riena.objecttransaction.ITransactedObject)
+ */
+ public void registerNew(ITransactedObject object) {
+ if (!allowRegister) {
+ return;
+ }
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isTrue(object.getObjectId() != null, "ObjectId of Transacted Object must not be null");
+ Assert.isTrue(!isRegistered(object), "Transacted Object must not be already registered");
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+
+ notifyObjectChange(object, Action.NEW);
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#registerAsDeleted(org.eclipse.riena.objecttransaction.ITransactedObject)
+ */
+ public void registerAsDeleted(ITransactedObject object) {
+ if (!allowRegister) {
+ return;
+ }
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ notifyObjectChange(object, Action.DELETE);
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#allowRegister(boolean)
+ */
+ public void allowRegister(boolean parmAllowRegister) {
+ this.allowRegister = parmAllowRegister;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#exportExtract()
+ */
+ public IObjectTransactionExtract exportExtract() {
+ return exportExtractInternal(true);
+ }
+
+ /*
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#exportOnlyModifedObjectsToExtract()
+ */
+ public IObjectTransactionExtract exportOnlyModifedObjectsToExtract() {
+ // first export regular modified objects
+ IObjectTransactionExtract extract = exportExtractInternal(false);
+ // then include all targets of a reference change in the extract
+ for (TransactionDelta delta : extract.getDeltas()) {
+ Collection<?> changes = delta.getChanges().values();
+ for (Object change : changes) {
+ if (change instanceof SingleChange) {
+ SingleChange sChange = (SingleChange) change;
+ Object child = sChange.getChildObject();
+ if (child instanceof IObjectId) {
+ child = lookupObjectById((IObjectId) child);
+ }
+ if (child instanceof ITransactedObject && !(extract.contains(((ITransactedObject) child).getObjectId()))) {
+ extract.addCleanTransactedObject((ITransactedObject) child);
+ }
+ } else {
+ if (change instanceof MultipleChange) {
+ MultipleChange mChange = (MultipleChange) change;
+ for (MultipleChangeEntry mEntry : mChange.getEntries()) {
+ Object mChild = mEntry.getChildObject();
+ if (mChild instanceof IObjectId) {
+ mChild = lookupObjectById((IObjectId) mChild);
+ }
+ if (mChild instanceof ITransactedObject) {
+ if (!extract.contains(((ITransactedObject) mChild).getObjectId())) {
+ extract.addCleanTransactedObject((ITransactedObject) mChild);
+ }
+ } else {
+ throw new ObjectTransactionFailure("non ITransactionObject in multi reference ???");
+ }
+ }
+ } else {
+ throw new ObjectTransactionFailure("unknown change typ (not single and not multi reference change)");
+ }
+ }
+ }
+ }
+ return extract;
+ }
+
+ private IObjectTransactionExtract exportExtractInternal(boolean exportClean) {
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ // copies the TransactionDeltas into an Array
+ ObjectTransactionExtractImpl extract = new ObjectTransactionExtractImpl();
+ try {
+ for (TransactionDelta temp : changesInTransaction.values()) {
+ if (!(temp.getState().equals(State.VANISHED))) {
+ if (exportClean || !(temp.getState().equals(State.CLEAN))) {
+ temp = (TransactionDelta) temp.clone();
+ extract.addDelta(temp);
+ }
+ }
+ }
+ } catch (CloneNotSupportedException e) {
+ throw new ObjectTransactionFailure("error cloning TransactionDelta ", e);
+ }
+ // and create an objectTransactionextract from it
+ return extract;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#importExtract(org.eclipse.riena.objecttransaction.IObjectTransactionExtract)
+ */
+ public void importExtract(IObjectTransactionExtract extract) throws InvalidTransactionFailure {
+ checkForRegisteredObjects();
+ importExtractInternal(extract, true);
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#importOnlyModifedObjectsFromExtract(org.eclipse.riena.objecttransaction.IObjectTransactionExtract)
+ */
+ public void importOnlyModifedObjectsFromExtract(IObjectTransactionExtract extract) throws InvalidTransactionFailure {
+ checkForRegisteredObjects();
+ // check that all targets of reference changes are registered
+ for (TransactionDelta delta : extract.getDeltas()) {
+ Collection<?> changes = delta.getChanges().values();
+ for (Object change : changes) {
+ if (change instanceof SingleChange) {
+ SingleChange sChange = (SingleChange) change;
+ Object child = sChange.getChildObject();
+ boolean isRegistered = true;
+ if (child instanceof IObjectId) {
+ isRegistered = this.isRegistered((IObjectId) child);
+ } else {
+ if (child instanceof ITransactedObject) {
+ isRegistered = this.isRegistered((ITransactedObject) child);
+ }
+ }
+ if (!isRegistered) {
+ throw new InvalidTransactionFailure("reference target object " + child + " must be registered before import");
+ }
+ } else {
+ if (change instanceof MultipleChange) {
+ MultipleChange mChange = (MultipleChange) change;
+ for (MultipleChangeEntry mEntry : mChange.getEntries()) {
+ Object mChild = mEntry.getChildObject();
+ boolean isRegistered = true;
+ if (mChild instanceof IObjectId) {
+ isRegistered = isRegistered((IObjectId) mChild);
+ } else {
+ if (mChild instanceof ITransactedObject) {
+ isRegistered = isRegistered((ITransactedObject) mChild);
+ } else {
+ throw new InvalidTransactionFailure("invalid object in multi-ref " + mChild);
+ }
+ }
+ if (!isRegistered) {
+ throw new InvalidTransactionFailure("reference target object " + mChild + " must be registered before import");
+ }
+ }
+ } else {
+ throw new ObjectTransactionFailure("unknown change typ (not single and not multi reference change)");
+ }
+ }
+ }
+ }
+ importExtractInternal(extract, false);
+ }
+
+ /**
+ * Check that objects that own a delta record are registered in the object
+ * transaction
+ *
+ * @throws InvalidTransactionFailure
+ */
+ private void checkForRegisteredObjects() throws InvalidTransactionFailure {
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ if (!isRootTransaction()) {
+ throw new InvalidTransactionFailure("object transaction must be the root transaction");
+ }
+ // import means adding changes to the objectTransaction and cannot
+ // happen in clean modus
+ if (isCleanModus()) {
+ throw new InvalidTransactionFailure("object transaction must NOT be in clean modus when importing");
+ }
+
+ // this will add all preregistered objects with ObjectIds to the
+ // objectTransaction
+ checkPreRegisteredClean();
+ if (preRegisteredCleanObjects != null && preRegisteredCleanObjects.size() > 0) {
+ for (ITransactedObject object : preRegisteredCleanObjects) {
+ if (object.getObjectId() != null) {
+ throw new InvalidTransactionFailure("internal error, preregistered object found with ObjectId " + object);
+ } else {
+ throw new InvalidTransactionFailure("missing object id for object " + object);
+ }
+ }
+ }
+
+ }
+
+ private void importExtractInternal(IObjectTransactionExtract extract, boolean importClean) throws InvalidTransactionFailure {
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ if (!isRootTransaction()) {
+ throw new InvalidTransactionFailure("object transaction must be the root transaction");
+ }
+ // import means adding changes to the objectTransaction and cannot
+ // happen in clean modus
+ if (isCleanModus()) {
+ throw new InvalidTransactionFailure("object transaction must NOT be in clean modus when importing");
+ }
+
+ // check that all object ids referenced in the deltas, exist in the
+ // transaction, if they exist copy them over
+ TransactionDelta[] deltas = extract.getDeltas();
+ ObjectTransactionImpl tempSubTransaction = (ObjectTransactionImpl) createSubObjectTransaction();
+ for (TransactionDelta delta : deltas) {
+ if (importClean || delta.getState() != State.CLEAN) {
+ IObjectId objectId = delta.getObjectId();
+ IObjectId newObjectId = null;
+ String versionChange = null;
+ // check if the extract contains an object id change
+ if (delta.getSingleRefObject("sys::oldoid") != null) {
+ objectId = (IObjectId) delta.getSingleRefObject("sys::oldoid");
+ newObjectId = (IObjectId) delta.getSingleRefObject("sys::oid");
+ }
+ if (delta.getSingleRefObject("sys::version") != null) {
+ versionChange = (String) delta.getSingleRefObject("sys::version");
+ }
+ if (this.involvedTransactedObjects.get(objectId) == null) {
+ throw new ObjectTransactionFailure("ObjectIds for all imported deltas must exist in objectTransaction, not found=" + delta);
+ } else {
+ if (newObjectId != null) {
+ changeObjectId(objectId, newObjectId);
+ objectId = newObjectId;
+ }
+ if (versionChange != null) {
+ ITransactedObject transObject = this.involvedTransactedObjects.get(objectId);
+ transObject.setVersion(versionChange);
+ }
+ // copy involved objects from this transaction and add
+ // deltas to subtransaction
+ tempSubTransaction.involvedTransactedObjects.put(objectId, this.involvedTransactedObjects.get(objectId));
+ tempSubTransaction.changesInTransaction.put(objectId, delta);
+ }
+ }
+ }
+
+ // commit the temporary sub transaction and forget it. this way the
+ // extract is merged into the current transaction
+ tempSubTransaction.commit();
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#isRootTransaction()
+ */
+ public boolean isRootTransaction() {
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ return rootTransaction;
+ }
+
+ /**
+ * sets the object state of a transacted object
+ *
+ * @param object
+ * transacted object for which to set the state
+ * @param state
+ * state that should be set
+ */
+ private void setObjectState(ITransactedObject object, State state) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+
+ keepReferenceOf(object);
+
+ // check if a delta exists and if not create one, then set the state
+ TransactionDelta delta = changesInTransaction.get(object.getObjectId());
+ if (delta == null) {
+ // we have to set the version at the end, because retrieving the
+ // version
+ // (sometimes) requires that the object is registered so it has to
+ // have
+ // a changesInTransaction entry
+ delta = new TransactionDelta(object.getObjectId(), state, object.getVersion());
+ changesInTransaction.put(object.getObjectId(), delta);
+ } else {
+ delta.setState(state);
+ }
+ return;
+ }
+
+ /**
+ * return the object state for a given transacted object
+ *
+ * @param object
+ * transacted object for which to retrieve the object state
+ * @return state of the transacted objcet
+ */
+ private State getObjectState(ITransactedObject object) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ // find the delta for an oid
+ TransactionDelta delta = changesInTransaction.get(object.getObjectId());
+ // if not found
+ if (delta == null) {
+ // if a parenttransaction exist, ask the parent transaction for the
+ // state
+ if (parentTransaction != null) {
+ return parentTransaction.getObjectState(object);
+ }
+ return null;
+ }
+ return delta.getState();
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#setReference(org.eclipse.riena.objecttransaction.ITransactedObject,
+ * java.lang.String, java.lang.Object)
+ */
+ public void setReference(ITransactedObject object, String refName, Object newValue) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+ Assert.isTrue(!(newValue instanceof ITransactedObject), "setReference for Object must not pass a \"hidden\" ITransactedObject");
+ checkPreRegisteredClean();
+ if (!isCleanModus()) {
+ Assert.isTrue(isRegistered(object), "object must be registered");
+ }
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+
+ // change nothing if in clean modus
+ if (isCleanModus()) {
+ return;
+ }
+ // find the delta entry for this transacted objects ObjectId, create new
+ // entry if it does not exist
+ TransactionDelta delta = changesInTransaction.get(object.getObjectId());
+ if (delta == null) {
+ delta = new TransactionDelta(object.getObjectId(), State.CREATED, object.getVersion());
+ changesInTransaction.put(object.getObjectId(), delta);
+ } else {
+ // if the object was clean, set it to modified
+ if (delta.getState().equals(State.CLEAN)) {
+ delta.setState(State.MODIFIED);
+ }
+ }
+
+ // set the newValue for the refName
+ delta.setSingleRefObject(refName, newValue);
+ return;
+ }
+
+ public Object getReference(ITransactedObject object, String refName, Object defaultValue) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+ Assert.isTrue(!(defaultValue instanceof ITransactedObject), "getReference for Object must not pass a \"hidden\" ITransactedObject for defaultValue");
+ checkPreRegisteredClean();
+ if (isCleanModus() || (!isStrictModus() && !isRegistered(object))) {
+ return defaultValue;
+ }
+ Assert.isTrue(isRegistered(object), "object must be registered");
+
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+
+ // find delta entry, look for a single change entry with the requested
+ // refName
+ // if it is a property (not instanceof IObjectId) return the value,
+ // if is a IObjectId, lookup the original transactedobject and return it
+ TransactionDelta delta = changesInTransaction.get(object.getObjectId());
+ if (delta != null) {
+ if (delta.hasSingleRefObject(refName)) {
+ Object propValue = delta.getSingleRefObject(refName);
+ if (propValue instanceof IObjectId) {
+ return lookupObjectById((IObjectId) propValue);
+ } else {
+ return propValue; // includes the case where propValue is
+ // null
+ }
+ }
+ }
+ // if I can't find an entry, ask the parenttransaction if it exists
+ if (parentTransaction != null) {
+ return parentTransaction.getReference(object, refName, defaultValue);
+ }
+ // if nothing is found, return the defaultValue
+ return defaultValue;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#setReference(org.eclipse.riena.objecttransaction.ITransactedObject,
+ * java.lang.String,
+ * org.eclipse.riena.objecttransaction.ITransactedObject)
+ */
+ public void setReference(ITransactedObject object, String relationName, ITransactedObject refObject) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+ checkPreRegisteredClean();
+ if (!isCleanModus()) {
+ Assert.isTrue(isRegistered(object), "object must be registered");
+ Assert.isTrue(refObject == null || (refObject.getObjectId() != null && isRegistered(refObject)), "invalid refObject");
+ }
+
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+
+ // do nothing if in clean modus
+ if (isCleanModus()) {
+ return;
+ }
+
+ // find current delta entry, create one if it does not exist
+ TransactionDelta delta = changesInTransaction.get(object.getObjectId());
+ if (delta == null) {
+ delta = new TransactionDelta(object.getObjectId(), State.CREATED, object.getVersion());
+ changesInTransaction.put(object.getObjectId(), delta);
+ } else {
+ // if it was clean, change it to modified
+ if (delta.getState().equals(State.CLEAN)) {
+ delta.setState(State.MODIFIED);
+ }
+ }
+ // add a reference to the ObjectId object of the referenced
+ // transactedobject
+ IObjectId id2 = null;
+ if (refObject != null) {
+ id2 = refObject.getObjectId();
+ }
+ delta.setSingleRefObject(relationName, id2);
+ return;
+
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#getReference(org.eclipse.riena.objecttransaction.ITransactedObject,
+ * java.lang.String,
+ * org.eclipse.riena.objecttransaction.ITransactedObject)
+ */
+ public ITransactedObject getReference(ITransactedObject object, String relationName, ITransactedObject defaultRefObject) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+ checkPreRegisteredClean();
+ if (isCleanModus() || (!isStrictModus() && !isRegistered(object))) {
+ return defaultRefObject;
+ }
+ Assert.isTrue(isRegistered(object), "object must be registered");
+ Assert.isTrue(defaultRefObject == null || (defaultRefObject.getObjectId() != null && isRegistered(defaultRefObject)),
+ "invalid defaultRefObject (is null, has no ObjectId or is not registered)");
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+
+ // find the delta entry for this transacted object, look for a single
+ // ref object with that reference name
+ // if is instanceof IObjectId, lookup the transacted object and return
+ // it, otherwise throw an exception
+ TransactionDelta delta = changesInTransaction.get(object.getObjectId());
+ if (delta != null) {
+ if (delta.hasSingleRefObject(relationName)) {
+ Object refObject = delta.getSingleRefObject(relationName);
+ if (refObject != null) {
+ if (refObject instanceof IObjectId) {
+ return lookupObjectById((IObjectId) refObject);
+ } else {
+ throw new InvalidTransactionFailure("how did I ever get here ???");
+ }
+ } else {
+ return null;
+ }
+ }
+ }
+ // if no delta entry was found, ask the parentTransaction, if it exists
+ if (parentTransaction != null) {
+ return parentTransaction.getReference(object, relationName, defaultRefObject);
+ }
+ // nothing found, return the default
+ return defaultRefObject;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#addReference(org.eclipse.riena.objecttransaction.ITransactedObject,
+ * java.lang.String,
+ * org.eclipse.riena.objecttransaction.ITransactedObject)
+ */
+ public void addReference(ITransactedObject object, String referenceName, ITransactedObject refObject) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+ checkPreRegisteredClean();
+ if (!isCleanModus()) {
+ Assert.isTrue(isRegistered(object), "object must be registered");
+ }
+ Assert.isNotNull(refObject, "refObject must not be null");
+ Assert.isNotNull(refObject.getObjectId(), "ObjectId of refObject must not be null");
+ if (!isCleanModus()) {
+ Assert.isTrue(isRegistered(refObject), "refObject must be registered");
+ }
+
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ // do nothing if in clean modus
+ if (isCleanModus()) {
+ return;
+ }
+ // find delta entry for the transacted object, add one if it was not
+ // found
+ TransactionDelta delta = changesInTransaction.get(object.getObjectId());
+ if (delta == null) {
+ delta = new TransactionDelta(object.getObjectId(), State.CREATED, object.getVersion());
+ changesInTransaction.put(object.getObjectId(), delta);
+ } else {
+ // if state was clean, change it to modified
+ if (delta.getState().equals(State.CLEAN)) {
+ delta.setState(State.MODIFIED);
+ }
+ }
+ // add a reference to the refname into the MultiRefObject (a set of
+ // multiobjects for one refName)
+ delta.addMultiRefObject(referenceName, refObject.getObjectId());
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#removeReference(org.eclipse.riena.objecttransaction.ITransactedObject,
+ * java.lang.String,
+ * org.eclipse.riena.objecttransaction.ITransactedObject)
+ */
+ public void removeReference(ITransactedObject object, String referenceName, ITransactedObject refObject) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+ checkPreRegisteredClean();
+ if (!isCleanModus()) {
+ Assert.isTrue(isRegistered(object), "object must be registered");
+ }
+ Assert.isNotNull(refObject, "object must not be null");
+ Assert.isNotNull(refObject.getObjectId(), "ObjectId of object must not be null");
+ if (!isCleanModus() || isStrictModus()) {
+ Assert.isTrue(isRegistered(refObject), "refObject must be registered");
+ }
+
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ // if in clean modus don't do anything in the transaction
+ if (isCleanModus()) {
+ return;
+ }
+ // find delta entry for transacted object, if not found, create one
+ TransactionDelta delta = changesInTransaction.get(object.getObjectId());
+ if (delta == null) {
+ delta = new TransactionDelta(object.getObjectId(), State.CREATED, object.getVersion());
+ changesInTransaction.put(object.getObjectId(), delta);
+ } else {
+ // if the state of the transacted object was clean, change it to
+ // modified
+ if (delta.getState().equals(State.CLEAN)) {
+ delta.setState(State.MODIFIED);
+ }
+ }
+ // add a "remove" entry to the multirefobject
+ delta.removeMultiRefObject(referenceName, refObject.getObjectId());
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#listReference(org.eclipse.riena.objecttransaction.ITransactedObject,
+ * java.lang.String, java.util.Set)
+ */
+ public <T> Set<T> listReference(ITransactedObject object, String referenceName, Set<T> initialSet) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+ checkPreRegisteredClean();
+ if (isCleanModus() || (!isStrictModus() && !isRegistered(object))) {
+ return initialSet;
+ }
+ Assert.isTrue(isRegistered(object), "object must be registered");
+ Set<T> newSet;
+ // if the passed Set is not a LinkedHashSet, make it one
+ if (initialSet == null) {
+ newSet = new LinkedHashSet<T>();
+ } else {
+ newSet = new LinkedHashSet<T>(initialSet);
+ }
+
+ fillReference(object, referenceName, newSet);
+ return newSet;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#listReference(org.eclipse.riena.objecttransaction.ITransactedObject,
+ * java.lang.String, java.util.List)
+ */
+ public <T> List<T> listReference(ITransactedObject object, String referenceName, List<T> initialList) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+ checkPreRegisteredClean();
+ if (isCleanModus() || (!isStrictModus() && !isRegistered(object))) {
+ return initialList;
+ }
+ Assert.isTrue(isRegistered(object), "object must be registered");
+
+ List<T> newList;
+ if (initialList == null) {
+ newList = new ArrayList<T>();
+ } else {
+ newList = new ArrayList<T>(initialList);
+ }
+
+ fillReference(object, referenceName, newList);
+ return newList;
+ }
+
+ @SuppressWarnings( { "unchecked" })
+ // TODO SuppressWarnings: Collection<T> is not Type safety
+ private <T> void fillReference(ITransactedObject object, String referenceName, Collection<T> initialCollection) {
+
+ // if this transaction has a parentTransaction, ask it first to add or
+ // remove their entries
+ if (parentTransaction != null) {
+ parentTransaction.fillReference(object, referenceName, initialCollection);
+ }
+
+ // find the delta object
+ TransactionDelta delta = changesInTransaction.get(object.getObjectId());
+ if (delta != null) {
+ // iterate over the changes
+ for (AbstractBaseChange cEntry : delta.getChanges().values()) {
+ // check if is a MultiSetChangeEntry and the referenceName
+ // matches
+ if (cEntry.getRelationName().equals(referenceName) && cEntry instanceof MultipleChange) {
+ // get the set of changes
+ List<MultipleChangeEntry> changes = ((MultipleChange) cEntry).getEntries();
+ for (MultipleChangeEntry singleEntry : changes) {
+ Object tObject = lookupObjectById((IObjectId) singleEntry.getChildObject());
+ // if added, add it to the result set
+ if (singleEntry.getState().equals(State.ADDED)) {
+ initialCollection.add((T) tObject);
+ // if removed, remove it from the result set
+ } else if (singleEntry.getState().equals(State.REMOVED)) {
+ initialCollection.remove(tObject);
+ } else {
+ throw new InvalidTransactionFailure("state was not ADDED or REMOVED for " + singleEntry);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#setVersionUpdate(org.eclipse.riena.objecttransaction.ITransactedObject,
+ * java.lang.String)
+ */
+ public void setVersionUpdate(ITransactedObject object, String version) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "object ObjectId must not be null");
+ Assert.isTrue(!isInvalid(), "must not be an invalid transaction");
+ Assert.isTrue(!isCleanModus(), "must not be in clean modus");
+ this.setReference(object, "sys::version", version);
+ object.setVersion(version);
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#getVersionUpdate(org.eclipse.riena.objecttransaction.ITransactedObject,
+ * java.lang.String)
+ */
+ // private String getVersionUpdate( ITransactedObject object, String
+ // defaultVersion ) {
+ // Assert.isNotNull( "object must not be null", object );
+ // Assert.isNotNull( "object ObjectId must not be null",
+ // object.getObjectId() );
+ // Assert.isTrue( "must not be an invalid transaction",
+ // !isInvalid() );
+ // if ( !isRegistered( object ) ) {
+ // return defaultVersion;
+ // }
+ // return (String) this.getReference( object, "sys::version", defaultVersion
+ // );
+ // }
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#setObjectIdUpdate(org.eclipse.riena.objecttransaction.IObjectId,
+ * org.eclipse.riena.objecttransaction.IObjectId)
+ */
+ public void setObjectIdUpdate(IObjectId oldObjectId, IObjectId newObjectId) {
+ Assert.isTrue(oldObjectId != null && newObjectId != null, "old and new ObjectId must not be null");
+ Assert.isTrue(oldObjectId != newObjectId, "instance of oldObjectId and newObjectId must not be the same");
+ checkPreRegisteredClean();
+ changeObjectId(oldObjectId, newObjectId);
+ }
+
+ private void changeObjectId(IObjectId oldObjectId, IObjectId newObjectId) {
+ assert oldObjectId != null && newObjectId != null : "oldObjectId and newObjectId must not be null";
+ ITransactedObject transObject = lookupObjectById(oldObjectId);
+ if (transObject == null) {
+ throw new ObjectTransactionFailure("oldObjectId is not registered");
+ }
+ // change the ObjectId in the transactedobject
+ transObject.setObjectId(newObjectId);
+ involvedTransactedObjects.remove(oldObjectId);
+ // change the ObjectId in the list of involvedobjects
+ involvedTransactedObjects.put(newObjectId, transObject);
+ // change the delta record for this ObjectId (if exist)
+ TransactionDelta delta = changesInTransaction.get(oldObjectId);
+ if (delta != null) {
+ changesInTransaction.remove(oldObjectId);
+ changesInTransaction.put(newObjectId, delta);
+ delta.setObjectId(newObjectId);
+ }
+ // search deltas and find reference to changed ObjectId
+ for (TransactionDelta delta2 : changesInTransaction.values()) {
+ for (AbstractBaseChange cEntry : delta2.getChanges().values()) {
+ if (cEntry instanceof SingleChange) {
+ Object child = ((SingleChange) cEntry).getChildObject();
+ if (child instanceof ITransactedObject) {
+ if (((ITransactedObject) child).getObjectId().equals(oldObjectId)) {
+ ((ITransactedObject) child).setObjectId(newObjectId);
+ }
+ }
+ } else {
+ List<MultipleChangeEntry> changes = ((MultipleChange) cEntry).getEntries();
+ for (MultipleChangeEntry singleEntry : changes) {
+ if (singleEntry.getChildObject() instanceof ITransactedObject) {
+ if (((ITransactedObject) singleEntry.getChildObject()).getObjectId().equals(oldObjectId)) {
+ ((ITransactedObject) singleEntry.getChildObject()).setObjectId(newObjectId);
+ }
+ }
+ }
+ }
+ }
+ }
+ // add change record so that extract contain a notification of the
+ // change
+ this.setReference(transObject, "sys::oid", newObjectId);
+ this.setReference(transObject, "sys::oldoid", oldObjectId);
+ }
+
+ /**
+ *
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#isRegistered(org.eclipse.riena.objecttransaction.ITransactedObject)
+ */
+ public boolean isRegistered(ITransactedObject object) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "object ObjectId must not be null");
+ Assert.isTrue(!isInvalid(), "must not be an invalid transaction");
+ checkPreRegisteredClean();
+ // check if a delta entry was found
+ boolean isRegistered = changesInTransaction.get(object.getObjectId()) != null;
+ // if not and a parent exist, ask parent and if it finds one, add it to
+ // the references in this transaction
+ if (!isRegistered && parentTransaction != null) {
+ isRegistered = parentTransaction.isRegistered(object);
+ keepReferenceOf(object);
+ }
+ return isRegistered;
+ }
+
+ private boolean isRegistered(IObjectId object) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isTrue(!isInvalid(), "must not be an invalid transaction");
+ checkPreRegisteredClean();
+ // check if a delta entry was found
+ boolean isRegistered = changesInTransaction.get(object) != null;
+ // if not and a parent exist, ask parent and if it finds one, add it to
+ // the references in this transaction
+ if (!isRegistered && parentTransaction != null) {
+ isRegistered = parentTransaction.isRegistered(object);
+ }
+ return isRegistered;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#notifyObjectChange(org.eclipse.riena.objecttransaction.IObjectId,
+ * int)
+ */
+ private void notifyObjectChange(ITransactedObject object, Action action) {
+ Assert.isNotNull(object, "object must not be null");
+ Assert.isNotNull(object.getObjectId(), "ObjectId of object must not be null");
+
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ keepReferenceOf(object);
+ // don't do anything if in clean modus
+ if (isCleanModus()) {
+ return;
+ }
+ // find the delta entry, create one if it does not exist, apply the
+ // action using the StateMachine
+ TransactionDelta delta = changesInTransaction.get(object.getObjectId());
+ if (delta == null) {
+ delta = new TransactionDelta(object.getObjectId(), StateMachine.initAction(action), object.getVersion());
+ changesInTransaction.put(object.getObjectId(), delta);
+ } else {
+ delta.setState(StateMachine.processAction(delta.getState(), action));
+ }
+ return;
+ }
+
+ /**
+ * add object to a hashmap of involvedObjects in this objectTransaction
+ *
+ * @param object
+ * object of which to keep the reference
+ */
+ private void keepReferenceOf(ITransactedObject object) {
+ if (object == null || object.getObjectId() == null) {
+ return;
+ }
+ involvedTransactedObjects.put(object.getObjectId(), object);
+ }
+
+ /**
+ * add a new object to the list of preregistered transacted objects (those
+ * with no IObjectId)
+ *
+ * @param object
+ * @pre isCleanModus()
+ * @pre object.getObjectId()==null
+ */
+ private void addPreRegisteredClean(ITransactedObject object) {
+ Assert.isTrue(isCleanModus(), "can only register objects with no IObjectId in clean modus");
+ Assert.isTrue(object.getObjectId() == null, "can only preregister object where the IObjectId is null");
+ if (preRegisteredCleanObjects == null) {
+ preRegisteredCleanObjects = new ArrayList<ITransactedObject>();
+ }
+ preRegisteredCleanObjects.add(object);
+ return;
+ }
+
+ /**
+ * preregistered transactedobjects are those that called in a register call,
+ * but dont had a IObjectId yet this method checks all entries, whether they
+ * now have a IObjectId. if so they are removed and added into the normal
+ * hashmaps (which index by IObjectId)
+ */
+ private void checkPreRegisteredClean() {
+ if (preRegisteredCleanObjects == null || preRegisteredCleanObjects.size() == 0) {
+ return;
+ }
+ for (int i = 0; i < preRegisteredCleanObjects.size(); i++) {
+ ITransactedObject object = preRegisteredCleanObjects.get(i);
+ if (object.getObjectId() != null) {
+ preRegisteredCleanObjects.remove(object);
+ changesInTransaction.put(object.getObjectId(), new TransactionDelta(object.getObjectId(), State.CLEAN, object.getVersion()));
+ keepReferenceOf(object);
+ i = i - 1;
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#setCleanModus(boolean)
+ */
+ public void setCleanModus(boolean cleanModus) {
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ checkPreRegisteredClean();
+ this.cleanModus = cleanModus;
+ if (!cleanModus) {
+ if (preRegisteredCleanObjects != null && preRegisteredCleanObjects.size() > 0) {
+ LOGGER
+ .log(
+ LogService.LOG_WARNING,
+ "The cleanModus is set to false in objectTransaction with the consequence that 'preregistered' object (objects with a 'null' oid) are removed and no longe registered. Your ObjectTransaction has "
+ + preRegisteredCleanObjects.size() + " of such objects.");
+ for (ITransactedObject transObject : preRegisteredCleanObjects) {
+ LOGGER.log(LogService.LOG_INFO, "removing " + transObject);
+ }
+ preRegisteredCleanObjects = new ArrayList<ITransactedObject>();
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#isCleanModus()
+ */
+ public boolean isCleanModus() {
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ return cleanModus;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#setStrictModus(boolean)
+ */
+ public void setStrictModus(boolean strictModus) {
+ checkPreRegisteredClean();
+ this.strictModus = strictModus;
+ }
+
+ public boolean isStrictModus() {
+ return strictModus;
+ }
+
+ /**
+ * internal implementation of the commit functionality. There is an internal
+ * method that performs the actual task, so that it can be used internally
+ * for other features
+ */
+ private void internalCommit() {
+ for (ITransactedObject transObject : involvedTransactedObjects.values()) {
+ if (!(parentTransaction.involvedTransactedObjects.get(transObject.getObjectId()) != null)) {
+ parentTransaction.involvedTransactedObjects.put(transObject.getObjectId(), transObject);
+ parentTransaction.changesInTransaction.put(transObject.getObjectId(), new TransactionDelta(transObject.getObjectId(), State.CLEAN, transObject
+ .getVersion()));
+ }
+ }
+ for (TransactionDelta delta : changesInTransaction.values()) {
+ ITransactedObject usedObject = lookupObjectById(delta.getObjectId());
+ // if not registered in parent, register and set same state as in
+ // this transaction
+ if (!parentTransaction.isRegistered(usedObject)) {
+ parentTransaction.setObjectState(usedObject, getObjectState(usedObject));
+ }
+ for (AbstractBaseChange cEntry : delta.getChanges().values()) {
+ if (cEntry instanceof SingleChange) {
+ parentTransaction.setReference(usedObject, ((SingleChange) cEntry).getRelationName(), ((SingleChange) cEntry).getChildObject());
+ } else {
+ List<MultipleChangeEntry> changes = ((MultipleChange) cEntry).getEntries();
+ for (MultipleChangeEntry singleEntry : changes) {
+ if (singleEntry.getState().equals(State.ADDED)) {
+ parentTransaction.addReference(usedObject, ((MultipleChange) cEntry).getRelationName(), lookupObjectById((IObjectId) singleEntry
+ .getChildObject()));
+ } else if (singleEntry.getState().equals(State.REMOVED)) {
+ parentTransaction.removeReference(usedObject, ((MultipleChange) cEntry).getRelationName(), lookupObjectById((IObjectId) singleEntry
+ .getChildObject()));
+ } else {
+ throw new InvalidTransactionFailure("state is not ADD and not REMOVED for " + singleEntry);
+ }
+ }
+ }
+ }
+ if (!(delta.getState().equals(State.CLEAN))) {
+ parentTransaction.setObjectState(usedObject, StateMachine.mergeStates(parentTransaction.getObjectState(usedObject), delta.getState()));
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#commit()
+ */
+ public void commit() {
+ Assert.isTrue(!isInvalid(), "must not be an invalid transaction");
+ Assert.isTrue(!isRootTransaction(), "must not be root transaction to commit");
+ // call the internal commit method
+ internalCommit();
+ // clean the deltas, this mainly is good so that it releases all
+ // references to external objects
+ // however the objectTransaction becomes invalid anyway and cannot be
+ // used further on
+ // UPDATE: no longer true since the objecttransaction is no longer
+ // invalidated
+ clearChanges();
+ // make the transaction invalid (UPDATE: no longer !!!)
+ // invalidate();
+ // make the current transaction the parent transaction of this
+ // transaction
+ ObjectTransactionManagerAccessor.fetchObjectTransactionManager().setCurrent(parentTransaction);
+ }
+
+ private Method findMethod(Class<?> clazz, String name, String methodPrefix, Object arg) {
+ String methodName = methodPrefix + name.substring(0, 1).toUpperCase() + name.substring(1);
+
+ // find methods in this class
+ for (Method method : clazz.getDeclaredMethods()) {
+ if (method.getName().equals(methodName)) {
+ Class<?>[] parmType = method.getParameterTypes();
+ if ((parmType != null && parmType.length == 1)) {
+ if ((arg != null && parmType[0].isAssignableFrom(arg.getClass())) || arg == null) {
+ method.setAccessible(true);
+ return method;
+ }
+ } else {
+ if ((parmType == null || parmType.length == 0) && arg == null) {
+ method.setAccessible(true);
+ return method;
+ }
+ }
+ }
+ }
+ // if no matching methods where found try superclass
+ Class<?> superClass = clazz.getSuperclass();
+ if (!superClass.equals(Object.class)) {
+ return findMethod(superClass, name, methodPrefix, arg);
+ }
+ throw new ObjectTransactionFailure("ITransactedObject " + clazz + " must have method " + methodName + " but lookup fails.");
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#commitToObjects()
+ */
+ public void commitToObjects() {
+ Assert.isTrue(!isInvalid(), "must not be an invalid transaction");
+ Assert.isTrue(isRootTransaction(), "must be rootTransaction");
+
+ boolean savedCleanModus = cleanModus;
+ cleanModus = false;
+
+ // while over all changes in the objectTransaction
+ for (TransactionDelta delta : changesInTransaction.values()) {
+ ITransactedObject usedObject = lookupObjectById(delta.getObjectId());
+ // if (delta.getstate().equals(State.DELETED)) {
+ // involvedTransactedObjects.remove(usedObject.getObjectId());
+ // continue;
+ // }
+ // while over all properties or relation changes for one
+ // transactedobject
+ for (AbstractBaseChange cEntry : delta.getChanges().values()) {
+ String refName = cEntry.getRelationName();
+ // single (1:1) property or relation change
+ if (cEntry instanceof SingleChange) {
+ try {
+ if (refName.equals("sys::oid") || refName.equals("sys::oldoid")) {
+ continue;
+ }
+ if (refName.equals("sys::version")) {
+ continue;
+ }
+ // get the current value from the bean, which should ask
+ // the objectTransaction
+ // Method getMethod = findMethod( usedObject.getClass(),
+ // refName, "get", null );
+ // Object value = getMethod.invoke( usedObject, new
+ // Object[] {} );
+ Object value = ((SingleChange) cEntry).getChildObject();
+ if (value instanceof IObjectId) {
+ value = lookupObjectById((IObjectId) value);
+ }
+ // set it into the bean using clean modus, so no
+ // objectTransaction is involved
+ Method setMethod = findMethod(usedObject.getClass(), refName, "set", value);
+ cleanModus = true;
+ setMethod.invoke(usedObject, new Object[] { value });
+ cleanModus = false;
+ } catch (IllegalAccessException e) {
+ throw new ObjectTransactionFailure("access to field blocked field " + refName + " in object " + usedObject, e);
+ } catch (InvocationTargetException e2) {
+ throw new ObjectTransactionFailure("problem while accessing field blocked field " + refName + " in object " + usedObject, e2);
+ }
+
+ } else {
+ try {
+ cleanModus = true;
+ Method addMethod = null;
+ Method removeMethod = null;
+ List<MultipleChangeEntry> changes = ((MultipleChange) cEntry).getEntries();
+ for (MultipleChangeEntry singleEntry : changes) {
+ if (singleEntry.getState().equals(State.ADDED)) {
+ Object value = lookupObjectById((IObjectId) singleEntry.getChildObject());
+ if (addMethod == null) {
+ addMethod = findMethod(usedObject.getClass(), refName, "add", value);
+ }
+ addMethod.invoke(usedObject, new Object[] { value });
+ } else {
+ if (singleEntry.getState().equals(State.REMOVED)) {
+ Object value = lookupObjectById((IObjectId) singleEntry.getChildObject());
+ if (removeMethod == null) {
+ removeMethod = findMethod(usedObject.getClass(), refName, "remove", value);
+ }
+ removeMethod.invoke(usedObject, new Object[] { value });
+ }
+ }
+ }
+ cleanModus = false;
+ } catch (IllegalAccessException e) {
+ throw new ObjectTransactionFailure("access to field blocked field " + refName + " in object " + usedObject, e);
+ } catch (InvocationTargetException e2) {
+ throw new ObjectTransactionFailure("problem while accessing field blocked field " + refName + " in object " + usedObject, e2);
+ }
+ }
+ }
+ }
+
+ // do a second iterate and remove deleted objects from involved object
+ // list
+ for (TransactionDelta delta : changesInTransaction.values()) {
+ ITransactedObject usedObject = lookupObjectById(delta.getObjectId());
+ if (delta.getState().equals(State.DELETED)) {
+ involvedTransactedObjects.remove(usedObject.getObjectId());
+ continue;
+ }
+ }
+ cleanModus = savedCleanModus;
+
+ // only clear the delta changes, keep the referenced transacted objects
+ changesInTransaction = new HashMap<IObjectId, TransactionDelta>();
+ for (ITransactedObject object : involvedTransactedObjects.values()) {
+ setObjectState(object, State.CLEAN);
+ }
+ }
+
+ public void rollback() {
+ if (isInvalid()) {
+ throw new InvalidTransactionFailure("object transaction is invalid");
+ }
+ clearChanges();
+ if (!isRootTransaction()) {
+ // UPDATE: no longer invalidated so that it can be reused
+ // invalidate();
+ ObjectTransactionManagerAccessor.fetchObjectTransactionManager().setCurrent(parentTransaction);
+ }
+ }
+
+ /**
+ * clear all changes in this transaction
+ *
+ */
+ private void clearChanges() {
+ changesInTransaction = new HashMap<IObjectId, TransactionDelta>();
+ involvedTransactedObjects = new HashMap<IObjectId, ITransactedObject>();
+ }
+
+ /**
+ * find a transacted object instance by its IObjectId, also check
+ * parentTransactions
+ *
+ * @param objectId
+ * object id of the transacted object that we are looking for
+ * @return ITransactedObject of the found object or null if no entry was
+ * found
+ */
+ public ITransactedObject lookupObjectById(IObjectId objectId) {
+ checkPreRegisteredClean();
+ // find object by oid
+ ITransactedObject tObject = involvedTransactedObjects.get(objectId);
+ // if not found, ask parentTransaction, if found there add to this
+ // transactions list of involvedobjects
+ if (tObject == null && parentTransaction != null) {
+ tObject = parentTransaction.lookupObjectById(objectId);
+ keepReferenceOf(tObject);
+ }
+ return tObject;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#replaceRegisteredObject(org.eclipse.riena.objecttransaction.IObjectId,
+ * org.eclipse.riena.objecttransaction.ITransactedObject)
+ */
+ public void replaceRegisteredObject(IObjectId objectId, ITransactedObject transactedObject) {
+ Assert.isTrue(objectId.equals(transactedObject.getObjectId()), "oldObjectId and new transactedobject must have the an 'equal' OID");
+ ITransactedObject tObject = involvedTransactedObjects.get(objectId);
+ Assert.isTrue(transactedObject != tObject,
+ "object instances of the existing registered transacted object and the new object must not be the same or this call is meaningless");
+ if (tObject != null) {
+ involvedTransactedObjects.put(tObject.getObjectId(), transactedObject);
+ }
+ if (parentTransaction != null) {
+ parentTransaction.replaceRegisteredObject(objectId, transactedObject);
+ }
+
+ }
+
+ /**
+ * invalidate this objectTransaction
+ *
+ */
+ @SuppressWarnings("unused")
+ // currently unused thats why it is private but maybe we need it later
+ private void invalidate() {
+ invalidTransaction = true;
+ }
+
+ /**
+ *
+ * @see org.eclipse.riena.objecttransaction.IObjectTransaction#isInvalid()
+ */
+ public boolean isInvalid() {
+ return invalidTransaction;
+ }
+
+ /**
+ * Internal method for testcases to test if the state is correct
+ *
+ * @param object
+ * @param state
+ * @return
+ */
+ public boolean isState(ITransactedObject object, State state) {
+ TransactionDelta delta = changesInTransaction.get(object.getObjectId());
+ if (delta == null) {
+ return false;
+ }
+ return delta.getState().equals(state);
+ }
+
+ /**
+ * pretty printing of the content of this object transaction
+ *
+ * @return String
+ */
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("----------transaction----------------\n");
+ if (!isInvalid()) {
+ for (TransactionDelta delta : this.exportExtract().getDeltas()) {
+ sb.append(delta);
+ }
+ } else {
+ sb.append("Transaction is invalid and cannot be displayed.");
+ }
+ sb.append("----------transaction----------------\n");
+ return sb.toString();
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionManagerImpl.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionManagerImpl.java
new file mode 100644
index 0000000..c6e3a84
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/internal/objecttransaction/impl/ObjectTransactionManagerImpl.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.internal.objecttransaction.impl;
+
+import org.eclipse.riena.objecttransaction.IObjectTransaction;
+import org.eclipse.riena.objecttransaction.IObjectTransactionManager;
+import org.eclipse.riena.objecttransaction.InvalidTransactionFailure;
+
+/**
+ * ObjectTransactionManagerImpl manages the current ObjectTransaction
+ *
+ */
+public class ObjectTransactionManagerImpl implements IObjectTransactionManager {
+
+ private IObjectTransaction objectTransaction;
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransactionManager#getCurrent()
+ */
+ public IObjectTransaction getCurrent() {
+ if (objectTransaction != null && objectTransaction.isInvalid()) {
+ throw new InvalidTransactionFailure("no valid objecttransaction, but required");
+ }
+ return objectTransaction;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.IObjectTransactionManager#setCurrent(org.eclipse.riena.objecttransaction.IObjectTransaction)
+ */
+ public void setCurrent(IObjectTransaction currentObjectTransaction) {
+ if (currentObjectTransaction != null && currentObjectTransaction.isInvalid()) {
+ throw new InvalidTransactionFailure("an invalid object transaction cannot be set to be the current object transaction");
+ }
+ this.objectTransaction = currentObjectTransaction;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/AbstractTransactedManager.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/AbstractTransactedManager.java
new file mode 100644
index 0000000..3ce3a3a
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/AbstractTransactedManager.java
@@ -0,0 +1,175 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+import java.lang.reflect.Proxy;
+
+import org.eclipse.riena.objecttransaction.context.BasicContextCarrier;
+import org.eclipse.riena.objecttransaction.context.ContextProxy;
+import org.eclipse.riena.objecttransaction.context.IContextProvider;
+import org.eclipse.riena.objecttransaction.context.IObjectTransactionContext;
+import org.eclipse.riena.objecttransaction.context.ObjectTransactionContext;
+
+/**
+ * An abstract superclass simplifying the implementation of application managers
+ * based on an object transaction.
+ *
+ * To ensure that all methods of a concrete manager are running in the context
+ * of the currently set Transaction IT IS STRONGLY recomended not to provide any
+ * public contructors. Istead provide a factory method creating the needed Proxy
+ * by calling cover() on the newly created instance of the manager.
+ *
+ * This superclass supports the follwing tasks: * surrounding all functions of
+ * the manager by a context * surrounding all functions of any object exposed by
+ * the manager * provides convenience methods for the creation of a new
+ * transaction
+ *
+ * The Transaction to actually work on, has to be provided by a concrete
+ * subclass. Since the abstract class do not know the business context the
+ * concrete subclass works on.
+ *
+ */
+public abstract class AbstractTransactedManager {
+
+ private IContextProvider contextProvider;
+ private IObjectTransactionContext objectTransactionContext;
+
+ /**
+ * Creates a new ObjectTransactionContextManager Initializes the context
+ * contained.
+ *
+ * @param context
+ */
+ protected AbstractTransactedManager() {
+ super();
+ this.objectTransactionContext = new ObjectTransactionContext();
+ this.contextProvider = new BasicContextCarrier(objectTransactionContext);
+ }
+
+ /**
+ * Delgates the Transaction to work on to the contained context. The setting
+ * of the Transaction is not public per default, thus this method is
+ * protected. The Object Transaction passed to this method is aktivated
+ * immediately!
+ *
+ * @param pObjectTransaction
+ * the ObjectTransaction to set.
+ */
+ protected final void setCurrentObjectTransaction(IObjectTransaction pObjectTransaction) {
+ objectTransactionContext.setObjectTransaction(pObjectTransaction);
+ }
+
+ /**
+ * @return the IObjectTransaction beeing current from the point of view of
+ * the concrete subclass of the manager
+ */
+ protected final IObjectTransaction getCurrentObjectTransaction() {
+ return objectTransactionContext.getObjectTransaction();
+ }
+
+ /**
+ * Creates a new ObjectTransaction without setting it current. The
+ * transaction set from the context will remain.
+ *
+ * @return an IObjectTransaction newly created
+ */
+ protected final IObjectTransaction createObjectTransaction() {
+ // TODO: the object Transaction shold not aktivate itself, talk about
+ // with cc, this moment the current context is reactivated!
+ IObjectTransaction oldTransaction = ObjectTransactionManagerAccessor.fetchObjectTransactionManager().getCurrent();
+ IObjectTransaction result = ObjectTransactionFactoryAccessor.fetchObjectTransactionFactory().createObjectTransaction();
+ ObjectTransactionManagerAccessor.fetchObjectTransactionManager().setCurrent(oldTransaction);
+ return result;
+ }
+
+ /**
+ * Creates a new SubObjectTransaction relative to the current object
+ * Transaction.
+ *
+ * @return the newly create sub object transaction
+ */
+ protected final IObjectTransaction createSubObjectTransaction() {
+ IObjectTransaction cobj = getCurrentObjectTransaction();
+ IObjectTransaction result = null;
+ if (cobj != null) {
+ result = this.createSubObjectTransaction(cobj);
+ }
+ return result;
+ }
+
+ /**
+ * Creates a new SubObjectTransaction without setting it current. The
+ * transaction set from the context will remain.
+ *
+ * @return an IObjectTransaction newly created
+ */
+ protected final IObjectTransaction createSubObjectTransaction(IObjectTransaction pParentTransaction) {
+ // TODO: the object Transaction shold not aktivate itself, talk about
+ // with cc, this moment the current context is reactivated!
+ IObjectTransaction oldTransaction = ObjectTransactionManagerAccessor.fetchObjectTransactionManager().getCurrent();
+ IObjectTransaction result = pParentTransaction.createSubObjectTransaction();
+ ObjectTransactionManagerAccessor.fetchObjectTransactionManager().setCurrent(oldTransaction);
+ return result;
+ }
+
+ /**
+ * @param oObject
+ * the Object to cover with the contained context
+ * @param <T>
+ * the Type extected to return
+ * @return a Context Proxy on any concrete Manager
+ */
+ public final <T> T cover(T pObject) {
+ return ContextProxy.cover(pObject, contextProvider);
+ }
+
+ /**
+ * Uncovers an object from a Context proxy, if the passed object is one
+ *
+ * @param <T>
+ * the extected type
+ * @param pCovered
+ * the covered object
+ * @return
+ */
+ @SuppressWarnings( { "unchecked" })
+ // During uncovering the object will be automatically castet
+ public final <T> T uncover(T pCovered) {
+ T result = null;
+ if (pCovered != null && Proxy.isProxyClass(pCovered.getClass()) && (Proxy.getInvocationHandler(pCovered) instanceof ContextProxy)) {
+ result = (T) ((ContextProxy) Proxy.getInvocationHandler(pCovered)).getService();
+ } else {
+ result = pCovered;
+ }
+ return result;
+ }
+
+ /**
+ * Commits the curren transaction if any
+ */
+ public void commit() {
+ IObjectTransaction cot = this.getCurrentObjectTransaction();
+ if (cot != null) {
+ cot.commit();
+ }
+ }
+
+ /**
+ * Roll back the current transaction if any
+ */
+ public void rollback() {
+ IObjectTransaction cot = this.getCurrentObjectTransaction();
+ if (cot != null) {
+ cot.rollback();
+ }
+ }
+
+}
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/AbstractTransactedObject.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/AbstractTransactedObject.java
new file mode 100644
index 0000000..e9b8938
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/AbstractTransactedObject.java
@@ -0,0 +1,108 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+/**
+ * Abstract base class for transacted objects. This implementation is a simple
+ * base for customer objects.
+ *
+ */
+public abstract class AbstractTransactedObject implements ITransactedObject {
+
+ private IObjectId objectId;
+ private String version;
+ private IObjectTransactionManager objectTransactionManager;
+
+ /**
+ * Create a transacted object without a inital object id and version.
+ */
+ protected AbstractTransactedObject() {
+ super();
+ objectTransactionManager = ObjectTransactionManagerAccessor.fetchObjectTransactionManager();
+ }
+
+ /**
+ * Create a transacted object with a inital object id and version.
+ *
+ * @param objectId
+ * initial object id
+ * @param version
+ * initial version
+ */
+ protected AbstractTransactedObject(IObjectId objectId, String version) {
+ this();
+ setObjectId(objectId);
+ setVersion(version);
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.ITransactedObject#getObjectId()
+ */
+ public IObjectId getObjectId() {
+ return objectId;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.ITransactedObject#setObjectId(org.eclipse.riena.objecttransaction.IObjectId)
+ */
+ public void setObjectId(IObjectId objectId) {
+ this.objectId = objectId;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.ITransactedObject#getVersion()
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.ITransactedObject#setVersion(java.lang.String)
+ */
+ public void setVersion(String versionString) {
+ this.version = versionString;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return "TransactedObject: objectId='" + objectId + "', version='" + version + "'";
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object object) {
+ if (object instanceof ITransactedObject) {
+ return objectId.equals(((ITransactedObject) object).getObjectId());
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return getObjectId().hashCode();
+ }
+
+ /**
+ * Get the current object transaction.
+ *
+ * @return current object transaction
+ */
+ protected IObjectTransaction getCurrentObjectTransaction() {
+ return objectTransactionManager.getCurrent();
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectId.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectId.java
new file mode 100644
index 0000000..7913b66
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectId.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+/**
+ * This interface must be implemented to identify a
+ * <code>ITransactedObject</code> uniquely, within the transaction context.
+ *
+ * Any object that implements this interface must also implement the equals and
+ * hashCode method for this object. It cannot rely on the implementation of
+ * java.lang.Object for this. - equals must be implemented to return TRUE if two
+ * IObjectId are logically equal. This must also be true, if they are two
+ * instances of the same object. - hashCode must work as specified in
+ * java.lang.Object. However it must create the hashCode for any two objects
+ * that represent logically the same Object or in other words where the equals
+ * method returns TRUE.
+ *
+ */
+public interface IObjectId {
+
+ /**
+ * Returns a type for which this IObjectId is used
+ *
+ * @return
+ */
+ String getType();
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransaction.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransaction.java
new file mode 100644
index 0000000..2e88c0e
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransaction.java
@@ -0,0 +1,392 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * The ObjectTransaction contains all the information about registered objects,
+ * changed properties. Existing Instances can be RootTransactions or
+ * SubObjectTransactions. SubObjectTransactions transfer their changes to the
+ * next higher level, if they are committed. RootTransactions cannot be
+ * committed but rather have to be passed on to the Persistant Layer which will
+ * read out the recorded changes. It is possible to have more than one
+ * RootTransaction. Only the currently activated ObjectTransaction will record
+ * changes in the ITransactedObjects.
+ *
+ */
+public interface IObjectTransaction {
+
+ /**
+ * register an ITransactedObject as CLEAN and not modified object
+ *
+ * @param object
+ * transactedobject that should be registered
+ * @pre !isInvalid() && object!=null && ((object.getObjectId()!=null &&
+ * !isRegistered(object)) || object.getObjectId()==null)
+ */
+ void register(ITransactedObject object);
+
+ /**
+ *
+ * @param object
+ * @pre !isInvalid() && object!=null && object.getObjectId()!=null &&
+ * !isRegistered(object)
+ */
+ void registerNew(ITransactedObject object);
+
+ /**
+ * register an ITransactedObject in the ObjectTransaction as being deleted,
+ * requires that the object exists on the database.
+ *
+ * @param object
+ * transactedobject that was deleted
+ * @pre !isInvalid()&& object!=null && object.getObjectId()!=null
+ */
+ void registerAsDeleted(ITransactedObject object);
+
+ /**
+ * Is the transacted Object in the parameter already registered in this
+ * object transaction ? This method also checks out transactions. So if this
+ * is a subtransaction and the transactedobject was registered in the
+ * rootTransactions, it returns true.
+ *
+ * @param object
+ * transactedobject that must be checked
+ * @return true if registered
+ * @pre !isInvalid() && object!=null && object.getObjectId()!=null
+ */
+ boolean isRegistered(ITransactedObject object);
+
+ /**
+ * This method enables the application to disable the register
+ * functionality. If register is not allowed, a register, registerNew or
+ * registerDelete call will return with no function performed.
+ *
+ * @param allowRegister
+ */
+ void allowRegister(boolean allowRegister);
+
+ /**
+ * Returns whether this ObjectTransaction is a RootTransaction. A Root has
+ * no parentTransaction. Commit and Rollback is only allowed on
+ * ObjectTransactions which are NOT RootTransactions
+ *
+ * @return "true" if it is a RootTransaction;
+ */
+ boolean isRootTransaction();
+
+ /**
+ * Creates an extract of all the recorded changes in this objectTransaction.
+ * This extract only contains the changes but no original business object.
+ *
+ * @return objectTransactionextract that contains all the deltas
+ * @pre !isInvalid()
+ */
+ IObjectTransactionExtract exportExtract();
+
+ /**
+ * Creates an extract of all changes within the objectTransaction. This
+ * extract contains no reference to clean objects. References to clean
+ * objects are contained in exportExtract(). To import this extract again,
+ * use the regular importExtract()
+ *
+ * @see exportExtract
+ * @see importExtract
+ * @return
+ */
+ IObjectTransactionExtract exportOnlyModifedObjectsToExtract();
+
+ /**
+ * Imports a previously exported extract. It requires that all transacted
+ * object in the extract were previously loaded (somehow) and registered
+ * with this ObjectTransaction.
+ *
+ * @param extract
+ * @pre !isInvalid() && !isCleanModus() && isRootTransaction()
+ */
+ void importExtract(IObjectTransactionExtract extract);
+
+ /**
+ * Imports from a full extract only those objects that were modified. Clean
+ * objects are not imported and therefore do not have to exist in the
+ * objecttransaction.
+ *
+ * @param extract
+ */
+ void importOnlyModifedObjectsFromExtract(IObjectTransactionExtract extract);
+
+ /**
+ * Set the ObjectTransaction into cleanmodus. That means no changes are
+ * recorded. However each object, is registered in the transaction as clean.
+ * Clean Modus is activated if the parameter is "true". Initial state of
+ * Clean Modus of a objectTransaction is "false".
+ *
+ * @param cleanModus
+ * "true" or "false" whether a objectTransaction is in cleanModus
+ */
+ void setCleanModus(boolean cleanModus);
+
+ /**
+ * is the CleanModus flag set to "true" ? then return "true" here
+ *
+ * @return value of the cleanModus flag
+ */
+ boolean isCleanModus();
+
+ /**
+ * For a description of strict modus see isStrictModus()
+ *
+ * @param strictModus
+ */
+ void setStrictModus(boolean strictModus);
+
+ /**
+ * if strict modus is true, every object must be registered even in clean
+ * modus that means that even if you use an object without a
+ * objectTransaction, you have to register an object. If false, only when
+ * cleanmodus is false, must object be registered before use.
+ *
+ * @return
+ */
+ boolean isStrictModus();
+
+ /**
+ * if a objectTransaction is invalid, no further action can be performed on
+ * it and the objectTransaction cannot be set to be the current
+ *
+ * @return
+ */
+ boolean isInvalid();
+
+ /**
+ * Set property value for an ITransactedObject, this is for setting
+ * properties or referenced object that DO NOT implement the
+ * ITransactedObject interface
+ *
+ * @param object
+ * transacted object for which to return the referenced object
+ * @param referenceName
+ * symbolic name of the reference
+ * @param oldRefValue
+ * old value of the reference
+ * @param refValue
+ * value that was set for the reference
+ * @pre object!=null && object.getObjectId()!=null && isRegistered(object) &&
+ * !(refValue instanceof ITransactedObject)
+ */
+ void setReference(ITransactedObject object, String referenceName, Object refValue);
+
+ /**
+ * Get property value for an ITransactedObject, the defaultValue is the
+ * current value in the bean. If no pending change is fund in any of the
+ * concerned ObjectTransactions, the defaultValue is returned
+ *
+ * @param object
+ * transacted object for which to return the referenced object
+ * @param referenceName
+ * symbolic name of the reference
+ * @param defaultValue
+ * current value of the reference in this bean
+ * @return objectvalue for that referenceName (if it exists)
+ * @pre object!=null && object.getObjectId()!=null && isRegistered(object);
+ */
+ Object getReference(ITransactedObject object, String referenceName, Object defaultValue);
+
+ /**
+ * Set property value for an ITransactedObject, this is for setting
+ * properties or referenced object that DO implement the ITransactedObject
+ * interface
+ *
+ * @param object
+ * transacted object for which to return the referenced object
+ * @param referenceName
+ * symbolic name of the reference
+ * @param oldRefValue
+ * old value of the reference
+ * @param refObject
+ * value that was set for the reference
+ * @pre object.getObjectId()!=null && isRegisted(object)
+ * @pre oldRefObject==null || (oldRefObject.getObjectId()!=null &&
+ * isRegistered(oldRefObject))
+ * @pre refObject==null || (refObject.getObjectId()!=null &&
+ * isRegistered(refObject))
+ */
+ void setReference(ITransactedObject object, String referenceName, ITransactedObject refObject);
+
+ /**
+ * Get property value for an ITransactedObject, the defaultValue is the
+ * current value in the bean. If no pending change is fund in any of the
+ * concerned ObjectTransactions, the defaultValue is returned
+ *
+ * @param object
+ * transacted object for which to return the referenced object
+ * @param referenceName
+ * symbolic name of the reference
+ * @param defaultRefObject
+ * current value of the reference in this bean
+ * @return
+ * @pre object!=null && object.getObjectId()!=null && isRegistered(object)
+ * @pre defaultRefObject==null || (defaultRefObject.getObjectId()!=null &&
+ * isRegistered(defaultRefObject))
+ */
+ ITransactedObject getReference(ITransactedObject object, String referenceName, ITransactedObject defaultRefObject);
+
+ /**
+ * Adds the reference to a child object simular to setReferenceObject with
+ * the difference that the referenceName refers to an unsorted collection of
+ * objects.
+ *
+ * @param object
+ * transacted object to which the child is added
+ * @param referenceName
+ * symbolic name of the reference
+ * @param refObject
+ * transacted child object to be added
+ * @pre object!=null && object.getObjectId()!=null && isRegistered(object)
+ * @pre refObject!=null && refObject.getObjectId()!=null &&
+ * isRegistered(refObject)
+ */
+ void addReference(ITransactedObject object, String referenceName, ITransactedObject refObject);
+
+ /**
+ * Removes the reference to a child object from a collection of child
+ * objects
+ *
+ * @param object
+ * transacted object from which the child is removed
+ * @param referenceName
+ * symbolic name of the reference
+ * @param refObject
+ * child object to be removed
+ * @pre object!=null && object.getObjectId()!=null && isRegistered(object)
+ * @pre refObject!=null && refObject.getObjectId()!=null &&
+ * isRegistered(refObject)
+ */
+ void removeReference(ITransactedObject object, String referenceName, ITransactedObject refObject);
+
+ /**
+ * Lists the entries of a child object collection in the state of this
+ * objectTransaction. The BusinessObject has to pass its own state and then
+ * all changes in this transaction are reapplied. The result is a collection
+ * that contains all current entries.
+ *
+ * @param object
+ * transacted object in which the collection is maintained
+ * @param referenceName
+ * symbolic name of the reference
+ * @param initialSet
+ * initialSet of collection entries from the business object
+ * @return a new collection with the current state of the entries within
+ * this transaction
+ * @pre object!=null && object.getObjectId()!=null && isRegistered(object)
+ */
+ <T> Set<T> listReference(ITransactedObject object, String referenceName, Set<T> initialSet);
+
+ /**
+ * Same as the other listReference but supplying a List instead of a Set
+ * (with a defined sequence)
+ *
+ * @param object
+ * @param referenceName
+ * @param initialSet
+ * @return
+ */
+ <T> List<T> listReference(ITransactedObject object, String referenceName, List<T> initialSet);
+
+ /**
+ *
+ * @param object
+ * @param version
+ * @pre object!=null && object.getObjectId()!=null
+ * @pre !isInvalid() && !isCleanModus()
+ */
+ void setVersionUpdate(ITransactedObject object, String version);
+
+ /**
+ * @param object
+ * @param defaultVersion
+ * @return
+ */
+ // String getVersionUpdate(ITransactedObject object, String defaultVersion);
+ /**
+ * Updates the ObjectId for an registered Object in the ObjectTransaction.
+ * The application must immediatelly afterwards also update the ObjectId in
+ * the ITransactedObject. All recorded changes are transferred from the old
+ * ObjectId to the new ObjectId.
+ *
+ * @param oldObjectId
+ * @param newObjectId
+ * @pre oldObjectId!=null && newObjectId!=null
+ * @pre oldObjectId!=newObjectId
+ */
+ void setObjectIdUpdate(IObjectId oldObjectId, IObjectId newObjectId);
+
+ /**
+ * Commits the ObjectTransaction. Cannot be done if it is not a
+ * SubTransaction. A so-called RootTransaction cannot be committed but has
+ * to be passed to the Persistence Layer which will read out all the
+ * changes. A SubObjectTransaction commits its value to the next higer level
+ * of ObjectTransaction. A ObjectTransaction becomes invalid and useless
+ * once committed. The next higher ObjectTransaction becomes the active
+ * ObjectTransaction. Only the active ObjectTransaction records changes.
+ *
+ * @pre (!isRootTransaction())
+ */
+ void commit();
+
+ /**
+ * This method works in similar to commit with some differences. This method
+ * can only be called on the rootTransaction. It commits the changes into
+ * the objects where they become "permanent" (cannot be rolled back). After
+ * the method is processed, all objects have the state CLEAN.
+ *
+ * @pre isRootTransaction()
+ */
+ void commitToObjects();
+
+ /**
+ * Rollback the changes in the ObjectTransaction. A ObjectTransaction
+ * rollback basically erases all recorded changes in it. If this is NOT a
+ * RootObjectTransaction, the next higher ObjectTransaction is automatically
+ * activated, and this ObjectTransaction is invalidated and becomes useless.
+ * If it IS the RootObjectTransaction, it remains active and valid.
+ */
+ void rollback();
+
+ /**
+ * creates a new objectTransaction where the current transaction becomes the
+ * "parent" of the new created transaction. The new created transaction
+ * becomes the active transaction.
+ *
+ * @return newly created transaction
+ */
+ IObjectTransaction createSubObjectTransaction();
+
+ /**
+ * Find an ITransactedObject by its objectId
+ *
+ * @param objectId
+ * @return
+ */
+ ITransactedObject lookupObjectById(IObjectId objectId);
+
+ /**
+ * Replaces an registered object in the objectTransaction.
+ *
+ * @param objectId
+ * @param transactedObject
+ * @pre objectId.equals(transactedObject.getObjectId())
+ * @pre transactedObject!=lookupObjectById(oid)
+ */
+ void replaceRegisteredObject(IObjectId objectId, ITransactedObject transactedObject);
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionExtract.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionExtract.java
new file mode 100644
index 0000000..6ea3498
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionExtract.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+import org.eclipse.riena.objecttransaction.delta.TransactionDelta;
+
+/**
+ * The interface for an extract that the ObjectTransaction imports and exports
+ * and which contains the modififactions of the transactedObjects.
+ *
+ */
+public interface IObjectTransactionExtract {
+
+ /**
+ * Returns the deltas stored in this objectransactionextract
+ *
+ * @return array of deltas
+ */
+ TransactionDelta[] getDeltas();
+
+ /**
+ * Adds an existing transacted object to the extract with status clean.
+ *
+ * @param transObject
+ * @pre !contains(transObject.getObjectId())
+ */
+ void addCleanTransactedObject(ITransactedObject transObject);
+
+ /**
+ * Method to check if an object is already part of an extract
+ *
+ * @param objectid
+ * @return
+ */
+ boolean contains(IObjectId objectid);
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionFactory.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionFactory.java
new file mode 100644
index 0000000..c3b24d9
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionFactory.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+/**
+ * This Factory is used to create new objectTransactions and new
+ * subObjectTransactions.
+ *
+ */
+public interface IObjectTransactionFactory {
+
+ /**
+ * Creates new ObjectTransaction
+ *
+ * @return created ObjectTransaction
+ */
+ IObjectTransaction createObjectTransaction();
+
+ /**
+ * Creates a new ObjectTransaction which is a subtransaction to the
+ * transaction passed as parameter
+ *
+ * @param parentObjectTransaction
+ * @pre parentObjectTransaction != null
+ * @return newly create objectTransaction
+ */
+ IObjectTransaction createSubObjectTransaction(IObjectTransaction parentObjectTransaction);
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionManager.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionManager.java
new file mode 100644
index 0000000..7fb5274
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/IObjectTransactionManager.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+/**
+ * Interface for the ObjectTransactionManager
+ *
+ */
+public interface IObjectTransactionManager {
+
+ /**
+ * Returns the current ObjectTransaction object
+ *
+ * @post !return.isInvalid()
+ * @return current ObjectTransaction
+ */
+ IObjectTransaction getCurrent();
+
+ /**
+ * Sets the current ObjectTransaction
+ *
+ * @param objectTransaction
+ * current object transaction
+ * @pre objecTransaction =! null && !objectTransaction.isInvalid()
+ */
+ void setCurrent(IObjectTransaction objectTransaction);
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ITransactedObject.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ITransactedObject.java
new file mode 100644
index 0000000..86769c7
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ITransactedObject.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+/**
+ * Interface that must be implemented by all transaction enabled Business
+ * Objects. It has method to retrieve a unique id and a version for any object
+ *
+ */
+public interface ITransactedObject {
+
+ /**
+ * Returns the object id of the transacted object
+ *
+ * @return IObjectId
+ */
+ IObjectId getObjectId();
+
+ /**
+ * changes the object id of the transacted object to the new object id
+ *
+ * @param objectId
+ */
+ void setObjectId(IObjectId objectId);
+
+ /**
+ * Returns the current version of the transacted object
+ *
+ * @return String version String
+ */
+ String getVersion();
+
+ /**
+ * Sets a new version string for a transacted object
+ *
+ * @param versionString
+ * version String
+ */
+ void setVersion(String versionString);
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/InvalidTransactedObjectFailure.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/InvalidTransactedObjectFailure.java
new file mode 100644
index 0000000..f24cd00
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/InvalidTransactedObjectFailure.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+/**
+ * This failure is thrown when the transacted object is not valid in this
+ * context
+ *
+ */
+public class InvalidTransactedObjectFailure extends ObjectTransactionFailure {
+
+ /**
+ * @param message
+ */
+ public InvalidTransactedObjectFailure(String message) {
+ super(message);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/InvalidTransactionFailure.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/InvalidTransactionFailure.java
new file mode 100644
index 0000000..2ed3cfe
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/InvalidTransactionFailure.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+/**
+ * This failure is thrown when the transaction is not in the right state for
+ * this method
+ *
+ */
+public class InvalidTransactionFailure extends ObjectTransactionFailure {
+
+ /**
+ * @param message
+ */
+ public InvalidTransactionFailure(String message) {
+ super(message);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionFactoryAccessor.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionFactoryAccessor.java
new file mode 100644
index 0000000..85f8868
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionFactoryAccessor.java
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+import org.eclipse.riena.internal.objecttransaction.impl.ObjectTransactionFactoryImpl;
+
+/**
+ * Accessor that gives access to the ObjectTransactionFactory
+ *
+ */
+public final class ObjectTransactionFactoryAccessor {
+
+ private static IObjectTransactionFactory singletonObjectTransactionFactory = null;
+
+ private ObjectTransactionFactoryAccessor() {
+ super();
+ // utility
+ }
+
+ /**
+ * Returns the correct ObjectTransactionFactory (currently defined as
+ * singleton)
+ *
+ * @return ObjectTransactionFactory
+ */
+ public static IObjectTransactionFactory fetchObjectTransactionFactory() {
+ if (singletonObjectTransactionFactory == null) {
+ singletonObjectTransactionFactory = new ObjectTransactionFactoryImpl(ObjectTransactionManagerAccessor.fetchObjectTransactionManager());
+ }
+ return singletonObjectTransactionFactory;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionFailure.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionFailure.java
new file mode 100644
index 0000000..db69948
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionFailure.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+import org.eclipse.riena.core.exception.Failure;
+
+/**
+ * This failure is thrown for error while processing a request in the
+ * objecttransaction
+ *
+ */
+public class ObjectTransactionFailure extends Failure {
+
+ /**
+ * @param message
+ */
+ public ObjectTransactionFailure(String message) {
+ super(message);
+ }
+
+ /**
+ * @param message
+ * @param t
+ */
+ public ObjectTransactionFailure(String message, Throwable t) {
+ super(message, t);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionManagerAccessor.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionManagerAccessor.java
new file mode 100644
index 0000000..e94716a
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/ObjectTransactionManagerAccessor.java
@@ -0,0 +1,41 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction;
+
+import org.eclipse.riena.internal.objecttransaction.impl.ObjectTransactionManagerImpl;
+
+/**
+ * Accessor to get access to the ObjectTransactionManager
+ *
+ */
+public final class ObjectTransactionManagerAccessor {
+
+ private static ThreadLocal<IObjectTransactionManager> threadedObjectTransactionManager = new ThreadLocal<IObjectTransactionManager>();
+
+ private ObjectTransactionManagerAccessor() {
+ super();
+ // utility
+ }
+
+ /**
+ * Returns the ObjectTransactionManager (currently defined as threaded)
+ *
+ * @return ObjectTransactionManager
+ */
+ public static IObjectTransactionManager fetchObjectTransactionManager() {
+ IObjectTransactionManager otm = threadedObjectTransactionManager.get();
+ if (otm == null) {
+ otm = new ObjectTransactionManagerImpl();
+ threadedObjectTransactionManager.set(otm);
+ }
+ return otm;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/BasicContextCarrier.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/BasicContextCarrier.java
new file mode 100644
index 0000000..2e01fb6
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/BasicContextCarrier.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.context;
+
+/**
+ * A standard-implementation of the IContextCarrier, which, can be used to proxy
+ * objects not beeing a context carrier!
+ *
+ */
+public class BasicContextCarrier implements IContextCarrier {
+
+ private IContext context;
+
+ /**
+ * Creates a new BasicContextManager
+ *
+ * @param context
+ */
+ public BasicContextCarrier() {
+ super();
+ }
+
+ /**
+ * Creates a new BasicContextManager
+ *
+ * @param context
+ * the context to work on
+ */
+ public BasicContextCarrier(IContext context) {
+ super();
+ this.context = context;
+ }
+
+ /**
+ * @return the context working on
+ */
+ public IContext getContext() {
+ return context;
+ }
+
+ /**
+ * @param pContext
+ * the context to work on
+ */
+ public void setContext(IContext pContext) {
+ context = ContextHelper.setContext(context, pContext);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextFailure.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextFailure.java
new file mode 100644
index 0000000..dab595a
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextFailure.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.context;
+
+import org.eclipse.riena.core.exception.Failure;
+
+/**
+ * This failure signifies a fatal error on the management of the context.
+ *
+ */
+
+public class ContextFailure extends Failure {
+
+ /**
+ * Creates a new instance of this failure.
+ *
+ * @param msg
+ * The failure message text.
+ * @param cause
+ * the cause if any
+ */
+ public ContextFailure(String msg, Throwable cause) {
+ super(msg, cause);
+ }
+
+ /**
+ * Creates a new instance of this failure.
+ *
+ * @param msg
+ * The failure message text.
+ */
+ public ContextFailure(String msg) {
+ super(msg);
+ }
+
+}
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextHelper.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextHelper.java
new file mode 100644
index 0000000..d85163a
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextHelper.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.context;
+
+/**
+ * A helper supporting the activation and passivation of a context
+ *
+ */
+
+public final class ContextHelper {
+
+ private ContextHelper() {
+ // there is no instance of the Helper
+ }
+
+ /**
+ * Activates aContext
+ *
+ * @param pContext
+ * context
+ */
+ public static void activateContext(IContext pContext) {
+ if (pContext != null) {
+ pContext.activate();
+ }
+ }
+
+ /**
+ * Passivates aContext
+ *
+ * @param pContext
+ * context
+ */
+ public static void passivateContext(IContext pContext) {
+ if (pContext != null) {
+ pContext.passivate();
+ }
+ }
+
+ /**
+ * Ascertains the right context to set to a Context carrier. Possibly the
+ * setted context has to be activated, dependent on the state of the old
+ * context. This shuld be then done on this central place
+ *
+ * @param pContext
+ * context
+ */
+ public static IContext setContext(IContext pOldContext, IContext pNewContext) {
+ return pNewContext;
+ }
+
+}
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextProxy.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextProxy.java
new file mode 100644
index 0000000..cebb49a
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ContextProxy.java
@@ -0,0 +1,133 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.context;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+
+/**
+ * A Proxy for the management of a Context on the contained Object. All public
+ * methods will be encapsulated by activating and passivating the corresponding
+ * context. If the encapsulated object is a Context carrier, the context of this
+ * object is used, otherwise is the context stored in the proxy is used. -> the
+ * context of the object, if any there, has the higher priority
+ *
+ * (It does not make sence to extend the manufactured proxy with an extra
+ * interface. because it is not possible to access the corresponding methods)
+ *
+ */
+
+public final class ContextProxy implements InvocationHandler {
+
+ // private final static ILogger LOGGER = LoggerAccessor.fetchLogger(
+ // ContextProxy.class );
+
+ private IContextProvider contextProvider;
+ private Object service;
+
+ /**
+ * Create a Context Proxy
+ */
+ private ContextProxy(Object pService, IContextProvider pContextProvider) {
+ service = pService;
+ contextProvider = pContextProvider;
+ }
+
+ /**
+ * @see java.lang.reflect.InvocationHandler#invoke(java.lang.Object,
+ * java.lang.reflect.Method, java.lang.Object[])
+ */
+ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
+ try {
+ ContextHelper.activateContext(contextProvider.getContext());
+
+ return method.invoke(service, args);
+ } catch (InvocationTargetException e) {
+ throw e.getTargetException();
+ } finally {
+ ContextHelper.passivateContext(contextProvider.getContext());
+ }
+ }
+
+ /**
+ * Creates a new Proxy on the passed object. The return typ is created
+ * automatically depending on the passed interface type. The genrics are
+ * checking the consystency of the passe object and interface automatically.
+ * The created proxy covers automatically the whole public interface of the
+ * passed object
+ *
+ * @param <T> -
+ * the expected interface typ equal also the type expected
+ * @param pObject -
+ * the Object to create proxy on
+ * @param pContext -
+ * the context to work on with this proxy
+ * @return the Proxy
+ */
+ @SuppressWarnings( { "unchecked" })
+ public static <T> T cover(T pObject, IContextProvider pContextProvider) {
+ assert pObject != null : "The object to proxy must not be null";
+ assert pContextProvider != null : "The context carrier must not be null";
+ return (T) Proxy.newProxyInstance(pObject.getClass().getClassLoader(), getInterfaces(pObject.getClass()), new ContextProxy(pObject, pContextProvider));
+ }
+
+ /**
+ * Creates a new Proxy on the passed object. The return typ is created
+ * automatically depending on the passed interface type. The genrics are
+ * checking the consystency of the passe object and interface automatically.
+ * The created proxy covers automatically the whole public interface of the
+ * passed object
+ *
+ * @param <T> -
+ * the expected interface typ equals the type passe to
+ * @param pContext -
+ * the context to work on with this proxy
+ * @return the Proxy
+ */
+ @SuppressWarnings( { "unchecked" })
+ public static <T extends IContextProvider> T cover(T pContextProvider) {
+ assert pContextProvider != null : "The context carrier must not be null";
+ return (T) Proxy.newProxyInstance(pContextProvider.getClass().getClassLoader(), getInterfaces(pContextProvider.getClass()), new ContextProxy(
+ pContextProvider, pContextProvider));
+ }
+
+ /**
+ * Acertains all interfaces of the passed class
+ *
+ * @param pClass
+ * the class to find interfaces from
+ * @return an Array of interfaces
+ */
+ private static Class<?>[] getInterfaces(Class<?> pClass) {
+ Class<?>[] result = pClass.getInterfaces();
+ Class<?> superclazz = pClass.getSuperclass();
+ if (superclazz != null) {
+ Class<?>[] superinterfaces = getInterfaces(superclazz);
+ if (superinterfaces.length > 0) {
+ Class<?>[] superresult = new Class[result.length + superinterfaces.length];
+ System.arraycopy(result, 0, superresult, 0, result.length);
+ System.arraycopy(superinterfaces, 0, superresult, result.length, superinterfaces.length);
+ result = superresult;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * @return Returns the service.
+ */
+ public Object getService() {
+ return service;
+ }
+
+}
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContext.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContext.java
new file mode 100644
index 0000000..5333ce2
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContext.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.context;
+
+/**
+ * Any action can/must be done in a context of something else. This interface
+ * desribes a hook beening submitted to different places in the application
+ * which must work in a context. A context mus be able to manage a replace of
+ * another context, or build a context stack, when passivated than set the old
+ * from the stact back.
+ *
+ */
+
+public interface IContext {
+
+ /**
+ * Activates the related context
+ */
+ void activate();
+
+ /**
+ * Passivate the related context
+ */
+ void passivate();
+
+ /**
+ * @return true if the context is active otherwise false
+ */
+ boolean isActivated();
+
+}
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContextCarrier.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContextCarrier.java
new file mode 100644
index 0000000..8fefd5f
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContextCarrier.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.context;
+
+/**
+ * Any class implementing this interfaces is able to hold a context
+ *
+ */
+
+public interface IContextCarrier extends IContextProvider {
+
+ /**
+ * @param context
+ * The context to set to the carriert
+ */
+ void setContext(IContext context);
+
+}
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContextProvider.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContextProvider.java
new file mode 100644
index 0000000..5365c2a
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IContextProvider.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.context;
+
+/**
+ * Interface marking object beeing deliverers of a Context
+ *
+ */
+public interface IContextProvider {
+
+ /**
+ * @return Returns the context of this UIRepresentation.
+ */
+ IContext getContext();
+
+}
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IObjectTransactionContext.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IObjectTransactionContext.java
new file mode 100644
index 0000000..fef0147
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/IObjectTransactionContext.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.context;
+
+import org.eclipse.riena.objecttransaction.IObjectTransaction;
+
+/**
+ * An extension to IContext being eable to hold an IObjectTransaction
+ *
+ */
+public interface IObjectTransactionContext extends IContext {
+
+ /**
+ * @return Returns the objectTransaction.
+ */
+ IObjectTransaction getObjectTransaction();
+
+ /**
+ * @param objectTransaction
+ * The objectTransaction to set.
+ */
+ void setObjectTransaction(IObjectTransaction pObjectTransaction);
+
+}
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ObjectTransactionContext.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ObjectTransactionContext.java
new file mode 100644
index 0000000..87b07ad
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ObjectTransactionContext.java
@@ -0,0 +1,107 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.context;
+
+import java.util.Stack;
+
+import org.eclipse.riena.objecttransaction.IObjectTransaction;
+import org.eclipse.riena.objecttransaction.ObjectTransactionManagerAccessor;
+
+/**
+ * This class describes an object Transaction Context, which can be passed to
+ * different places in the application to work on. At one time can only one
+ * Instace of a Transaction be activated, to check this. The TransactionContext
+ * must always be activated and deactivated! If any other transaction is
+ * activated on the same thread, when calling activated on this context, the
+ * context throws an exception! The object transaction context implies, that
+ * activate and passivate on it are always called in pairs!! the calls to
+ * activate an passivate build a stack! The Transaction is only than set to null
+ * if the call stack is 0;
+ *
+ */
+public class ObjectTransactionContext implements IObjectTransactionContext {
+
+ // private static final ILogger LOGGER = LoggerAccessor.fetchLogger(
+ // ObjectTransactionContext.class );
+
+ private Stack<IObjectTransaction> replaced = new Stack<IObjectTransaction>();
+ private IObjectTransaction objectTransaction;
+
+ /**
+ * Creates a new ObjectTransactionContext on the passe object transaction
+ */
+ public ObjectTransactionContext() {
+ super();
+ }
+
+ /**
+ * Creates a new ObjectTransactionContext on the passe object transaction
+ *
+ * @param transaction -
+ * the Transaction to activate
+ */
+ public ObjectTransactionContext(IObjectTransaction transaction) {
+ super();
+ objectTransaction = transaction;
+ }
+
+ /**
+ * Activates the contained Transaction
+ */
+ public void activate() {
+ replaced.push(ObjectTransactionManagerAccessor.fetchObjectTransactionManager().getCurrent());
+ ObjectTransactionManagerAccessor.fetchObjectTransactionManager().setCurrent(objectTransaction);
+ }
+
+ /**
+ * Passivates the contained transaction. Every activate() must follow a
+ * deactivate() bevore the next activate on the same thread follows. The
+ * deactivation is necessary to oversee the transaction management.
+ */
+ public void passivate() {
+ if (isActivated()) {
+ ObjectTransactionManagerAccessor.fetchObjectTransactionManager().setCurrent(replaced.pop());
+ } else {
+ throw new ObjectTransactionContextFailure("Inconsistency while passivating object transaction context!");
+ }
+
+ }
+
+ /**
+ * @return Returns the objectTransaction.
+ */
+ public IObjectTransaction getObjectTransaction() {
+ return objectTransaction;
+ }
+
+ /**
+ * @param objectTransaction
+ * The objectTransaction to set.
+ */
+ public void setObjectTransaction(IObjectTransaction pObjectTransaction) {
+ this.objectTransaction = pObjectTransaction;
+ if (isActivated()) {
+ ObjectTransactionManagerAccessor.fetchObjectTransactionManager().setCurrent(objectTransaction);
+ }
+ }
+
+ /**
+ * @see org.eclipse.riena.objecttransaction.context.IContext#isActivated()
+ */
+ public boolean isActivated() {
+ return !replaced.empty();
+ }
+
+ public String toString() {
+ return super.toString() + "ObjectTransaction=" + objectTransaction;
+ }
+
+}
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ObjectTransactionContextFailure.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ObjectTransactionContextFailure.java
new file mode 100644
index 0000000..90e09d0
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/context/ObjectTransactionContextFailure.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.context;
+
+import org.eclipse.riena.objecttransaction.ObjectTransactionFailure;
+
+/**
+ * Failure indicating, that somethin goes wrong while managing the transaction
+ * in the current context
+ *
+ */
+
+public class ObjectTransactionContextFailure extends ObjectTransactionFailure {
+
+ /**
+ * Creates a new instance of this failure
+ *
+ * @param message
+ * the message to show.
+ */
+ public ObjectTransactionContextFailure(String message) {
+ super(message);
+ }
+
+}
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/AbstractBaseChange.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/AbstractBaseChange.java
new file mode 100644
index 0000000..e7eb4e2
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/AbstractBaseChange.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.delta;
+
+/**
+ * Base Object for all recorded object changes of the various types
+ *
+ */
+public abstract class AbstractBaseChange {
+
+ private String relationName;
+
+ /** <code>SINGLE_CHANGE_ENTRY</code> */
+ public static transient final int SINGLE_CHANGE_ENTRY = 1;
+ /** <code>SET_CHANGE_ENTRY</code> */
+ public static transient final int SET_CHANGE_ENTRY = 2;
+
+ /**
+ * @param relationName
+ */
+ public AbstractBaseChange(String relationName) {
+ this.relationName = relationName;
+ }
+
+ /**
+ * @return Returns the relationName.
+ */
+ public String getRelationName() {
+ return relationName;
+ }
+
+ /**
+ * @param relationName
+ * The relationName to set.
+ */
+ public void setRelationName(String relationName) {
+ this.relationName = relationName;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/MultipleChange.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/MultipleChange.java
new file mode 100644
index 0000000..7d46c5d
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/MultipleChange.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.delta;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.riena.objecttransaction.state.State;
+
+/**
+ * Object for maintaining the changes for 1:N relations
+ *
+ */
+public class MultipleChange extends AbstractBaseChange {
+
+ private List<MultipleChangeEntry> changeEntries;
+
+ /**
+ * @param relationName
+ */
+ public MultipleChange(String relationName) {
+ super(relationName);
+ changeEntries = new ArrayList<MultipleChangeEntry>();
+ }
+
+ /**
+ * Adds a new changed relation to the Multichange set
+ *
+ * @param childObject
+ */
+ public void addEntry(Object childObject) {
+ changeEntries.add(new MultipleChangeEntry(childObject, State.ADDED));
+ }
+
+ /**
+ * Removes a previously recorded change from the Multichange set
+ *
+ * @param childObject
+ */
+ public void removeEntry(Object childObject) {
+ if (changeEntries.size() > 0) {
+ for (int i = changeEntries.size() - 1; i >= 0; i--) {
+ MultipleChangeEntry entry = changeEntries.get(i);
+ if (entry.getChildObject().equals(childObject) && entry.getState().equals(State.ADDED)) {
+ changeEntries.remove(i);
+ return;
+ }
+ }
+ }
+ changeEntries.add(new MultipleChangeEntry(childObject, State.REMOVED));
+ }
+
+ /**
+ * Returns a changes as List
+ *
+ * @return
+ */
+ public List<MultipleChangeEntry> getEntries() {
+ return changeEntries;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ if (changeEntries.size() == 0) {
+ return "SetChange: <no changes>";
+ }
+ Object[] array = changeEntries.toArray();
+ StringBuilder sb = new StringBuilder("SetChange: refName:" + this.getRelationName());
+ if (array.length > 1) {
+ sb.append("\n");
+ }
+ for (int i = 0; i < array.length; i++) {
+ if (array.length > 1) {
+ sb.append("---------------->");
+ }
+ sb.append(" entry[" + i + "]:" + array[i]);
+ if (array.length > 1 && (i + 1) < array.length) {
+ sb.append("\n");
+ }
+ }
+ return sb.toString();
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/MultipleChangeEntry.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/MultipleChangeEntry.java
new file mode 100644
index 0000000..9ba02a5
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/MultipleChangeEntry.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.delta;
+
+import org.eclipse.riena.objecttransaction.state.State;
+
+/**
+ * Class that maintains the change used by 1:N Relations. This object maintains
+ * the changes for a single entry for a 1:N relation.
+ *
+ */
+public class MultipleChangeEntry {
+
+ private Object childObject;
+ private State state;
+
+ MultipleChangeEntry(Object childObject, State state) {
+ this.childObject = childObject;
+ this.state = state;
+ }
+
+ /**
+ * @return Returns the childObject.
+ */
+ public Object getChildObject() {
+ return childObject;
+ }
+
+ /**
+ * @return Returns the state.
+ */
+ public State getState() {
+ return state;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ return "obj:" + childObject + " state:" + State.toString(state);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/SingleChange.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/SingleChange.java
new file mode 100644
index 0000000..eb0e802
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/SingleChange.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.delta;
+
+/**
+ * ChangeEntry Class that maintains a single property or 1:1 reference change
+ *
+ */
+public class SingleChange extends AbstractBaseChange {
+
+ private Object childObject;
+
+ /**
+ * @param relationName
+ * @param childObject
+ */
+ public SingleChange(String relationName, Object childObject) {
+ super(relationName);
+ this.childObject = childObject;
+ }
+
+ /**
+ * @return Returns the childObject.
+ */
+ public Object getChildObject() {
+ return childObject;
+ }
+
+ /**
+ * @param childObject
+ * The childObject to set.
+ */
+ public void setChildObject(Object childObject) {
+ this.childObject = childObject;
+ }
+
+ public String toString() {
+ return "SingleChange: new:" + childObject;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/TransactionDelta.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/TransactionDelta.java
new file mode 100644
index 0000000..2b46429
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/delta/TransactionDelta.java
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.delta;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.riena.objecttransaction.IObjectId;
+import org.eclipse.riena.objecttransaction.ObjectTransactionFailure;
+import org.eclipse.riena.objecttransaction.state.State;
+
+/**
+ * this instance holds all changes for one transacted objects.
+ *
+ */
+public class TransactionDelta implements Cloneable {
+
+ private IObjectId objectId;
+ private State state; // (Clean, Created, Modified, Deleted)
+ private String version; // version of TransactionDelta
+ private Map<String, AbstractBaseChange> referenceChanges; // (refName
+
+ // newValue)
+
+ /**
+ * @param objectId
+ * @param state
+ * @param version
+ */
+ public TransactionDelta(IObjectId objectId, State state, String version) {
+ super();
+ setObjectId(objectId);
+ setState(state);
+ setVersion(version);
+ this.referenceChanges = new HashMap<String, AbstractBaseChange>();
+ }
+
+ /**
+ * @return Returns the objectId.
+ */
+ public IObjectId getObjectId() {
+ return objectId;
+ }
+
+ /**
+ * @param objectId
+ * The objectId to set.
+ */
+ public void setObjectId(IObjectId objectId) {
+ this.objectId = objectId;
+ }
+
+ /**
+ * Sets the change for a 1:1 relation overriding previous changes
+ *
+ * @param refName
+ * @param childObject
+ */
+ public void setSingleRefObject(String refName, Object childObject) {
+ referenceChanges.put(refName, new SingleChange(refName, childObject));
+ }
+
+ /**
+ * @param refName
+ * @return
+ */
+ public boolean hasSingleRefObject(String refName) {
+ SingleChange sEntry = ((SingleChange) referenceChanges.get(refName));
+ if (sEntry != null) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns the change for a 1:1 relation, if there is no it returns null
+ *
+ * @param refName
+ * @return
+ */
+ public Object getSingleRefObject(String refName) {
+ SingleChange sEntry = ((SingleChange) referenceChanges.get(refName));
+ if (sEntry == null) {
+ return null;
+ }
+ return sEntry.getChildObject();
+ }
+
+ /**
+ * Adds a change to a 1:N relation, creates a new 1:N relation if it did not
+ * exist
+ *
+ * @param refName
+ * @param childObject
+ */
+ public void addMultiRefObject(String refName, Object childObject) {
+ AbstractBaseChange baseEntry = referenceChanges.get(refName);
+ if (!(baseEntry instanceof MultipleChange) && baseEntry != null) {
+ throw new ObjectTransactionFailure("impossible to add a reference to refName" + refName
+ + "as it was previously used with a set object, which creates a 1:1 reference.");
+ }
+ MultipleChange entry = (MultipleChange) baseEntry;
+ if (entry == null) {
+ entry = new MultipleChange(refName);
+ referenceChanges.put(refName, entry);
+ }
+ entry.addEntry(childObject);
+ }
+
+ /**
+ * Removes a previously recorded change from a 1:N relation
+ *
+ * @param refName
+ * @param childObject
+ */
+ public void removeMultiRefObject(String refName, Object childObject) {
+ AbstractBaseChange baseEntry = referenceChanges.get(refName);
+ if (!(baseEntry instanceof MultipleChange) && baseEntry != null) {
+ throw new ObjectTransactionFailure("impossible to add a reference to refName" + refName
+ + "as it was previously used with a set object, which creates a 1:1 reference.");
+ }
+ MultipleChange entry = (MultipleChange) baseEntry;
+ if (entry == null) {
+ entry = new MultipleChange(refName);
+ referenceChanges.put(refName, entry);
+ }
+ entry.removeEntry(childObject);
+
+ }
+
+ protected Map<String, AbstractBaseChange> getAllChanges() {
+ return referenceChanges;
+ }
+
+ /**
+ * @return Returns the state.
+ */
+ public State getState() {
+ return state;
+ }
+
+ /**
+ * @param state
+ * The state to set.
+ */
+ public void setState(State state) {
+ this.state = state;
+ }
+
+ /**
+ * @return true if delta is clean
+ */
+ public boolean isClean() {
+ return state.equals(State.CLEAN);
+ }
+
+ /**
+ * @returntrue if delta is modified
+ */
+ public boolean isModified() {
+ return state.equals(State.MODIFIED);
+ }
+
+ /**
+ * @return true if delta is created
+ */
+ public boolean isCreated() {
+ return state.equals(State.CREATED);
+ }
+
+ /**
+ * @return true if delta is deleted
+ */
+ public boolean isDeleted() {
+ return state.equals(State.DELETED);
+ }
+
+ /**
+ * @return Returns the version.
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * @param version
+ * The version to set.
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ /**
+ * @return
+ */
+ public Map<String, AbstractBaseChange> getChanges() {
+ return referenceChanges;
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("##### objectId:" + objectId + " #####\n");
+ sb.append("state:" + State.toString(state) + "\n");
+ sb.append("reference Changes ---START---\n");
+ for (Map.Entry<String, AbstractBaseChange> entry : referenceChanges.entrySet()) {
+ sb.append(entry.toString() + "\n");
+ }
+ sb.append("reference Changes ---END---\n");
+ return sb.toString();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object clone() throws CloneNotSupportedException {
+ TransactionDelta delta = (TransactionDelta) super.clone();
+ delta.referenceChanges = (Map<String, AbstractBaseChange>) ((HashMap<String, AbstractBaseChange>) referenceChanges).clone();
+ return delta;
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/Action.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/Action.java
new file mode 100644
index 0000000..e13fea2
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/Action.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.state;
+
+/**
+ * This enumerator class creates a static set of actions that can be performed
+ * on a state. This is done by the StateMachine.
+ *
+ * @see org.eclipse.riena.objecttransaction.state.StateMachine
+ *
+ */
+public final class Action {
+
+ private static transient final int NEW_CODE = 1;
+ private static transient final int SET_CODE = 2;
+ private static transient final int ADD_CODE = 3;
+ private static transient final int REMOVE_CODE = 4;
+ private static transient final int DELETE_CODE = 5;
+
+ /** <code>NEW</code> */
+ public transient final static Action NEW = new Action(NEW_CODE);
+ /** <code>SET</code> */
+ public transient final static Action SET = new Action(SET_CODE);
+ /** <code>ADD</code> */
+ public transient final static Action ADD = new Action(ADD_CODE);
+ /** <code>REMOVE</code> */
+ public transient final static Action REMOVE = new Action(REMOVE_CODE);
+ /** <code>DELETE</code> */
+ public transient final static Action DELETE = new Action(DELETE_CODE);
+
+ private int actionCode;
+
+ private Action(int actionCode) {
+ this.actionCode = actionCode;
+ }
+
+ /**
+ * @see java.lang.Object#toString()
+ */
+ public String toString() {
+ if (actionCode == NEW_CODE) {
+ return "new";
+ } else if (actionCode == SET_CODE) {
+ return "set";
+ } else if (actionCode == ADD_CODE) {
+ return "add";
+ } else if (actionCode == REMOVE_CODE) {
+ return "remove";
+ } else if (actionCode == DELETE_CODE) {
+ return "delete";
+ }
+ return "unknown state ?????";
+ }
+
+ /**
+ * @param action
+ * @return
+ */
+ public static String toString(Action action) {
+ if (action == null) {
+ return "action is NULL ??";
+ } else {
+ return action.toString();
+ }
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object object) {
+ if (object instanceof Action) {
+ return ((Action) object).actionCode == actionCode;
+ }
+
+ return false;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return actionCode;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/InvalidActionFailure.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/InvalidActionFailure.java
new file mode 100644
index 0000000..f504469
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/InvalidActionFailure.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.state;
+
+import org.eclipse.riena.objecttransaction.ObjectTransactionFailure;
+
+/**
+ * Failure if an invalid action in the statemachine was executed
+ *
+ */
+public class InvalidActionFailure extends ObjectTransactionFailure {
+
+ /**
+ * @param message
+ */
+ public InvalidActionFailure(String message) {
+ super(message);
+ }
+
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/State.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/State.java
new file mode 100644
index 0000000..4aee0bd
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/State.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.state;
+
+/**
+ * Enumerator class that represented the current state of a transactedobject or
+ * or a relation.
+ *
+ * @see org.eclipse.riena.objecttransaction.state.StateMachine
+ *
+ */
+public final class State {
+
+ private static transient final int CREATED_CODE = 1;
+ private static transient final int DELETED_CODE = 2;
+ private static transient final int MODIFIED_CODE = 3;
+ private static transient final int CLEAN_CODE = 4;
+ private static transient final int VANISHED_CODE = 5;
+ private static transient final int ADDED_CODE = 6;
+ private static transient final int REMOVED_CODE = 7;
+
+ /** <code>CLEAN</code> */
+ public transient final static State CLEAN = new State(State.CLEAN_CODE);
+ /** <code>CREATED</code> */
+ public transient final static State CREATED = new State(State.CREATED_CODE);
+ /** <code>MODIFIED</code> */
+ public transient final static State MODIFIED = new State(State.MODIFIED_CODE);
+ /** <code>DELETED</code> */
+ public transient final static State DELETED = new State(State.DELETED_CODE);
+ /** <code>VANISHED</code> */
+ public transient final static State VANISHED = new State(State.VANISHED_CODE);
+ /** <code>ADDED</code> */
+ public transient final static State ADDED = new State(State.ADDED_CODE);
+ /** <code>REMOVED</code> */
+ public transient final static State REMOVED = new State(State.REMOVED_CODE);
+
+ private int state;
+
+ private State(int state) {
+ super();
+ this.state = state;
+ }
+
+ public String toString() {
+ if (state == CREATED_CODE) {
+ return "created";
+ } else if (state == DELETED_CODE) {
+ return "deleted";
+ } else if (state == MODIFIED_CODE) {
+ return "modified";
+ } else if (state == CLEAN_CODE) {
+ return "clean (unmodified)";
+ } else if (state == VANISHED_CODE) {
+ return "vanished (was created and then deleted)";
+ } else if (state == ADDED_CODE) {
+ return "add";
+ } else if (state == REMOVED_CODE) {
+ return "remove";
+ }
+ return "unknown state ?????";
+ }
+
+ /**
+ * @param state
+ * @return
+ */
+ public static String toString(State state) {
+ if (state == null) {
+ return "state is NULL ??";
+ } else {
+ return state.toString();
+ }
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object object) {
+ if (object instanceof State) {
+ return ((State) object).state == state;
+ }
+ return false;
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return state;
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/StateMachine.java b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/StateMachine.java
new file mode 100644
index 0000000..4f627de
--- /dev/null
+++ b/org.eclipse.riena.objecttransaction/src/org/eclipse/riena/objecttransaction/state/StateMachine.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.objecttransaction.state;
+
+import org.eclipse.core.runtime.Assert;
+
+/**
+ * StateMachine which takes a State, applies an Action on it and the result is a
+ * new State. If an Action is invalid for a certain State, the
+ * InvalidActionFailure is thrown.
+ *
+ */
+public final class StateMachine {
+
+ private StateMachine() {
+ // utility
+ }
+
+ /**
+ * Creates an initialState for a given action.
+ *
+ * @param action
+ * for which to create a state
+ * @return initialState
+ * @throws InvalidActionFailure
+ */
+ public static State initAction(Action action) throws InvalidActionFailure {
+ if (action.equals(Action.NEW) || action.equals(Action.ADD) || action.equals(Action.SET)) {
+ return State.CREATED;
+ } else if (action.equals(Action.DELETE) || action.equals(Action.REMOVE)) {
+ return State.DELETED;
+ }
+
+ throw new InvalidActionFailure("unknown action " + Action.toString(action));
+ }
+
+ /**
+ * Applies an action on a currentState and returns the resulting State. If
+ * the Action is invalid for this state an InvalidActionFailure is thrown
+ *
+ * @param currentState
+ * @param action
+ * @return State this is the new State after applying the action
+ * @throws InvalidActionFailure
+ * @pre currentState!=null
+ */
+ public static State processAction(State currentState, Action action) throws InvalidActionFailure {
+ Assert.isNotNull(currentState, "currentState cannot be null");
+ // CREATED
+ if (currentState.equals(State.CREATED)) {
+ if (action.equals(Action.SET) || action.equals(Action.ADD) || action.equals(Action.REMOVE)) {
+ return currentState;
+ } else if (action.equals(Action.NEW)) {
+ return currentState;
+ } else if (action.equals(Action.DELETE)) {
+ return State.VANISHED;
+ }
+ // MODIFIED
+ } else if (currentState.equals(State.MODIFIED)) {
+ if (action.equals(Action.NEW)) {
+ throw new InvalidActionFailure("state is MODIFIED, can't set to NEW");
+ } else if (action.equals(Action.SET) || action.equals(Action.ADD) || action.equals(Action.REMOVE)) {
+ return currentState;
+ } else if (action.equals(Action.DELETE)) {
+ return State.DELETED;
+ }
+ // DELETED
+ } else if (currentState.equals(State.DELETED)) {
+ throw new InvalidActionFailure("currentState is DELETED, no action possible");
+ // VANISHED
+ } else if (currentState.equals(State.VANISHED)) {
+ throw new InvalidActionFailure("currentState is VANISHED, no action possible");
+ // CLEAN
+ } else if (currentState.equals(State.CLEAN)) {
+ if (action.equals(Action.NEW)) {
+ throw new InvalidActionFailure("state is MODIFIED, can't set to NEW");
+ } else if (action.equals(Action.SET) || action.equals(Action.ADD) || action.equals(Action.REMOVE)) {
+ return State.MODIFIED;
+ } else if (action.equals(Action.DELETE)) {
+ return State.DELETED;
+ }
+ }
+ throw new InvalidActionFailure("unknown action for currentState state is " + State.toString(currentState) + " action is " + Action.toString(action));
+ }
+
+ /**
+ * Merges two States and create a resulting State. The newState (second
+ * parameter) is the more current State that is updating the existing
+ * current State (first Parameter).
+ *
+ * @param currentState
+ * @param newState
+ * @return State the new state after the merge
+ * @throws InvalidActionFailure
+ */
+ public static State mergeStates(State currentState, State newState) throws InvalidActionFailure {
+ if (currentState.equals(newState)) {
+ return currentState;
+ }
+ if (currentState.equals(State.CREATED)) {
+ if (newState.equals(State.DELETED) || newState.equals(State.VANISHED)) {
+ return State.VANISHED;
+ } else {
+ return State.CREATED;
+ }
+ } else if (currentState.equals(State.MODIFIED) && (newState.equals(State.DELETED) || newState.equals(State.VANISHED))) {
+ return State.DELETED;
+ } else if (currentState.equals(State.MODIFIED) && newState.equals(State.CREATED)) {
+ return State.MODIFIED;
+ } else if (currentState.equals(State.DELETED) || currentState.equals(State.VANISHED)) {
+ throw new InvalidActionFailure("current State is " + State.toString(currentState) + " new State is " + State.toString(newState) + " invalid change");
+ } else if (currentState.equals(State.CLEAN)) {
+ if (newState.equals(State.MODIFIED) || newState.equals(State.DELETED)) {
+ return newState;
+ }
+ if (newState.equals(State.VANISHED)) {
+ throw new InvalidActionFailure("current State is " + State.toString(currentState) + " new State is " + State.toString(newState)
+ + " invalid change");
+ }
+ }
+ throw new InvalidActionFailure("unknown current State " + State.toString(currentState) + " and new State " + State.toString(newState));
+ }
+} \ No newline at end of file