Skip to content
Browse files

Review class added.

  • Loading branch information...
1 parent be28de6 commit 757202cdb868b1e372c8726cf8f0bcc20bda7740 @mchandler committed
View
19 src/main/java/com/rmwebfx/citygridsearch/resources/Place.java
@@ -1,5 +1,9 @@
package com.rmwebfx.citygridsearch.resources;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.citygrid.CGBaseReview;
import com.citygrid.CGException;
import com.citygrid.CityGrid;
import com.citygrid.content.places.detail.CGPlacesDetail;
@@ -17,6 +21,7 @@
private String phone;
private String businessHours;
private int reviewCount;
+ private List<Review> reviews;
public Place() {
super();
@@ -42,9 +47,11 @@ public void initializeByLocationObj(CGPlacesDetailLocation locationObj) {
name = locationObj.getName();
publicId = locationObj.getPublicId();
phone = locationObj.getPhone();
- setAddress();
businessHours = locationObj.getBusinessHours();
reviewCount = locationObj.getReviews().getCount();
+
+ setAddress();
+ setAllReviews();
}
public boolean isSameLocation(Place otherPlace) {
@@ -104,4 +111,14 @@ private void setAddress() {
public PlaceAddress getAddress() {
return address;
}
+
+ public void setAllReviews() {
+ CGBaseReview[] allReviews = locationObj.getReviews().getReviews();
+ reviews = new ArrayList<Review>();
+
+ for (int i = 0; i < allReviews.length; i++) {
+ Review review = new Review(allReviews[i]);
+ reviews.add(review);
+ }
+ }
}
View
34 src/main/java/com/rmwebfx/citygridsearch/resources/Review.java
@@ -0,0 +1,34 @@
+package com.rmwebfx.citygridsearch.resources;
+
+import java.util.Date;
+
+import com.citygrid.CGBaseReview;
+
+public class Review {
+
+ private CGBaseReview reviewObj;
+
+ public Review(CGBaseReview review) {
+ reviewObj = review;
+ }
+
+ public String getTitle() {
+ return reviewObj.getTitle();
+ }
+
+ public String getUrl() {
+ return reviewObj.getUrl().toString();
+ }
+
+ public Date getDate() {
+ return reviewObj.getDate();
+ }
+
+ public int getRating() {
+ return reviewObj.getRating();
+ }
+
+ public int getHelpful() {
+ return reviewObj.getHelpful();
+ }
+}

0 comments on commit 757202c

Please sign in to comment.
Something went wrong with that request. Please try again.