GUACAMOLE-394: Merge refactor extension API to define user history

This commit is contained in:
Nick Couchman
2017-09-27 18:14:43 -04:00
27 changed files with 504 additions and 194 deletions

View File

@@ -20,6 +20,7 @@
package org.apache.guacamole.rest.connection;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -131,6 +132,11 @@ public class APIConnectionWrapper implements Connection {
throw new UnsupportedOperationException("Operation not supported.");
}
@Override
public Date getLastActive() {
return null;
}
@Override
public List<? extends ConnectionRecord> getHistory() throws GuacamoleException {
return Collections.<ConnectionRecord>emptyList();

View File

@@ -21,7 +21,7 @@ package org.apache.guacamole.rest.history;
import javax.ws.rs.core.Response;
import org.apache.guacamole.GuacamoleClientException;
import org.apache.guacamole.net.auth.ConnectionRecordSet;
import org.apache.guacamole.net.auth.ActivityRecordSet;
import org.apache.guacamole.rest.APIException;
/**
@@ -38,7 +38,7 @@ public class APIConnectionRecordSortPredicate {
/**
* All possible property name strings and their corresponding
* ConnectionRecordSet.SortableProperty values.
* ActivityRecordSet.SortableProperty values.
*/
public enum SortableProperty {
@@ -46,24 +46,24 @@ public class APIConnectionRecordSortPredicate {
* The date that the connection associated with the connection record
* began (connected).
*/
startDate(ConnectionRecordSet.SortableProperty.START_DATE);
startDate(ActivityRecordSet.SortableProperty.START_DATE);
/**
* The ConnectionRecordSet.SortableProperty that this property name
* The ActivityRecordSet.SortableProperty that this property name
* string represents.
*/
public final ConnectionRecordSet.SortableProperty recordProperty;
public final ActivityRecordSet.SortableProperty recordProperty;
/**
* Creates a new SortableProperty which associates the property name
* string (identical to its own name) with the given
* ConnectionRecordSet.SortableProperty value.
* ActivityRecordSet.SortableProperty value.
*
* @param recordProperty
* The ConnectionRecordSet.SortableProperty value to associate with
* The ActivityRecordSet.SortableProperty value to associate with
* the new SortableProperty.
*/
SortableProperty(ConnectionRecordSet.SortableProperty recordProperty) {
SortableProperty(ActivityRecordSet.SortableProperty recordProperty) {
this.recordProperty = recordProperty;
}
@@ -72,7 +72,7 @@ public class APIConnectionRecordSortPredicate {
/**
* The property to use when sorting ConnectionRecords.
*/
private ConnectionRecordSet.SortableProperty property;
private ActivityRecordSet.SortableProperty property;
/**
* Whether the requested sort order is descending (true) or ascending
@@ -102,7 +102,7 @@ public class APIConnectionRecordSortPredicate {
value = value.substring(DESCENDING_PREFIX.length());
}
// Parse sorting property into ConnectionRecordSet.SortableProperty
// Parse sorting property into ActivityRecordSet.SortableProperty
try {
this.property = SortableProperty.valueOf(value).recordProperty;
}
@@ -118,15 +118,15 @@ public class APIConnectionRecordSortPredicate {
}
/**
* Returns the SortableProperty defined by ConnectionRecordSet which
* Returns the SortableProperty defined by ActivityRecordSet which
* represents the property requested.
*
* @return
* The ConnectionRecordSet.SortableProperty which refers to the same
* The ActivityRecordSet.SortableProperty which refers to the same
* property as the string originally provided when this
* APIConnectionRecordSortPredicate was created.
*/
public ConnectionRecordSet.SortableProperty getProperty() {
public ActivityRecordSet.SortableProperty getProperty() {
return property;
}

View File

@@ -28,8 +28,8 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.net.auth.ActivityRecordSet;
import org.apache.guacamole.net.auth.ConnectionRecord;
import org.apache.guacamole.net.auth.ConnectionRecordSet;
import org.apache.guacamole.net.auth.UserContext;
/**
@@ -92,7 +92,7 @@ public class HistoryResource {
throws GuacamoleException {
// Retrieve overall connection history
ConnectionRecordSet history = userContext.getConnectionHistory();
ActivityRecordSet<ConnectionRecord> history = userContext.getConnectionHistory();
// Restrict to records which contain the specified strings
for (String required : requiredContents) {

View File

@@ -19,9 +19,13 @@
package org.apache.guacamole.rest.user;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.guacamole.GuacamoleException;
import org.apache.guacamole.GuacamoleUnsupportedException;
import org.apache.guacamole.net.auth.ActivityRecord;
import org.apache.guacamole.net.auth.User;
import org.apache.guacamole.net.auth.permission.ObjectPermissionSet;
import org.apache.guacamole.net.auth.permission.SystemPermissionSet;
@@ -112,4 +116,14 @@ public class APIUserWrapper implements User {
throw new GuacamoleUnsupportedException("APIUserWrapper does not provide permission access.");
}
@Override
public Date getLastActive() {
return null;
}
@Override
public List<? extends ActivityRecord> getHistory() throws GuacamoleException {
return Collections.<ActivityRecord>emptyList();
}
}