[SunONE-JATO] Multiple Tiles using same Model
John,
Is status just another piece of criteria that should be in the where
clause? If so, just reexecute the same model instance with each tiled view.
If for some reason you need all 4 result sets at the same time (can't
imagine that you do, but i don't know the need), then each tiled view
can have a unique instance of the same model class.
When each tiled view "gets" its model, use the getModel method that has
an instance name parameter.
getModelManager().getModel(RecordsModel.class, "open")
getModelManager().getModel(RecordsModel.class, "pending")
getModelManager().getModel(RecordsModel.class, "review")
getModelManager().getModel(RecordsModel.class, "closed")
During this request, there would be four unique instances of the same
model class instead of just one. But the reason i said before that you
probably only need one instance is that each tiled view will display
syncronously, so once the "open records" tiled view is done displaying,
the records in the model are no longer needed (my assumption).
Then before the "pending records" tiled view displays, you clear the
criteria on the model, set the criteria to get "pending" records, then
execute the model, and bingo, you now have pending records in that model
instance, and the pending tiled view displays those records.
Continue this for the next 2 tiled views.
Does this make sense?
Is there a requirement to have all four result sets at the same time? If
so, why?
If the "status" is not a condition in the database, then how did this
work in ND?
c
jhoskins wrote:
>I have a page with 4 tiles on it.
>Each of the tiles corresponds with a different status of the same
>record set, Tile1 is open records, Tile2 is pending records, Tile3 is
>review records, and Tile4 is closed records.
>I would like to use the same model for each tile, as they are exactly
>the same, except for the status. After some digging around, I added a
>__status__ to the SELECT_SQL_TEMPLATE string. Then in the tiledviews
>begindisplay, I use the stringtokenizer2 and the get/setSelectSQL to
>replace the __status__ with what I want it to be. This works fine for
>the first tiled view, but not the subsequent tiled views. The
>SELECT_SQL_TEMPLATE doesn't appear to be getting reset. I do a
>clearUserWhereCriteria, but this obviously isn't the right thing to
>do.
>
>Any thoughts on how I can get this reset for each tiled call? Am I
>approaching this correctly?
>
>John Hoskins
>
>
>
>To download the latest version of JATO, please visit:
><a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>
>
>For more information about JATO, please visit:
><a href="http://developer.iplanet.com/tech/appserver/framework/index.jsp">http: //developer.iplanet.com/tech/appserver/framework/index.jsp</a>
>
>
>
>
[3336 byte] By [
Guest] at [2007-11-25 9:29:55]

Craig,
Thanks for the feedback. The scenario you describe is what I am
looking for. The status for the records is part of the db record
(opens are 0,1,6, closeds are 2,3...), and each tiled view can be
fetched synchronously.
I am trying to execute the same model 4 different times, once in each
tiledView. The problem is getting the where clause to revert back to
it's original state. Because the status is governed by a set of
values in a field, I went with the idea I stated below and set the
SELECT_SQL_TEMPLATE
to
"...FROM ARADMIN.ENTERPRISE_SOLUTIONS_REQUEST, ARADMIN.CLIENT
__WHERE__ AND (ARADMIN.ENTERPRISE_SOLUTIONS_REQUEST.STATUS __STATUS__)";
Then in my code in each tiled view, I use the stringTokenizer2. For
example in the OPEN tiled view I do this:
qmb.setSelectSQL(StringTokenizer2.replace(qmb.getSelectSQL(),"__STATUS__","in
(0,1,6)"));
But when the next tiled view comes along, the __STATUS__ is still set
to "in (0,1,6)". I do a clearUserWhereCriteria(), but that doesn't
seem to be the right thing to do.
John Hoskins
In <a href="/group/SunONE-JATO/post?protectID=246075234167171124217231170221059165026 048139046">SunONE-JATO@y...</a>, "Craig V. Conover" <<a href="/group/SunONE-JATO/post?protectID=219212113009229091025149066024064239039 098031046209130">craig.conover@s...</a>> wrote:
> John,
> Is status just another piece of criteria that should be in the where
> clause? If so, just reexecute the same model instance with each
tiled view.
>
> If for some reason you need all 4 result sets at the same time (can't
> imagine that you do, but i don't know the need), then each tiled view
> can have a unique instance of the same model class.
>
> When each tiled view "gets" its model, use the getModel method that has
> an instance name parameter.
> getModelManager().getModel(RecordsModel.class, "open")
> getModelManager().getModel(RecordsModel.class, "pending")
> getModelManager().getModel(RecordsModel.class, "review")
> getModelManager().getModel(RecordsModel.class, "closed")
>
> During this request, there would be four unique instances of the same
> model class instead of just one. But the reason i said before that you
> probably only need one instance is that each tiled view will display
> syncronously, so once the "open records" tiled view is done displaying,
> the records in the model are no longer needed (my assumption).
>
> Then before the "pending records" tiled view displays, you clear the
> criteria on the model, set the criteria to get "pending" records, then
> execute the model, and bingo, you now have pending records in that
model
> instance, and the pending tiled view displays those records.
>
> Continue this for the next 2 tiled views.
>
> Does this make sense?
> Is there a requirement to have all four result sets at the same
time? If
> so, why?
>
> If the "status" is not a condition in the database, then how did this
> work in ND?
>
> c
>
>
> jhoskins wrote:
>
> >I have a page with 4 tiles on it.
> >Each of the tiles corresponds with a different status of the same
> >record set, Tile1 is open records, Tile2 is pending records, Tile3 is
> >review records, and Tile4 is closed records.
> >I would like to use the same model for each tile, as they are exactly
> >the same, except for the status. After some digging around, I added a
> >__status__ to the SELECT_SQL_TEMPLATE string. Then in the tiledviews
> >begindisplay, I use the stringtokenizer2 and the get/setSelectSQL to
> >replace the __status__ with what I want it to be. This works fine for
> >the first tiled view, but not the subsequent tiled views. The
> >SELECT_SQL_TEMPLATE doesn't appear to be getting reset. I do a
> >clearUserWhereCriteria, but this obviously isn't the right thing to
> >do.
> >
> >Any thoughts on how I can get this reset for each tiled call? Am I
> >approaching this correctly?
> >
> >John Hoskins
> >
> >
> >
> >To download the latest version of JATO, please visit:
> ><a href="http://www.sun.com/software/download/developer/5102.html">http://www.s un.com/software/download/developer/5102.html</a>
> >
> >For more information about JATO, please visit:
> ><a href="http://developer.iplanet.com/tech/appserver/framework/index.jsp">http: //developer.iplanet.com/tech/appserver/framework/index.jsp</a>
> >
> >
> >
> >
Guest at 2007-7-1 16:36:16 >
