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: tao $'
|
11
|
* '$Date: 2003-02-14 16:56:14 -0800 (Fri, 14 Feb 2003) $'
|
12
|
* '$Revision: 1406 $'
|
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
|
|
33
|
/**
|
34
|
* A Class that represents an XML access rule. It include principal and
|
35
|
* permission
|
36
|
*/
|
37
|
public class AccessSection
|
38
|
{
|
39
|
private String accessSectionId = null;
|
40
|
private String permissionOrder = null;
|
41
|
private Vector accessRules = new Vector();
|
42
|
|
43
|
/** Set the a accessSectionId */
|
44
|
public void setAccessSectionId(String myId)
|
45
|
{
|
46
|
this.accessSectionId = myId;
|
47
|
}
|
48
|
|
49
|
/** Get the accessSectionId */
|
50
|
public String getAccessSectionId()
|
51
|
{
|
52
|
return this.accessSectionId;
|
53
|
}
|
54
|
|
55
|
/**
|
56
|
* Set a permissionOrder
|
57
|
*/
|
58
|
public void setPermissionOrder(String myOrder)
|
59
|
{
|
60
|
this.permissionOrder = myOrder;
|
61
|
}
|
62
|
|
63
|
/**
|
64
|
* Get permissionOrder
|
65
|
*/
|
66
|
public String getPermissionOrder()
|
67
|
{
|
68
|
return this.permissionOrder;
|
69
|
}
|
70
|
|
71
|
/** Add an access rule */
|
72
|
public void addAccessRule(AccessRule rule)
|
73
|
{
|
74
|
this.accessRules.addElement(rule);
|
75
|
}
|
76
|
|
77
|
/** Get all access rule */
|
78
|
public Vector getAccessRules()
|
79
|
{
|
80
|
return this.accessRules;
|
81
|
}
|
82
|
|
83
|
/** Method to copy a accesssection object to a new one */
|
84
|
public Object clone()
|
85
|
{
|
86
|
//create a new AccessSection object
|
87
|
AccessSection newAccessSection = new AccessSection();
|
88
|
// set parameters
|
89
|
MetaCatUtil.debugMessage("Copy Access Section Id: " +
|
90
|
this.getAccessSectionId(), 35);
|
91
|
newAccessSection.setAccessSectionId(this.getAccessSectionId());
|
92
|
MetaCatUtil.debugMessage("Copy permission order: " +
|
93
|
this.getPermissionOrder(), 35);
|
94
|
newAccessSection.setPermissionOrder(this.getPermissionOrder());
|
95
|
Vector accessRuleVector = this.getAccessRules();
|
96
|
// go through access rule vector
|
97
|
for (int i=0; i< accessRuleVector.size(); i++)
|
98
|
{
|
99
|
AccessRule access = (AccessRule)accessRuleVector.elementAt(i);
|
100
|
newAccessSection.addAccessRule(access);
|
101
|
}
|
102
|
|
103
|
return newAccessSection;
|
104
|
}
|
105
|
|
106
|
}
|