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