001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.amazonrankings.model;
016    
017    import java.io.Serializable;
018    
019    import java.util.Date;
020    
021    /**
022     * @author Brian Wing Shun Chan
023     */
024    public class AmazonRankings
025            implements Comparable<AmazonRankings>, Serializable {
026    
027            public AmazonRankings(String isbn, String productName, String catalog,
028                                                               String[] authors, Date releaseDate,
029                                                               String releaseDateAsString, String manufacturer,
030                                                               String smallImageURL, String mediumImageURL,
031                                                               String largeImageURL, double listPrice,
032                                                               double ourPrice, double usedPrice,
033                                                               double collectiblePrice,
034                                                               double thirdPartyNewPrice, int salesRank,
035                                                               String media, String availability) {
036    
037                    _isbn = isbn;
038                    _productName = productName;
039                    _catalog = catalog;
040                    _authors = authors;
041                    _releaseDate = releaseDate;
042                    _releaseDateAsString = releaseDateAsString;
043                    _manufacturer = manufacturer;
044                    _smallImageURL = smallImageURL;
045                    _mediumImageURL = mediumImageURL;
046                    _largeImageURL = largeImageURL;
047                    _listPrice = listPrice;
048                    _ourPrice = ourPrice;
049                    _usedPrice = usedPrice;
050                    _collectiblePrice = collectiblePrice;
051                    _thirdPartyNewPrice = thirdPartyNewPrice;
052                    _salesRank = salesRank;
053                    _media = media;
054                    _availability = availability;
055            }
056    
057            public int compareTo(AmazonRankings amazonRankings) {
058                    if (amazonRankings == null) {
059                            return -1;
060                    }
061    
062                    if (getSalesRank() > amazonRankings.getSalesRank()) {
063                            return 1;
064                    }
065                    else if (getSalesRank() < amazonRankings.getSalesRank()) {
066                            return -1;
067                    }
068                    else {
069                            return getReleaseDate().compareTo(amazonRankings.getReleaseDate());
070                    }
071            }
072    
073            public String getISBN() {
074                    return _isbn;
075            }
076    
077            public void setISBN(String isbn) {
078                    _isbn = isbn;
079            }
080    
081            public String getProductName() {
082                    return _productName;
083            }
084    
085            public void setProductName(String productName) {
086                    _productName = productName;
087            }
088    
089            public String getCatalog() {
090                    return _catalog;
091            }
092    
093            public void setCatalog(String catalog) {
094                    _catalog = catalog;
095            }
096    
097            public String[] getAuthors() {
098                    return _authors;
099            }
100    
101            public void setAuthors(String[] authors) {
102                    _authors = authors;
103            }
104    
105            public Date getReleaseDate() {
106                    return _releaseDate;
107            }
108    
109            public void setReleaseDate(Date releaseDate) {
110                    _releaseDate = releaseDate;
111            }
112    
113            public String getReleaseDateAsString() {
114                    return _releaseDateAsString;
115            }
116    
117            public void setReleaseDateAsString(String releaseDateAsString) {
118                    _releaseDateAsString = releaseDateAsString;
119            }
120    
121            public String getManufacturer() {
122                    return _manufacturer;
123            }
124    
125            public void setManufacturer(String manufacturer) {
126                    _manufacturer = manufacturer;
127            }
128    
129            public String getSmallImageURL() {
130                    return _smallImageURL;
131            }
132    
133            public void setSmallImageURL(String smallImageURL) {
134                    _smallImageURL = smallImageURL;
135            }
136    
137            public String getMediumImageURL() {
138                    return _mediumImageURL;
139            }
140    
141            public void setMediumImageURL(String mediumImageURL) {
142                    _mediumImageURL = mediumImageURL;
143            }
144    
145            public String getLargeImageURL() {
146                    return _largeImageURL;
147            }
148    
149            public void setLargeImageURL(String largeImageURL) {
150                    _largeImageURL = largeImageURL;
151            }
152    
153            public double getListPrice() {
154                    return _listPrice;
155            }
156    
157            public void setListPrice(double listPrice) {
158                    _listPrice = listPrice;
159            }
160    
161            public double getOurPrice() {
162                    return _ourPrice;
163            }
164    
165            public void setOurPrice(double ourPrice) {
166                    _ourPrice = ourPrice;
167            }
168    
169            public double getUsedPrice() {
170                    return _usedPrice;
171            }
172    
173            public void setUsedPrice(double usedPrice) {
174                    _usedPrice = usedPrice;
175            }
176    
177            public double getCollectiblePrice() {
178                    return _collectiblePrice;
179            }
180    
181            public void setCollectiblePrice(double collectiblePrice) {
182                    _collectiblePrice = collectiblePrice;
183            }
184    
185            public double getThirdPartyNewPrice() {
186                    return _thirdPartyNewPrice;
187            }
188    
189            public void setThirdPartyNewPrice(double thirdPartyNewPrice) {
190                    _thirdPartyNewPrice = thirdPartyNewPrice;
191            }
192    
193            public int getSalesRank() {
194                    return _salesRank;
195            }
196    
197            public void setSalesRank(int salesRank) {
198                    _salesRank = salesRank;
199            }
200    
201            public String getMedia() {
202                    return _media;
203            }
204    
205            public void setMedia(String media) {
206                    _media = media;
207            }
208    
209            public String getAvailability() {
210                    return _availability;
211            }
212    
213            public void setAvailability(String availability) {
214                    _availability = availability;
215            }
216    
217            private String _isbn;
218            private String _productName;
219            private String _catalog;
220            private String[] _authors;
221            private Date _releaseDate;
222            private String _releaseDateAsString;
223            private String _manufacturer;
224            private String _smallImageURL;
225            private String _mediumImageURL;
226            private String _largeImageURL;
227            private double _listPrice;
228            private double _ourPrice;
229            private double _usedPrice;
230            private double _collectiblePrice;
231            private double _thirdPartyNewPrice;
232            private int _salesRank;
233            private String _media;
234            private String _availability;
235    
236    }