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: sgarg $'
11
 *     '$Date: 2004-08-19 18:09:25 -0700 (Thu, 19 Aug 2004) $'
12
 * '$Revision: 2245 $'
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
  private Vector describedIdList = new Vector();
47
  private long startedDescribesNodeId = -1;
48

    
49

    
50
    /**
51
     * Set a storedTempNodeStack
52
     */
53
    public void setStoredTmpNodeStack(Stack myStack)
54
    {
55
      this.storedTmpNodeStack = myStack;
56
    }
57

    
58
    /**
59
     * Get storedTempNodeStack
60
     */
61
    public Stack getStoredTmpNodeStack()
62
    {
63
      return this.storedTmpNodeStack;
64
    }
65

    
66
    /**
67
     * Set a controllevel
68
     */
69
    public void setControlLevel(String myLevel)
70
    {
71
      this.controlLevel = myLevel;
72
    }
73

    
74
    /**
75
     * Get controllevel
76
     */
77
    public String getControlLevel()
78
    {
79
      return this.controlLevel;
80
    }
81

    
82
   /**
83
     * Set a permissionOrder
84
     */
85
    public void setPermissionOrder(String myOrder)
86
    {
87
      this.permissionOrder = myOrder;
88
    }
89

    
90
    /**
91
     * Get permissionOrder
92
     */
93
    public String getPermissionOrder()
94
    {
95
      return this.permissionOrder;
96
    }
97

    
98
    /** Add an access rule */
99
    public void addAccessRule(AccessRule rule)
100
    {
101
      this.accessRules.addElement(rule);
102
    }
103

    
104
    /** Get all access rule */
105
    public Vector getAccessRules()
106
    {
107
      return this.accessRules;
108
    }
109

    
110
    /** Set a references */
111
    public void setReferences(String myReferences)
112
    {
113
      this.references = myReferences;
114
    }
115

    
116
    /** Get the references */
117
    public String getReferences()
118
    {
119
      return this.references;
120
    }
121

    
122
    /** 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
    /** Method to copy a accesssection object to a new one */
147
    public void copyPermOrderAndAccessRules(AccessSection newAccessSection)
148
    {
149

    
150
      // 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
    }
162

    
163
}
(5-5/62)