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.rice.authorization.PermissionType;
22 import org.kuali.student.common.ui.shared.IdAttributes.IdType;
23
24
25
26
27
28
29
30
31 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 private Map<String, String> attributes = new HashMap<String, String>();
38 private String id = "";
39 private IdType idType = null;
40
41 private String state = "draft";
42 private PermissionType permissionType;
43
44 public String getId() {
45 return id;
46 }
47
48
49
50
51
52 public void setId(String id) {
53 this.id = id;
54 }
55
56 public IdType getIdType() {
57 return idType;
58 }
59
60
61
62
63
64 public void setIdType(IdType idType) {
65 this.idType = idType;
66 }
67
68 public void setIdType(String idTypeString){
69 this.idType = IdType.fromString(idTypeString);
70 }
71
72 public String getState() {
73 return state;
74 }
75
76 public void setState(String state) {
77 this.state = state;
78 }
79
80 public PermissionType getPermissionType() {
81 return permissionType;
82 }
83
84
85
86
87
88
89 public void setPermissionType(PermissionType permissionType) {
90 this.permissionType = permissionType;
91 }
92
93 @Override
94 public int compareTo(ViewContext o) {
95 if(o.getId().equals(id) && o.getIdType() == idType && o.getAttributes().equals(attributes)){
96 return 0;
97 }
98 else{
99 return -1;
100 }
101 }
102
103
104
105
106
107 public void setAttribute(String key, String value) {
108 attributes.put(key, value);
109 }
110
111 public String getAttribute(String key){
112 return attributes.get(key);
113 }
114
115 public Map<String, String> getAttributes(){
116 return attributes;
117 }
118
119 }