Just filed this as RIFE-304. It was originally suggested in IRC by Patrick Lightbody but I think it's a great idea so I figured I'd write it up.

With the @FlowlinkField and @SubmissionHandler annotations, RIFE is very close to the "don't repeat yourself" ideal. But there is still one place where you have to repeat yourself, and where errors can creep in: templates still need to refer to exit and submission names.

It would be great to have an alternate scheme where you could refer to exits/submissions by the names of fields in Java classes. For example:

<a href="${v EXIT:QUERY:com.foo.elements.AccountHome.EXIT_PAY_BILL/}">...</a>

This has the advantage of allowing IDEs to do refactoring if classes are renamed, etc. An alternate, less verbose approach would decouple templates from particular classes:

<a href="${v EXIT:QUERY:EXIT_PAY_BILL/}">...</a>

Then any element implementation that uses the template simply defines a public static final String field called EXIT_PAY_BILL, which could point to different places depending on the element in question. This would be perhaps slightly less amenable to IDE refactoring, but for class name changes it'd be irrelevant since there isn't a class name to refactor.

There should probably be some way to mark names to indicate whether they are raw exit names or field names, but unless that marking is very terse (say, 1 character) better would be to default to something like "if there's an exit by this name, use it, otherwise search for a field" to keep templates as uncluttered as possible.

The same idea can apply to submission handlers. This will be most useful in conjunction with something like RIFE-303 so there is some assurance that a submission handler name actually matches the corresponding submission handler in the element.

<form method="POST" action="${v SUBMISSION:FORM:SUBMISSION_PAY_BILL/}">
or, fully qualified,
<form method="POST" action="${v SUBMISSION:FORM:com.foo.elements.BillingHome.SUBMISSION_PAY_BILL/}">


Comments?

-Steve
_______________________________________________
Rife-users mailing list
Rife-users@uwyn.com
http://lists.uwyn.com/mailman/listinfo/rife-users

Reply via email to