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: tao $'
11
 *     '$Date: 2003-04-09 17:44:29 -0700 (Wed, 09 Apr 2003) $'
12
 * '$Revision: 1536 $'
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

    
33
/**
34
 * A Class that represents an XML access rule. It include principal and 
35
 * permission
36
 */
37
public class AccessSection
38
{
39
  private String accessSectionId = null;
40
  private String permissionOrder = null;
41
  private Vector accessRules = new Vector();
42
  private String references = null;
43
  private long accessSectionStartNodeId = -1;
44
  private long accessSectionEndNodeId = -1;
45
 
46
    /** Set the a accessSectionId */
47
    public void setAccessSectionId(String myId) 
48
    {
49
      this.accessSectionId = myId;
50
    }
51

    
52
    /** Get the accessSectionId */
53
    public String getAccessSectionId() 
54
    {
55
      return this.accessSectionId;
56
    }
57

    
58
    /** 
59
     * Set a permissionOrder
60
     */
61
    public void setPermissionOrder(String myOrder) 
62
    {
63
      this.permissionOrder = myOrder;
64
    }
65
    
66
    /**
67
     * Get permissionOrder
68
     */
69
    public String getPermissionOrder()
70
    {
71
      return this.permissionOrder;
72
    }
73
    
74
    /** Add an access rule */
75
    public void addAccessRule(AccessRule rule)
76
    {
77
      this.accessRules.addElement(rule);
78
    }
79
    
80
    /** Get all access rule */
81
    public Vector getAccessRules()
82
    {
83
      return this.accessRules;
84
    }
85
    
86
    /** Set a references */
87
    public void setReferences(String myReferences)
88
    {
89
      this.references = myReferences;
90
    }
91
    
92
    /** Get the references */
93
    public String getReferences()
94
    {
95
      return this.references;
96
    }
97
    
98
     /** Set start node id */
99
    public void setAccessSectionStartNodeId(long startId)
100
    {
101
      this.accessSectionStartNodeId = startId;
102
    }
103
        
104
    /** Get the start node id */
105
    public long getAccessSectionStartNodeId()
106
    {
107
      return this.accessSectionStartNodeId;
108
    }
109
    
110
    /** Set end node id */
111
    public void setAccessSectionEndNodeId(long endId)
112
    {
113
      this.accessSectionEndNodeId = endId;
114
    }
115
        
116
    /** Get the start node id */
117
    public long getAccessSectionEndNodeId()
118
    {
119
      return this.accessSectionEndNodeId;
120
    }
121
    
122
    
123
    /** Method to copy a accesssection object to a new one */
124
    public Object clone()
125
    {
126
      //create a new AccessSection object
127
      AccessSection newAccessSection = new AccessSection();
128
      // set parameters
129
      MetaCatUtil.debugMessage("Copy Access Section Id: " +
130
                                this.getAccessSectionId(), 35);
131
      newAccessSection.setAccessSectionId(this.getAccessSectionId());
132
      MetaCatUtil.debugMessage("Copy permission order: " +
133
                                this.getPermissionOrder(), 35);
134
      newAccessSection.setPermissionOrder(this.getPermissionOrder());
135
      Vector accessRuleVector = this.getAccessRules();
136
      // go through access rule vector
137
      for (int i=0; i< accessRuleVector.size(); i++)
138
      {
139
        AccessRule access = (AccessRule)accessRuleVector.elementAt(i);
140
        newAccessSection.addAccessRule(access);
141
      }
142
      
143
      return newAccessSection;
144
    }
145
 
146
}
(5-5/56)