Class Reservation

java.lang.Object
wt.reservation._Reservation
wt.reservation.Reservation
All Implemented Interfaces:
Externalizable, Serializable

@GenAsUnPersistable(extendable=false,properties={@GeneratedProperty(name="reservableRef",type=ObjectReference.class,supportedAPI=PUBLIC,accessors=@PropertyAccessors(getAccess=PRIVATE),javaDoc="Reference to {@link Reservable} object."),@GeneratedProperty(name="reservationType",type=ReservationType.class,supportedAPI=PUBLIC,accessors=@PropertyAccessors(getAccess=PRIVATE),javaDoc="Type of reservation requested or granted to the {@link Reservable} object."),@GeneratedProperty(name="reservedByRef",type=WTPrincipalReference.class,supportedAPI=PUBLIC,accessors=@PropertyAccessors(getAccess=PRIVATE),javaDoc="Reference to {@link WTPrincipal} requesting or holding the reservation (null for current principal)."),@GeneratedProperty(name="expiresAfter",type=int.class,supportedAPI=PUBLIC,accessors=@PropertyAccessors(getAccess=PRIVATE),javaDoc="Number of minutes the reservation is held before expiring (< 1 for default expiration time)."),@GeneratedProperty(name="expires",type=java.sql.Timestamp.class,supportedAPI=PUBLIC,accessors=@PropertyAccessors(setAccess=PRIVATE),javaDoc="Reservation is automatically dropped after this time has passed (null if reservation has not been granted yet)."),@GeneratedProperty(name="enforcedByService",type=boolean.class,supportedAPI=PUBLIC,accessors=@PropertyAccessors(setAccess=PRIVATE),javaDoc="True if reservation is enforced by {@link ReservationService}, false if enforced by client (default)."),@GeneratedProperty(name="adminOverride",type=boolean.class,supportedAPI=PUBLIC,accessors=@PropertyAccessors(setAccess=PRIVATE),javaDoc="True if a principal with administrative permission to the site or organization containing the {@link Reservable} object is allowed to override the reservation, false if not allowed (default)."),@GeneratedProperty(name="workflowOverride",type=boolean.class,supportedAPI=PUBLIC,accessors=@PropertyAccessors(setAccess=PRIVATE),javaDoc="True if a workflow process is allowed to override the reservation, false if not allowed (default)."),@GeneratedProperty(name="granted",type=boolean.class,supportedAPI=PUBLIC,accessors=@PropertyAccessors(setAccess=PRIVATE),javaDoc="True if reservation is granted, false if not granted."),@GeneratedProperty(name="errorMessage",type=WTMessage.class,supportedAPI=PUBLIC,accessors=@PropertyAccessors(setAccess=PRIVATE),javaDoc="Reason a reservation could not be granted (null if no error)."),@GeneratedProperty(name="immutable",type=boolean.class,supportedAPI=PRIVATE,accessors=@PropertyAccessors(getAccess=PRIVATE),javaDoc="True if this object is immutable.")}) public final class Reservation extends _Reservation
Class to aggregate the parameters for requesting reservations or returning ReservationService API results.

Supported API: true

