Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 399380

Summary: Move @Replace support into Scout core and extend it
Product: z_Archived Reporter: Andi Bur <andi.bur>
Component: ScoutAssignee: Project Inbox <scout.core-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 Flags: andi.bur: juno+
andi.bur: kepler+
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 384479    
Attachments:
Description Flags
applied patch none

Description Andi Bur CLA 2013-01-29 08:19:44 EST
Scout's Extension Support plug-in (i.e. org.eclipse.scout.rt.extension.client) provides the org.eclipse.scout.rt.extension.client.Replace annotation for replacing table menus and columns, that are declared in a super class. This kind of adaption is not using Eclipse's extension mechanisms, other than the rest of the extension support. Therefore move @Replace annotation into Scout core and support it by other scout model objects as well.

Remove support for replacing arbitrary classes [Class<?> value()]
Replace supports an optional class-typed value for declaring the class to be replaced. If it is not provided, the annotated class' super class is replaced. The arbitrary class-to-be-replaced type does not fit with Scout's configuration approach because almost all declared scout objects (i.e. inner classes) are accessed by their types. Hence replacing a model object by another one that does not subclassing the replaced type leads to ClassCastExceptions.

Extend @Replace support to other Scout objects
Currently, the @Replace annotation is supported by table columns and table menus only. The annotation should work on other scout objects as well, like form fields, form field data and actions in general.

Apply replacements before creating instances
Currently, replaced as well as replacing classes are instantiated before the actual replacement is performed. This could lead to performance issues and to unwanted multiple executions of some logic. Hence process replacements before any classes are instantiated.

Complete support for get-by-class methods
Currently, getXxxByClass is not working with replaced classes. Null is returned instead of the replacing class.
(E.g. if OriginalColumn is replaced by ReplacingColumn extends OriginalColumn, table.getColumnSet().getColumnByClass(OriginalColumn.class) returns null instead of the ReplacingColumn instance).

IDs of replacing objects
Columns, form fields, form field data and actions have a getId() method that defaults to the class' simple name. If such an object is replaced, getId() must still return the original ID.

Scout SDK: Carry over @Replace to a generated form field data and extend it from the replaced field's form field data
If a form field is annotated with @Replace, its corresponding form field data must be annotated as well. The information is required at runtime to perform the very same replacements on form field data, that are performed on form fields as well. Further the generated replacing field data must extend the replaced form field's data. Any @FormData annotation on a replacing field is ignored unless the replaced field does not have a form field data.

Scout SDK: Validation rules
The validation rule map of an extended form field data must contain any validation differences between the original and replacing field. Validation rules that are available on the original field and that are skipped on replacing fields must be removed from the replacing field's validation rule map.
Comment 1 Andi Bur CLA 2013-01-29 11:27:26 EST
Created attachment 226268 [details]
applied patch

patch implementing the requirements described above
Comment 2 Andi Bur CLA 2013-01-29 11:28:37 EST
applied attached patch on Scout branch 3.8. Merge to 3.9 will be done automatically.
Comment 3 Matthias Zimmermann CLA 2013-03-04 06:11:04 EST
Bug closed, shipped with 3.8.2 (Juno, SR2)