Book Image

Building a RESTful Web Service with Spring

By : Ludovic Dewailly
Book Image

Building a RESTful Web Service with Spring

By: Ludovic Dewailly

Overview of this book

Table of Contents (17 chapters)
Building a RESTful Web Service with Spring
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Room availability


In previous chapters, we discussed the inventory component of our property management service. The next component we will implement is the availability service.

An overview of implementation

The aim of this component is to provide end users and third-party systems with a way to query whether rooms are available during a given period.

We will implement this functionality by looking up all the rooms in our sample property, and overlaying the existing bookings for a given period so as to work out availability. In real systems used in large hotels, more sophisticated algorithms are used to optimize room allocations. In our case, however, a simpler approach is sufficient. So, let's consider the following service interface:

public interface AvailabilityService {

  /**
  * Answers the availability status for the given query.
  *
  * @param query the availability query
  *
  * @return the availability status for each day in the requested period.
  */
  public List<AvailabilityStatus...