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.om.registry.base; 18 19 import org.apache.jetspeed.om.registry.*; 20 21 /*** 22 * Bean like implementation of the Security interface suitable for 23 * Castor serialization. 24 * 25 * @see org.apache.jetspeed.om.registry.Security 26 * @author <a href="mailto:raphael@apache.org">Raphaël Luta</a> 27 * @version $Id: BaseSecurity.java,v 1.4 2004/02/23 03:08:26 jford Exp $ 28 */ 29 public class BaseSecurity implements Security,java.io.Serializable 30 { 31 32 private String role; 33 34 public BaseSecurity() 35 {} 36 37 public BaseSecurity(String role) 38 { 39 this.role = role; 40 } 41 42 /*** 43 * Implements the equals operation so that 2 elements are equal if 44 * all their member values are equal. 45 */ 46 public boolean equals(Object object) 47 { 48 if (object==null) 49 { 50 return false; 51 } 52 53 BaseSecurity obj = (BaseSecurity)object; 54 55 if (role!=null) 56 { 57 return role.equals(obj.getRole()); 58 } 59 else 60 { 61 if (obj.getRole()!=null) 62 { 63 return false; 64 } 65 } 66 67 return true; 68 } 69 70 /*** @return the role name that is required for accessing this entry */ 71 public String getRole() 72 { 73 return this.role; 74 } 75 76 /*** Sets the role name required for accessing this entry 77 * @param role the required role name 78 */ 79 public void setRole( String role ) 80 { 81 this.role = role; 82 } 83 84 }