001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portlet.amazonrankings.model;
022:
023: import java.io.Serializable;
024:
025: import java.util.Date;
026:
027: /**
028: * <a href="AmazonRankings.java.html"><b><i>View Source</i></b></a>
029: *
030: * @author Brian Wing Shun Chan
031: *
032: */
033: public class AmazonRankings implements Comparable, Serializable {
034:
035: public AmazonRankings(String isbn, String productName,
036: String catalog, String[] authors, Date releaseDate,
037: String releaseDateAsString, String manufacturer,
038: String smallImageURL, String mediumImageURL,
039: String largeImageURL, double listPrice, double ourPrice,
040: double usedPrice, double collectiblePrice,
041: double thirdPartyNewPrice, int salesRank, String media,
042: String availability) {
043:
044: _isbn = isbn;
045: _productName = productName;
046: _catalog = catalog;
047: _authors = authors;
048: _releaseDate = releaseDate;
049: _releaseDateAsString = releaseDateAsString;
050: _manufacturer = manufacturer;
051: _smallImageURL = smallImageURL;
052: _mediumImageURL = mediumImageURL;
053: _largeImageURL = largeImageURL;
054: _listPrice = listPrice;
055: _ourPrice = ourPrice;
056: _usedPrice = usedPrice;
057: _collectiblePrice = collectiblePrice;
058: _thirdPartyNewPrice = thirdPartyNewPrice;
059: _salesRank = salesRank;
060: _media = media;
061: _availability = availability;
062: }
063:
064: public String getISBN() {
065: return _isbn;
066: }
067:
068: public void setISBN(String isbn) {
069: _isbn = isbn;
070: }
071:
072: public String getProductName() {
073: return _productName;
074: }
075:
076: public void setProductName(String productName) {
077: _productName = productName;
078: }
079:
080: public String getCatalog() {
081: return _catalog;
082: }
083:
084: public void setCatalog(String catalog) {
085: _catalog = catalog;
086: }
087:
088: public String[] getAuthors() {
089: return _authors;
090: }
091:
092: public void setAuthors(String[] authors) {
093: _authors = authors;
094: }
095:
096: public Date getReleaseDate() {
097: return _releaseDate;
098: }
099:
100: public void setReleaseDate(Date releaseDate) {
101: _releaseDate = releaseDate;
102: }
103:
104: public String getReleaseDateAsString() {
105: return _releaseDateAsString;
106: }
107:
108: public void setReleaseDateAsString(String releaseDateAsString) {
109: _releaseDateAsString = releaseDateAsString;
110: }
111:
112: public String getManufacturer() {
113: return _manufacturer;
114: }
115:
116: public void setManufacturer(String manufacturer) {
117: _manufacturer = manufacturer;
118: }
119:
120: public String getSmallImageURL() {
121: return _smallImageURL;
122: }
123:
124: public void setSmallImageURL(String smallImageURL) {
125: _smallImageURL = smallImageURL;
126: }
127:
128: public String getMediumImageURL() {
129: return _mediumImageURL;
130: }
131:
132: public void setMediumImageURL(String mediumImageURL) {
133: _mediumImageURL = mediumImageURL;
134: }
135:
136: public String getLargeImageURL() {
137: return _largeImageURL;
138: }
139:
140: public void setLargeImageURL(String largeImageURL) {
141: _largeImageURL = largeImageURL;
142: }
143:
144: public double getListPrice() {
145: return _listPrice;
146: }
147:
148: public void setListPrice(double listPrice) {
149: _listPrice = listPrice;
150: }
151:
152: public double getOurPrice() {
153: return _ourPrice;
154: }
155:
156: public void setOurPrice(double ourPrice) {
157: _ourPrice = ourPrice;
158: }
159:
160: public double getUsedPrice() {
161: return _usedPrice;
162: }
163:
164: public void setUsedPrice(double usedPrice) {
165: _usedPrice = usedPrice;
166: }
167:
168: public double getCollectiblePrice() {
169: return _collectiblePrice;
170: }
171:
172: public void setCollectiblePrice(double collectiblePrice) {
173: _collectiblePrice = collectiblePrice;
174: }
175:
176: public double getThirdPartyNewPrice() {
177: return _thirdPartyNewPrice;
178: }
179:
180: public void setThirdPartyNewPrice(double thirdPartyNewPrice) {
181: _thirdPartyNewPrice = thirdPartyNewPrice;
182: }
183:
184: public int getSalesRank() {
185: return _salesRank;
186: }
187:
188: public void setSalesRank(int salesRank) {
189: _salesRank = salesRank;
190: }
191:
192: public String getMedia() {
193: return _media;
194: }
195:
196: public void setMedia(String media) {
197: _media = media;
198: }
199:
200: public String getAvailability() {
201: return _availability;
202: }
203:
204: public void setAvailability(String availability) {
205: _availability = availability;
206: }
207:
208: public int compareTo(Object obj) {
209: if (obj == null) {
210: return -1;
211: }
212:
213: AmazonRankings amazonRankings = (AmazonRankings) obj;
214:
215: if (getSalesRank() > amazonRankings.getSalesRank()) {
216: return 1;
217: } else if (getSalesRank() < amazonRankings.getSalesRank()) {
218: return -1;
219: } else {
220: return getReleaseDate().compareTo(
221: amazonRankings.getReleaseDate());
222: }
223: }
224:
225: private String _isbn;
226: private String _productName;
227: private String _catalog;
228: private String[] _authors;
229: private Date _releaseDate;
230: private String _releaseDateAsString;
231: private String _manufacturer;
232: private String _smallImageURL;
233: private String _mediumImageURL;
234: private String _largeImageURL;
235: private double _listPrice;
236: private double _ourPrice;
237: private double _usedPrice;
238: private double _collectiblePrice;
239: private double _thirdPartyNewPrice;
240: private int _salesRank;
241: private String _media;
242: private String _availability;
243:
244: }
|