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