1   /**
2    * Copyright (c) 2000-2007 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 implements Comparable, Serializable {
36  
37      public AmazonRankings(String isbn, String productName, String catalog,
38                                 String[] authors, Date releaseDate,
39                                 String releaseDateAsString, String manufacturer,
40                                 String smallImageURL, String mediumImageURL,
41                                 String largeImageURL, double listPrice,
42                                 double ourPrice, double usedPrice,
43                                 double collectiblePrice,
44                                 double thirdPartyNewPrice, int salesRank,
45                                 String media, String availability) {
46  
47          _isbn = isbn;
48          _productName = productName;
49          _catalog = catalog;
50          _authors = authors;
51          _releaseDate = releaseDate;
52          _releaseDateAsString = releaseDateAsString;
53          _manufacturer = manufacturer;
54          _smallImageURL = smallImageURL;
55          _mediumImageURL = mediumImageURL;
56          _largeImageURL = largeImageURL;
57          _listPrice = listPrice;
58          _ourPrice = ourPrice;
59          _usedPrice = usedPrice;
60          _collectiblePrice = collectiblePrice;
61          _thirdPartyNewPrice = thirdPartyNewPrice;
62          _salesRank = salesRank;
63          _media = media;
64          _availability = availability;
65      }
66  
67      public String getISBN() {
68          return _isbn;
69      }
70  
71      public void setISBN(String isbn) {
72          _isbn = isbn;
73      }
74  
75      public String getProductName() {
76          return _productName;
77      }
78  
79      public void setProductName(String productName) {
80          _productName = productName;
81      }
82  
83      public String getCatalog() {
84          return _catalog;
85      }
86  
87      public void setCatalog(String catalog) {
88          _catalog = catalog;
89      }
90  
91      public String[] getAuthors() {
92          return _authors;
93      }
94  
95      public void setAuthors(String[] authors) {
96          _authors = authors;
97      }
98  
99      public Date getReleaseDate() {
100         return _releaseDate;
101     }
102 
103     public void setReleaseDate(Date releaseDate) {
104         _releaseDate = releaseDate;
105     }
106 
107     public String getReleaseDateAsString() {
108         return _releaseDateAsString;
109     }
110 
111     public void setReleaseDateAsString(String releaseDateAsString) {
112         _releaseDateAsString = releaseDateAsString;
113     }
114 
115     public String getManufacturer() {
116         return _manufacturer;
117     }
118 
119     public void setManufacturer(String manufacturer) {
120         _manufacturer = manufacturer;
121     }
122 
123     public String getSmallImageURL() {
124         return _smallImageURL;
125     }
126 
127     public void setSmallImageURL(String smallImageURL) {
128         _smallImageURL = smallImageURL;
129     }
130 
131     public String getMediumImageURL() {
132         return _mediumImageURL;
133     }
134 
135     public void setMediumImageURL(String mediumImageURL) {
136         _mediumImageURL = mediumImageURL;
137     }
138 
139     public String getLargeImageURL() {
140         return _largeImageURL;
141     }
142 
143     public void setLargeImageURL(String largeImageURL) {
144         _largeImageURL = largeImageURL;
145     }
146 
147     public double getListPrice() {
148         return _listPrice;
149     }
150 
151     public void setListPrice(double listPrice) {
152         _listPrice = listPrice;
153     }
154 
155     public double getOurPrice() {
156         return _ourPrice;
157     }
158 
159     public void setOurPrice(double ourPrice) {
160         _ourPrice = ourPrice;
161     }
162 
163     public double getUsedPrice() {
164         return _usedPrice;
165     }
166 
167     public void setUsedPrice(double usedPrice) {
168         _usedPrice = usedPrice;
169     }
170 
171     public double getCollectiblePrice() {
172         return _collectiblePrice;
173     }
174 
175     public void setCollectiblePrice(double collectiblePrice) {
176         _collectiblePrice = collectiblePrice;
177     }
178 
179     public double getThirdPartyNewPrice() {
180         return _thirdPartyNewPrice;
181     }
182 
183     public void setThirdPartyNewPrice(double thirdPartyNewPrice) {
184         _thirdPartyNewPrice = thirdPartyNewPrice;
185     }
186 
187     public int getSalesRank() {
188         return _salesRank;
189     }
190 
191     public void setSalesRank(int salesRank) {
192         _salesRank = salesRank;
193     }
194 
195     public String getMedia() {
196         return _media;
197     }
198 
199     public void setMedia(String media) {
200         _media = media;
201     }
202 
203     public String getAvailability() {
204         return _availability;
205     }
206 
207     public void setAvailability(String availability) {
208         _availability = availability;
209     }
210 
211     public int compareTo(Object obj) {
212         if (obj == null) {
213             return -1;
214         }
215 
216         AmazonRankings amazonRankings = (AmazonRankings)obj;
217 
218         if (getSalesRank() > amazonRankings.getSalesRank()) {
219             return 1;
220         }
221         else if (getSalesRank() < amazonRankings.getSalesRank()) {
222             return -1;
223         }
224         else {
225             return getReleaseDate().compareTo(amazonRankings.getReleaseDate());
226         }
227     }
228 
229     private String _isbn;
230     private String _productName;
231     private String _catalog;
232     private String[] _authors;
233     private Date _releaseDate;
234     private String _releaseDateAsString;
235     private String _manufacturer;
236     private String _smallImageURL;
237     private String _mediumImageURL;
238     private String _largeImageURL;
239     private double _listPrice;
240     private double _ourPrice;
241     private double _usedPrice;
242     private double _collectiblePrice;
243     private double _thirdPartyNewPrice;
244     private int _salesRank;
245     private String _media;
246     private String _availability;
247 
248 }