1 /**
2 * Copyright 2005-2007 the original author or authors.
3 *
4 * Licensed under the Gnu General Pubic License, Version 2.0 (the
5 * "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/gpl-license.php
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the Gnu General Public License for more details.
14 */
15 package org.figure8.join.control.config;
16
17 import java.io.Serializable;
18 /**
19 * A JavaBean representing information about a security role into Join application.<br/>
20 * A security role can be a simple role (such as "administrator" or "joiner") or can
21 * be applied to a specific resource. In this later case, the <code>resourceParameter</code>
22 * attribute can gives the HTTP request parameter that will be used to identify resource
23 * key.
24 * @author <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
25 * @version $Revision: 1.1 $
26 */
27 public class RoleConfig implements Serializable{
28
29
30
31 /** Name of this role */
32 private String name;
33 /** Resource the role applies to */
34 private String resource;
35 /** Request parameter allowing to identify the resource role applies to */
36 private String resourceParameter;
37 /** Boolean flag that tells if role applies to a resource or not */
38 private boolean hasResource = false;
39 /** Boolean flag that tells if role applies to a resource retrieved from parameter */
40 private boolean hasResourceParameter = false;
41
42
43
44
45 /** Creates a new instance of RoleConfig */
46 public RoleConfig(){
47 super();
48 }
49
50
51
52
53 /** @return Name of this role */
54 public String getName(){
55 return name;
56 }
57 /** @param name Name of this role */
58 public void setName(String name){
59 this.name = name;
60 }
61
62 /** @return The resource the role applies to */
63 public String getResource(){
64 return resource;
65 }
66 /** @param resource The resource the role applies to */
67 public void setResource(String resource){
68 this.hasResource = true;
69 this.resource = resource;
70 }
71
72 /** @return Request parameter allowing to identify the resource role applies to */
73 public String getResourceParameter(){
74 return resourceParameter;
75 }
76 /** @param resourceParameter Request parameter allowing to identify the resource role applies to */
77 public void setResourceParameter(String resourceParameter){
78 this.hasResource = true;
79 this.hasResourceParameter = true;
80 this.resourceParameter = resourceParameter;
81 }
82
83 /** @return Boolean flag that tells if role applies to a resource or not */
84 public boolean hasResource(){
85 return hasResource;
86 }
87 /** @return Boolean flag that tells if role applies to a resource retrieved from parameter */
88 public boolean hasResourceParameter(){
89 return hasResourceParameter;
90 }
91 }