Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » XXX code tags in generated FormData classes
XXX code tags in generated FormData classes [message #1713075] Fri, 30 October 2015 15:56 Go to next message
Samuel   is currently offline Samuel Friend
Messages: 22
Registered: January 2012
Junior Member
I have two questions related to XXX code tags in generated form data classes.


    (1) I have a form with a smartfield that has a LocalLookupCall configured.
    The form data of this form then gets the following comment:
          /**
           * XXX not processed ValidationRule(lookupCall)
           * 'MyLookupCall.class' is not accessible from here.
           * at ors.eclipse.scout.basteleien.client.TestForm.MainBox.TestField#getConfiguredLookupCall
           */
    

    The comment is correct: the field validation for this field cannot be performed on server side because the server does not know the local lookup call.
    As we have the policy of not having any TODOs, FIXMEs or XXXs in the productive code, I want to get rid of the "XXX".
    Possible solutions:


      (a) Not including the field in the form data using the form data annotation "@FormData(sdkCommand = SdkCommand.IGNORE)" on thie field.
      (b) Moving the local lookup call to the shared plugin.

    Solution (a) is not an option for me since I need the value of the field on the server side.
    Solution (b) would in my case indeed be an option.
    Nevertheless, do you see other solutions (in case both solutions (a) and (B) are no option to the user)?



    (2) I have a form with a post code field and a city field. The city field has the post code field as its master field.
    The city field is an instance of an AbstractCityField (code template).
    As the city field must know it's post code field, the AbstractCityField has an abstract method getConfiguredPostCodeField().
    public abstract class AbstractCityField extends AbstractStringField {
    
      protected abstract Class<? extends IValueField<?>> getConfiguredPostcodeField();
    
      @Override
      protected String getConfiguredLabel() {
        return TEXTS.get("City");
      }
    }
    

    Hence, each instance of an abstract city field must provide its post code field.
    The method getConfiguredMasterField just returns the result of the method getPostcodeField.
    The main box of my TestForm looks as follows:
      @Order(10.0)
      public class MainBox extends AbstractGroupBox {
    
        @Order(20.0)
        public class PostcodeField extends AbstractStringField {
    
          @Override
          protected String getConfiguredLabel() {
            return TEXTS.get("Postcode");
          }
        }
    
        @Order(30.0)
        public class CityField extends AbstractCityField {
    
          @Override
          protected Class<? extends IValueField<?>> getConfiguredPostcodeField() {
            return getPostcodeField();
          }
    
          @Override
          protected Class<? extends IValueField> getConfiguredMasterField() {
            return getPostcodeField();
          }
    
        }
    
      }
    

    The generated form data object for this form has the following comment in the method initValidationRules(...) of the City class:
          /**
           * XXX not processed ValidationRule(masterValueField)
           * 'getPostcodeField()' is not accessible from here.
           * at ors.eclipse.scout.basteleien.client.TestForm.MainBox.CityField#getConfiguredMasterField
           */
    

    Again, I understand, that the FormData generator cannot determine the class of the master field at compile time.
    Nevertheless, for the same reasons as above, I want to get rid of the XXX code tag.
    Possible solution:


      Include both the postcode field and the city field in the code template (and write something like an "AbstractPostcodeCityBox")

    This solution is not an option in my project.
    Can you suggest other solutions?


Possible solutions:

    (1) One could implement an annotation on a form field that controls if validation rules for this field are included into the form data class. Something like "@InputValidation(value = IGNORE)".
    (2) The above annotation could also be placed on the getConfiguredXxx methods. An annotation on the method getConfiguredMaxLength would e.g. inhibit the rule on the maximal length of a string field in the form data. Consequently, this annotation on the method getConfiguredMasterField wouled inihibit the fule for the master field in hte form data.

Cheers, Samuel
Re: XXX code tags in generated FormData classes [message #1718996 is a reply to message #1713075] Mon, 04 January 2016 10:30 Go to previous messageGo to next message
Anna-Nina Wille is currently offline Anna-Nina WilleFriend
Messages: 6
Registered: September 2015
Junior Member
Hi all,

I found out that you can use the @ValidationRule annotation for that as it provides a "skip" parameter:

      @Override
      @ValidationRule(skip = true, value = ValidationRule.MASTER_VALUE_FIELD)
      protected Class<? extends IValueField> getConfiguredMasterField() {
        return getPostcodeField();
      }


You just need to know which configuration method generates which validation rule (or look it up in the AbstractFormField class). Smile
Re: XXX code tags in generated FormData classes [message #1719092 is a reply to message #1718996] Tue, 05 January 2016 07:35 Go to previous message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
This is a great input. Thank you Anna-Nina for sharing this here.
Previous Topic:[Neon] StringField getConfiguredValidateOnAnyKey
Next Topic:[Neon] Multiple levels of maven projects
Goto Forum:
  


Current Time: Tue Sep 24 13:29:54 GMT 2024

Powered by FUDForum. Page generated in 0.03910 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top