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