Class AvailabilityEntityBuilder

java.lang.Object
org.exoplatform.agenda.rest.util.AvailabilityEntityBuilder

public class AvailabilityEntityBuilder extends Object
Turns the busy-time domain model into what goes on the wire.

The one narrowing this class performs is the point of it: whatever the service knows, only an identifier, a status and a list of two-instant ranges leave the server.

  • Method Details

    • toEntities

      public static List<UserBusyTimeEntity> toEntities(List<org.exoplatform.agenda.model.UserBusyTime> busyTimes, ZoneId timeZone)
      Builds the wire form of a whole busy-time answer.
      Parameters:
      busyTimes - what the service answered, one entry per participant
      timeZone - the zone the ranges are rendered in — the asking user's own, so the browser reads a block's wall-clock time the way it reads every other event on the same grid
      Returns:
      one entity per entry, in the same order, never null
    • toEntity

      public static UserBusyTimeEntity toEntity(org.exoplatform.agenda.model.UserBusyTime busyTime, ZoneId timeZone)
      Builds the wire form of one participant's busy time.

      The blocks are carried only when the status says a calendar was actually read. For the other two statuses the field is left null rather than emptied, so that no client can reach an empty array without having gone past a status that says the list means nothing.

      Parameters:
      busyTime - one participant's busy time and read status
      timeZone - the zone the ranges are rendered in
      Returns:
      the entity, never null