1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.student.common.ui.client.application; |
17 | |
|
18 | |
import java.util.HashMap; |
19 | |
import java.util.Map; |
20 | |
|
21 | |
import org.kuali.student.common.ui.shared.IdAttributes.IdType; |
22 | |
import org.kuali.student.core.rice.authorization.PermissionType; |
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | 0 | public class ViewContext implements Comparable<ViewContext>{ |
32 | |
|
33 | |
public static final String ID_ATR = "docId"; |
34 | |
public static final String ID_TYPE_ATR = "idType"; |
35 | |
|
36 | |
|
37 | 0 | private Map<String, String> attributes = new HashMap<String, String>(); |
38 | 0 | private String id = ""; |
39 | 0 | private IdType idType = null; |
40 | |
|
41 | 0 | private String state = "draft"; |
42 | |
private PermissionType permissionType; |
43 | |
|
44 | |
public String getId() { |
45 | 0 | return id; |
46 | |
} |
47 | |
|
48 | |
public void setId(String id) { |
49 | 0 | this.id = id; |
50 | 0 | } |
51 | |
|
52 | |
public IdType getIdType() { |
53 | 0 | return idType; |
54 | |
} |
55 | |
|
56 | |
public void setIdType(IdType idType) { |
57 | 0 | this.idType = idType; |
58 | 0 | } |
59 | |
|
60 | |
public void setIdType(String idTypeString){ |
61 | 0 | this.idType = IdType.fromString(idTypeString); |
62 | 0 | } |
63 | |
|
64 | |
public String getState() { |
65 | 0 | return state; |
66 | |
} |
67 | |
|
68 | |
public void setState(String state) { |
69 | 0 | this.state = state; |
70 | 0 | } |
71 | |
|
72 | |
public PermissionType getPermissionType() { |
73 | 0 | return permissionType; |
74 | |
} |
75 | |
|
76 | |
public void setPermissionType(PermissionType permissionType) { |
77 | 0 | this.permissionType = permissionType; |
78 | 0 | } |
79 | |
|
80 | |
@Override |
81 | |
public int compareTo(ViewContext o) { |
82 | 0 | if(o.getId().equals(id) && o.getIdType() == idType && o.getAttributes().equals(attributes)){ |
83 | 0 | return 0; |
84 | |
} |
85 | |
else{ |
86 | 0 | return -1; |
87 | |
} |
88 | |
} |
89 | |
|
90 | |
public void setAttribute(String key, String value) { |
91 | 0 | attributes.put(key, value); |
92 | 0 | } |
93 | |
|
94 | |
public String getAttribute(String key){ |
95 | 0 | return attributes.get(key); |
96 | |
} |
97 | |
|
98 | |
public Map<String, String> getAttributes(){ |
99 | 0 | return attributes; |
100 | |
} |
101 | |
|
102 | |
} |