View Javadoc

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.util.ArrayList;
18  import java.util.Collection;
19  import java.io.Serializable;
20  /**
21   * A JavaBean reprenseting configuraiton information about security constraints
22   * on business operation execution.<br/>
23   * An operation represents a business method of an <code>&lt;action&gt;</code>
24   * element from a Struts application module configuration file.
25   * @author  <a href="mailto:laurent.broudoux@free.fr">Laurent Broudoux</a>
26   * @version $Revision: 1.1 $
27   */
28  public class OperationConstraintConfig implements Serializable{
29   
30     // Attributes ---------------------------------------------------------------
31     
32     /** The set of associated roles handling configurations for this operation, if any.  */
33     private ArrayList roles = new ArrayList();
34     
35     /**
36      * Name of the operation with the Action scope. This name if indeed the
37      * value of the <code>op</code> request parameter that is used in action
38      * for routing request to the correct business method.
39      */
40     private String name;
41     
42     
43     // Constructors -------------------------------------------------------------
44     
45     /** Creates a new instance of OperationConstraintConfig */
46     public OperationConstraintConfig(){
47        super();
48     }
49     
50     
51     // Public -------------------------------------------------------------------
52     
53     /** @return This operation name within action */
54     public String getName(){
55        return name;
56     }
57     /** @param name This operation name within action */
58     public void setName(String name){
59        this.name = name;
60     }
61     
62     /**
63      * Add a new <code>RoleConfig</code> instance to the set associated.
64      * @param role The new role configuration instance to be added
65      */
66     public void addRole(RoleConfig role){
67        roles.add(role);
68     }
69     
70     /**
71      * Return the list of security roles allowed to request the associated operation
72      * if any; otherwise return an empty collection.
73      * @return Collection of <code>RoleConfig</code>
74      */
75     public Collection getRoles(){
76       return roles;  
77     }
78  }