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
 *
9
 *   '$Author$'
10
 *     '$Date$'
11
 * '$Revision$'
12
 *
13
 * This program is free software; you can redistribute it and/or modify
14
 * it under the terms of the GNU General Public License as published by
15
 * the Free Software Foundation; either version 2 of the License, or
16
 * (at your option) any later version.
17
 *
18
 * This program is distributed in the hope that it will be useful,
19
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
 * GNU General Public License for more details.
22
 *
23
 * You should have received a copy of the GNU General Public License
24
 * along with this program; if not, write to the Free Software
25
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
 */
27
28
package edu.ucsb.nceas.metacat;
29
30
import java.util.Vector;
31 1543 tao
import java.util.Stack;
32 1400 tao
33 2663 sgarg
import org.apache.log4j.Logger;
34
35 1400 tao
/**
36 2245 sgarg
 * A Class that represents an XML access rule. It include principal and
37 1400 tao
 * permission
38
 */
39 1539 tao
public class AccessSection extends SubTree
40 1400 tao
{
41 1539 tao
  //private String accessSectionId = null;
42 1400 tao
  private String permissionOrder = null;
43 4469 daigle
  private Vector<AccessRule> accessRules = new Vector<AccessRule>();
44 1472 tao
  private String references = null;
45 1539 tao
  private String controlLevel = null;
46 4469 daigle
  private Stack<NodeRecord> storedTmpNodeStack = null;
47
  private Vector<String> describedIdList = new Vector<String>();
48 2245 sgarg
  private long startedDescribesNodeId = -1;
49 4469 daigle
  private String inlineDataFileName = null;
50 2663 sgarg
  private Logger logMetacat = Logger.getLogger(AccessSection.class);
51 2245 sgarg
52
53
    /**
54 1543 tao
     * Set a storedTempNodeStack
55
     */
56 4469 daigle
    public void setStoredTmpNodeStack(Stack<NodeRecord> myStack)
57 1543 tao
    {
58
      this.storedTmpNodeStack = myStack;
59
    }
60 2245 sgarg
61 1543 tao
    /**
62
     * Get storedTempNodeStack
63
     */
64 4469 daigle
    public Stack<NodeRecord> getStoredTmpNodeStack()
65 1543 tao
    {
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 4469 daigle
    public Vector<AccessRule> 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 4469 daigle
    public void setDescribedIdList(Vector<String> list)
127 2245 sgarg
    {
128
      describedIdList = list;
129
    }
130
131
    /** Get a described id list */
132 4469 daigle
    public Vector<String> getDescribedIdList()
133 2245 sgarg
    {
134
      return describedIdList;
135
    }
136
137 4469 daigle
    /** Set the start "describes" node id*/
138
   public void setStartedDescribesNodeId(long id)
139 2245 sgarg
   {
140
     startedDescribesNodeId = id;
141
   }
142
143
   /** Get the start described id */
144
   public long getStartedDescribesNodeId()
145
   {
146
     return startedDescribesNodeId;
147
   }
148 4469 daigle
149
   /** Set the inlineDataFileName */
150
   public void setInlineDataFileName(String fileName)
151
   {
152
     inlineDataFileName = fileName;
153
   }
154
155
   /** Get the inlineDataFileName */
156
   public String getInlineDataFileName()
157
   {
158
     return inlineDataFileName;
159
   }
160 2245 sgarg
161 1406 tao
    /** Method to copy a accesssection object to a new one */
162 2245 sgarg
    public void copyPermOrderAndAccessRules(AccessSection newAccessSection)
163 1400 tao
    {
164 2245 sgarg
165 1406 tao
      // set parameters
166 2663 sgarg
      logMetacat.info("Copy permission order: " +
167 2589 sgarg
                                this.getPermissionOrder());
168 1406 tao
      newAccessSection.setPermissionOrder(this.getPermissionOrder());
169 4469 daigle
      Vector<AccessRule> accessRuleVector = this.getAccessRules();
170 1406 tao
      // go through access rule vector
171
      for (int i=0; i< accessRuleVector.size(); i++)
172
      {
173
        AccessRule access = (AccessRule)accessRuleVector.elementAt(i);
174
        newAccessSection.addAccessRule(access);
175
      }
176 1400 tao
    }
177 2245 sgarg
178 1400 tao
}