1 | |
package org.paneris.jammyjoes.controller; |
2 | |
|
3 | |
import org.melati.util.UTF8URLEncoder; |
4 | |
import org.paneris.jammyjoes.model.Age; |
5 | |
|
6 | |
public class SearchAge { |
7 | |
|
8 | |
private Age age; |
9 | |
private String name; |
10 | |
private Integer minAge; |
11 | |
private Integer maxAge; |
12 | 0 | private boolean isNull = true; |
13 | |
|
14 | 0 | public SearchAge(Age age) { |
15 | 0 | this.age = age; |
16 | 0 | this.name = null; |
17 | 0 | isNull = false; |
18 | 0 | } |
19 | |
|
20 | 0 | public SearchAge(Integer minAge, Integer maxAge) { |
21 | 0 | this.minAge = minAge; |
22 | 0 | this.maxAge = maxAge; |
23 | 0 | this.age = null; |
24 | 0 | this.name = null; |
25 | 0 | isNull = false; |
26 | 0 | } |
27 | |
|
28 | 0 | public SearchAge(String name) { |
29 | 0 | this.name = name; |
30 | 0 | this.age = null; |
31 | 0 | isNull = false; |
32 | 0 | } |
33 | |
|
34 | 0 | public SearchAge() { |
35 | 0 | } |
36 | |
|
37 | |
public String toString() { |
38 | 0 | if (age != null) return age.getName(); |
39 | 0 | if (name != null) return name; |
40 | 0 | if (minAge != null && maxAge != null) { |
41 | 0 | return minAge + "_" + maxAge; |
42 | |
} |
43 | 0 | return ""; |
44 | |
} |
45 | |
|
46 | |
public boolean isNull() { |
47 | 0 | return isNull; |
48 | |
} |
49 | |
|
50 | |
public String pathise() { |
51 | 0 | if (age == null) |
52 | 0 | return "/_"; |
53 | 0 | return "/" + UTF8URLEncoder.encode(age.getName()); |
54 | |
} |
55 | |
|
56 | |
} |