[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2672) @ValidateProperty annotation for action components

Christian Bauer (JIRA) jira-events at lists.jboss.org
Tue Feb 26 01:39:42 EST 2008


@ValidateProperty annotation for action components
--------------------------------------------------

                 Key: JBSEAM-2672
                 URL: http://jira.jboss.com/jira/browse/JBSEAM-2672
             Project: JBoss Seam
          Issue Type: Feature Request
          Components: Core
            Reporter: Christian Bauer
            Priority: Optional


I have an entity class:

public class Document {

    @Length(min/max)
    String content;

}

This property is not mapped directly with a value binding to a GUI textarea, it has to be passed through the form controller/action (where I parse the content for magic stuff):

public class DocumentHome {

    String formContent;

    persist() {
        instance.setContent(formContent);
    }
    
}

This effectively disables any validation of the @Length as only Hibernate Validator will throw an InvalidStateException on persist(). To get the message into the form, I'd have to either do manual validation calls in DocumentHome.persist() before copying the form value onto the instance, or add another @Length annotation to the form-bound property of the controller:

public class DocumentHome {

    @Length(min/max)
    String formContent;

    persist() {
        instance.setContent(formContent);
    }
    
}

This means I need to duplicate the validation rules if one of my entity properties is not directly mapped to a form but through some intermediate processing in a controller. I'd like to connect the two, like so:

public class DocumentHome {

    @ValidateProperty("some.syntax.that.declares.the.Document.content.property")
    String formContent;

    persist() {
        instance.setContent(formContent);
    }
    
}

I'm marking this as optional because I'm not sure this is a generic problem and that we need a generic solution. OTOH, duplicating and manual coding of validation doesn't seem to be the right approach either.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list