Hello Thiago. The thing is that this Stitch Observe component is not working for me at all. It only loads everything from db and it's fine, but when I try to apply some filtering, it does nothing. :/
> To: users@tapestry.apache.org > Subject: Re: Stitch observe component applied over DB entities > Date: Fri, 3 Oct 2014 15:59:28 -0300 > From: thiag...@gmail.com > > Your post was too vague for us to even know what's the problem. Just > saying "unsuccessfully" doesn't explain what's the desired outcome and how > the current one differs from it. > > On Fri, 03 Oct 2014 15:42:11 -0300, Name Surname > <wintertime0...@outlook.com> wrote: > > > 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? > >> > > > > > -- > Thiago H. de Paula Figueiredo > Tapestry, Java and Hibernate consultant and developer > http://machina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org >