Pinned topic Custom Builder by extending existing builder
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Is it possible to create a new customer builder that extends directly another builder? For example, is it possible to create a new builder that extends DataPage builder but adds a new functionality to it ?
Updated on 2010-05-18T17:40:36Z at 2010-05-18T17:40:36Z by SystemAdmin
Re: Custom Builder by extending existing builder2010-05-17T16:58:57ZThis is the accepted answer. This is the accepted answer.Sure. Input form and View and Form are examples of just that. However extending Data Page is somewhat tricky, because the PageAutomation stuff does different things in different phases of the Generation process. If you say a little more about what it is you are trying to accomplish, I can help you better.
Re: Custom Builder by extending existing builder2010-05-17T17:26:00ZThis is the accepted answer. This is the accepted answer.
- SystemAdmin 110000D4XK
Re: Custom Builder by extending existing builder2010-05-17T17:30:58ZThis is the accepted answer. This is the accepted answer.What I meant is to have a new builder that is a DataPage but with just a small enhancement that can be shown in a new section below the DataPage builder sections, add capabilities like filteration, some validations, so on. What is the best approach for that? With minimal effort I mean
Re: Custom Builder by extending existing builder2010-05-17T19:12:24ZThis is the accepted answer. This is the accepted answer.
- sh_said 120000NMPS
PageAutomation is all about the presentation of data and forms (including the collection of the data from the form). It assumes that the data is there, already. The higher-level builders like View and Form are intended to combine the collection of data with its presentation -- that's why they are considered higher level. The idea of filtration (I assume, using information entered somehow by the end user) is definitely a data function rather than a presentation function.
In fact, View and Form does filtration pretty well. If you make a service that has inputs (i.e. the filter values) and then returns a table of results, V&F does a great job with this. You just have to hand the Data Service to the builder and check that you want an input page. It will even put the input page on the view page, if you check the appropriate box.
As for validations, are you talking about individual field validation or cross-field validation? If the former, do you know about the built-in validation that Data Page already provides? And how to extend it? If the latter, then the correct approach is the Post-save operation that is an input to Data Page -- you reference a method there which does whatever you like, including accessing the public API of the Errors object, which is where PageAutomation stores all the error messages for display on the page when validation has failed.
So, the first question is: do you know how to accomplish the task manually, using existing builders? It is pretty easy to make a builder that just wraps up a few others, though there are a few distinctly tricky steps, especially when you are talking about PageAutomation. For instance, to create a single builder that includes a Data Page plus one or more modifier builders (Data Field Modifier, etc.) it is a little tricky to know how to make the selector in the modifier's inputs which tells it which PageAutomation element to modify. And that's if your builder just calls other builders.
It is also possible to make a "PageAutomation" builder, which means that it runs in the magical PageAutomation phase, in between when Data Page has made the internal representation of what it is going to create but before it has actually rendered anything to the page or to Java code (which is creates roughly simultaneously). This also uses public API's which I could point you at, but I wouldn't want you making your FIRST builder this way. Making a simple builder is enough to wrap your head around. (Not that its hard, exactly, but its a new way of thinking that is tricky at first.)
Anyway, the first step is to understand how you could accomplish what you are trying to accomplish just with the existing builders. Then we can discuss the steps to make a builder that implements the pattern.
Re: Custom Builder by extending existing builder2010-05-18T09:59:38ZThis is the accepted answer. This is the accepted answer.I created the model manually using the DataPage with other builders and have the functionality that I need in that model .Now, I want to export this new model as a new builder, I know that model based builder can be used to accomplish that. But what I want is that the new builder inputs will be those of the DataPage and some extra inputs that I expose from the other builders in the model for the new functionality. I was thinking of profiling every input in the DataPage in my model so that it can exposed in the new builder, but I was thinking that there should be a better way to do that. A way like saying that the builder is extending from DataPage or something like that. Can you guide on the best way for that?
Re: Custom Builder by extending existing builder2010-05-18T17:40:36ZThis is the accepted answer. This is the accepted answer.
- sh_said 120000NMPS
Be careful of any XML inputs: Make sure you call cloneElement on them before handing them over.
So your BDEF is filled with these:
<InputDefinition name="Name" base="com.bowstreet.builders.webapp.pageautomation.DataPage.Name"> <UseAssociatedCoordinator>true</UseAssociatedCoordinator> </InputDefinition>
which you create by just copying all the inputs from the Data Page bdef (snag it from the zip file at the top of the builders directory) and editing each input to look like the above, where only "Name" is different for each one.Updated on 2014-03-25T15:56:03Z at 2014-03-25T15:56:03Z by iron-man