1
|
/**
|
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: jones $'
|
10
|
* '$Date: 2006-11-10 10:25:38 -0800 (Fri, 10 Nov 2006) $'
|
11
|
* '$Revision: 3077 $'
|
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;
|
29
|
|
30
|
import java.util.Vector;
|
31
|
import java.util.Stack;
|
32
|
|
33
|
import org.apache.log4j.Logger;
|
34
|
|
35
|
/**
|
36
|
* A Class that represents an XML access rule. It include principal and
|
37
|
* permission
|
38
|
*/
|
39
|
public class AccessSection extends SubTree
|
40
|
{
|
41
|
//private String accessSectionId = null;
|
42
|
private String permissionOrder = null;
|
43
|
private Vector accessRules = new Vector();
|
44
|
private String references = null;
|
45
|
private String controlLevel = null;
|
46
|
private Stack storedTmpNodeStack = null;
|
47
|
private Vector describedIdList = new Vector();
|
48
|
private long startedDescribesNodeId = -1;
|
49
|
private Logger logMetacat = Logger.getLogger(AccessSection.class);
|
50
|
|
51
|
|
52
|
/**
|
53
|
* Set a storedTempNodeStack
|
54
|
*/
|
55
|
public void setStoredTmpNodeStack(Stack myStack)
|
56
|
{
|
57
|
this.storedTmpNodeStack = myStack;
|
58
|
}
|
59
|
|
60
|
/**
|
61
|
* Get storedTempNodeStack
|
62
|
*/
|
63
|
public Stack getStoredTmpNodeStack()
|
64
|
{
|
65
|
return this.storedTmpNodeStack;
|
66
|
}
|
67
|
|
68
|
/**
|
69
|
* Set a controllevel
|
70
|
*/
|
71
|
public void setControlLevel(String myLevel)
|
72
|
{
|
73
|
this.controlLevel = myLevel;
|
74
|
}
|
75
|
|
76
|
/**
|
77
|
* Get controllevel
|
78
|
*/
|
79
|
public String getControlLevel()
|
80
|
{
|
81
|
return this.controlLevel;
|
82
|
}
|
83
|
|
84
|
/**
|
85
|
* Set a permissionOrder
|
86
|
*/
|
87
|
public void setPermissionOrder(String myOrder)
|
88
|
{
|
89
|
this.permissionOrder = myOrder;
|
90
|
}
|
91
|
|
92
|
/**
|
93
|
* Get permissionOrder
|
94
|
*/
|
95
|
public String getPermissionOrder()
|
96
|
{
|
97
|
return this.permissionOrder;
|
98
|
}
|
99
|
|
100
|
/** Add an access rule */
|
101
|
public void addAccessRule(AccessRule rule)
|
102
|
{
|
103
|
this.accessRules.addElement(rule);
|
104
|
}
|
105
|
|
106
|
/** Get all access rule */
|
107
|
public Vector getAccessRules()
|
108
|
{
|
109
|
return this.accessRules;
|
110
|
}
|
111
|
|
112
|
/** Set a references */
|
113
|
public void setReferences(String myReferences)
|
114
|
{
|
115
|
this.references = myReferences;
|
116
|
}
|
117
|
|
118
|
/** Get the references */
|
119
|
public String getReferences()
|
120
|
{
|
121
|
return this.references;
|
122
|
}
|
123
|
|
124
|
/** Set a described id list (in data access part)*/
|
125
|
public void setDescribedIdList(Vector list)
|
126
|
{
|
127
|
describedIdList = list;
|
128
|
}
|
129
|
|
130
|
/** Get a described id list */
|
131
|
public Vector getDescribedIdList()
|
132
|
{
|
133
|
return describedIdList;
|
134
|
}
|
135
|
|
136
|
/** Set a the start "describes" node id*/
|
137
|
public void seStartedDescribesNodeId(long id)
|
138
|
{
|
139
|
startedDescribesNodeId = id;
|
140
|
}
|
141
|
|
142
|
/** Get the start described id */
|
143
|
public long getStartedDescribesNodeId()
|
144
|
{
|
145
|
return startedDescribesNodeId;
|
146
|
}
|
147
|
|
148
|
/** Method to copy a accesssection object to a new one */
|
149
|
public void copyPermOrderAndAccessRules(AccessSection newAccessSection)
|
150
|
{
|
151
|
|
152
|
// set parameters
|
153
|
logMetacat.info("Copy permission order: " +
|
154
|
this.getPermissionOrder());
|
155
|
newAccessSection.setPermissionOrder(this.getPermissionOrder());
|
156
|
Vector accessRuleVector = this.getAccessRules();
|
157
|
// go through access rule vector
|
158
|
for (int i=0; i< accessRuleVector.size(); i++)
|
159
|
{
|
160
|
AccessRule access = (AccessRule)accessRuleVector.elementAt(i);
|
161
|
newAccessSection.addAccessRule(access);
|
162
|
}
|
163
|
}
|
164
|
|
165
|
}
|