View Javadoc
1   /**
2    * Copyright (c) 2009-2010 by Glodon
3    * All rights reserved.
4    */
5   package gboat2.web.model;
6   
7   import java.util.LinkedList;
8   import java.util.List;
9   
10  import javax.persistence.Column;
11  import javax.persistence.Entity;
12  import javax.persistence.GeneratedValue;
13  import javax.persistence.Id;
14  import javax.persistence.Table;
15  import javax.persistence.Transient;
16  
17  import org.hibernate.annotations.GenericGenerator;
18  
19  /**
20   * @author lysming
21   *
22   */
23  @Entity
24  @Table(name = "G2_T_RESOURCE")
25  public class Resource {
26  
27  	private String resId;
28  
29  	//模块名称,配置模块时自定义的,默认与节点名称相同
30  	private String resName;
31  
32  	//注解定义的节点名称,即Module注解的name属性
33  	private String moduleName;
34  
35  	//模块编码
36  	private String resCode;
37  
38  	//url路径
39  	private String resUrl;
40  	
41  	//是否是主菜单(主菜单在左侧显示,非主菜单在右侧显示)
42  	private Boolean mainMenu;
43  
44  	//父模块编号
45  	private String parentId = "0";
46  
47  	//显示顺序
48  	private double dispOrder = 1F;
49  
50  	//单例模块,传统桌面样式下,只有单模块权限不显示导航栏 [0:非单例,1:单例]
51  	private String singleton = "0";
52  
53  	//bundle的symbleName
54  	private String bundle;
55  
56  	//action类名
57  	private String actionClass;
58  
59  	//模块状态,"0":不可用,"1":可用
60  	private String status;
61  
62  	//标识节点的类型,0:普通实节点,1:虚节点,2:外部链接,可能用iframe技术打开
63  	private String type = "0";
64  
65  	//系统id
66  	private String systemId;
67  
68  	//所有孩子节点,无需持久化
69  	private List<Resource> children;
70  
71  	//标记是否为叶子节点,辅助ExtJs4中树的生成, 无需持久化
72  	private boolean leaf = true; //add by tanxw
73  
74  	//是否禁用,默认不禁用,无需持久化 add by yangjf
75  	private boolean disabled = false;
76  
77  	@Transient
78  	public boolean getLeaf() {
79  		return leaf;
80  	}
81  
82  	public void setLeaf(boolean leaf) {
83  		this.leaf = leaf;
84  	}
85  
86  	@Id
87  	@GenericGenerator(name = "generator", strategy = "uuid.hex")
88  	@GeneratedValue(generator = "generator")
89  	@Column(name = "RES_ID", length = 40)
90  	public String getResId() {
91  		return resId;
92  	}
93  
94  	public void setResId(String resId) {
95  		this.resId = resId;
96  	}
97  
98  	@Column(name = "RES_NAME", length = 200)
99  	public String getResName() {
100 		return resName;
101 	}
102 
103 	public void setResName(String resName) {
104 		this.resName = resName;
105 	}
106 
107 	@Column(name = "MODULE_NAME", length = 200)
108 	public String getModuleName() {
109 		return moduleName;
110 	}
111 
112 	public void setModuleName(String moduleName) {
113 		this.moduleName = moduleName;
114 	}
115 
116 	@Column(name = "RES_CODE", length = 50)
117 	public String getResCode() {
118 		return resCode;
119 	}
120 
121 	public void setResCode(String resCode) {
122 		this.resCode = resCode;
123 	}
124 
125 	@Column(name = "RES_URL", length = 400)
126 	public String getResUrl() {
127 		return resUrl;
128 	}
129 
130 	public void setResUrl(String resUrl) {
131 		this.resUrl = resUrl;
132 	}
133 
134 	@Column(name = "PARENT_ID", length = 40)
135 	public String getParentId() {
136 		return parentId;
137 	}
138 
139 	public void setParentId(String parentId) {
140 		this.parentId = parentId;
141 	}
142 
143 	@Column(name = "DISP_ORDER")
144 	public double getDispOrder() {
145 		return dispOrder;
146 	}
147 
148 	public void setDispOrder(double dispOrder) {
149 		this.dispOrder = dispOrder;
150 	}
151 
152 	@Column(name = "SINGLETON", length = 1)
153 	public String getSingleton() {
154 		return singleton;
155 	}
156 
157 	public void setSingleton(String singleton) {
158 		this.singleton = singleton;
159 	}
160 
161 	@Column(name = "BUNDLE", length = 100)
162 	public String getBundle() {
163 		return bundle;
164 	}
165 
166 	public void setBundle(String bundle) {
167 		this.bundle = bundle;
168 	}
169 
170 	@Column(name = "ACTION_CLASS", length = 200)
171 	public String getActionClass() {
172 		return actionClass;
173 	}
174 
175 	public void setActionClass(String actionClass) {
176 		this.actionClass = actionClass;
177 	}
178 
179 	@Column(name = "STATUS", length = 1)
180 	public String getStatus() {
181 		return status;
182 	}
183 
184 	public void setStatus(String status) {
185 		this.status = status;
186 	}
187 
188 	@Transient
189 	public List<Resource> getChildren() {
190 		return children;
191 	}
192 
193 	public void setChildren(List<Resource> children) {
194 		this.children = children;
195 	}
196 
197 	public void addChild(Resource child) {
198 		if (this.children == null) {
199 			children = new LinkedList<Resource>();
200 		}
201 		children.add(child);
202 	}
203 
204 	@Column(name = "TYPE", length = 1)
205 	public String getType() {
206 		return type;
207 	}
208 
209 	public void setType(String type) {
210 		this.type = type;
211 	}
212 
213 	@Column(name = "SYSTEM_ID", length = 40)
214 	public String getSystemId() {
215 		return systemId;
216 	}
217 
218 	public void setSystemId(String systemId) {
219 		this.systemId = systemId;
220 	}
221 
222 	@Transient
223 	public boolean getDisabled() {
224 		return disabled;
225 	}
226 
227 	public void setDisabled(boolean disabled) {
228 		this.disabled = disabled;
229 	}
230 
231 	@Column(name = "MAIN_MENU", length = 10)
232 	public Boolean getMainMenu() {
233 		return mainMenu;
234 	}
235 
236 	public void setMainMenu(Boolean mainMenu) {
237 		this.mainMenu = mainMenu;
238 	}
239 	
240 	
241 	
242 }