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