1 13 package info.magnolia.jaas.principal; 14 15 import info.magnolia.cms.security.auth.Entity; 16 17 import java.util.Hashtable ; 18 import java.util.Map ; 19 20 import org.apache.commons.lang.StringUtils; 21 import org.apache.commons.lang.builder.ToStringBuilder; 22 import org.apache.commons.lang.builder.ToStringStyle; 23 24 25 28 public class EntityImpl implements Entity { 29 30 33 private static final long serialVersionUID = 222L; 34 35 private static final String DEFAULT_NAME = "person"; 36 37 40 private String name; 41 42 private Map properties; 43 44 public EntityImpl() { 45 this.properties = new Hashtable (); 46 } 47 48 52 public String getName() { 53 if (StringUtils.isEmpty(this.name)) { 54 return DEFAULT_NAME; 55 } 56 return this.name; 57 } 58 59 public void setName(String name) { 60 this.name = name; 61 } 62 63 public void addProperty(String key, Object value) { 64 this.properties.put(key, value); 65 } 66 67 public Object getProperty(String key) { 68 return this.properties.get(key); 69 } 70 71 74 public String toString() { 75 return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("name", this.name).toString(); 76 } 77 78 } 79 | Popular Tags |