Rev 29707 | View as "text/plain" | Blame | Compare with Previous | Last modification | View Log | RSS feed
package com.spice.profitmandi.common.model;public class CustomItemModel {private int itemId;private String brand;private String modelName;private String modelNumber;private String color;private String type;public CustomItemModel(int itemId, String brand, String modelName, String modelNumber, String color) {super();this.itemId = itemId;this.brand = brand;this.modelName = modelName;this.modelNumber = modelNumber;this.color = color;}public String getType() {return type;}public void setType(String type) {this.type = type;}public int getItemId() {return itemId;}public void setItemId(int itemId) {this.itemId = itemId;}public String getBrand() {return brand;}public void setBrand(String brand) {this.brand = brand;}public String getModelName() {return modelName;}public void setModelName(String modelName) {this.modelName = modelName;}public String getModelNumber() {return modelNumber;}public void setModelNumber(String modelNumber) {this.modelNumber = modelNumber;}public String getColor() {return color;}public void setColor(String color) {this.color = color;}public String getItemDescription() {StringBuilder itemString = new StringBuilder();if (this.getBrand() != null && !this.getBrand().isEmpty()) {itemString.append(this.getBrand().trim());}itemString.append(" ");if (this.getModelName() != null && !this.getModelName().isEmpty()) {itemString.append(this.getModelName().trim());}if (this.getModelNumber() != null && !this.getModelNumber().isEmpty()) {itemString.append(" ");itemString.append(this.getModelNumber().trim());}if (this.getColor() != null && !this.getColor().isEmpty() && !this.getColor().trim().equals("f_")) {itemString.append(" ");itemString.append(this.getColor().trim());}return itemString.toString().replaceAll("\\s+", " ").trim();}@Overridepublic int hashCode() {final int prime = 31;int result = 1;result = prime * result + ((brand == null) ? 0 : brand.hashCode());result = prime * result + ((color == null) ? 0 : color.hashCode());result = prime * result + itemId;result = prime * result + ((modelName == null) ? 0 : modelName.hashCode());result = prime * result + ((modelNumber == null) ? 0 : modelNumber.hashCode());return result;}@Overridepublic boolean equals(Object obj) {if (this == obj)return true;if (obj == null)return false;if (getClass() != obj.getClass())return false;CustomItemModel other = (CustomItemModel) obj;if (brand == null) {if (other.brand != null)return false;} else if (!brand.equals(other.brand))return false;if (color == null) {if (other.color != null)return false;} else if (!color.equals(other.color))return false;if (itemId != other.itemId)return false;if (modelName == null) {if (other.modelName != null)return false;} else if (!modelName.equals(other.modelName))return false;if (modelNumber == null) {if (other.modelNumber != null)return false;} else if (!modelNumber.equals(other.modelNumber))return false;return true;}@Overridepublic String toString() {return "CustomItemModel [itemId=" + itemId + ", brand=" + brand + ", modelName=" + modelName + ", modelNumber="+ modelNumber + ", color=" + color + ", type=" + type + "]";}}