Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added country based analytics to main forecast api
- Loading branch information
Showing
4 changed files
with
133 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
src/main/java/edu/hackathon/rest/domain/AnalyticsWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package edu.hackathon.rest.domain; | ||
|
||
import java.util.List; | ||
|
||
public class AnalyticsWrapper { | ||
|
||
private List<BookingAnalytics> bookingAnalyticsList; | ||
|
||
private List<CountryAnalytics> countryAnalyticsList; | ||
|
||
/** | ||
* @return the bookingAnalyticsList | ||
*/ | ||
public List<BookingAnalytics> getBookingAnalyticsList() { | ||
return bookingAnalyticsList; | ||
} | ||
|
||
/** | ||
* @param bookingAnalyticsList the bookingAnalyticsList to set | ||
*/ | ||
public void setBookingAnalyticsList(List<BookingAnalytics> bookingAnalyticsList) { | ||
this.bookingAnalyticsList = bookingAnalyticsList; | ||
} | ||
|
||
/** | ||
* @return the countryAnalyticsList | ||
*/ | ||
public List<CountryAnalytics> getCountryAnalyticsList() { | ||
return countryAnalyticsList; | ||
} | ||
|
||
/** | ||
* @param countryAnalyticsList the countryAnalyticsList to set | ||
*/ | ||
public void setCountryAnalyticsList(List<CountryAnalytics> countryAnalyticsList) { | ||
this.countryAnalyticsList = countryAnalyticsList; | ||
} | ||
|
||
|
||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/edu/hackathon/rest/domain/CountryAnalytics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package edu.hackathon.rest.domain; | ||
|
||
import java.math.BigInteger; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public class CountryAnalytics extends AbstractAnalyticsItem { | ||
|
||
@JsonProperty | ||
private String name; | ||
|
||
@JsonProperty | ||
private String code; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getCode() { | ||
return code; | ||
} | ||
|
||
public void setCode(String code) { | ||
this.code = code; | ||
} | ||
|
||
public CountryAnalytics(BigInteger ancillaryCount, BigInteger bookingCount, Price ancillaryPrice, Price bookingPrice, String code, String name) { | ||
this.setAncillaryCount(ancillaryCount); | ||
this.setBookingCount(bookingCount); | ||
this.setBookingPrice(bookingPrice); | ||
this.setAncillaryPrice(ancillaryPrice); | ||
this.code = code; | ||
this.name = name; | ||
} | ||
|
||
public void updateNewDetails(Country country) { | ||
this.addBookingCount(country.getBookingCount()); | ||
this.addAncillaryCount(country.getAncillaryCount()); | ||
this.updateAncillaryPrice(country.getAncillaryPrice()); | ||
this.updateBookingPrice(country.getBookingPrice()); | ||
} | ||
|
||
} |