1 | |
package org.paneris.jammyjoes.model; |
2 | |
|
3 | |
import java.sql.ResultSet; |
4 | |
|
5 | |
import org.melati.poem.Database; |
6 | |
import org.melati.poem.DefinitionSource; |
7 | |
import org.melati.poem.PoemException; |
8 | |
import org.paneris.jammyjoes.model.generated.ProductStatusTableBase; |
9 | |
|
10 | |
public class ProductStatusTable extends ProductStatusTableBase { |
11 | |
|
12 | |
private ProductStatus discontinued, normallystocked, notstocked, newItem; |
13 | |
|
14 | |
public ProductStatusTable( |
15 | |
Database database, String name, |
16 | |
DefinitionSource definitionSource) throws PoemException { |
17 | 0 | super(database, name, definitionSource); |
18 | 0 | } |
19 | |
|
20 | |
public synchronized void unifyWithDB(ResultSet colDescs) |
21 | |
throws PoemException { |
22 | 0 | super.unifyWithDB(colDescs); |
23 | 0 | normallystocked = ensure("Normally Stocked"); |
24 | 0 | notstocked = ensure("Do Not Reorder"); |
25 | 0 | discontinued = ensure("Discontinued"); |
26 | 0 | newItem = ensure("New"); |
27 | 0 | } |
28 | |
|
29 | |
public ProductStatus ensure(String status) { |
30 | 0 | ProductStatus p = (ProductStatus)newPersistent(); |
31 | 0 | p.setStatus(status); |
32 | 0 | return (ProductStatus)getStatusColumn().ensure(p); |
33 | |
} |
34 | |
|
35 | |
public ProductStatus getNormallyStocked() { |
36 | 0 | return normallystocked; |
37 | |
} |
38 | |
|
39 | |
public ProductStatus getNotStocked() { |
40 | 0 | return notstocked; |
41 | |
} |
42 | |
|
43 | |
public ProductStatus getDiscontinued() { |
44 | 0 | return discontinued; |
45 | |
} |
46 | |
|
47 | |
public ProductStatus getNew() { |
48 | 0 | return newItem; |
49 | |
} |
50 | |
} |