1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.amazonrankings.model;
16  
17  import java.io.Serializable;
18  
19  import java.util.Date;
20  
21  /**
22   * <a href="AmazonRankings.java.html"><b><i>View Source</i></b></a>
23   *
24   * @author Brian Wing Shun Chan
25   */
26  public class AmazonRankings
27      implements Comparable<AmazonRankings>, Serializable {
28  
29      public AmazonRankings(String isbn, String productName, String catalog,
30                                 String[] authors, Date releaseDate,
31                                 String releaseDateAsString, String manufacturer,
32                                 String smallImageURL, String mediumImageURL,
33                                 String largeImageURL, double listPrice,
34                                 double ourPrice, double usedPrice,
35                                 double collectiblePrice,
36                                 double thirdPartyNewPrice, int salesRank,
37                                 String media, String availability) {
38  
39          _isbn = isbn;
40          _productName = productName;
41          _catalog = catalog;
42          _authors = authors;
43          _releaseDate = releaseDate;
44          _releaseDateAsString = releaseDateAsString;
45          _manufacturer = manufacturer;
46          _smallImageURL = smallImageURL;
47          _mediumImageURL = mediumImageURL;
48          _largeImageURL = largeImageURL;
49          _listPrice = listPrice;
50          _ourPrice = ourPrice;
51          _usedPrice = usedPrice;
52          _collectiblePrice = collectiblePrice;
53          _thirdPartyNewPrice = thirdPartyNewPrice;
54          _salesRank = salesRank;
55          _media = media;
56          _availability = availability;
57      }
58  
59      public String getISBN() {
60          return _isbn;
61      }
62  
63      public void setISBN(String isbn) {
64          _isbn = isbn;
65      }
66  
67      public String getProductName() {
68          return _productName;
69      }
70  
71      public void setProductName(String productName) {
72          _productName = productName;
73      }
74  
75      public String getCatalog() {
76          return _catalog;
77      }
78  
79      public void setCatalog(String catalog) {
80          _catalog = catalog;
81      }
82  
83      public String[] getAuthors() {
84          return _authors;
85      }
86  
87      public void setAuthors(String[] authors) {
88          _authors = authors;
89      }
90  
91      public Date getReleaseDate() {
92          return _releaseDate;
93      }
94  
95      public void setReleaseDate(Date releaseDate) {
96          _releaseDate = releaseDate;
97      }
98  
99      public String getReleaseDateAsString() {
100         return _releaseDateAsString;
101     }
102 
103     public void setReleaseDateAsString(String releaseDateAsString) {
104         _releaseDateAsString = releaseDateAsString;
105     }
106 
107     public String getManufacturer() {
108         return _manufacturer;
109     }
110 
111     public void setManufacturer(String manufacturer) {
112         _manufacturer = manufacturer;
113     }
114 
115     public String getSmallImageURL() {
116         return _smallImageURL;
117     }
118 
119     public void setSmallImageURL(String smallImageURL) {
120         _smallImageURL = smallImageURL;
121     }
122 
123     public String getMediumImageURL() {
124         return _mediumImageURL;
125     }
126 
127     public void setMediumImageURL(String mediumImageURL) {
128         _mediumImageURL = mediumImageURL;
129     }
130 
131     public String getLargeImageURL() {
132         return _largeImageURL;
133     }
134 
135     public void setLargeImageURL(String largeImageURL) {
136         _largeImageURL = largeImageURL;
137     }
138 
139     public double getListPrice() {
140         return _listPrice;
141     }
142 
143     public void setListPrice(double listPrice) {
144         _listPrice = listPrice;
145     }
146 
147     public double getOurPrice() {
148         return _ourPrice;
149     }
150 
151     public void setOurPrice(double ourPrice) {
152         _ourPrice = ourPrice;
153     }
154 
155     public double getUsedPrice() {
156         return _usedPrice;
157     }
158 
159     public void setUsedPrice(double usedPrice) {
160         _usedPrice = usedPrice;
161     }
162 
163     public double getCollectiblePrice() {
164         return _collectiblePrice;
165     }
166 
167     public void setCollectiblePrice(double collectiblePrice) {
168         _collectiblePrice = collectiblePrice;
169     }
170 
171     public double getThirdPartyNewPrice() {
172         return _thirdPartyNewPrice;
173     }
174 
175     public void setThirdPartyNewPrice(double thirdPartyNewPrice) {
176         _thirdPartyNewPrice = thirdPartyNewPrice;
177     }
178 
179     public int getSalesRank() {
180         return _salesRank;
181     }
182 
183     public void setSalesRank(int salesRank) {
184         _salesRank = salesRank;
185     }
186 
187     public String getMedia() {
188         return _media;
189     }
190 
191     public void setMedia(String media) {
192         _media = media;
193     }
194 
195     public String getAvailability() {
196         return _availability;
197     }
198 
199     public void setAvailability(String availability) {
200         _availability = availability;
201     }
202 
203     public int compareTo(AmazonRankings amazonRankings) {
204         if (amazonRankings == null) {
205             return -1;
206         }
207 
208         if (getSalesRank() > amazonRankings.getSalesRank()) {
209             return 1;
210         }
211         else if (getSalesRank() < amazonRankings.getSalesRank()) {
212             return -1;
213         }
214         else {
215             return getReleaseDate().compareTo(amazonRankings.getReleaseDate());
216         }
217     }
218 
219     private String _isbn;
220     private String _productName;
221     private String _catalog;
222     private String[] _authors;
223     private Date _releaseDate;
224     private String _releaseDateAsString;
225     private String _manufacturer;
226     private String _smallImageURL;
227     private String _mediumImageURL;
228     private String _largeImageURL;
229     private double _listPrice;
230     private double _ourPrice;
231     private double _usedPrice;
232     private double _collectiblePrice;
233     private double _thirdPartyNewPrice;
234     private int _salesRank;
235     private String _media;
236     private String _availability;
237 
238 }