1 | |
package org.paneris.jammyjoes.model; |
2 | |
|
3 | |
import org.melati.poem.Database; |
4 | |
import org.melati.poem.DefinitionSource; |
5 | |
import org.melati.poem.PoemException; |
6 | |
import org.melati.poem.SQLPoemException; |
7 | |
import org.melati.poem.util.PagedEnumeration; |
8 | |
import org.paneris.jammyjoes.model.generated.ProductTableBase; |
9 | |
|
10 | |
public class ProductTable extends ProductTableBase { |
11 | |
|
12 | |
public ProductTable(Database database, String name, DefinitionSource definitionSource) |
13 | |
throws PoemException { |
14 | 0 | super(database, name, definitionSource); |
15 | 0 | } |
16 | |
|
17 | |
public PagedEnumeration selection( |
18 | |
String whereClause, |
19 | |
String orderByClause, |
20 | |
boolean includeDeleted, |
21 | |
int pageStart, |
22 | |
int pageSize) |
23 | |
throws SQLPoemException { |
24 | 0 | if (whereClause == null) |
25 | 0 | whereClause = ""; |
26 | 0 | if (whereClause.indexOf("\"status\"") < 0 && whereClause.indexOf("\"id\"") < 0) { |
27 | 0 | if (!whereClause.equals("")) |
28 | 0 | whereClause += " AND "; |
29 | 0 | whereClause += "((\"status\" != " |
30 | |
+ getJammyjoesDatabaseTables().getProductStatusTable().getDiscontinued().getTroid(); |
31 | 0 | whereClause += " AND "; |
32 | 0 | whereClause += "\"status\" != " |
33 | |
+ getJammyjoesDatabaseTables().getProductStatusTable().getNotStocked().getTroid(); |
34 | 0 | whereClause += ") OR \"stocklevel\" > 0)"; |
35 | |
} |
36 | 0 | return super.selection(whereClause, orderByClause, includeDeleted, pageStart, pageSize); |
37 | |
} |
38 | |
|
39 | |
public PagedEnumeration unFiltetredSelection(String whereClause, String orderByClause, boolean includeDeleted, int pageStart, int pageSize) { |
40 | 0 | return super.selection(whereClause, orderByClause, includeDeleted, pageStart, pageSize); |
41 | |
} |
42 | |
|
43 | |
} |