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[] getAuthors() {
074                    return _authors;
075            }
076    
077            public String getAvailability() {
078                    return _availability;
079            }
080    
081            public String getCatalog() {
082                    return _catalog;
083            }
084    
085            public double getCollectiblePrice() {
086                    return _collectiblePrice;
087            }
088    
089            public String getISBN() {
090                    return _isbn;
091            }
092    
093            public String getLargeImageURL() {
094                    return _largeImageURL;
095            }
096    
097            public double getListPrice() {
098                    return _listPrice;
099            }
100    
101            public String getManufacturer() {
102                    return _manufacturer;
103            }
104    
105            public String getMedia() {
106                    return _media;
107            }
108    
109            public String getMediumImageURL() {
110                    return _mediumImageURL;
111            }
112    
113            public double getOurPrice() {
114                    return _ourPrice;
115            }
116    
117            public String getProductName() {
118                    return _productName;
119            }
120    
121            public Date getReleaseDate() {
122                    return _releaseDate;
123            }
124    
125            public String getReleaseDateAsString() {
126                    return _releaseDateAsString;
127            }
128    
129            public int getSalesRank() {
130                    return _salesRank;
131            }
132    
133            public String getSmallImageURL() {
134                    return _smallImageURL;
135            }
136    
137            public double getThirdPartyNewPrice() {
138                    return _thirdPartyNewPrice;
139            }
140    
141            public double getUsedPrice() {
142                    return _usedPrice;
143            }
144    
145            public void setAuthors(String[] authors) {
146                    _authors = authors;
147            }
148    
149            public void setAvailability(String availability) {
150                    _availability = availability;
151            }
152    
153            public void setCatalog(String catalog) {
154                    _catalog = catalog;
155            }
156    
157            public void setCollectiblePrice(double collectiblePrice) {
158                    _collectiblePrice = collectiblePrice;
159            }
160    
161            public void setISBN(String isbn) {
162                    _isbn = isbn;
163            }
164    
165            public void setLargeImageURL(String largeImageURL) {
166                    _largeImageURL = largeImageURL;
167            }
168    
169            public void setListPrice(double listPrice) {
170                    _listPrice = listPrice;
171            }
172    
173            public void setManufacturer(String manufacturer) {
174                    _manufacturer = manufacturer;
175            }
176    
177            public void setMedia(String media) {
178                    _media = media;
179            }
180    
181            public void setMediumImageURL(String mediumImageURL) {
182                    _mediumImageURL = mediumImageURL;
183            }
184    
185            public void setOurPrice(double ourPrice) {
186                    _ourPrice = ourPrice;
187            }
188    
189            public void setProductName(String productName) {
190                    _productName = productName;
191            }
192    
193            public void setReleaseDate(Date releaseDate) {
194                    _releaseDate = releaseDate;
195            }
196    
197            public void setReleaseDateAsString(String releaseDateAsString) {
198                    _releaseDateAsString = releaseDateAsString;
199            }
200    
201            public void setSalesRank(int salesRank) {
202                    _salesRank = salesRank;
203            }
204    
205            public void setSmallImageURL(String smallImageURL) {
206                    _smallImageURL = smallImageURL;
207            }
208    
209            public void setThirdPartyNewPrice(double thirdPartyNewPrice) {
210                    _thirdPartyNewPrice = thirdPartyNewPrice;
211            }
212    
213            public void setUsedPrice(double usedPrice) {
214                    _usedPrice = usedPrice;
215            }
216    
217            private String[] _authors;
218            private String _availability;
219            private String _catalog;
220            private double _collectiblePrice;
221            private String _isbn;
222            private String _largeImageURL;
223            private double _listPrice;
224            private String _manufacturer;
225            private String _media;
226            private String _mediumImageURL;
227            private double _ourPrice;
228            private String _productName;
229            private Date _releaseDate;
230            private String _releaseDateAsString;
231            private int _salesRank;
232            private String _smallImageURL;
233            private double _thirdPartyNewPrice;
234            private double _usedPrice;
235    
236    }