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 ...

Get Building a RESTful Web Service with Spring now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.