0 Replies Latest reply on Mar 24, 2011 5:22 AM by Francesco Lemma

    Help on Configurable Custom-Properties Framework.

    Francesco Lemma Newbie

      Hi, at work I need to take the responsibility of the further development of an up and running Seam application.
      This application is increasing and other than new fetures, many fixes and modifications are being requested.
      Among all those modifications, I'm requested to change and add new fields to the user registration form. This could sound like the simplest of the task but, as I'm quite confident that this application will be in the near future used by other people in other contexts, I was thinking about a way to create an interface for operators (who are not supposed to know anything about the technical implementations and about coding or java in general) where they can manage custom fields to associate to the objects of the application domain model (in this case to the User entity).
      The operator should be able to choose not also if the fields are mandatory or not, but also define these rules based on other fields values (Eg.: request the State field only if the user is From United States) and eventually also choose a sort of data source for certain kind of fields (for example the City field could be a combo that only shows the cities of the selected state).
      On the user view, within the registration form, it should be relatively easy to show only the custom fields associated with the User entity and on the backend, a custom Hibernate validator, mapping via reflection the properties set by the operator to validation rules (eg: if the operator has chosen that a specific field is mandatory, so it shouldn't be nullable and so on).

      On the object model part, basically I thought about creating 5 classes:

      Field (name, description, group)
      Group (name, description)
      Properties (name, value)
      FieldProperties (field, property)
      GroupProperties (group, property) For properties to apply to all the fields in a group
      EntityProperties (entityName, field) //Via reflection this should associate the custom fields to a specific property.

      What I would like to know is if anyone has already done something like that or if seam already provides a way of doing that.
      Otherwise any suggestions is appreciated and also, if any, reasons why you think this is not a good thing to implement.

      For me, this is just at at an idea stage, so any comment and help is really appreciated. I'm here first because I want to learn, before of looking for a way to solve my problems.

      Thanks in advance for the time spent reading.