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 2245 sgarg
 * A Class that represents an XML access rule. It include principal and
36 1400 tao
 * 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 2245 sgarg
  private Vector describedIdList = new Vector();
47
  private long startedDescribesNodeId = -1;
48
49
50
    /**
51 1543 tao
     * Set a storedTempNodeStack
52
     */
53 2245 sgarg
    public void setStoredTmpNodeStack(Stack myStack)
54 1543 tao
    {
55
      this.storedTmpNodeStack = myStack;
56
    }
57 2245 sgarg
58 1543 tao
    /**
59
     * Get storedTempNodeStack
60
     */
61
    public Stack getStoredTmpNodeStack()
62
    {
63
      return this.storedTmpNodeStack;
64
    }
65 2245 sgarg
66
    /**
67 1539 tao
     * Set a controllevel
68
     */
69 2245 sgarg
    public void setControlLevel(String myLevel)
70 1400 tao
    {
71 1539 tao
      this.controlLevel = myLevel;
72 1400 tao
    }
73 2245 sgarg
74 1539 tao
    /**
75
     * Get controllevel
76
     */
77
    public String getControlLevel()
78 1400 tao
    {
79 1539 tao
      return this.controlLevel;
80 1400 tao
    }
81 2245 sgarg
82
   /**
83 1400 tao
     * Set a permissionOrder
84
     */
85 2245 sgarg
    public void setPermissionOrder(String myOrder)
86 1400 tao
    {
87
      this.permissionOrder = myOrder;
88
    }
89 2245 sgarg
90 1400 tao
    /**
91
     * Get permissionOrder
92
     */
93
    public String getPermissionOrder()
94
    {
95
      return this.permissionOrder;
96
    }
97 2245 sgarg
98 1403 tao
    /** Add an access rule */
99
    public void addAccessRule(AccessRule rule)
100 1400 tao
    {
101 1403 tao
      this.accessRules.addElement(rule);
102 1400 tao
    }
103 2245 sgarg
104 1403 tao
    /** Get all access rule */
105
    public Vector getAccessRules()
106 1400 tao
    {
107 1403 tao
      return this.accessRules;
108 1400 tao
    }
109 2245 sgarg
110 1472 tao
    /** Set a references */
111
    public void setReferences(String myReferences)
112
    {
113
      this.references = myReferences;
114
    }
115 2245 sgarg
116 1472 tao
    /** Get the references */
117
    public String getReferences()
118
    {
119
      return this.references;
120
    }
121 1539 tao
122 2245 sgarg
    /** Set a described id list (in data access part)*/
123
    public void setDescribedIdList(Vector list)
124
    {
125
      describedIdList = list;
126
    }
127
128
    /** Get a described id list */
129
    public Vector getDescribedIdList()
130
    {
131
      return describedIdList;
132
    }
133
134
    /** Set a  the start "describes" node id*/
135
   public void seStartedDescribesNodeId(long id)
136
   {
137
     startedDescribesNodeId = id;
138
   }
139
140
   /** Get the start described id */
141
   public long getStartedDescribesNodeId()
142
   {
143
     return startedDescribesNodeId;
144
   }
145
146 1406 tao
    /** Method to copy a accesssection object to a new one */
147 2245 sgarg
    public void copyPermOrderAndAccessRules(AccessSection newAccessSection)
148 1400 tao
    {
149 2245 sgarg
150 1406 tao
      // set parameters
151
      MetaCatUtil.debugMessage("Copy permission order: " +
152
                                this.getPermissionOrder(), 35);
153
      newAccessSection.setPermissionOrder(this.getPermissionOrder());
154
      Vector accessRuleVector = this.getAccessRules();
155
      // go through access rule vector
156
      for (int i=0; i< accessRuleVector.size(); i++)
157
      {
158
        AccessRule access = (AccessRule)accessRuleVector.elementAt(i);
159
        newAccessSection.addAccessRule(access);
160
      }
161 1400 tao
    }
162 2245 sgarg
163 1400 tao
}