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 | 0 | public FroogleSearchCriteria(JammyjoesDatabase db) { |
13 | 0 | this.db = db; |
14 | 0 | db = this.db; |
15 | 0 | } |
16 | |
|
17 | |
public void constrainOutOfStock(List constraints) { |
18 | 0 | constraints.add(q("stocklevel") + " > 0"); |
19 | 0 | } |
20 | |
|
21 | |
public String q(String name) { |
22 | 0 | StringBuffer b = new StringBuffer(); |
23 | 0 | StringUtils.appendQuoted(b, name, '"'); |
24 | 0 | return b.toString(); |
25 | |
} |
26 | |
|
27 | |
public void constrain(List constraints) { |
28 | 0 | constrainOutOfStock(constraints); |
29 | 0 | } |
30 | |
|
31 | |
public String order() { |
32 | 0 | return null; |
33 | |
} |
34 | |
|
35 | |
} |