Project

General

Profile

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-04-11 19:15:52 -0700 (Fri, 11 Apr 2003) $'
12
 * '$Revision: 1543 $'
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
/**
35
 * A Class that represents an XML access rule. It include principal and 
36
 * permission
37
 */
38
public class AccessSection extends SubTree
39
{
40
  //private String accessSectionId = null;
41
  private String permissionOrder = null;
42
  private Vector accessRules = new Vector();
43
  private String references = null;
44
  private String controlLevel = null;
45
  private Stack storedTmpNodeStack = null;
46
  
47
  
48
    /** 
49
     * 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
     * Set a controllevel
66
     */
67
    public void setControlLevel(String myLevel) 
68
    {
69
      this.controlLevel = myLevel;
70
    }
71
    
72
    /**
73
     * Get controllevel
74
     */
75
    public String getControlLevel()
76
    {
77
      return this.controlLevel;
78
    }
79
   
80
   /** 
81
     * 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
    /** Add an access rule */
97
    public void addAccessRule(AccessRule rule)
98
    {
99
      this.accessRules.addElement(rule);
100
    }
101
    
102
    /** Get all access rule */
103
    public Vector getAccessRules()
104
    {
105
      return this.accessRules;
106
    }
107
    
108
    /** 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

    
121
    
122
    /** Method to copy a accesssection object to a new one */
123
    public Object clone()
124
    {
125
      //create a new AccessSection object
126
      AccessSection newAccessSection = new AccessSection();
127
      // set parameters
128
      MetaCatUtil.debugMessage("Copy Access Section Id: " +
129
                                this.getSubTreeId(), 35);
130
      newAccessSection.setSubTreeId(this.getSubTreeId());
131
      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
    }
144
 
145
}
(5-5/58)