necouchman commented on a change in pull request #546:
URL: https://github.com/apache/guacamole-client/pull/546#discussion_r513542264



##########
File path: 
guacamole/src/main/java/org/apache/guacamole/rest/connection/ConnectionResource.java
##########
@@ -150,18 +149,16 @@ public ConnectionResource(@Assisted UserContext 
userContext,
      * @throws GuacamoleException
      *     If an error occurs while retrieving the connection history.
      */
-    @GET
     @Path("history")
-    public List<APIConnectionRecord> getConnectionHistory()
+    public ConnectionHistoryResource getConnectionHistory()
             throws GuacamoleException {
 
-        // Retrieve the requested connection's history
-        List<APIConnectionRecord> apiRecords = new 
ArrayList<APIConnectionRecord>();
-        for (ConnectionRecord record : connection.getHistory())
-            apiRecords.add(new APIConnectionRecord(record));
-
-        // Return the converted history
-        return apiRecords;
+        try {
+            return new 
ConnectionHistoryResource(connection.getConnectionHistory());
+        }
+        catch (GuacamoleUnsupportedException e) {
+            return new ConnectionHistoryResource(new 
SimpleActivityRecordSet<>());
+        }

Review comment:
       Okay, I've worked through this - not entirely sure how well I've done. I 
hit some issues with the `List<? extends ConnectionRecord>` and converting that 
to `List<ConnectionRecord>`. I ended up with the loops you see, here, now - not 
sure if there's a more elegant way to do that translation from `? extends 
RecordType` to just `RecordType`? I tried various adjustments to the types of 
methods and such in the classes, and I couldn't really do much without breaking 
compatibility.
   
   Also, the `HistoryResource` class in `rest/history` pulls history from 
`UserContext`, whereas the `ConnectionResource` and `UserResource` classes in 
`rest/connection` and `rest/user` pull history from `Connection` and `User`, 
and I'm not sure if there are any modifications needed to the `HistoryResource` 
class or anything in the `UserContext` interfaces or classes that need to be 
tweaked to handle these changes?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to