September 20, 2017

Hotel Supplier Integration Java Design pattern


Hotel Supplier Integration Java Design pattern


Hotel.java

package com.travelport.hotels;

public class Hotel {

String name;
String code;
String chain;
String description;
/**
* @return the name
*/
public String getName() {
return name;
}
/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}
/**
* @return the code
*/
public String getCode() {
return code;
}
/**
* @param code the code to set
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return the chain
*/
public String getChain() {
return chain;
}
/**
* @param chain the chain to set
*/
public void setChain(String chain) {
this.chain = chain;
}
/**
* @return the description
*/
public String getDescription() {
return description;
}
/**
* @param description the description to set
*/
public void setDescription(String description) {
this.description = description;
}



}

Room.java

package com.travelport.hotels;

public class Room {

private String room;
private String code;
private String ph;
/**
* @return the room
*/
public String getRoom() {
return room;
}
/**
* @param room the room to set
*/
public void setRoom(String room) {
this.room = room;
}
/**
* @return the code
*/
public String getCode() {
return code;
}
/**
* @param code the code to set
*/
public void setCode(String code) {
this.code = code;
}
/**
* @return the ph
*/
public String getPh() {
return ph;
}
/**
* @param ph the ph to set
*/
public void setPh(String ph) {
this.ph = ph;
}
}

Mainclass

/**
 *
 */
package com.travelport.hotels;

/**
 * @author belazy
 *
 */
public class MainHotelsClass {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
SearchHotels srcH = new SearchHotels();
srcH.searchHotel();
SearchRoom req = new SearchRoom();
req.searchRoom();

}

}


SearchHotels

/**
 * 
 */
package com.travelport.hotels;

/**
 * @author nijesh
 *
 */
public class SearchHotels extends TravelPortAbstract{



/* private Hotel getHotelProperties(Hotel hotel) {
// TODO Auto-generated method stub
hotel.setName("Mariot hotel");
hotel.setCode("ABC");
hotel.setDescription("hotel Desctiption");
hotel.setChain("CH1");
return hotel;
}*/

public void searchHotel() {
// TODO Auto-generated method stub
Hotel hotel = new Hotel();
hotel = getHotelProperties(hotel);
System.out.println("auth: "+isAuthenticated());
System.out.println("code: "+hotel.getCode());
}



}


SearchRoom

/**
 * 
 */
package com.travelport.hotels;

/**
 * @author belazy
 *
 */
public class SearchRoom extends TravelPortAbstract {

public void searchRoom() {
// TODO Auto-generated method stub
Hotel hotel = new Hotel();
Room room = new Room();
hotel = getHotelProperties(hotel);
room = getRoom(room);
System.out.println("room :"+room.getCode());
System.out.println("hotel :"+hotel.getCode());
}



}


TravelPortAbstract class

/**
 * 
 */
package com.travelport.hotels;

/**
 * @author nijesh
 *
 */
public abstract class TravelPortAbstract {
protected Hotel getHotelProperties(Hotel hotel) {
// TODO Auto-generated method stub
hotel.setName("Mariot hotel");
hotel.setCode("ABC");
hotel.setDescription("hotel Desctiption");
hotel.setChain("CH1");
return hotel;
}
protected boolean isAuthenticated(){
return true;
}
protected Room getRoom(Room room) {
// TODO Auto-generated method stub
room.setCode("R12");
room.setRoom("Single bed");
return room;
}

}

https://support.travelport.com/webhelp/uapi/Content/Hotel/Shared_Hotel_Topics/Hotel%20Payment%20Types_Pre-Pay_and_Post-Pay.htm

https://support.travelport.com/webhelp/uapi/Content/Hotel/Hotel_TRM/TRM%20Synchronous%20Hotel%20Search.htm

https://support.travelport.com/webhelp/uapi/Content/Hotel/Shared_Hotel_Topics/Hotel%20Payment%20Types_Guarantee_%20Deposit_Pre-Pay.htm




http://javabelazy.blogspot.in/

No comments:

Post a Comment

Your feedback may help others !!!

Facebook comments