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-03-13 17:32:59 -0800 (Thu, 13 Mar 2003) $'
12
 * '$Revision: 1472 $'
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
 
44
    /** Set the a accessSectionId */
45
    public void setAccessSectionId(String myId) 
46
    {
47
      this.accessSectionId = myId;
48
    }
49

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

    
56
    /** 
57
     * Set a permissionOrder
58
     */
59
    public void setPermissionOrder(String myOrder) 
60
    {
61
      this.permissionOrder = myOrder;
62
    }
63
    
64
    /**
65
     * Get permissionOrder
66
     */
67
    public String getPermissionOrder()
68
    {
69
      return this.permissionOrder;
70
    }
71
    
72
    /** Add an access rule */
73
    public void addAccessRule(AccessRule rule)
74
    {
75
      this.accessRules.addElement(rule);
76
    }
77
    
78
    /** Get all access rule */
79
    public Vector getAccessRules()
80
    {
81
      return this.accessRules;
82
    }
83
    
84
    /** Set a references */
85
    public void setReferences(String myReferences)
86
    {
87
      this.references = myReferences;
88
    }
89
    
90
    /** Get the references */
91
    public String getReferences()
92
    {
93
      return this.references;
94
    }
95
    
96
    /** Method to copy a accesssection object to a new one */
97
    public Object clone()
98
    {
99
      //create a new AccessSection object
100
      AccessSection newAccessSection = new AccessSection();
101
      // set parameters
102
      MetaCatUtil.debugMessage("Copy Access Section Id: " +
103
                                this.getAccessSectionId(), 35);
104
      newAccessSection.setAccessSectionId(this.getAccessSectionId());
105
      MetaCatUtil.debugMessage("Copy permission order: " +
106
                                this.getPermissionOrder(), 35);
107
      newAccessSection.setPermissionOrder(this.getPermissionOrder());
108
      Vector accessRuleVector = this.getAccessRules();
109
      // go through access rule vector
110
      for (int i=0; i< accessRuleVector.size(); i++)
111
      {
112
        AccessRule access = (AccessRule)accessRuleVector.elementAt(i);
113
        newAccessSection.addAccessRule(access);
114
      }
115
      
116
      return newAccessSection;
117
    }
118
 
119
}
(5-5/54)