1 |
1400
|
tao
|
/**
|
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$'
|
11 |
|
|
* '$Date$'
|
12 |
|
|
* '$Revision$'
|
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 |
1403
|
tao
|
private Vector accessRules = new Vector();
|
42 |
1400
|
tao
|
|
43 |
|
|
/** Set the a accessSectionId */
|
44 |
1403
|
tao
|
public void setAccessSectionId(String myId)
|
45 |
1400
|
tao
|
{
|
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 |
1403
|
tao
|
/** Add an access rule */
|
72 |
|
|
public void addAccessRule(AccessRule rule)
|
73 |
1400
|
tao
|
{
|
74 |
1403
|
tao
|
this.accessRules.addElement(rule);
|
75 |
1400
|
tao
|
}
|
76 |
|
|
|
77 |
1403
|
tao
|
/** Get all access rule */
|
78 |
|
|
public Vector getAccessRules()
|
79 |
1400
|
tao
|
{
|
80 |
1403
|
tao
|
return this.accessRules;
|
81 |
1400
|
tao
|
}
|
82 |
|
|
|
83 |
1406
|
tao
|
/** Method to copy a accesssection object to a new one */
|
84 |
1403
|
tao
|
public Object clone()
|
85 |
1400
|
tao
|
{
|
86 |
1406
|
tao
|
//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 |
1400
|
tao
|
}
|
105 |
1403
|
tao
|
|
106 |
1400
|
tao
|
}
|