If anybody is willing to help me, I have opened Stackoverflow Q. 

http://stackoverflow.com/questions/26184814/filtering-over-pulled-list-from-a-database-in-tapestry

I was thinking to make two lists, one that will take all from db and act like 
already setup arraylist and the other that will act as a filter for that one, 
but I am not quite sure. So any help is appreciated.
Thanks in advance.

> From: wintertime0...@outlook.com
> To: users@tapestry.apache.org
> Subject: Stitch observe component applied over DB entities
> Date: Thu, 2 Oct 2014 12:55:41 +0100
> 
> /*
>  * To change this template, choose Tools | Templates
>  * and open the template in the editor.
>  */
> package rs.domaci.components;
> 
> import org.apache.tapestry5.PersistenceConstants;
> import org.apache.tapestry5.annotations.Persist;
> import org.apache.tapestry5.hibernate.annotations.CommitAfter;
> import org.apache.tapestry5.ioc.annotations.Inject;
> import com.entities.Ticket;
> import com.services.logic.BizLogic;
> 
> import java.util.ArrayList;
> import java.util.Date;
> import java.util.List;
> 
> import org.apache.tapestry5.Block;
> import org.apache.tapestry5.annotations.InjectComponent;
> import org.apache.tapestry5.annotations.Property;
> import org.apache.tapestry5.corelib.components.Zone;
> import rs.domaci.entities.TypeOfTicket;
> 
> /**
>  *
>  * @author 
>  */
> public class ListTickets{
> 
>     @Inject
>     private BizLogic businessLogic;
>     @Property
>     @Persist(PersistenceConstants.FLASH)
>     private Ticket ticket;
>     @Property
>     @Persist(PersistenceConstants.FLASH)
>     private List<Ticket> ticketss;
>     @InjectComponent
>     private Zone zonee;
> 
>     void setupRender() {
>         ticketss= getTickets();
>     }
> 
>     /**
>      * This event is fired by the observe mixin
>      */
>     @CommitAfter
>     @SuppressWarnings("unchecked")
>     Block onFilter(String datumZaPromjenu, String tipDrawTiketa) {
>         //Date parsedDatum = parseDate(datumZaPromjenu);
>         List<Tiket> filtered = new ArrayList<Tiket>();
>         for (Tiket tiketaa : tiketi) {
>             //boolean include = datumZaPromjenu == null || 
> phone.name.toLowerCase().contains(name.toLowerCase());
>             boolean include = datumZaPromjenu == null || 
> datumZaPromjenu.equals(tiketaa.getTicketDate());
>             include &= tipDrawTiketa == null || 
> tipDrawTiketa.equals(tiketaa.getTicketDrawTicket());
>             if (include) {
>                 filtered.add(tiketaa);
>             }
>         }
>         tiketi = filtered;
>         return zonaZaTikete.getBody();
>     }
> 
>     Date parseDate(String s) {
>         try {
>             return s == null ? null : new Date(s);
>         } catch (NumberFormatException e) {
>             // ignore invalid decimals
>             return null;
>         }
>     }
> 
> 
>     @CommitAfter
>     @SuppressWarnings("unchecked")
>     public List<Ticket> getTickets() {
>         return businessLogic.listAllTickets();
>     }
> }
> 
> 
> 
> I am trying to run Stitch observe demo, however unsuccesfully.  The thing is 
> that I would like to filter my list that is pulled from db by date and type 
> of ticket params. How can I do so?
>                                         
                                          

Reply via email to