[jboss-user] [JBoss Seam] - Re: getter method called hundereds of times

terryb do-not-reply at jboss.com
Thu Oct 25 03:22:48 EDT 2007


For anyone interested, MyEntityList code:


  | 
  | package au.edu.tisc.entity;
  | 
  | import java.util.Arrays;
  | import java.util.Calendar;
  | import java.util.Date;
  | import java.util.List;
  | 
  | import org.jboss.seam.annotations.Name;
  | import org.jboss.seam.framework.EntityQuery;
  | 
  | import au.edu.tisc.util.DateTime;
  | import au.edu.tisc.util.Strings;
  | 
  | @Name("organisationUserActivityLogList")
  | public class OrganisationUserActivityLogList extends EntityQuery {
  | 
  |   private static final String[] RESTRICTIONS = {
  |       "lower(organisationUserActivityLog.id) like concat('%', lower(#{organisationUserActivityLogList.organisationUserActivityLog.id}),'%')",
  |       "lower(organisationUserActivityLog.ipaddress) like concat('%', lower(#{organisationUserActivityLogList.organisationUserActivityLog.ipaddress}),'%')",
  |       "lower(organisationUserActivityLog.action) like concat('%', lower(#{organisationUserActivityLogList.organisationUserActivityLog.action}),'%')",
  |       "lower(organisationUserActivityLog.description) like concat('%', lower(#{organisationUserActivityLogList.organisationUserActivityLog.description}),'%')",
  |       "lower(organisationUserActivityLog.organisationUser.id) like concat('%', '%',lower(#{organisationUserActivityLogList.selectedOrgUserId}),'%')",
  |       "organisationUserActivityLog.insertDate >= #{organisationUserActivityLogList.selectedInsertDateFrom}",
  |       "organisationUserActivityLog.insertDate <= #{organisationUserActivityLogList.selectedInsertDateTo}",      
  |   };
  | 
  |   private OrganisationUserActivityLog organisationUserActivityLog = new OrganisationUserActivityLog();
  | 
  |   private String selectedOrgUserId = null;
  |   private Date selectedInsertDateFrom = null;
  |   private Date selectedInsertDateTo = null;
  |   
  |   @Override
  |   public String getEjbql() {
  |     return "select organisationUserActivityLog from OrganisationUserActivityLog organisationUserActivityLog";
  |   }
  | 
  |   @Override
  |   public Integer getMaxResults() {
  |     return 25;
  |   }
  | 
  |   public OrganisationUserActivityLog getOrganisationUserActivityLog() {
  |     return organisationUserActivityLog;
  |   }
  |   
  |   @Override
  |   public List<String> getRestrictions() {
  |     return Arrays.asList(RESTRICTIONS);
  |   }
  | 
  |   public String getSelectedOrgUserId() {
  |        return this.selectedOrgUserId;
  |   }
  |    
  |   public void setSelectedOrgUserId(String selectedOrgUserId) {
  |      this.selectedOrgUserId = selectedOrgUserId;
  |   }
  |   
  |   public Date getSelectedInsertDateFrom() {
  |     
  |     if (this.selectedInsertDateFrom != null) {
  |       System.out.println("*** getSelectedInsertDateFrom() - property is null....");
  |     } else {
  |       System.out.println("*** getSelectedInsertDateFrom() - property is null....");
  |     }
  |     
  |     return this.selectedInsertDateFrom;
  |   }
  | 
  |   public void setSelectedInsertDateFrom(Date selectedInsertDateFrom) {
  |      this.selectedInsertDateFrom = selectedInsertDateFrom;
  |   }  
  |   
  |   public Date getSelectedInsertDateTo() {
  |     
  |     if (selectedInsertDateTo != null) {
  | 
  |       Calendar cal= Calendar.getInstance();
  |       cal.setTime(selectedInsertDateTo);
  |       
  |       if (!DateTime.hasTime(cal)) {
  |         DateTime.setDayEnd(cal);
  |       }
  |       return (cal.getTime());
  |     } else {
  |        return this.selectedInsertDateTo;
  |     }
  |   }
  |   
  |   public void setSelectedInsertDateTo(Date selectedInsertDateTo) {
  |      this.selectedInsertDateTo = selectedInsertDateTo;
  |   }  
  |   
  |   @Override
  |   public String getOrder() {
  |     String order = super.getOrder();
  |     if (Strings.isNull(order)) {
  |       order = "organisationUserActivityLog.insertDate desc, organisationUser.username asc, organisationUserActivityLog.action asc";
  |     }
  |     return order;
  |   }  
  | }
  | 
  | 
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4098680#4098680

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4098680



More information about the jboss-user mailing list