Class SubmittedAppointment

  • All Implemented Interfaces:
    Serializable

    public class SubmittedAppointment
    extends Object
    implements Serializable
    Represents the state of a submitted appointment form field. Used to determine which action to take, such as whether to create or delete an appointment entity.
    Since:
    6.5.0
    Author:
    XIMA MEDIA GmbH
    See Also:
    Serialized Form
    • Method Detail

      • getAppointmentUuid

        public UUID getAppointmentUuid()
        Returns:
        The submitted UUID of the appointment, if any.
      • getExistingAppointment

        public Appointment getExistingAppointment()
        Returns:
        The existing appointment for the form field, if any.
      • getFormValuesIndex

        public int getFormValuesIndex()
        Returns:
        The index in the form values array from which this appointment submission was created. -1 for deleted appointments or when not created from a form value.
      • getFieldName

        public FieldName getFieldName()
        Returns:
        The name of the form field with the appointment widget.
      • getSlotId

        public Instant getSlotId()
        Returns:
        The start time of the slot that the user want to book or change.
      • getTemplateUuid

        public UUID getTemplateUuid()
        Returns:
        The UUID of the appointment template to which the slot belongs.
      • getType

        public EAppointmentActionType getType()
        Analyzes the submitted and existing data and decided which action needs to be taken.
        Returns:
        The action to apply to the appointment.
      • getTypeUuid

        public UUID getTypeUuid()
        Returns:
        The submitted UUID of the appointment type for which an appointment should be booked or changed.
      • forDeletedAppointment

        public static SubmittedAppointment forDeletedAppointment​(Appointment appointment)
        Creates a new appointment action for deleting an existing appointment.
        Parameters:
        appointment - The existing appointment that needs to be deleted.
      • forFormData

        public static List<SubmittedAppointment> forFormData​(FieldName fieldName,
                                                             UUID templateUuid,
                                                             IFormDataAdapter formData,
                                                             Map<UUID,​Appointment> existingAppointmentsByUuid)
        Creates a new appointment action for a form submission.
        Parameters:
        fieldName - The name of the form field with the appointment widget.
        templateUuid - The UUID of the corresponding appointment template.
        formData - The form data that was submitted.
        existingAppointmentsByUuid - A map between the Appointment.getUUID() and the corresponding appointments. Must contain only the appointments for the current appointment template
        Returns:
        The appointment submission descriptor.
      • forFormData

        public static List<SubmittedAppointment> forFormData​(FieldName fieldName,
                                                             UUID templateUuid,
                                                             Map<String,​List<String[]>> formValuesMap,
                                                             Appointment appointment,
                                                             AppointmentType appointmentType,
                                                             int ordinalIndex)
        Creates a new appointment action for a form submission.
        Parameters:
        fieldName - The name of the form field with the appointment widget.
        templateUuid - The UUID of the corresponding appointment template.
        formValuesMap - The form data that was submitted.
        appointment - An existing appointment, may be null.
        appointmentType - The appointment type of the given appointment.
        Returns:
        The appointment submission descriptor.