Skip to main content
Skip table of contents

ReservationCollectionTimeSlotFinder

Finds timeslots for a list of reservation collections.

Methods

findTimeSlots
Description

This method takes a list of reservation collections and a timeslot context. It will return a list of timeslots matching that context where at least one of those collections is avaialble. Each slot also contains a subset of the reservation collections.

Signature
CODE
global static B25.ReservationCollectionTimeSlotFinder.Result getTimeRanges(B25.ReservationCollectionTimeSlotFinder.Context context)
Parameters
CODE
B25.ReservationCollectionTimeSlotFinder.Context

An instance of B25.ReservationCollectionTimeSlotFinder.Context. This class wraps the input parameters, such as the collections to check, and timeSlotContext

Return Type
CODE
B25.ReservationCollectionTimeSlotFinder.Result

An instance of B25.ReservationCollectionTimeSlotFinder.Result. This contains a list of timeslots matching that context where at least one of those collections is avaialble. Each slot also contains a subset of the reservation collections.

Inner Classes

Context
Description

This class wraps the input parameters: a list of reservation collections, and a timeslot context.

Properties
CODE
List<ReservationCollection> collectionsToCheck

A list of Reservation Collections you want to conflict check for each timeslot.

CODE
TimeSlotGenerator.Context timeSlotContext;

Definition of the shape and range of the timeslots.

Result
Description

This class wraps the result, which contains a list of available timeslots.

Properties
CODE
List<TimeSlotWithReservationCollections> timeSlots;

A list of available timeslots. Each timeslot contains a list of ReservationCollections that would be available in that timeslot in the reservationCollections property.

Example

This example shows how you can use the class in your own code.

JAVA
// Create the context that determines the range and size of the slots.
B25.TimeSlotGenerator.Context timeSlotContext = new B25.TimeSlotGenerator.Context();
timeSlotContext.startOfRange = Datetime.newInstance(2024, 01, 01, 0, 0, 0);
timeSlotContext.endOfRange = Datetime.newInstance(2024, 01, 07, 0, 0, 0);
timeSlotContext.duration = 15;

// Create the input for the method
B25.ReservationCollectionTimeSlotFinder.Context findContext = new B25.ReservationCollectionTimeSlotFinder.Context();
findContext.collectionsToCheck = <List of collections most likely from ReservationBlueprints>
findContext.timeSlotContext = timeSlotContext;

// Call the method.
B25.ReservationCollectionTimeSlotFinder.Result result = B25.ReservationCollectionTimeSlotFinder.findTimeSlots(findContext);

// Do something witht he results for now just print them to the debug log.
for (B25.TimeSlotWithReservationCollections slot : result.timeSlots) {
    System.debug('available time slot from ' + timeSlot.startDatetime
        + ' until ' + timeSlot.endDatetime);
    System.debug('Possible Reservations');
    for (B25.ReservationCollection reservationCollection : timeSlot.reservationCollections) {
        System.debug(reservationCollection);
    }
}
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.