mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 21:27:40 +00:00
Ticket #269: Fix whitespace errors.
This commit is contained in:
@@ -59,12 +59,12 @@ public class ActiveConnectionSet {
|
||||
*/
|
||||
@Inject
|
||||
private ConnectionHistoryMapper connectionHistoryDAO;
|
||||
|
||||
|
||||
/**
|
||||
* Set of all the connections that are currently active.
|
||||
*/
|
||||
private Set<Integer> activeConnectionSet = new HashSet<Integer>();
|
||||
|
||||
|
||||
/**
|
||||
* Check if a connection is currently in use.
|
||||
* @param connectionID The connection to check the status of.
|
||||
@@ -73,7 +73,7 @@ public class ActiveConnectionSet {
|
||||
public boolean isActive(int connectionID) {
|
||||
return activeConnectionSet.contains(connectionID);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a connection as open.
|
||||
* @param connectionID The ID of the connection that is being opened.
|
||||
@@ -81,20 +81,20 @@ public class ActiveConnectionSet {
|
||||
* @return The ID of the history record created for this open connection.
|
||||
*/
|
||||
public int openConnection(int connectionID, int userID) {
|
||||
|
||||
|
||||
// Create the connection history record
|
||||
ConnectionHistory connectionHistory = new ConnectionHistory();
|
||||
connectionHistory.setConnection_id(connectionID);
|
||||
connectionHistory.setUser_id(userID);
|
||||
connectionHistory.setStart_date(new Date());
|
||||
connectionHistoryDAO.insert(connectionHistory);
|
||||
|
||||
|
||||
// Mark the connection as active
|
||||
activeConnectionSet.add(connectionID);
|
||||
|
||||
|
||||
return connectionHistory.getHistory_id();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set a connection as closed.
|
||||
* @param connectionID The ID of the connection that is being opened.
|
||||
@@ -103,18 +103,18 @@ public class ActiveConnectionSet {
|
||||
*/
|
||||
public void closeConnection(int connectionID, int historyID)
|
||||
throws GuacamoleException {
|
||||
|
||||
|
||||
// Get the existing history record
|
||||
ConnectionHistory connectionHistory =
|
||||
ConnectionHistory connectionHistory =
|
||||
connectionHistoryDAO.selectByPrimaryKey(historyID);
|
||||
|
||||
|
||||
if(connectionHistory == null)
|
||||
throw new GuacamoleException("History record not found.");
|
||||
|
||||
|
||||
// Update the connection history record to mark that it is now closed
|
||||
connectionHistory.setEnd_date(new Date());
|
||||
connectionHistoryDAO.updateByPrimaryKey(connectionHistory);
|
||||
|
||||
|
||||
// Remove the connection from the set of active connections.
|
||||
activeConnectionSet.remove(connectionID);
|
||||
}
|
||||
|
@@ -59,7 +59,7 @@ public class MySQLConnection extends AbstractConnection {
|
||||
* The ID associated with this connection in the database.
|
||||
*/
|
||||
private Integer connectionID;
|
||||
|
||||
|
||||
/**
|
||||
* The ID of the user who queried or created this connection.
|
||||
*/
|
||||
@@ -116,7 +116,7 @@ public class MySQLConnection extends AbstractConnection {
|
||||
setConfiguration(config);
|
||||
this.history.addAll(history);
|
||||
this.userID = userID;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -51,12 +51,12 @@ public class MySQLConnectionRecord implements ConnectionRecord {
|
||||
* The start date of the ConnectionRecord.
|
||||
*/
|
||||
private Date startDate;
|
||||
|
||||
|
||||
/**
|
||||
* The end date of the ConnectionRecord.
|
||||
*/
|
||||
private Date endDate;
|
||||
|
||||
|
||||
/**
|
||||
* The name of the user that is associated with this ConnectionRecord.
|
||||
*/
|
||||
|
@@ -65,7 +65,7 @@ public class MySQLGuacamoleSocket implements GuacamoleSocket {
|
||||
* socket.
|
||||
*/
|
||||
private int connectionID;
|
||||
|
||||
|
||||
/**
|
||||
* The ID of the history record associated with this instance of the
|
||||
* connection.
|
||||
|
@@ -114,7 +114,7 @@ public class ConnectionService {
|
||||
*/
|
||||
@Inject
|
||||
private ActiveConnectionSet activeConnectionSet;
|
||||
|
||||
|
||||
/**
|
||||
* Service managing users.
|
||||
*/
|
||||
@@ -282,7 +282,7 @@ public class ConnectionService {
|
||||
* connection.
|
||||
*/
|
||||
public List<MySQLConnectionRecord> retrieveHistory(int connectionID) {
|
||||
|
||||
|
||||
// Retrieve history records relating to given connection ID
|
||||
ConnectionHistoryExample example = new ConnectionHistoryExample();
|
||||
example.createCriteria().andConnection_idEqualTo(connectionID);
|
||||
@@ -299,10 +299,10 @@ public class ConnectionService {
|
||||
for(ConnectionHistory history : connectionHistories) {
|
||||
userIDSet.add(history.getUser_id());
|
||||
}
|
||||
|
||||
|
||||
// Get all the usernames for the users who are in the history
|
||||
Map<Integer, String> usernameMap = userService.retrieveUsernames(userIDSet);
|
||||
|
||||
|
||||
// Create the new ConnectionRecords
|
||||
for(ConnectionHistory history : connectionHistories) {
|
||||
Date startDate = history.getStart_date();
|
||||
@@ -349,7 +349,7 @@ public class ConnectionService {
|
||||
|
||||
// Mark this connection as active
|
||||
int historyID = activeConnectionSet.openConnection(connection.getConnectionID(), userID);
|
||||
|
||||
|
||||
// Return new MySQLGuacamoleSocket
|
||||
MySQLGuacamoleSocket mySQLGuacamoleSocket = mySQLGuacamoleSocketProvider.get();
|
||||
mySQLGuacamoleSocket.init(socket, connection.getConnectionID(), historyID);
|
||||
|
@@ -360,7 +360,7 @@ public class PermissionCheckService {
|
||||
|
||||
// Set of all permissions
|
||||
Set<SystemPermission> permissions = new HashSet<SystemPermission>();
|
||||
|
||||
|
||||
// And finally, system permissions
|
||||
SystemPermissionExample systemPermissionExample = new SystemPermissionExample();
|
||||
systemPermissionExample.createCriteria().andUser_idEqualTo(userID);
|
||||
|
Reference in New Issue
Block a user