1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * Permission is hereby granted, free of charge, to any person obtaining a copy
5    * of this software and associated documentation files (the "Software"), to deal
6    * in the Software without restriction, including without limitation the rights
7    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8    * copies of the Software, and to permit persons to whom the Software is
9    * furnished to do so, subject to the following conditions:
10   *
11   * The above copyright notice and this permission notice shall be included in
12   * all copies or substantial portions of the Software.
13   *
14   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20   * SOFTWARE.
21   */
22  
23  package com.liferay.portlet.amazonrankings.model;
24  
25  import java.io.Serializable;
26  
27  import java.util.Date;
28  
29  /**
30   * <a href="AmazonRankings.java.html"><b><i>View Source</i></b></a>
31   *
32   * @author Brian Wing Shun Chan
33   *
34   */
35  public class AmazonRankings
36      implements Comparable<AmazonRankings>, Serializable {
37  
38      public AmazonRankings(String isbn, String productName, String catalog,
39                                 String[] authors, Date releaseDate,
40                                 String releaseDateAsString, String manufacturer,
41                                 String smallImageURL, String mediumImageURL,
42                                 String largeImageURL, double listPrice,
43                                 double ourPrice, double usedPrice,
44                                 double collectiblePrice,
45                                 double thirdPartyNewPrice, int salesRank,
46                                 String media, String availability) {
47  
48          _isbn = isbn;
49          _productName = productName;
50          _catalog = catalog;
51          _authors = authors;
52          _releaseDate = releaseDate;
53          _releaseDateAsString = releaseDateAsString;
54          _manufacturer = manufacturer;
55          _smallImageURL = smallImageURL;
56          _mediumImageURL = mediumImageURL;
57          _largeImageURL = largeImageURL;
58          _listPrice = listPrice;
59          _ourPrice = ourPrice;
60          _usedPrice = usedPrice;
61          _collectiblePrice = collectiblePrice;
62          _thirdPartyNewPrice = thirdPartyNewPrice;
63          _salesRank = salesRank;
64          _media = media;
65          _availability = availability;
66      }
67  
68      public String getISBN() {
69          return _isbn;
70      }
71  
72      public void setISBN(String isbn) {
73          _isbn = isbn;
74      }
75  
76      public String getProductName() {
77          return _productName;
78      }
79  
80      public void setProductName(String productName) {
81          _productName = productName;
82      }
83  
84      public String getCatalog() {
85          return _catalog;
86      }
87  
88      public void setCatalog(String catalog) {
89          _catalog = catalog;
90      }
91  
92      public String[] getAuthors() {
93          return _authors;
94      }
95  
96      public void setAuthors(String[] authors) {
97          _authors = authors;
98      }
99  
100     public Date getReleaseDate() {
101         return _releaseDate;
102     }
103 
104     public void setReleaseDate(Date releaseDate) {
105         _releaseDate = releaseDate;
106     }
107 
108     public String getReleaseDateAsString() {
109         return _releaseDateAsString;
110     }
111 
112     public void setReleaseDateAsString(String releaseDateAsString) {
113         _releaseDateAsString = releaseDateAsString;
114     }
115 
116     public String getManufacturer() {
117         return _manufacturer;
118     }
119 
120     public void setManufacturer(String manufacturer) {
121         _manufacturer = manufacturer;
122     }
123 
124     public String getSmallImageURL() {
125         return _smallImageURL;
126     }
127 
128     public void setSmallImageURL(String smallImageURL) {
129         _smallImageURL = smallImageURL;
130     }
131 
132     public String getMediumImageURL() {
133         return _mediumImageURL;
134     }
135 
136     public void setMediumImageURL(String mediumImageURL) {
137         _mediumImageURL = mediumImageURL;
138     }
139 
140     public String getLargeImageURL() {
141         return _largeImageURL;
142     }
143 
144     public void setLargeImageURL(String largeImageURL) {
145         _largeImageURL = largeImageURL;
146     }
147 
148     public double getListPrice() {
149         return _listPrice;
150     }
151 
152     public void setListPrice(double listPrice) {
153         _listPrice = listPrice;
154     }
155 
156     public double getOurPrice() {
157         return _ourPrice;
158     }
159 
160     public void setOurPrice(double ourPrice) {
161         _ourPrice = ourPrice;
162     }
163 
164     public double getUsedPrice() {
165         return _usedPrice;
166     }
167 
168     public void setUsedPrice(double usedPrice) {
169         _usedPrice = usedPrice;
170     }
171 
172     public double getCollectiblePrice() {
173         return _collectiblePrice;
174     }
175 
176     public void setCollectiblePrice(double collectiblePrice) {
177         _collectiblePrice = collectiblePrice;
178     }
179 
180     public double getThirdPartyNewPrice() {
181         return _thirdPartyNewPrice;
182     }
183 
184     public void setThirdPartyNewPrice(double thirdPartyNewPrice) {
185         _thirdPartyNewPrice = thirdPartyNewPrice;
186     }
187 
188     public int getSalesRank() {
189         return _salesRank;
190     }
191 
192     public void setSalesRank(int salesRank) {
193         _salesRank = salesRank;
194     }
195 
196     public String getMedia() {
197         return _media;
198     }
199 
200     public void setMedia(String media) {
201         _media = media;
202     }
203 
204     public String getAvailability() {
205         return _availability;
206     }
207 
208     public void setAvailability(String availability) {
209         _availability = availability;
210     }
211 
212     public int compareTo(AmazonRankings amazonRankings) {
213         if (amazonRankings == null) {
214             return -1;
215         }
216 
217         if (getSalesRank() > amazonRankings.getSalesRank()) {
218             return 1;
219         }
220         else if (getSalesRank() < amazonRankings.getSalesRank()) {
221             return -1;
222         }
223         else {
224             return getReleaseDate().compareTo(amazonRankings.getReleaseDate());
225         }
226     }
227 
228     private String _isbn;
229     private String _productName;
230     private String _catalog;
231     private String[] _authors;
232     private Date _releaseDate;
233     private String _releaseDateAsString;
234     private String _manufacturer;
235     private String _smallImageURL;
236     private String _mediumImageURL;
237     private String _largeImageURL;
238     private double _listPrice;
239     private double _ourPrice;
240     private double _usedPrice;
241     private double _collectiblePrice;
242     private double _thirdPartyNewPrice;
243     private int _salesRank;
244     private String _media;
245     private String _availability;
246 
247 }