1 package org.paneris.jammyjoes.controller; 2 3 import java.util.List; 4 5 import org.melati.util.StringUtils; 6 import org.paneris.jammyjoes.model.JammyjoesDatabase; 7 8 public class FroogleSearchCriteria implements SearchCriteria { 9 10 private JammyjoesDatabase db; 11 12 public FroogleSearchCriteria(JammyjoesDatabase db) { 13 this.db = db; 14 db = this.db; 15 } 16 17 public void constrainOutOfStock(List constraints) { 18 constraints.add(q("stocklevel") + " > 0"); 19 } 20 21 public String q(String name) { 22 StringBuffer b = new StringBuffer(); 23 StringUtils.appendQuoted(b, name, '"'); 24 return b.toString(); 25 } 26 27 public void constrain(List constraints) { 28 constrainOutOfStock(constraints); 29 } 30 31 public String order() { 32 return null; 33 } 34 35 }