001: package org.springunit.framework.samples.jpetstore.domain;
002:
003: import org.apache.commons.lang.builder.CompareToBuilder;
004: import org.apache.commons.lang.builder.EqualsBuilder;
005: import org.apache.commons.lang.builder.HashCodeBuilder;
006: import org.apache.commons.lang.builder.ToStringBuilder;
007: import org.apache.commons.lang.builder.ToStringStyle;
008:
009: public class Item extends Persistable {
010:
011: public String getAttribute1() {
012: return this .attribute1;
013: }
014:
015: public String getAttribute2() {
016: return this .attribute2;
017: }
018:
019: public String getAttribute3() {
020: return this .attribute3;
021: }
022:
023: public String getAttribute4() {
024: return this .attribute4;
025: }
026:
027: public String getAttribute5() {
028: return this .attribute5;
029: }
030:
031: public double getListPrice() {
032: return this .listPrice;
033: }
034:
035: public Product getProduct() {
036: return this .product;
037: }
038:
039: public int getQuantity() {
040: return this .quantity;
041: }
042:
043: public String getStatus() {
044: return this .status;
045: }
046:
047: public int getSupplierId() {
048: return this .supplierId;
049: }
050:
051: public double getUnitCost() {
052: return this .unitCost;
053: }
054:
055: public void setAttribute1(String attribute1) {
056: this .attribute1 = attribute1;
057: }
058:
059: public void setAttribute2(String attribute2) {
060: this .attribute2 = attribute2;
061: }
062:
063: public void setAttribute3(String attribute3) {
064: this .attribute3 = attribute3;
065: }
066:
067: public void setAttribute4(String attribute4) {
068: this .attribute4 = attribute4;
069: }
070:
071: public void setAttribute5(String attribute5) {
072: this .attribute5 = attribute5;
073: }
074:
075: public void setListPrice(double listPrice) {
076: this .listPrice = listPrice;
077: }
078:
079: public void setProduct(Product product) {
080: this .product = product;
081: }
082:
083: public void setQuantity(int quantity) {
084: this .quantity = quantity;
085: }
086:
087: public void setStatus(String status) {
088: this .status = status;
089: }
090:
091: public void setSupplierId(int supplierId) {
092: this .supplierId = supplierId;
093: }
094:
095: public void setUnitCost(double unitCost) {
096: this .unitCost = unitCost;
097: }
098:
099: public int compareTo(Object that) {
100: Item other = (Item) that;
101: return new CompareToBuilder().append(getProduct(),
102: other.getProduct()).append(getSupplierId(),
103: other.getSupplierId()).append(getUnitCost(),
104: other.getUnitCost()).append(getQuantity(),
105: other.getQuantity()).toComparison();
106: }
107:
108: public boolean equals(Object that) {
109: if (this == that) {
110: return true;
111: }
112: if (!(that instanceof Item)) {
113: return false;
114: }
115: Item other = (Item) that;
116: return new EqualsBuilder().append(getProduct(),
117: other.getProduct()).append(getSupplierId(),
118: other.getSupplierId()).isEquals();
119: }
120:
121: public int hashCode() {
122: return new HashCodeBuilder(PRIME, MULTIPLIER).append(
123: getProduct()).append(getSupplierId()).toHashCode();
124: }
125:
126: public String toString() {
127: return new ToStringBuilder(this , ToStringStyle.MULTI_LINE_STYLE)
128: .appendSuper(super .toString()).append("listPrice",
129: getListPrice()).append("unitCost",
130: getUnitCost()).append("supplierId",
131: getSupplierId()).append("status", getStatus())
132: .append("attribute1", getAttribute1()).append(
133: "attribute2", getAttribute2()).append(
134: "attribute3", getAttribute3()).append(
135: "attribute4", getAttribute4()).append(
136: "attribute5", getAttribute5()).append(
137: "quantity", getQuantity()).toString();
138: }
139:
140: private static final long serialVersionUID = 4L;
141:
142: private double listPrice;
143: private double unitCost;
144: private int supplierId;
145: private String status;
146: private String attribute1;
147: private String attribute2;
148: private String attribute3;
149: private String attribute4;
150: private String attribute5;
151: private Product product;
152: private int quantity;
153:
154: }
|