1 package org.infoglue.cms.entities.management; 2 3 import org.infoglue.cms.util.DomainUtils; 4 5 10 public class CategoryAttribute implements Comparable 11 { 12 private String value; 13 private String title; 14 private String description; 15 private Integer categoryId; 16 private String categoryName; 17 18 public CategoryAttribute(String value) 19 { 20 this(value, null); 21 } 22 23 public CategoryAttribute(String value, String categoryId) 24 { 25 this.value = value; 26 this.categoryId = (categoryId != null) ? new Integer (categoryId) : null; 27 } 28 29 public CategoryAttribute(String value, String categoryId, String title, String desc) 30 { 31 this.value = value; 32 this.categoryId = (categoryId != null) ? new Integer (categoryId) : null; 33 this.title = title; 34 this.description = desc; 35 } 36 37 public String getValue() { return value; } 38 public void setValue(String s) { value = s; } 39 40 public String getTitle() { return title; } 41 public void setTitle(String s) { title = s; } 42 43 public String getDescription() { return description; } 44 public void setDescription(String s) { description = s; } 45 46 public Integer getCategoryId() { return categoryId; } 47 public void setCategoryId(String s) { categoryId = (s != null) ? new Integer (s) : null; } 48 49 public String getCategoryName() { return categoryName; } 50 public void setCategoryName(String s) { categoryName = s; } 51 52 58 public int compareTo(Object o) 59 { 60 if (!(o instanceof CategoryAttribute)) 61 throw new ClassCastException (); 62 63 return new Integer (hashCode()).compareTo(new Integer (o.hashCode())); 64 } 65 66 70 public int hashCode() 71 { 72 return (categoryId == null) ? new Integer (0).hashCode() : categoryId.hashCode(); 73 } 74 75 public boolean equals(Object o) 76 { 77 CategoryAttribute other = (CategoryAttribute)o; 78 return DomainUtils.equals(value, other.value) 79 && DomainUtils.equals(title, other.title) 80 && DomainUtils.equals(description, other.description) 81 && DomainUtils.equals(categoryId, other.categoryId); 82 } 83 84 public String toString() 85 { 86 StringBuffer sb = new StringBuffer (); 87 sb.append("value=").append(value) 88 .append(" title=").append(title) 89 .append(" description=").append(description) 90 .append(" categoryId=").append(categoryId); 91 return sb.toString(); 92 } 93 } 94 95 | Popular Tags |