[jboss-user] [JBoss Seam] - Re: Seam Design Question
tony.herstell@gmail.com
do-not-reply at jboss.com
Thu Feb 7 07:30:20 EST 2008
Going back to 1/
I need to initialise the "allocations" and this is generally done by a @Factory.
This causes a stack Overflow...
| @SuppressWarnings("serial")
| @Scope(ScopeType.SESSION)
| @Name("allocations")
| public class Allocations implements Serializable {
|
| private List<Day> indoorArenaDays;
| private List<Day> dressageArenaDays;
| private List<Day> sjArenaDays;
|
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| @Factory(scope=ScopeType.SESSION, value="allocations")
| public void init() {
|
| List<DaySlot> indoorArenaDaySlots = new ArrayList<DaySlot>();
| DaySlot daySlot = new DaySlot();
| daySlot.setBooked(true);
| daySlot.setBooker("Billy");
| daySlot.setBookingId(1l);
| daySlot.setReason(BookingReasonsKind.ONE_HOUR_PRIVATE);
| daySlot.setTitle("This is a test");
| indoorArenaDaySlots.add(daySlot);
|
| Day day = new Day();
| day.setDate(new GregorianCalendar());
| day.setDaySlots(indoorArenaDaySlots);
| indoorArenaDays = new ArrayList<Day>();
| this.indoorArenaDays.add(day);
| }
|
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| public List<Day> getIndoorArenaDays() {
| //init();
| return indoorArenaDays;
| }
|
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| public void setIndoorArenaDays(List<Day> indoorArenaDays) {
| this.indoorArenaDays = indoorArenaDays;
| }
|
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| public List<Day> getDressageArenaDays() {
| return dressageArenaDays;
| }
|
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| public void setDressageArenaDays(List<Day> dressageArenaDays) {
| this.dressageArenaDays = dressageArenaDays;
| }
|
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| public List<Day> getSjArenaDays() {
| return sjArenaDays;
| }
|
| @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
| public void setSjArenaDays(List<Day> sjArenaDays) {
| this.sjArenaDays = sjArenaDays;
| }
|
| }
|
This little class started as a POJO (used by my ResourceAllocationController) as it really didn't need to be a Seam Object (or so I though).... Anyhow now its a fully grown up Seam object.
So... How do I get the Factory to work?
Do I need and Interface and make this a body (impl)?
This is the .xthml that calls it.... (and as such expects allocations to be set up - by the factory).
| <h:panelGrid class="left" id="day_slots_choices" width="20%">
| <rich:dataTable var="eachDayForIndoorArena" value="#{allocations.indoorArenaDays}"
| rendered="#{not empty allocations.indoorArenaDays}">
| <rich:column width="10%">
| <f:facet name="header">
| <h:outputText id="resource_date"
| value="#{messages.allocation_day}" />
| </f:facet>
| <div class="centre">
| <h:outputText value="#{eachDayForIndoorArena.date}">
| <s:convertDateTime type="date" dateStyle="full"/>
| </h:outputText>
| </div>
| </rich:column>
| </rich:dataTable>
| </h:panelGrid>
|
If I hack the getXXX then the init will be called, but then it gets called every time.
CONFUSED....
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4127342#4127342
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4127342
More information about the jboss-user
mailing list