Class AccommodationHelper
java.lang.Object
de.hybris.platform.coreairlineaccommodationocc.helper.AccommodationHelper
Accommodation utilities methods.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected PassengerTypeQuantityDatacreatePassengerTypeQuantityData(int qty, PassengerTypeData passengerTypeData) CreatesPassengerTypeQuantityData.protected RoomStayCandidateDatacreateRoomStayCandidateData(int roomRefNumber, List<PassengerTypeQuantityData> passengerTypeQuantities) CreatesRoomStayCandidateData.createRoomStayCandidates(String roomGuestOccupancy) CreatesRoomStayCandidateData.createRoomStayCandidates(List<String> roomOccupancies) CreatesRoomStayCandidateData.createStayDateRangeData(String checkInDate, String checkOutDate, String format) CreatesStayDateRangeData.protected PassengerTypeDatafindPassengerTypeByCode(List<PassengerTypeData> passengerTypes, String ptcCode) ReturnsPassengerTypeDataby given passenger type code.getPassengerTypeDuplicates(List<PassengerTypeQuantityData> passengerTypeQuantities) Returns guest types that are duplicated in given occupanciesprotected DateParse string to date.protected voidvalidateAdultsPerRoom(RoomStayCandidateData roomStayCandidateData) Validates if room stay candidate contains at least one adult.protected voidvalidatePassengerTypeQuantities(int roomRefNumber, List<PassengerTypeQuantityData> passengerTypeQuantities) Validates if room doesn't contain duplicated guest occupancies.voidvalidateRoomStayCandidates(List<RoomStayCandidateData> roomStayCandidates) Validates if room stay candidates meet business restrictions.protected voidvalidateStayDuration(long rangeOfStay) Validates if stay duration not greater then the maximum stay duration.
-
Constructor Details
-
AccommodationHelper
public AccommodationHelper()
-
-
Method Details
-
createRoomStayCandidates
CreatesRoomStayCandidateData.- Parameters:
roomGuestOccupancy- the room guest occupancy- Returns:
- room stay candidates
-
validateRoomStayCandidates
public void validateRoomStayCandidates(List<RoomStayCandidateData> roomStayCandidates) throws InvalidRoomStayWsException Validates if room stay candidates meet business restrictions.- Parameters:
roomStayCandidates- the room stay candidates to validate- Throws:
InvalidRoomStayWsException- if room stay candidates contain invalid entry
-
createRoomStayCandidates
CreatesRoomStayCandidateData.- Parameters:
roomOccupancies- the room guest occupancies- Returns:
- room stay candidates
-
createStayDateRangeData
public StayDateRangeData createStayDateRangeData(String checkInDate, String checkOutDate, String format) throws InvalidDateWsException CreatesStayDateRangeData.- Parameters:
checkInDate- the check in datecheckOutDate- the check out dateformat- the format- Returns:
- stay date range data
- Throws:
InvalidDateWsException- if provided dates are invalid
-
validateAdultsPerRoom
protected void validateAdultsPerRoom(RoomStayCandidateData roomStayCandidateData) throws InvalidRoomStayWsException Validates if room stay candidate contains at least one adult.- Parameters:
roomStayCandidateData- the room stay candidate data to validate- Throws:
InvalidRoomStayWsException- if room stay candidate is invalid
-
parseDate
Parse string to date.- Parameters:
date- the dateformat- the format- Returns:
- date
- Throws:
InvalidDateWsException- if date format is invalid
-
validateStayDuration
Validates if stay duration not greater then the maximum stay duration.- Parameters:
rangeOfStay- the range of stay- Throws:
InvalidDateWsException- if range of stay is invalid
-
createRoomStayCandidateData
protected RoomStayCandidateData createRoomStayCandidateData(int roomRefNumber, List<PassengerTypeQuantityData> passengerTypeQuantities) CreatesRoomStayCandidateData.- Parameters:
roomRefNumber- the room reference numberpassengerTypeQuantities- the passenger type quantities- Returns:
- room stay candidate data
-
getPassengerTypeDuplicates
protected List<String> getPassengerTypeDuplicates(List<PassengerTypeQuantityData> passengerTypeQuantities) Returns guest types that are duplicated in given occupancies- Parameters:
passengerTypeQuantities- the passenger type quantities- Returns:
- duplicated guest types or empty
-
validatePassengerTypeQuantities
protected void validatePassengerTypeQuantities(int roomRefNumber, List<PassengerTypeQuantityData> passengerTypeQuantities) throws RequestParameterWsException Validates if room doesn't contain duplicated guest occupancies.- Parameters:
roomRefNumber- the room reference numberpassengerTypeQuantities- the guest occupancies- Throws:
RequestParameterWsException- if room contains duplicated guest occupancies
-
createPassengerTypeQuantityData
protected PassengerTypeQuantityData createPassengerTypeQuantityData(int qty, PassengerTypeData passengerTypeData) CreatesPassengerTypeQuantityData.- Parameters:
qty- the quantitypassengerTypeData- the passenger type data- Returns:
- passenger type quantity data
-
findPassengerTypeByCode
protected PassengerTypeData findPassengerTypeByCode(List<PassengerTypeData> passengerTypes, String ptcCode) throws InvalidPtcWsException ReturnsPassengerTypeDataby given passenger type code.- Parameters:
passengerTypes- the source list of passenger typesptcCode- the target passenger type code- Returns:
- passenger type data
- Throws:
InvalidPtcWsException- if passenger type code is invalid
-