Class DecoratingActivityRecordSet<RecordType extends ActivityRecord>

  • Type Parameters:
    RecordType - The type of records stored within this ActivityRecordSet.
    All Implemented Interfaces:
    ActivityRecordSet<RecordType>

    public abstract class DecoratingActivityRecordSet<RecordType extends ActivityRecord>
    extends DelegatingActivityRecordSet<RecordType>
    ActivityRecordSet implementation which simplifies decorating the records within an underlying ActivityRecordSet. The decorate() function must be implemented to define how each record is decorated. As ActivityRecordSets are read-only, there is no need to define an undecorate() function as required by DecoratingDirectory.
    • Constructor Detail

      • DecoratingActivityRecordSet

        public DecoratingActivityRecordSet​(ActivityRecordSet<RecordType> recordSet)
        Creates a new DecoratingActivityRecordSet which decorates the records within the given set.
        Parameters:
        recordSet - The ActivityRecordSet whose records are being decorated.
    • Method Detail

      • decorate

        protected abstract RecordType decorate​(RecordType record)
                                        throws org.apache.guacamole.GuacamoleException
        Given a record retrieved from a ActivityRecordSet which originates from a different AuthenticationProvider, returns an identical type of record optionally wrapped with additional information, functionality, etc. If this record set chooses to decorate the record provided, it is up to the implementation of that decorated record to properly pass through operations as appropriate. All records retrieved from this DecoratingActivityRecordSet will first be passed through this function.
        Parameters:
        record - A record from a ActivityRecordSet which originates from a different AuthenticationProvider.
        Returns:
        A record which may have been decorated by this DecoratingActivityRecordSet. If the record was not decorated, the original, unmodified record may be returned instead.
        Throws:
        org.apache.guacamole.GuacamoleException - If the provided record cannot be decorated due to an error.
      • decorate

        protected ActivityRecordSet<RecordType> decorate​(ActivityRecordSet<RecordType> recordSet)
                                                  throws org.apache.guacamole.GuacamoleException
        Given an ActivityRecordSet which originates from a different AuthenticationProvider, returns an identical type of record set optionally wrapped with additional information, functionality, etc. If this record set chooses to decorate the record set provided, it is up to the implementation of that decorated record set to properly pass through operations as appropriate. All record sets retrieved from this DecoratingActivityRecordSet will first be passed through this function, such as those returned by limit(int) and similar functions.

        By default, this function will wrap any provided ActivityRecordSet in a simple, anonymous instance of DecoratingActivityRecordSet that delegates to the decorate() implementations of this DecoratingActivityRecordSet. This default behavior may need to be overridden if the DecoratingActivityRecordSet implementation maintains any internal state.

        Parameters:
        recordSet - An ActivityRecordSet which originates from a different AuthenticationProvider.
        Returns:
        A record set which may have been decorated by this DecoratingActivityRecordSet. If the record set was not decorated, the original, unmodified record set may be returned instead, however beware that this may result in records within the set no longer being decorated.
        Throws:
        org.apache.guacamole.GuacamoleException - If the provided record set cannot be decorated due to an error.
      • get

        public RecordType get​(String string)
                       throws org.apache.guacamole.GuacamoleException
        Description copied from interface: ActivityRecordSet
        Returns the record having the given unique identifier, if records within this set have unique identifiers. If records within this set do not have defined unique identifiers, this function has no effect.
        Specified by:
        get in interface ActivityRecordSet<RecordType extends ActivityRecord>
        Overrides:
        get in class DelegatingActivityRecordSet<RecordType extends ActivityRecord>
        Parameters:
        string - The unique identifier of the record to retrieve.
        Returns:
        The record having the given unique identifier, or null if there is no such record.
        Throws:
        org.apache.guacamole.GuacamoleException - If an error occurs while retrieving the record.
      • sort

        public ActivityRecordSet<RecordType> sort​(ActivityRecordSet.SortableProperty property,
                                                  boolean desc)
                                           throws org.apache.guacamole.GuacamoleException
        Description copied from interface: ActivityRecordSet
        Returns a ActivityRecordSet containing identically the records within this set, sorted according to the specified criteria. The sort operation performed is guaranteed to be stable with respect to any past call to sort(). This function may also affect the contents of the current ActivityRecordSet. The contents of the current ActivityRecordSet should NOT be relied upon after this function is called.
        Specified by:
        sort in interface ActivityRecordSet<RecordType extends ActivityRecord>
        Overrides:
        sort in class DelegatingActivityRecordSet<RecordType extends ActivityRecord>
        Parameters:
        property - The property by which the records within the resulting set should be sorted.
        desc - Whether the records should be sorted according to the specified property in descending order. If false, records will be sorted according to the specified property in ascending order.
        Returns:
        The ActivityRecordSet, sorted according to the specified criteria.
        Throws:
        org.apache.guacamole.GuacamoleException - If an error occurs while sorting the current subset, or if the given property is not supported by the implementation.
      • limit

        public ActivityRecordSet<RecordType> limit​(int limit)
                                            throws org.apache.guacamole.GuacamoleException
        Description copied from interface: ActivityRecordSet
        Returns the subset of records containing only the first limit records. If the subset has fewer than limit records, then this function has no effect. This function may also affect the contents of the current ActivityRecordSet. The contents of the current ActivityRecordSet should NOT be relied upon after this function is called.
        Specified by:
        limit in interface ActivityRecordSet<RecordType extends ActivityRecord>
        Overrides:
        limit in class DelegatingActivityRecordSet<RecordType extends ActivityRecord>
        Parameters:
        limit - The maximum number of records that the new subset should contain.
        Returns:
        The subset of records that containing only the first limit records.
        Throws:
        org.apache.guacamole.GuacamoleException - If an error occurs while limiting the current subset.
      • contains

        public ActivityRecordSet<RecordType> contains​(String value)
                                               throws org.apache.guacamole.GuacamoleException
        Description copied from interface: ActivityRecordSet
        Returns the subset of records which contain the given value. The properties and semantics involved with determining whether a particular record "contains" the given value is implementation dependent. This function may affect the contents of the current ActivityRecordSet. The contents of the current ActivityRecordSet should NOT be relied upon after this function is called.
        Specified by:
        contains in interface ActivityRecordSet<RecordType extends ActivityRecord>
        Overrides:
        contains in class DelegatingActivityRecordSet<RecordType extends ActivityRecord>
        Parameters:
        value - The value which all records within the resulting subset should contain.
        Returns:
        The subset of records which contain the specified value.
        Throws:
        org.apache.guacamole.GuacamoleException - If an error occurs while restricting the current subset.