getWebActionModels(int executionType)
I'm having a difficult time understanding what the following method
does besides return a list of Models....
I've seen this method is both ViewBeans and TiledViews...
public Model[] getWebActionModels(int executionType)
Some questions I have:
1.) Since this method is called by JATO internally from a request, how
do you change the executionType so that the other cases are triggered.
The only case that seems to be triggered is the MODEL_TYPE_RETRIEVE
executionType.
2.) Now, what happens when this method is finished executing and an
array of Models are returned? What do these models do from here? Are
they executed? What should a developer do with this models, if
anything.
Thanks
- Billy -
[815 byte] By [
Guest] at [2007-11-25 9:27:58]

Billy,
Instead of answering your questions directly, I'll just give a mini-
lesson on web actions.
The getWebActionModels is only for the framework to call. It is used
to automate the execution of models for different operations
(retrieve, insert, update, delete).
Typically, you will create buttons (Insert, Update, Delete, etc) that
invoke the "handle web action" methods:
handleWebAction(int handlerType)
where handlerType is a class constant from WebActionHandler class:
ACTION_UPDATE, ACTION_INSERT, ACTION_DELETE, ACTION_SELECT,
ACTION_FIRST, ACTION_NEXT, etc.
So in your update button handler, you would do this:
public void handleUpdateRequest(RequestInvocation event)
{
handleWebAction(WebActionHandler.ACTION_UPDATE);
<targeVB>.forwardTo(event.getRequestContext());
}
One thing to remember is to invoke handleWebAction on the appropriate
container view, which may not necessarilly be "this", but may be a
child TiledView of the ViewBean. This is because for a list of
records in the tiled view, to do First - Next - Prev - Last, you have
the buttons in the ViewBean, and the model binding and
getWebActionModels in the TiledView. So your handle web action method
might look like this:
CustomerList custListTV =
(CustomerList)getChild("CustomerListTiledView");
custListTV.handleWebAction(WebActionHandler.ACTION_NEXT);
The retrieve action is a bit more automated in that when a ViewBean
(or TiledView) is displayed, all of its retrieve models are executed.
This is done in the "super" call of beginDisplay of the
ViewBean/TiledView. In other words, when you implement beginDisplay
for a ViewBean/TiledView, you are overriding some built-in behavior.
If you don't call super.beginDisplay(event), you disable this
behavior. The built-in behavior is to check if autoExecuteRetrieve
models is turned on. If it is, get the retrieve models from
getWebActionModels and execute them. Likely, one or more of those
models is bound to your display fields, and the data is displayed for
you.
Remember that each operation in the getWebActionModels can have
multiple models, even if those models are not actually bound to the
display fields. And you can have different models for different
operations, however currently, it is not so easy to bind fields to
different models for different operations. This will be easier in the
coming release of JATO.
So the bottom line is, you never call getWebActions. You are merely
telling the framework which models you want auto-executed under
certain circumstances. Just like you never call createChild. You are
just telling the framework what children live in the container and
the framework will call it when it needs a child.
Does this make sens? Once the JATO tools are completed, this sort of
thing will be less manual. Please ask if any of these points need to
be clarified.
This has the makings of a JATO Tip ;)
craig
In <a href="/group/SunONE-JATO/post?protectID=246075234167171124217231170221059165026 048139046">SunONE-JATO@y...</a>, "chubbykidd" <<a href="/group/SunONE-JATO/post?protectID=014166219007078048234218065036129208"&g t;bacon33@o...</a>> wrote:
> I'm having a difficult time understanding what the following method
> does besides return a list of Models....
>
> I've seen this method is both ViewBeans and TiledViews...
> public Model[] getWebActionModels(int executionType)
>
> Some questions I have:
>
> 1.) Since this method is called by JATO internally from a request,
how
> do you change the executionType so that the other cases are
triggered.
> The only case that seems to be triggered is the MODEL_TYPE_RETRIEVE
> executionType.
>
> 2.) Now, what happens when this method is finished executing and an
> array of Models are returned? What do these models do from here? Are
> they executed? What should a developer do with this models, if
> anything.
>
> Thanks
>
> - Billy -
Guest at 2007-7-1 16:33:15 >

