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