4 Replies Latest reply on Jun 9, 2009 2:24 PM by earnest.dyke

    Unexplained behaviour - @Factory executed before @Create

    earnest.dyke

      Greetings all,


      I have a POJO action like below and the @Factory method fortimeSheetModifiable is executed before the init method. Can someone explain why?


      Thanks in advance for any and all help.


      P.S. This is NOT the complete code just the pertinent fragments. E!




      @Name("timeEntry")
      @Scope(ScopeType.CONVERSATION)
      public class TimeEntryAction {
              @In(required = false)
              @Out(scope = ScopeType.SESSION)
              private Calendar currentWorkDate;
              private Calendar currentDate;
              @In(required = false, create = true)
              @Out(required = false)
              private Boolean timeSheetModifiable = false;
      
              @Create
              public void init() {
                      if (currentDate == null) {
                              currentDate = Calendar.getInstance();
                              currentDate.setLenient(false);
                              currentDate.set(Calendar.AM_PM, Calendar.AM);
                              currentDate.set(Calendar.HOUR, 0);
                              currentDate.set(Calendar.MINUTE, 0);
                              currentDate.set(Calendar.SECOND, 0);
                              currentDate.set(Calendar.MILLISECOND, 0);
                      }
                      if (currentWorkDate == null) {
                              currentWorkDate = new GregorianCalendar();
                              currentDate.setLenient(false);
                              currentDate.set(Calendar.AM_PM, Calendar.AM);
                              currentWorkDate.setTimeInMillis(currentDate.getTimeInMillis());
                      }
                      if (timeEntryinitialized == null || !timeEntryinitialized) {
                              loadTimeSheetData();
                      }
              }
              @Factory("timeSheetModifiable")
              public void getTimeSheetCanBeModified() {
              }
      }