001: package org.apache.ojb.performance;
002:
003: import org.apache.commons.lang.builder.ToStringBuilder;
004: import org.apache.commons.lang.builder.HashCodeBuilder;
005: import org.apache.commons.lang.builder.EqualsBuilder;
006:
007: /* Copyright 2002-2005 The Apache Software Foundation
008: *
009: * Licensed under the Apache License, Version 2.0 (the "License");
010: * you may not use this file except in compliance with the License.
011: * You may obtain a copy of the License at
012: *
013: * http://www.apache.org/licenses/LICENSE-2.0
014: *
015: * Unless required by applicable law or agreed to in writing, software
016: * distributed under the License is distributed on an "AS IS" BASIS,
017: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
018: * See the License for the specific language governing permissions and
019: * limitations under the License.
020: */
021:
022: /**
023: * Implementation of the {@link PerfArticle} interface.
024: *
025: * @version $Id: PerfArticleImpl.java,v 1.6.2.3 2005/12/30 00:01:42 arminw Exp $
026: */
027: public class PerfArticleImpl implements PerfArticle {
028: private Long articleId;
029: private String articleName;
030: private int minimumStock;
031: private double price;
032: private String unit;
033: private int stock;
034: private int supplierId;
035: private int productGroupId;
036:
037: public PerfArticleImpl() {
038: }
039:
040: public PerfArticleImpl(Long articleId, String articleName,
041: int minimumStock, double price, String unit, int stock,
042: int supplierId, int productGroupId) {
043: this .articleId = articleId;
044: this .articleName = articleName;
045: this .minimumStock = minimumStock;
046: this .price = price;
047: this .unit = unit;
048: this .stock = stock;
049: this .supplierId = supplierId;
050: this .productGroupId = productGroupId;
051: }
052:
053: public String toString() {
054: return new ToStringBuilder(this ).append("articleId", articleId)
055: .append("articleName", articleName).append(
056: "minimumStock", minimumStock).append("price",
057: price).append("unit", unit).append("stock",
058: stock).append("supplierId", supplierId).append(
059: "productGroupId", productGroupId).toString();
060: }
061:
062: public Long getArticleId() {
063: return articleId;
064: }
065:
066: public void setArticleId(Long articleId) {
067: this .articleId = articleId;
068: }
069:
070: public String getArticleName() {
071: return articleName;
072: }
073:
074: public void setArticleName(String articleName) {
075: this .articleName = articleName;
076: }
077:
078: public int getMinimumStock() {
079: return minimumStock;
080: }
081:
082: public void setMinimumStock(int minimumStock) {
083: this .minimumStock = minimumStock;
084: }
085:
086: public double getPrice() {
087: return price;
088: }
089:
090: public void setPrice(double price) {
091: this .price = price;
092: }
093:
094: public String getUnit() {
095: return unit;
096: }
097:
098: public void setUnit(String unit) {
099: this .unit = unit;
100: }
101:
102: public int getStock() {
103: return stock;
104: }
105:
106: public void setStock(int stock) {
107: this .stock = stock;
108: }
109:
110: public int getSupplierId() {
111: return supplierId;
112: }
113:
114: public void setSupplierId(int supplierId) {
115: this .supplierId = supplierId;
116: }
117:
118: public int getProductGroupId() {
119: return productGroupId;
120: }
121:
122: public void setProductGroupId(int productGroupId) {
123: this .productGroupId = productGroupId;
124: }
125:
126: public int hashCode() {
127: return new HashCodeBuilder().append(articleId).hashCode();
128: }
129:
130: public boolean equals(Object obj) {
131: if (obj == this ) {
132: return true;
133: }
134: if (obj instanceof PerfArticleImpl) {
135: PerfArticleImpl o = (PerfArticleImpl) obj;
136: return new EqualsBuilder().append(articleId, o.articleId)
137: .append(articleName, o.articleName).append(
138: minimumStock, o.minimumStock).append(price,
139: o.price).append(productGroupId,
140: o.productGroupId).append(stock, o.stock)
141: .append(supplierId, o.supplierId).append(unit,
142: o.unit).isEquals();
143: }
144: return false;
145: }
146: }
|