Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 408759 - ValidationRule is sometimes not correctly overridden on replaced fields
Summary: ValidationRule is sometimes not correctly overridden on replaced fields
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Scout (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 384479
  Show dependency tree
 
Reported: 2013-05-22 17:26 EDT by Andi Bur CLA
Modified: 2021-08-19 11:26 EDT (History)
0 users

See Also:
andi.bur: juno+
andi.bur: kepler+


Attachments
applied patch (5.59 KB, patch)
2013-05-22 17:33 EDT, Andi Bur CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andi Bur CLA 2013-05-22 17:26:01 EDT
The validation rule map is not correctly created by Scout SDK for replaced form fields if the rule's value evaluates to false or null.

Example (simplified):

BaseForm:
public class NameField extends AbstractStringField {
  @Override
  protected boolean getConfiguredMandatory() {
    return true;
  }
}

Creates the following rule map in the form field data
  @Override
  protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
    super.initValidationRules(ruleMap);
    ruleMap.put(ValidationRule.MANDATORY, true);
  }

ExtendedForm extends BaseForm:
@Replace
public class NameExField extends BaseForm.MainBox.GroupBox.NameField {
  @Override
  protected boolean getConfiguredMandatory() {
    return false;
  }
}

The rule map in the extended form field data is empty, but it should have the following contents:
  @Override
  protected void initValidationRules(java.util.Map<String, Object> ruleMap) {
    super.initValidationRules(ruleMap);
    ruleMap.remove(ValidationRule.MANDATORY);
  }
  
Note: Whenever a overridden rule evaluates to false or null, it is removed from the rule map. In all other cases, the rule is overridden with its new value.
Comment 1 Andi Bur CLA 2013-05-22 17:33:12 EDT
Created attachment 231337 [details]
applied patch
Comment 2 Andi Bur CLA 2013-05-22 17:48:49 EDT
committed on Scout branch 3.8. Will be merged by Stephan or ken to Scout branch 3.9
Comment 3 Stephan Leicht Vogt CLA 2013-05-24 05:51:48 EDT
Has been pushed as change (https://git.eclipse.org/r/#/c/13103/) and committed to master: d994a9f414d22452035d36ddc82d6c25d6fa37c2 (http://git.eclipse.org/c/scout/org.eclipse.scout.rt.git/commit/?id=d994a9f414d22452035d36ddc82d6c25d6fa37c2)

@Andi: Please verify
Comment 4 Matthias Zimmermann CLA 2013-07-08 17:25:58 EDT
Bug closed, shipped with 3.9.0 (Kepler)