Project

General

Profile

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 1543 tao
import java.util.Stack;
33 1400 tao
34
/**
35
 * A Class that represents an XML access rule. It include principal and
36
 * permission
37
 */
38 1539 tao
public class AccessSection extends SubTree
39 1400 tao
{
40 1539 tao
  //private String accessSectionId = null;
41 1400 tao
  private String permissionOrder = null;
42 1403 tao
  private Vector accessRules = new Vector();
43 1472 tao
  private String references = null;
44 1539 tao
  private String controlLevel = null;
45 1543 tao
  private Stack storedTmpNodeStack = null;
46
47
48 1539 tao
    /**
49 1543 tao
     * Set a storedTempNodeStack
50
     */
51
    public void setStoredTmpNodeStack(Stack myStack)
52
    {
53
      this.storedTmpNodeStack = myStack;
54
    }
55
56
    /**
57
     * Get storedTempNodeStack
58
     */
59
    public Stack getStoredTmpNodeStack()
60
    {
61
      return this.storedTmpNodeStack;
62
    }
63
64
    /**
65 1539 tao
     * Set a controllevel
66
     */
67
    public void setControlLevel(String myLevel)
68 1400 tao
    {
69 1539 tao
      this.controlLevel = myLevel;
70 1400 tao
    }
71 1539 tao
72
    /**
73
     * Get controllevel
74
     */
75
    public String getControlLevel()
76 1400 tao
    {
77 1539 tao
      return this.controlLevel;
78 1400 tao
    }
79 1539 tao
80
   /**
81 1400 tao
     * Set a permissionOrder
82
     */
83
    public void setPermissionOrder(String myOrder)
84
    {
85
      this.permissionOrder = myOrder;
86
    }
87
88
    /**
89
     * Get permissionOrder
90
     */
91
    public String getPermissionOrder()
92
    {
93
      return this.permissionOrder;
94
    }
95
96 1403 tao
    /** Add an access rule */
97
    public void addAccessRule(AccessRule rule)
98 1400 tao
    {
99 1403 tao
      this.accessRules.addElement(rule);
100 1400 tao
    }
101
102 1403 tao
    /** Get all access rule */
103
    public Vector getAccessRules()
104 1400 tao
    {
105 1403 tao
      return this.accessRules;
106 1400 tao
    }
107
108 1472 tao
    /** Set a references */
109
    public void setReferences(String myReferences)
110
    {
111
      this.references = myReferences;
112
    }
113
114
    /** Get the references */
115
    public String getReferences()
116
    {
117
      return this.references;
118
    }
119
120 1539 tao
121 1536 tao
122 1406 tao
    /** Method to copy a accesssection object to a new one */
123 1403 tao
    public Object clone()
124 1400 tao
    {
125 1406 tao
      //create a new AccessSection object
126
      AccessSection newAccessSection = new AccessSection();
127
      // set parameters
128
      MetaCatUtil.debugMessage("Copy Access Section Id: " +
129 1539 tao
                                this.getSubTreeId(), 35);
130
      newAccessSection.setSubTreeId(this.getSubTreeId());
131 1406 tao
      MetaCatUtil.debugMessage("Copy permission order: " +
132
                                this.getPermissionOrder(), 35);
133
      newAccessSection.setPermissionOrder(this.getPermissionOrder());
134
      Vector accessRuleVector = this.getAccessRules();
135
      // go through access rule vector
136
      for (int i=0; i< accessRuleVector.size(); i++)
137
      {
138
        AccessRule access = (AccessRule)accessRuleVector.elementAt(i);
139
        newAccessSection.addAccessRule(access);
140
      }
141
142
      return newAccessSection;
143 1400 tao
    }
144 1403 tao
145 1400 tao
}