mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 09:03:21 +00:00 
			
		
		
		
	GUACAMOLE-394: Deprecate ConnectionRecordSet. Refactor accordingly.
This commit is contained in:
		| @@ -19,83 +19,13 @@ | ||||
|  | ||||
| package org.apache.guacamole.net.auth; | ||||
|  | ||||
| import org.apache.guacamole.GuacamoleException; | ||||
|  | ||||
| /** | ||||
|  * The set of all available connection records, or a subset of those records. | ||||
|  * | ||||
|  * @deprecated | ||||
|  *     Use {@link ActivityRecordSet}<{@link ConnectionRecord}> instead. | ||||
|  */ | ||||
| public interface ConnectionRecordSet extends ActivityRecordSet<ConnectionRecord> { | ||||
|  | ||||
|     /** | ||||
|      * Returns the subset of connection records to only those where the | ||||
|      * connection name, user identifier, or any associated date field contain | ||||
|      * the given value. This function may also affect the contents of the | ||||
|      * current ConnectionRecordSet. The contents of the current | ||||
|      * ConnectionRecordSet should NOT be relied upon after this function is | ||||
|      * called. | ||||
|      * | ||||
|      * @param value | ||||
|      *     The value which all connection records within the resulting subset | ||||
|      *     should contain within their associated connection name or user | ||||
|      *     identifier. | ||||
|      * | ||||
|      * @return | ||||
|      *     The subset of connection history records which contain the specified | ||||
|      *     value within their associated connection name or user identifier. | ||||
|      * | ||||
|      * @throws GuacamoleException | ||||
|      *     If an error occurs while restricting the current subset. | ||||
|      */ | ||||
|     @Override | ||||
|     ConnectionRecordSet contains(String value) throws GuacamoleException; | ||||
|  | ||||
|     /** | ||||
|      * Returns the subset of connection history records containing only the | ||||
|      * first <code>limit</code> records. If the subset has fewer than | ||||
|      * <code>limit</code> records, then this function has no effect. This | ||||
|      * function may also affect the contents of the current | ||||
|      * ConnectionRecordSet. The contents of the current ConnectionRecordSet | ||||
|      * should NOT be relied upon after this function is called. | ||||
|      * | ||||
|      * @param limit | ||||
|      *     The maximum number of records that the new subset should contain. | ||||
|      * | ||||
|      * @return | ||||
|      *     The subset of connection history records that containing only the | ||||
|      *     first <code>limit</code> records. | ||||
|      * | ||||
|      * @throws GuacamoleException | ||||
|      *     If an error occurs while limiting the current subset. | ||||
|      */ | ||||
|     @Override | ||||
|     ConnectionRecordSet limit(int limit) throws GuacamoleException; | ||||
|  | ||||
|     /** | ||||
|      * Returns a ConnectionRecordSet 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 | ||||
|      * ConnectionRecordSet. The contents of the current ConnectionRecordSet | ||||
|      * should NOT be relied upon after this function is called. | ||||
|      * | ||||
|      * @param property | ||||
|      *     The property by which the connection records within the resulting | ||||
|      *     set should be sorted. | ||||
|      * | ||||
|      * @param 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. | ||||
|      * | ||||
|      * @return | ||||
|      *     The ConnnectionRecordSet, sorted according to the specified | ||||
|      *     criteria. | ||||
|      * | ||||
|      * @throws GuacamoleException | ||||
|      *     If an error occurs while sorting the current subset. | ||||
|      */ | ||||
|     @Override | ||||
|     ConnectionRecordSet sort(SortableProperty property, boolean desc) | ||||
|             throws GuacamoleException; | ||||
|  | ||||
| @Deprecated | ||||
| public interface ConnectionRecordSet | ||||
|         extends ActivityRecordSet<ConnectionRecord> { | ||||
| } | ||||
|   | ||||
| @@ -145,7 +145,7 @@ public interface UserContext { | ||||
|     /** | ||||
|      * Retrieves all connection records visible to current user. The resulting | ||||
|      * set of connection records can be further filtered and ordered using the | ||||
|      * methods defined on ConnectionRecordSet. | ||||
|      * methods defined on ActivityRecordSet. | ||||
|      * | ||||
|      * @return | ||||
|      *     A set of all connection records visible to the current user. | ||||
| @@ -153,7 +153,8 @@ public interface UserContext { | ||||
|      * @throws GuacamoleException | ||||
|      *     If an error occurs while retrieving the connection records. | ||||
|      */ | ||||
|     ConnectionRecordSet getConnectionHistory() throws GuacamoleException; | ||||
|     ActivityRecordSet<ConnectionRecord> getConnectionHistory() | ||||
|             throws GuacamoleException; | ||||
|  | ||||
|     /** | ||||
|      * Retrieves a connection group which can be used to view and manipulate | ||||
|   | ||||
| @@ -0,0 +1,62 @@ | ||||
| /* | ||||
|  * Licensed to the Apache Software Foundation (ASF) under one | ||||
|  * or more contributor license agreements.  See the NOTICE file | ||||
|  * distributed with this work for additional information | ||||
|  * regarding copyright ownership.  The ASF licenses this file | ||||
|  * to you under the Apache License, Version 2.0 (the | ||||
|  * "License"); you may not use this file except in compliance | ||||
|  * with the License.  You may obtain a copy of the License at | ||||
|  * | ||||
|  *   http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  * | ||||
|  * Unless required by applicable law or agreed to in writing, | ||||
|  * software distributed under the License is distributed on an | ||||
|  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||||
|  * KIND, either express or implied.  See the License for the | ||||
|  * specific language governing permissions and limitations | ||||
|  * under the License. | ||||
|  */ | ||||
|  | ||||
| package org.apache.guacamole.net.auth.simple; | ||||
|  | ||||
| import java.util.Collection; | ||||
| import java.util.Collections; | ||||
| import org.apache.guacamole.GuacamoleException; | ||||
| import org.apache.guacamole.net.auth.ActivityRecord; | ||||
| import org.apache.guacamole.net.auth.ActivityRecordSet; | ||||
| import org.apache.guacamole.net.auth.ActivityRecordSet.SortableProperty; | ||||
|  | ||||
| /** | ||||
|  * An immutable and empty ActivityRecordSet. | ||||
|  * | ||||
|  * @param <RecordType> | ||||
|  *     The type of ActivityRecord contained within this set. | ||||
|  */ | ||||
| public class SimpleActivityRecordSet<RecordType extends ActivityRecord> | ||||
|         implements ActivityRecordSet<RecordType> { | ||||
|  | ||||
|     @Override | ||||
|     public Collection<RecordType> asCollection() | ||||
|             throws GuacamoleException { | ||||
|         return Collections.<RecordType>emptyList(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public ActivityRecordSet<RecordType> contains(String value) | ||||
|             throws GuacamoleException { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public ActivityRecordSet<RecordType> limit(int limit) | ||||
|             throws GuacamoleException { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public ActivityRecordSet<RecordType> sort(SortableProperty property, | ||||
|             boolean desc) throws GuacamoleException { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -23,12 +23,16 @@ import java.util.Collection; | ||||
| import java.util.Collections; | ||||
| import org.apache.guacamole.GuacamoleException; | ||||
| import org.apache.guacamole.net.auth.ConnectionRecord; | ||||
| import org.apache.guacamole.net.auth.ConnectionRecordSet; | ||||
|  | ||||
| /** | ||||
|  * An immutable and empty ConnectionRecordSet. | ||||
|  * | ||||
|  * @deprecated | ||||
|  *     Use {@link SimpleActivityRecordSet}<{@link ConnectionRecord}> | ||||
|  *     instead. | ||||
|  */ | ||||
| public class SimpleConnectionRecordSet implements ConnectionRecordSet { | ||||
| @Deprecated | ||||
| public class SimpleConnectionRecordSet implements org.apache.guacamole.net.auth.ConnectionRecordSet { | ||||
|  | ||||
|     @Override | ||||
|     public Collection<ConnectionRecord> asCollection() | ||||
| @@ -37,19 +41,19 @@ public class SimpleConnectionRecordSet implements ConnectionRecordSet { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public ConnectionRecordSet contains(String value) | ||||
|     public org.apache.guacamole.net.auth.ConnectionRecordSet contains(String value) | ||||
|             throws GuacamoleException { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public ConnectionRecordSet limit(int limit) | ||||
|     public org.apache.guacamole.net.auth.ConnectionRecordSet limit(int limit) | ||||
|             throws GuacamoleException { | ||||
|         return this; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public ConnectionRecordSet sort(SortableProperty property, boolean desc) | ||||
|     public org.apache.guacamole.net.auth.ConnectionRecordSet sort(SortableProperty property, boolean desc) | ||||
|             throws GuacamoleException { | ||||
|         return this; | ||||
|     } | ||||
|   | ||||
| @@ -27,10 +27,11 @@ import java.util.UUID; | ||||
| import org.apache.guacamole.GuacamoleException; | ||||
| import org.apache.guacamole.form.Form; | ||||
| import org.apache.guacamole.net.auth.ActiveConnection; | ||||
| import org.apache.guacamole.net.auth.ActivityRecordSet; | ||||
| import org.apache.guacamole.net.auth.AuthenticationProvider; | ||||
| import org.apache.guacamole.net.auth.Connection; | ||||
| import org.apache.guacamole.net.auth.ConnectionGroup; | ||||
| import org.apache.guacamole.net.auth.ConnectionRecordSet; | ||||
| import org.apache.guacamole.net.auth.ConnectionRecord; | ||||
| import org.apache.guacamole.net.auth.Directory; | ||||
| import org.apache.guacamole.net.auth.SharingProfile; | ||||
| import org.apache.guacamole.net.auth.User; | ||||
| @@ -209,9 +210,9 @@ public class SimpleUserContext implements UserContext { | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public ConnectionRecordSet getConnectionHistory() | ||||
|     public ActivityRecordSet<ConnectionRecord> getConnectionHistory() | ||||
|             throws GuacamoleException { | ||||
|         return new SimpleConnectionRecordSet(); | ||||
|         return new SimpleActivityRecordSet<ConnectionRecord>(); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
		Reference in New Issue
	
	Block a user