View Javadoc

1   /*
2    * Copyright 2000-2001,2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.apache.jetspeed.services.security;
18  
19  // Jetspeed imports
20  import org.apache.jetspeed.portal.Portlet;
21  import org.apache.jetspeed.om.profile.Entry;
22  import org.apache.jetspeed.om.registry.RegistryEntry;
23  
24  import java.io.Serializable;
25  /***
26   * PortalResource
27   *
28   * @author <a href="paulsp@apache.org">Paul Spencer</a>
29   * @version $Id: PortalResource.java,v 1.5 2004/02/23 03:58:11 jford Exp $
30   */
31  public class PortalResource implements Serializable
32  {
33      public static final int TYPE_PORTLET = 100;
34      public static final int TYPE_ENTRY = 200;
35      public static final int TYPE_ENTRY_PARAMETER = 201;
36      public static final int TYPE_REGISTRY = 300;
37      public static final int TYPE_REGISTRY_PARAMETER = 301;
38  
39      private int resourceType = 0;
40  
41      private Entry entry = null;
42      private org.apache.jetspeed.om.profile.Parameter entryParameter = null;
43      private Portlet portlet = null;
44      private org.apache.jetspeed.om.registry.Parameter registryParameter = null;
45      private RegistryEntry registryEntry = null;
46      
47      /*** Holds value of property owner. */
48      private String owner;    
49  
50      /***
51       * Resource is a PSML entry, i.e. a Portlet Instance
52       * @param entry PSML Entry, i.e Portlet Instance
53       */
54      public PortalResource(Entry entry)
55      {
56          resourceType = TYPE_ENTRY;
57          this.entry = entry;
58      }
59  
60      /***
61       * Resource is a parameter associated with a PSML entry, i.e. a Portlet Instance
62       * @param entry PSML Entry, i.e Portlet Instance
63       * @param parameter Requesting parameter
64       */
65      public PortalResource(Entry entry, org.apache.jetspeed.om.profile.Parameter parameter)
66      {
67          resourceType = TYPE_ENTRY_PARAMETER;
68          this.entry = entry;
69          this.entryParameter = parameter;
70      }
71  
72      /***
73       * Resource is a Portlet, i.e. a Portlet
74       * @param portlet Portlet registry entry
75       */
76      public PortalResource(Portlet portlet)
77      {
78          resourceType = TYPE_PORTLET;
79          this.portlet = portlet;
80      }
81  
82      /***
83       * Resource is a registry entry
84       *
85       * @param registryEntry of portal resource
86       */
87      public PortalResource(RegistryEntry registryEntry)
88      {
89          resourceType = TYPE_REGISTRY;
90          this.registryEntry = registryEntry;
91      }
92  
93      /***
94       * Resource is a parameter associated with a registry entry
95       * @param registryEntry of portal resource
96       * @param parameter Requesting parameter
97       */
98      public PortalResource(RegistryEntry registryEntry, org.apache.jetspeed.om.registry.Parameter parameter)
99      {
100         resourceType = TYPE_REGISTRY_PARAMETER;
101         this.registryEntry = registryEntry;
102         this.registryParameter = parameter;
103     }
104 
105     /***
106      * Getter for property resourceType.
107      * @return Value of property resourceType.
108      */
109     public int getResourceType()
110     {
111         return resourceType;
112     }
113 
114     /***
115      * Getter for property entry.
116      * @return Value of property entry.
117      */
118     public Entry getEntry()
119     {
120         return entry;
121     }
122 
123     /***
124      * Getter for property parameter
125      * @return Value of property parameter.
126      */
127     public org.apache.jetspeed.om.profile.Parameter getEntryParameter()
128     {
129         return entryParameter;
130     }
131 
132     /***
133      * Getter for property portlet.
134      * @return Value of property portlet.
135      */
136     public Portlet getPortlet()
137     {
138         return portlet;
139     }
140 
141     /***
142      * Getter for property registryEntry.
143      * @return Value of property registryEntry.
144      */
145     public RegistryEntry getRegistryEntry()
146     {
147         return registryEntry;
148     }
149 
150     /***
151      * Getter for property registryParameter.
152      * @return Value of property registryParameter.
153      */
154     public org.apache.jetspeed.om.registry.Parameter getRegistryParameter()
155     {
156         return registryParameter;
157     }
158 
159     /*** Getter for property owner.
160      * @return Value of property owner.
161      */
162     public String getOwner()
163     {
164         return this.owner;
165     }
166     
167     /*** Setter for property owner.
168      * @param owner New value of property owner.
169      */
170     public void setOwner(String owner)
171     {
172         this.owner = owner;
173     }
174     
175 }