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
 *
9
 *   '$Author: daigle $'
10
 *     '$Date: 2008-10-21 15:22:01 -0700 (Tue, 21 Oct 2008) $'
11
 * '$Revision: 4469 $'
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
import java.util.Stack;
32

    
33
import org.apache.log4j.Logger;
34

    
35
/**
36
 * A Class that represents an XML access rule. It include principal and
37
 * permission
38
 */
39
public class AccessSection extends SubTree
40
{
41
  //private String accessSectionId = null;
42
  private String permissionOrder = null;
43
  private Vector<AccessRule> accessRules = new Vector<AccessRule>();
44
  private String references = null;
45
  private String controlLevel = null;
46
  private Stack<NodeRecord> storedTmpNodeStack = null;
47
  private Vector<String> describedIdList = new Vector<String>();
48
  private long startedDescribesNodeId = -1;
49
  private String inlineDataFileName = null;
50
  private Logger logMetacat = Logger.getLogger(AccessSection.class);
51

    
52

    
53
    /**
54
     * Set a storedTempNodeStack
55
     */
56
    public void setStoredTmpNodeStack(Stack<NodeRecord> myStack)
57
    {
58
      this.storedTmpNodeStack = myStack;
59
    }
60

    
61
    /**
62
     * Get storedTempNodeStack
63
     */
64
    public Stack<NodeRecord> getStoredTmpNodeStack()
65
    {
66
      return this.storedTmpNodeStack;
67
    }
68

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

    
77
    /**
78
     * Get controllevel
79
     */
80
    public String getControlLevel()
81
    {
82
      return this.controlLevel;
83
    }
84

    
85
   /**
86
     * Set a permissionOrder
87
     */
88
    public void setPermissionOrder(String myOrder)
89
    {
90
      this.permissionOrder = myOrder;
91
    }
92

    
93
    /**
94
     * Get permissionOrder
95
     */
96
    public String getPermissionOrder()
97
    {
98
      return this.permissionOrder;
99
    }
100

    
101
    /** Add an access rule */
102
    public void addAccessRule(AccessRule rule)
103
    {
104
      this.accessRules.addElement(rule);
105
    }
106

    
107
    /** Get all access rule */
108
    public Vector<AccessRule> getAccessRules()
109
    {
110
      return this.accessRules;
111
    }
112

    
113
    /** Set a references */
114
    public void setReferences(String myReferences)
115
    {
116
      this.references = myReferences;
117
    }
118

    
119
    /** Get the references */
120
    public String getReferences()
121
    {
122
      return this.references;
123
    }
124

    
125
    /** Set a described id list (in data access part)*/
126
    public void setDescribedIdList(Vector<String> list)
127
    {
128
      describedIdList = list;
129
    }
130

    
131
    /** Get a described id list */
132
    public Vector<String> getDescribedIdList()
133
    {
134
      return describedIdList;
135
    }
136

    
137
    /** Set the start "describes" node id*/
138
   public void setStartedDescribesNodeId(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
   /** 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

    
161
    /** Method to copy a accesssection object to a new one */
162
    public void copyPermOrderAndAccessRules(AccessSection newAccessSection)
163
    {
164

    
165
      // set parameters
166
      logMetacat.info("Copy permission order: " +
167
                                this.getPermissionOrder());
168
      newAccessSection.setPermissionOrder(this.getPermissionOrder());
169
      Vector<AccessRule> accessRuleVector = this.getAccessRules();
170
      // 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
    }
177

    
178
}
(5-5/67)