Makes sense... so in regards to my last question, should I put all the
methods I want auto-executed in my Model constructor :-/
In <a href="/group/SunONE-JATO/post?protectID=246075234167171124217231170221059165026 048139046">SunONE-JATO@y...</a>, "chubbykidd" <<a href="/group/SunONE-JATO/post?protectID=014166219007078048234218065036129208"&g t;bacon33@o...</a>> wrote:
> I think that makes sense but I have a few more questions on this
> subject...
>
> 1.) What will this method call actually do?
> handleWebAction(WebActionHandler.ACTION_UPDATE);
>
> Will it execute the Model that I've associated to the
> MODEL_TYPE_UPDATE case?
>
> 2.) The paragraph where you describe invoking the handleWebAction()
> method in the correct container view was a little confusing. How do
I
> determine where the handleWebAction() method should be invoked?
>
>
> One other question and hopefully this isn't a stupid one... is there
a
> specific method that gets executed within my Model that I want
> auto-executed from the getWebActionModels() method, or should I put
> any methods I want executed in the Models constructor?
>
> - Billy -
>
>
> In <a href="/group/SunONE-JATO/post?protectID=246075234167171124217231170221059165026 048139046">SunONE-JATO@y...</a>, "cvconover" <<a href="/group/SunONE-JATO/post?protectID=219212113009229091025149066024064239039 098031046209130">craig.conover@s...</a>> wrote:
> > Billy,
> > Instead of answering your questions directly, I'll just give a
mini-
> > lesson on web actions.
> >
> > The getWebActionModels is only for the framework to call. It is
> used
> > to automate the execution of models for different operations
> > (retrieve, insert, update, delete).
> >
> > Typically, you will create buttons (Insert, Update, Delete, etc)
> that
> > invoke the "handle web action" methods:
> > handleWebAction(int handlerType)
> > where handlerType is a class constant from WebActionHandler class:
> > ACTION_UPDATE, ACTION_INSERT, ACTION_DELETE, ACTION_SELECT,
> > ACTION_FIRST, ACTION_NEXT, etc.
> >
> > So in your update button handler, you would do this:
> >
> > public void handleUpdateRequest(RequestInvocation event)
> > {
> > handleWebAction(WebActionHandler.ACTION_UPDATE);
> > <targeVB>.forwardTo(event.getRequestContext());
> > }
> >
> > One thing to remember is to invoke handleWebAction on the
> appropriate
> > container view, which may not necessarilly be "this", but may be a
> > child TiledView of the ViewBean. This is because for a list of
> > records in the tiled view, to do First - Next - Prev - Last, you
> have
> > the buttons in the ViewBean, and the model binding and
> > getWebActionModels in the TiledView. So your handle web action
> method
> > might look like this:
> >
> > CustomerList custListTV =
> > (CustomerList)getChild("CustomerListTiledView");
> > custListTV.handleWebAction(WebActionHandler.ACTION_NEXT);
> >
> >
> > The retrieve action is a bit more automated in that when a
ViewBean
> > (or TiledView) is displayed, all of its retrieve models are
> executed.
> > This is done in the "super" call of beginDisplay of the
> > ViewBean/TiledView. In other words, when you implement
beginDisplay
> > for a ViewBean/TiledView, you are overriding some built-in
> behavior.
> > If you don't call super.beginDisplay(event), you disable this
> > behavior. The built-in behavior is to check if autoExecuteRetrieve
> > models is turned on. If it is, get the retrieve models from
> > getWebActionModels and execute them. Likely, one or more of those
> > models is bound to your display fields, and the data is displayed
> for
> > you.
> >
> > Remember that each operation in the getWebActionModels can have
> > multiple models, even if those models are not actually bound to
the
> > display fields. And you can have different models for different
> > operations, however currently, it is not so easy to bind fields to
> > different models for different operations. This will be easier in
> the
> > coming release of JATO.
> >
> > So the bottom line is, you never call getWebActions. You are
merely
> > telling the framework which models you want auto-executed under
> > certain circumstances. Just like you never call createChild. You
> are
> > just telling the framework what children live in the container and
> > the framework will call it when it needs a child.
> >
> > Does this make sens? Once the JATO tools are completed, this sort
> of
> > thing will be less manual. Please ask if any of these points need
> to
> > be clarified.
> >
> > This has the makings of a JATO Tip ;)
> >
> > craig
> >
> >
> >
> >
> > In <a href="/group/SunONE-JATO/post?protectID=246075234167171124217231170221059165026 048139046">SunONE-JATO@y...</a>, "chubbykidd" <<a href="/group/SunONE-JATO/post?protectID=014166219007078048234218065036129208"&g t;bacon33@o...</a>> wrote:
> > > I'm having a difficult time understanding what the following
> method
> > > does besides return a list of Models....
> > >
> > > I've seen this method is both ViewBeans and TiledViews...
> > > public Model[] getWebActionModels(int executionType)
> > >
> > > Some questions I have:
> > >
> > > 1.) Since this method is called by JATO internally from a
> request,
> > how
> > > do you change the executionType so that the other cases are
> > triggered.
> > > The only case that seems to be triggered is the
> MODEL_TYPE_RETRIEVE
> > > executionType.
> > >
> > > 2.) Now, what happens when this method is finished executing and
> an
> > > array of Models are returned? What do these models do from here?
> Are
> > > they executed? What should a developer do with this models, if
> > > anything.
> > >
> > > Thanks
> > >
> > > - Billy -
Guest at 2007-7-1 16:33:15 >
