1 package org.apache.fulcrum.security.impl.db.entity; 2 3 56 57 import java.util.Collections ; 58 import java.util.HashMap ; 59 import java.util.Map ; 60 import org.apache.torque.om.BaseObject; 61 62 import org.apache.fulcrum.security.entity.SecurityEntity; 63 64 75 public abstract class SecurityObject 76 extends BaseObject 77 implements Comparable , 78 SecurityEntity 79 { 80 81 private String name; 82 83 84 private Map attributes; 85 86 89 public SecurityObject() 90 { 91 this(""); 92 } 93 94 99 public SecurityObject( String name ) 100 { 101 setName(name); 102 setAttributes(Collections.synchronizedMap(new HashMap ())); 103 } 104 105 110 public Map getAttributes() 111 { 112 return attributes; 113 } 114 115 120 public void setAttributes( Map attributes ) 121 { 122 this.attributes = attributes; 123 } 124 125 131 public Object getAttribute( String name ) 132 { 133 return attributes.get(name); 134 } 135 136 142 public void setAttribute( String name, Object value ) 143 { 144 attributes.put(name, value); 145 } 146 147 152 public String getName() 153 { 154 return name; 155 } 156 157 162 public void setName(String name) 163 { 164 this.name = name; 165 } 166 167 174 public int compareTo(Object obj) 175 { 176 if(this.getClass() != obj.getClass()) 177 throw new ClassCastException (); 178 String name1 = ((SecurityObject)obj).getName(); 179 String name2 = this.getName(); 180 181 return name2.compareTo(name1); 182 } 183 184 190 public String toString() 191 { 192 return (getName() + ':' + getAttributes().toString()); 193 } 194 } 195 | Popular Tags |