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
|
* Release: @release@
|
9
|
*
|
10
|
* '$Author: sgarg $'
|
11
|
* '$Date: 2005-10-10 11:06:55 -0700 (Mon, 10 Oct 2005) $'
|
12
|
* '$Revision: 2663 $'
|
13
|
*
|
14
|
* This program is free software; you can redistribute it and/or modify
|
15
|
* it under the terms of the GNU General Public License as published by
|
16
|
* the Free Software Foundation; either version 2 of the License, or
|
17
|
* (at your option) any later version.
|
18
|
*
|
19
|
* This program is distributed in the hope that it will be useful,
|
20
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
21
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
22
|
* GNU General Public License for more details.
|
23
|
*
|
24
|
* You should have received a copy of the GNU General Public License
|
25
|
* along with this program; if not, write to the Free Software
|
26
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
27
|
*/
|
28
|
|
29
|
package edu.ucsb.nceas.metacat;
|
30
|
|
31
|
import java.util.Vector;
|
32
|
import java.util.Stack;
|
33
|
|
34
|
import org.apache.log4j.Logger;
|
35
|
|
36
|
/**
|
37
|
* A Class that represents an XML access rule. It include principal and
|
38
|
* permission
|
39
|
*/
|
40
|
public class AccessSection extends SubTree
|
41
|
{
|
42
|
//private String accessSectionId = null;
|
43
|
private String permissionOrder = null;
|
44
|
private Vector accessRules = new Vector();
|
45
|
private String references = null;
|
46
|
private String controlLevel = null;
|
47
|
private Stack storedTmpNodeStack = null;
|
48
|
private Vector describedIdList = new Vector();
|
49
|
private long startedDescribesNodeId = -1;
|
50
|
private Logger logMetacat = Logger.getLogger(AccessSection.class);
|
51
|
|
52
|
|
53
|
/**
|
54
|
* Set a storedTempNodeStack
|
55
|
*/
|
56
|
public void setStoredTmpNodeStack(Stack myStack)
|
57
|
{
|
58
|
this.storedTmpNodeStack = myStack;
|
59
|
}
|
60
|
|
61
|
/**
|
62
|
* Get storedTempNodeStack
|
63
|
*/
|
64
|
public Stack getStoredTmpNodeStack()
|
65
|
{
|
66
|
return this.storedTmpNodeStack;
|
67
|
}
|
68
|
|
69
|
/**
|
70
|
* Set a controllevel
|
71
|
*/
|
72
|
public void setControlLevel(String myLevel)
|
73
|
{
|
74
|
this.controlLevel = myLevel;
|
75
|
}
|
76
|
|
77
|
/**
|
78
|
* Get controllevel
|
79
|
*/
|
80
|
public String getControlLevel()
|
81
|
{
|
82
|
return this.controlLevel;
|
83
|
}
|
84
|
|
85
|
/**
|
86
|
* Set a permissionOrder
|
87
|
*/
|
88
|
public void setPermissionOrder(String myOrder)
|
89
|
{
|
90
|
this.permissionOrder = myOrder;
|
91
|
}
|
92
|
|
93
|
/**
|
94
|
* Get permissionOrder
|
95
|
*/
|
96
|
public String getPermissionOrder()
|
97
|
{
|
98
|
return this.permissionOrder;
|
99
|
}
|
100
|
|
101
|
/** Add an access rule */
|
102
|
public void addAccessRule(AccessRule rule)
|
103
|
{
|
104
|
this.accessRules.addElement(rule);
|
105
|
}
|
106
|
|
107
|
/** Get all access rule */
|
108
|
public Vector getAccessRules()
|
109
|
{
|
110
|
return this.accessRules;
|
111
|
}
|
112
|
|
113
|
/** Set a references */
|
114
|
public void setReferences(String myReferences)
|
115
|
{
|
116
|
this.references = myReferences;
|
117
|
}
|
118
|
|
119
|
/** Get the references */
|
120
|
public String getReferences()
|
121
|
{
|
122
|
return this.references;
|
123
|
}
|
124
|
|
125
|
/** Set a described id list (in data access part)*/
|
126
|
public void setDescribedIdList(Vector list)
|
127
|
{
|
128
|
describedIdList = list;
|
129
|
}
|
130
|
|
131
|
/** Get a described id list */
|
132
|
public Vector getDescribedIdList()
|
133
|
{
|
134
|
return describedIdList;
|
135
|
}
|
136
|
|
137
|
/** Set a the start "describes" node id*/
|
138
|
public void seStartedDescribesNodeId(long id)
|
139
|
{
|
140
|
startedDescribesNodeId = id;
|
141
|
}
|
142
|
|
143
|
/** Get the start described id */
|
144
|
public long getStartedDescribesNodeId()
|
145
|
{
|
146
|
return startedDescribesNodeId;
|
147
|
}
|
148
|
|
149
|
/** Method to copy a accesssection object to a new one */
|
150
|
public void copyPermOrderAndAccessRules(AccessSection newAccessSection)
|
151
|
{
|
152
|
|
153
|
// set parameters
|
154
|
logMetacat.info("Copy permission order: " +
|
155
|
this.getPermissionOrder());
|
156
|
newAccessSection.setPermissionOrder(this.getPermissionOrder());
|
157
|
Vector accessRuleVector = this.getAccessRules();
|
158
|
// go through access rule vector
|
159
|
for (int i=0; i< accessRuleVector.size(); i++)
|
160
|
{
|
161
|
AccessRule access = (AccessRule)accessRuleVector.elementAt(i);
|
162
|
newAccessSection.addAccessRule(access);
|
163
|
}
|
164
|
}
|
165
|
|
166
|
}
|