use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class UserSessionModelAggregator method execute.
@Override
protected void execute() throws Exception {
final UserSession newUserSession = this.userSessionInputPort.receive();
if (newUserSession != null) {
this.userSessions.add(newUserSession);
}
final Long timeTrigger = this.timeTriggerInputPort.receive();
if (timeTrigger != null) {
// or stream of sessions.
for (int i = 0; i < this.userSessions.size(); i++) {
final UserSession userSession = this.userSessions.get(i);
if (userSession != null) {
final Long entryTime = userSession.getEntryTime();
final Long lowerBoundary = timeTrigger - UserSessionModelAggregator.SLIDING_WINDOW;
if (entryTime < lowerBoundary) {
this.userSessions.remove(i);
}
}
}
final UserSessionCollectionModel model = new UserSessionCollectionModel(this.userSessions);
this.outputPort.send(model);
}
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class UserSessionOperationCleanupStage method execute.
@Override
protected void execute(final UserSession session) throws Exception {
final UserSession filteredUserSession = new UserSession(session.getHost(), session.getSessionId());
session.getEvents().stream().filter(this.filter::isAllowed).forEach(filteredUserSession::add);
this.outputPort.send(filteredUserSession);
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class CollectUserSessionsFilter method execute.
@Override
protected void execute() throws Exception {
final UserSession userSession = this.userSessionInputPort.receive();
if (userSession != null) {
CollectUserSessionsFilter.LOGGER.debug("Received model...");
this.userSessions.add(userSession);
}
final Long triggerTime = this.timeTriggerInputPort.receive();
if (triggerTime != null) {
/**
* collect all sessions.
*/
final UserSessionCollectionModel model = new UserSessionCollectionModel(this.userSessions);
/**
* remove expired sessions.
*/
if (this.userSessions.size() > this.minCollectionSize) {
for (int i = 0; this.userSessions.size() > i; i++) {
if (this.userSessions.get(i).getExitTime() + this.keepTime < triggerTime) {
this.userSessions.remove(i);
}
}
}
CollectUserSessionsFilter.LOGGER.debug("Sending model...");
this.outputPort.send(model);
}
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class SessionOperationCleanupFilter method filterSession.
private UserSession filterSession(final UserSession session) {
final UserSession filteredUserSession = new UserSession(session.getHost(), session.getSessionId());
session.getEvents().stream().filter(this.filter::isAllowed).forEach(filteredUserSession::add);
return filteredUserSession;
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class SessionOperationCleanupFilter method execute.
@Override
protected void execute(final UserSessionCollectionModel entryCallSequenceModel) throws Exception {
final List<UserSession> sessions = entryCallSequenceModel.getUserSessions().stream().map(this::filterSession).collect(Collectors.toList());
final UserSessionCollectionModel filteredEntryCallSequenceModel = new UserSessionCollectionModel(sessions);
this.outputPort.send(filteredEntryCallSequenceModel);
}
Aggregations