use of com.keybox.manage.model.UserSessionsOutput in project KeyBox by skavanagh.
the class SessionOutputUtil method removeUserSession.
/**
* removes session for user session
*
* @param sessionId session id
*/
public static void removeUserSession(Long sessionId) {
UserSessionsOutput userSessionsOutput = userSessionsOutputMap.get(sessionId);
if (userSessionsOutput != null) {
userSessionsOutput.getSessionOutputMap().clear();
}
userSessionsOutputMap.remove(sessionId);
}
use of com.keybox.manage.model.UserSessionsOutput in project KeyBox by skavanagh.
the class SessionOutputUtil method addOutput.
/**
* adds a new output
*
* @param sessionOutput session output object
*/
public static void addOutput(SessionOutput sessionOutput) {
UserSessionsOutput userSessionsOutput = userSessionsOutputMap.get(sessionOutput.getSessionId());
if (userSessionsOutput == null) {
userSessionsOutputMap.put(sessionOutput.getSessionId(), new UserSessionsOutput());
userSessionsOutput = userSessionsOutputMap.get(sessionOutput.getSessionId());
}
userSessionsOutput.getSessionOutputMap().put(sessionOutput.getInstanceId(), sessionOutput);
}
use of com.keybox.manage.model.UserSessionsOutput in project KeyBox by skavanagh.
the class SessionOutputUtil method getOutput.
/**
* returns list of output lines
*
* @param sessionId session id object
* @param user user auth object
* @return session output list
*/
public static List<SessionOutput> getOutput(Connection con, Long sessionId, User user) {
List<SessionOutput> outputList = new ArrayList<>();
UserSessionsOutput userSessionsOutput = userSessionsOutputMap.get(sessionId);
if (userSessionsOutput != null) {
for (Integer key : userSessionsOutput.getSessionOutputMap().keySet()) {
//get output chars and set to output
try {
SessionOutput sessionOutput = userSessionsOutput.getSessionOutputMap().get(key);
if (sessionOutput != null && sessionOutput.getOutput() != null && StringUtils.isNotEmpty(sessionOutput.getOutput())) {
outputList.add(sessionOutput);
//send to audit logger
systemAuditLogger.info(gson.toJson(new AuditWrapper(user, sessionOutput)));
if (enableInternalAudit) {
SessionAuditDB.insertTerminalLog(con, sessionOutput);
}
userSessionsOutput.getSessionOutputMap().put(key, new SessionOutput(sessionId, sessionOutput));
}
} catch (Exception ex) {
log.error(ex.toString(), ex);
}
}
}
return outputList;
}
Aggregations