1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    *
5    *
6    *
7    * The contents of this file are subject to the terms of the Liferay Enterprise
8    * Subscription License ("License"). You may not use this file except in
9    * compliance with the License. You can obtain a copy of the License by
10   * contacting Liferay, Inc. See the License for the specific language governing
11   * permissions and limitations under the License, including but not limited to
12   * distribution rights 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  public class AmazonRankings
35      implements Comparable<AmazonRankings>, 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(AmazonRankings amazonRankings) {
212         if (amazonRankings == null) {
213             return -1;
214         }
215 
216         if (getSalesRank() > amazonRankings.getSalesRank()) {
217             return 1;
218         }
219         else if (getSalesRank() < amazonRankings.getSalesRank()) {
220             return -1;
221         }
222         else {
223             return getReleaseDate().compareTo(amazonRankings.getReleaseDate());
224         }
225     }
226 
227     private String _isbn;
228     private String _productName;
229     private String _catalog;
230     private String[] _authors;
231     private Date _releaseDate;
232     private String _releaseDateAsString;
233     private String _manufacturer;
234     private String _smallImageURL;
235     private String _mediumImageURL;
236     private String _largeImageURL;
237     private double _listPrice;
238     private double _ourPrice;
239     private double _usedPrice;
240     private double _collectiblePrice;
241     private double _thirdPartyNewPrice;
242     private int _salesRank;
243     private String _media;
244     private String _availability;
245 
246 }