@@ -49,11 +49,13 @@ public class QuotesQuickStartScenario implements VrboScenario {
4949 LoggerFactory .getLogger (QuotesQuickStartScenario .class );
5050
5151 /**
52- * The property count to read from the file.
53- * If the first 20 properties are not available when you run this example, it may end with
54- * NO_RESULT_FOUND. In that case, you can adjust the property count to get more properties.
52+ * This field limits the number of line to read from the SDP DownloadURL API Listings file to
53+ * reduce time to run the example.
54+ * If the first 20 properties from the file are not accessible OR available when you run this
55+ * example, it may end with "No accessible property ids found." OR NO_RESULT_FOUND. In that case,
56+ * you can adjust the property count to get more properties.
5557 */
56- private static final int PROPERTY_COUNT = 20 ;
58+ private static final int SAMPLE_ITEMS_RESTRICTION = 20 ;
5759
5860 /**
5961 * A property id to location map. This mocks a cache in this example to store the static content
@@ -82,7 +84,7 @@ public void run() {
8284
8385 private List <String > getPropertyIdsFromDownloadUrl () {
8486 LOGGER .info (
85- "====================== Executing getPropertyIdsFromDownloadUrl == ===================" );
87+ "==================== Executing Step I: getPropertyIdsFromDownloadUrl ===================" );
8688
8789 GetFeedDownloadUrlOperationParams getPropertyIdListParams =
8890 GetFeedDownloadUrlOperationParams .builder ()
@@ -119,7 +121,7 @@ private List<String> getPropertyIdsFromDownloadUrl() {
119121 LOGGER .info ("Accessible Vrbo Property Ids: {}" , propertyIds );
120122
121123 LOGGER .info (
122- "======================= getPropertyIdsFromDownloadUrl Executed == ====================" );
124+ "==================== Step I: getPropertyIdsFromDownloadUrl Executed ====================" );
123125 return propertyIds ;
124126 }
125127
@@ -130,7 +132,7 @@ private List<String> getPropertyIdsFromDownloadUrl() {
130132 */
131133 private void cachePropertyLocationFromDownloadUrl (List <String > propertyIds ) {
132134 LOGGER .info (
133- "====================== Executing CachePropertyLocationFromDownloadUrl === ===============" );
135+ "================ Executing Step II: CachePropertyLocationFromDownloadUrl ===============" );
134136 GetFeedDownloadUrlOperationParams getPropertyLocationParams =
135137 GetFeedDownloadUrlOperationParams .builder ()
136138 // Use the type LOCATIONS to get the address of accessible properties.
@@ -156,7 +158,7 @@ private void cachePropertyLocationFromDownloadUrl(List<String> propertyIds) {
156158 cachePropertyLocationFromLocationsFile (locationsDownloadUrl , propertyIds );
157159
158160 LOGGER .info (
159- "===================== CachePropertyLocationFromDownloadUrl Executed ===== ===============" );
161+ "================= Step II: CachePropertyLocationFromDownloadUrl Executed ===============" );
160162 }
161163
162164 /**
@@ -167,7 +169,7 @@ private void cachePropertyLocationFromDownloadUrl(List<String> propertyIds) {
167169 */
168170 private LodgingQuotesResponse getPropertyPriceFromLodgingQuotes (List <String > propertyIds ) {
169171 LOGGER .info (
170- "====================== Executing GetPropertyPriceFromLodgingQuotes ===== ================" );
172+ "================= Executing Step III: GetPropertyPriceFromLodgingQuotes ================" );
171173
172174 // Build the occupancy
173175 ArrayList <Room > rooms = new ArrayList <>();
@@ -195,7 +197,7 @@ private LodgingQuotesResponse getPropertyPriceFromLodgingQuotes(List<String> pro
195197 .getData ();
196198
197199 LOGGER .info (
198- "====================== GetPropertyPriceFromLodgingQuotes Executed ==== =================" );
200+ "================= Step III: GetPropertyPriceFromLodgingQuotes Executed =================" );
199201 return lodgingQuotesResponse ;
200202 }
201203
@@ -223,15 +225,16 @@ private List<String> getPropertyIdsFromVacationRentalFile(String downloadUrl) {
223225 try (BufferedReader reader = new BufferedReader (new InputStreamReader (zipStream ))) {
224226 String line ;
225227 ObjectMapper objectMapper = new ObjectMapper ();
226- while ((line = reader .readLine ()) != null && propertyIds .size () < PROPERTY_COUNT ) {
228+ while ((line = reader .readLine ()) != null
229+ && propertyIds .size () < SAMPLE_ITEMS_RESTRICTION ) {
227230 // Parse the property id from the json object
228231 // An example json line from the jsonl file:
229232 /*
230233 {
231234 "propertyId": {
232- "expedia": "75032362 ",
233- "hcom": "2402035584 ",
234- "vrbo": "731.2068610.2244521 "
235+ "expedia": "1234567 ",
236+ "hcom": "987654321 ",
237+ "vrbo": "123.1234567.7654321 "
235238 },
236239 "country": "France",
237240 "propertySize": {
@@ -320,24 +323,24 @@ private void cachePropertyLocationFromLocationsFile(String locationsDownloadUrl,
320323 /*
321324 {
322325 "propertyId": {
323- "expedia": "108502000 ",
324- "hcom": "3473064000 ",
325- "vrbo": "321.4176310.4750480 "
326+ "expedia": "1234567 ",
327+ "hcom": "987654321 ",
328+ "vrbo": "123.1234567.1234567 "
326329 },
327330 "propertyType": {
328331 "id": 16,
329332 "name": "Apartment"
330333 },
331- "propertyName": "Pine Brook 416 I Corporate 1.5Br Apartment ! Pool ",
334+ "propertyName": "Vrbo Property Name ",
332335 "address1": "",
333336 "address2": "",
334337 "city": "Newark",
335338 "province": "Delaware",
336339 "country": "United States",
337340 "postalCode": "19711",
338341 "geoLocation": {
339- "latitude": "39.694889 ",
340- "longitude": "-75.749393 ",
342+ "latitude": "10.999999 ",
343+ "longitude": "-10.999999 ",
341344 "obfuscated": false
342345 },
343346 "locationAttribute": {
@@ -403,6 +406,7 @@ private void cachePropertyLocationFromLocationsFile(String locationsDownloadUrl,
403406 * @param lodgingQuotesResponse The response of the Lodging Quotes API.
404407 */
405408 private static void displayResult (LodgingQuotesResponse lodgingQuotesResponse ) {
409+ LOGGER .info ("======================= Executing Step IV: DisplayResult =======================" );
406410 if (lodgingQuotesResponse == null || lodgingQuotesResponse .getProperties () == null
407411 || lodgingQuotesResponse .getProperties ().isEmpty ()) {
408412 throw new IllegalStateException ("No properties found." );
@@ -452,12 +456,12 @@ private static void displayResult(LodgingQuotesResponse lodgingQuotesResponse) {
452456 roomType .getRatePlans ().get (0 ).getCancellationPolicy ().getFreeCancellation ());
453457 }
454458 if (roomType .getLinks () != null ) {
455- // To get the deeplink to the Expedia Web Search Result Page
459+ // To get the deeplink to the website Search Result Page
456460 if (roomType .getLinks ().getWebSearchResult () != null ) {
457461 LOGGER .info ("WebSearchResult Link: {}" ,
458462 roomType .getLinks ().getWebSearchResult ().getHref ());
459463 }
460- // To get the deeplink to the Expedia Web Details Page
464+ // To get the deeplink to the website Details Page
461465 if (roomType .getLinks ().getWebDetails () != null ) {
462466 LOGGER .info ("WebDetails Link: {}" , roomType .getLinks ().getWebDetails ().getHref ());
463467 }
@@ -466,5 +470,6 @@ private static void displayResult(LodgingQuotesResponse lodgingQuotesResponse) {
466470 LOGGER .info (
467471 "==================================== Property End ====================================" );
468472 });
473+ LOGGER .info ("======================= Step IV: DisplayResult Executed ========================" );
469474 }
470475}
0 commit comments