Extendable: false
See Also:
  • Method Details

    • newReservation

      public static Reservation newReservation()
      Factory to construct a Reservation object. All reservation options are set to default values.

      Supported API: true
      Returns:
      New Reservation object.
    • newReservation

      public static Reservation newReservation(Reservation copyFrom, boolean immutable)
      Factory to construct a copy of a Reservation object.

      Supported API: true
      Parameters:
      copyFrom - Existing object from which to copy attribute values.
      immutable - True to make the new reservation immutable.
      Returns:
      New Reservation object with copied attributes. Subsequent changes to the attributes values of either the original or copy will not affect the other.
    • newReservation

      public static Reservation newReservation(Reservable reservable) throws WTException
      Factory to construct a Reservation object. All reservation options not specified are set to default values.

      Supported API: true
      Parameters:
      reservable - Persisted Reservable object.
      Returns:
      New Reservation object.
      Throws:
      WTException
    • newReservation

      public static Reservation newReservation(Reservable reservable, boolean enforcedByService, boolean adminOverride, boolean workflowOverride) throws WTException
      Factory to construct a Reservation object. All reservation options not specified are set to default values.

      Supported API: true
      Parameters:
      reservable - Persisted Reservable object.
      enforcedByService - True if reservation is enforced by ReservationService, or false if enforced by client code.
      adminOverride - True if a principal with administrative permission to the site or organization containing the Reservable object is allowed to override the reservation, false if not allowed.
      workflowOverride - True if a workflow process is allowed to override the reservation, false if not allowed.
      Returns:
      New Reservation object.
      Throws:
      WTException
    • newReservation

      public static Reservation newReservation(ObjectReference reservableRef) throws WTException
      Factory to construct a Reservation object. All reservation options not specified are set to default values.

      Supported API: true
      Parameters:
      reservableRef - Reference to Reservable object.
      Returns:
      New Reservation object.
      Throws:
      WTException
    • newReservation

      public static Reservation newReservation(ObjectReference reservableRef, boolean enforcedByService, boolean adminOverride, boolean workflowOverride) throws WTException
      Factory to construct a Reservation object. All reservation options not specified are set to default values.

      Supported API: true
      Parameters:
      reservableRef - Reference to persisted Reservable object.
      enforcedByService - True if reservation is enforced by ReservationService, or false if enforced by client code.
      adminOverride - True if a principal with administrative permission to the site or organization containing the Reservable object is allowed to override the reservation, false if not allowed.
      workflowOverride - True if a workflow process is allowed to override the reservation, false if not allowed.
      Returns:
      New Reservation object.
      Throws:
      WTException
    • newReservations

      public static Set<Reservation> newReservations(WTSet reservables) throws WTException
      Factory to construct a collection of Reservation objects.

      Supported API: true
      Parameters:
      reservables - Set of Reservable object references (will not be inflated, other types ignored). References to Reservable objects must be type ObjectReference.
      Returns:
      Set of new Reservation objects (guaranteed non-null, may be empty).
      Throws:
      WTException
    • newReservations

      public static Set<Reservation> newReservations(WTSet reservables, boolean enforcedByService, boolean adminOverride, boolean workflowOverride) throws WTException
      Factory to construct a collection of Reservation objects.

      Supported API: true
      Parameters:
      reservables - Set of Reservable object references (will not be inflated, other types ignored). References to Reservable objects must be type ObjectReference.
      enforcedByService - True if reservation is enforced by ReservationService, or false if enforced by client code.
      adminOverride - True if a principal with administrative permission to the site or organization containing the Reservable object is allowed to override the reservation, false if not allowed.
      workflowOverride - True if a workflow process is allowed to override the reservation, false if not allowed.
      Returns:
      Set of new Reservation objects (guaranteed non-null, may be empty). The set will only contain entries for reservable references that meet the stated requirements.
      Throws:
      WTException
    • getReservableRef

      public ObjectReference getReservableRef()
      Get reference to Reservable object.

      Supported API: true
      Returns:
      Reference to Reservable object (may be null for reservations not yet granted).
    • setReservableRef

      public void setReservableRef(ObjectReference reservableRef) throws WTException
      Set reference to a Reservable object. Required when requesting a new reservation.

      Supported API: true
      Parameters:
      reservableRef - Reference to a persisted Reservable object (must be non-null).
      Throws:
      WTException
    • setReservable

      public void setReservable(Reservable reservable) throws WTException
      Set reference to a Reservable object. Required when requesting a new reservation.

      Supported API: true
      Parameters:
      reservable - Persisted Reservable object (must be non-null).
      Throws:
      WTException
    • getReservationType

      public ReservationType getReservationType()
      Get type of reservation requested or active (default is ReservationType.MODIFY).

      Supported API: true
      Returns:
      ReservationType object (non-null).
    • setReservationType

      public void setReservationType(ReservationType reservationType)
      Set type of reservation requested or active (default is ReservationType.MODIFY).

      Supported API: true
      Parameters:
      reservationType - ReservationType object (null for default type).
      Throws:
      WTException
    • getReservedByRef

      public WTPrincipalReference getReservedByRef()
      Get reference to principal requesting or holding the reservation (default is current principal).

      Supported API: true
      Returns:
      WTPrincipalReference to reserving principal (null for default).
    • setReservedByRef

      public void setReservedByRef(WTPrincipalReference reservedByRef)
      Set reference to principal requesting or holding the reservation (default is current principal).

      Supported API: true
      Parameters:
      reservedByRef - WTPrincipalReference to reserving principal (null for default).
    • getExpiresAfter

      public int getExpiresAfter()
      Get the length of time in minutes a reservation is held before expiring (default is taken from system property "ReservationService.expiresAfter").

      Supported API: true
    • setExpiresAfter

      public void setExpiresAfter(int expiresAfter)
      Set the length of time in minutes a reservation is held before expiring (default is taken from system property "ReservationService.expiresAfter").

      Supported API: true
      Parameters:
      expiresAfter - Number of minutes until expiration (< 1 for default expiration time).
    • setEnforcedByService

      public void setEnforcedByService(boolean enforcedByService)
      Control if reservation is enforced by the ReservationService.

      Supported API: true
      Parameters:
      enforcedByService - True to enable service enforcement of reservation, false to disable (default).
    • setAdminOverride

      public void setAdminOverride(boolean adminOverride) throws WTException
      Control if a principal with administrative permission to the site or organization containing the Reservable object is allowed to override the reservation.

      Supported API: true
      Parameters:
      adminOverride - True to enable administrative override, false to disable (default). Can only be set true if ReservationService enforcement is enabled.
      Throws:
      WTException
    • setWorkflowOverride

      public void setWorkflowOverride(boolean workflowOverride) throws WTException
      Set true if a workflow process is allowed to override the reservation.

      Supported API: true
      Parameters:
      workflowOverride - True to enable workflow process override, false to disable (default). Can only be set true if ReservationService enforcement is enabled.
      Throws:
      WTException
    • equals

      public boolean equals(Object obj)
      Reservation objects are equal if they have the same reservable object reference and reservation type.

      Supported API: true
      Overrides:
      equals in class Object