1 |
5091
|
daigle
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Purpose: A Class that represents an XML Text node and its contents,
|
4 |
|
|
* and can build itself from a database connection
|
5 |
|
|
* Copyright: 2000 Regents of the University of California and the
|
6 |
|
|
* National Center for Ecological Analysis and Synthesis
|
7 |
|
|
* Authors: Matt Jones
|
8 |
|
|
*
|
9 |
|
|
* '$Author: daigle $'
|
10 |
|
|
* '$Date: 2008-10-21 15:20:52 -0700 (Tue, 21 Oct 2008) $'
|
11 |
|
|
* '$Revision: 4468 $'
|
12 |
|
|
*
|
13 |
|
|
* This program is free software; you can redistribute it and/or modify
|
14 |
|
|
* it under the terms of the GNU General Public License as published by
|
15 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
16 |
|
|
* (at your option) any later version.
|
17 |
|
|
*
|
18 |
|
|
* This program is distributed in the hope that it will be useful,
|
19 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
20 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
21 |
|
|
* GNU General Public License for more details.
|
22 |
|
|
*
|
23 |
|
|
* You should have received a copy of the GNU General Public License
|
24 |
|
|
* along with this program; if not, write to the Free Software
|
25 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
26 |
|
|
*/
|
27 |
|
|
|
28 |
|
|
package edu.ucsb.nceas.metacat.accesscontrol;
|
29 |
|
|
|
30 |
|
|
import java.sql.Date;
|
31 |
|
|
|
32 |
|
|
import org.apache.log4j.Logger;
|
33 |
|
|
|
34 |
|
|
import edu.ucsb.nceas.metacat.shared.BaseDAO;
|
35 |
|
|
|
36 |
|
|
/**
|
37 |
|
|
* A Class that represents an XML access rule. It include principal and
|
38 |
|
|
* permission
|
39 |
|
|
*/
|
40 |
|
|
public class XMLAccessDAO extends BaseDAO {
|
41 |
|
|
|
42 |
|
|
private String _docId = null;
|
43 |
|
|
private String _accessFileId = null;
|
44 |
|
|
private String _principalName = null;
|
45 |
|
|
private Long _permission = null;
|
46 |
|
|
private String _permType = null;
|
47 |
|
|
private String _permOrder = null;
|
48 |
|
|
private Date _beginTime = null;
|
49 |
|
|
private Date _endTime = null;
|
50 |
|
|
private Long _ticketCount = null;
|
51 |
|
|
private String _subTreeId = null;
|
52 |
|
|
private String _startNodeId = null;
|
53 |
|
|
private String _endNodeId = null;
|
54 |
|
|
|
55 |
|
|
public String getDocId() {
|
56 |
|
|
return _docId;
|
57 |
|
|
}
|
58 |
|
|
|
59 |
|
|
public void setDocId(String docId) {
|
60 |
5098
|
daigle
|
if (docId != null && docId.equals("")) {
|
61 |
|
|
docId = null;
|
62 |
|
|
} else {
|
63 |
|
|
_docId = docId;
|
64 |
|
|
}
|
65 |
5091
|
daigle
|
}
|
66 |
|
|
|
67 |
|
|
public String getAccessFileId() {
|
68 |
|
|
return _accessFileId;
|
69 |
|
|
}
|
70 |
|
|
|
71 |
|
|
public void setAccessFileId(String accessFileId) {
|
72 |
5098
|
daigle
|
if(accessFileId != null && accessFileId.equals("")) {
|
73 |
|
|
_accessFileId = null;
|
74 |
|
|
} else {
|
75 |
|
|
_accessFileId = accessFileId;
|
76 |
|
|
}
|
77 |
5091
|
daigle
|
}
|
78 |
|
|
|
79 |
|
|
public String getPrincipalName() {
|
80 |
|
|
return _principalName;
|
81 |
|
|
}
|
82 |
|
|
|
83 |
|
|
public void setPrincipalName(String principalName) {
|
84 |
5098
|
daigle
|
if (principalName != null && principalName.equals("")) {
|
85 |
|
|
_principalName = null;
|
86 |
|
|
} else {
|
87 |
|
|
_principalName = principalName;
|
88 |
|
|
}
|
89 |
5091
|
daigle
|
}
|
90 |
|
|
|
91 |
|
|
public Long getPermission() {
|
92 |
|
|
return _permission;
|
93 |
|
|
}
|
94 |
|
|
|
95 |
|
|
public void setPermission(Long permission) {
|
96 |
5099
|
daigle
|
if (_permission == null) {
|
97 |
|
|
_permission = new Long(0);
|
98 |
|
|
}
|
99 |
5091
|
daigle
|
_permission = permission;
|
100 |
|
|
}
|
101 |
|
|
|
102 |
5099
|
daigle
|
public void addPermission(Long permission) {
|
103 |
|
|
if (_permission != null) {
|
104 |
5100
|
daigle
|
_permission |= permission;
|
105 |
5099
|
daigle
|
} else {
|
106 |
|
|
_permission = permission;
|
107 |
|
|
}
|
108 |
|
|
}
|
109 |
|
|
|
110 |
5091
|
daigle
|
public String getPermType() {
|
111 |
|
|
return _permType;
|
112 |
|
|
}
|
113 |
|
|
|
114 |
|
|
public void setPermType(String permType) {
|
115 |
5098
|
daigle
|
if (permType != null && permType.equals("")) {
|
116 |
|
|
_permType = null;
|
117 |
|
|
} else {
|
118 |
|
|
_permType = permType;
|
119 |
|
|
}
|
120 |
5091
|
daigle
|
}
|
121 |
|
|
|
122 |
|
|
public String getPermOrder() {
|
123 |
|
|
return _permOrder;
|
124 |
|
|
}
|
125 |
|
|
|
126 |
|
|
public void setPermOrder(String permOrder) {
|
127 |
5098
|
daigle
|
if (permOrder != null && permOrder.equals("")) {
|
128 |
|
|
_permOrder = null;
|
129 |
|
|
} else {
|
130 |
|
|
_permOrder = permOrder;
|
131 |
|
|
}
|
132 |
5091
|
daigle
|
}
|
133 |
|
|
|
134 |
|
|
public Date getBeginTime() {
|
135 |
|
|
return _beginTime;
|
136 |
|
|
}
|
137 |
|
|
|
138 |
|
|
public void setBeginTime(Date beginTime) {
|
139 |
|
|
_beginTime = beginTime;
|
140 |
|
|
}
|
141 |
|
|
|
142 |
|
|
public Date getEndTime() {
|
143 |
|
|
return _endTime;
|
144 |
|
|
}
|
145 |
|
|
|
146 |
|
|
public void setEndTime(Date endTime) {
|
147 |
|
|
_endTime = endTime;
|
148 |
|
|
}
|
149 |
|
|
|
150 |
|
|
public Long getTicketCount() {
|
151 |
|
|
return _ticketCount;
|
152 |
|
|
}
|
153 |
|
|
|
154 |
|
|
public void setTicketCount(Long ticketCount) {
|
155 |
|
|
_ticketCount = ticketCount;
|
156 |
|
|
}
|
157 |
|
|
|
158 |
|
|
public String getSubTreeId() {
|
159 |
|
|
return _subTreeId;
|
160 |
|
|
}
|
161 |
|
|
|
162 |
|
|
public void setSubTreeId(String subTreeId) {
|
163 |
5098
|
daigle
|
if (subTreeId != null && subTreeId.equals("")) {
|
164 |
|
|
_subTreeId = null;
|
165 |
|
|
} else {
|
166 |
|
|
_subTreeId = subTreeId;
|
167 |
|
|
}
|
168 |
5091
|
daigle
|
}
|
169 |
|
|
|
170 |
|
|
public String getStartNodeId() {
|
171 |
|
|
return _startNodeId;
|
172 |
|
|
}
|
173 |
|
|
|
174 |
|
|
public void setStartNodeId(String startNodeId) {
|
175 |
5098
|
daigle
|
if (startNodeId != null && startNodeId.equals("")) {
|
176 |
|
|
_startNodeId = null;
|
177 |
|
|
} else {
|
178 |
|
|
_startNodeId = startNodeId;
|
179 |
|
|
}
|
180 |
5091
|
daigle
|
}
|
181 |
|
|
|
182 |
|
|
public String getEndNodeId() {
|
183 |
|
|
return _endNodeId;
|
184 |
|
|
}
|
185 |
|
|
|
186 |
|
|
public void setEndNodeId(String endNodeId) {
|
187 |
5098
|
daigle
|
if (endNodeId != null && endNodeId.equals("")) {
|
188 |
|
|
endNodeId = null;
|
189 |
|
|
} else {
|
190 |
|
|
_endNodeId = endNodeId;
|
191 |
|
|
}
|
192 |
5091
|
daigle
|
}
|
193 |
|
|
|
194 |
|
|
}
|