use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class DummyClassificationStage method execute.
@Override
protected void execute() throws Exception {
final UserSession session = this.sessionInputPort.receive();
final Long timestamp = this.timerInputPort.receive();
if (session != null) {
DummyClassificationStage.LOGGER.debug("session: host={} id={} time=[{}:{}] events={}", session.getHost(), session.getSessionId(), session.getEntryTime(), session.getExitTime(), session.getEvents().size());
}
if (timestamp != null) {
DummyClassificationStage.LOGGER.debug("time {}", timestamp);
}
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class BehaviorModelPreparation method executeEntryCallSequenceModel.
/**
* Execute case object instanceof EntryCallSequenceModel.
*
* @param userSessionCollectionModel
* entryCallSequenceModel
*/
private void executeEntryCallSequenceModel(final UserSessionCollectionModel userSessionCollectionModel) {
if (this.behaviorModelTable == null) {
this.sequenceModelCache.add(userSessionCollectionModel);
} else {
final List<UserSession> userSessions = userSessionCollectionModel.getUserSessions();
BehaviorModelPreparation.LOGGER.debug("Executing {}", userSessionCollectionModel.getClass());
BehaviorModelPreparation.LOGGER.debug("userSessions: {}", userSessions.size());
for (final UserSession userSession : userSessions) {
final BehaviorModelTable modelTable = this.behaviorModelTable.getClearedCopy(this.keepEmptyTransitions);
final List<EntryCallEvent> entryCalls = userSession.getEvents();
EntryCallEvent lastCall = null;
for (final EntryCallEvent eventCall : entryCalls) {
final boolean isAllowed = modelTable.isAllowedSignature(eventCall);
if (lastCall != null && isAllowed) {
modelTable.addTransition(lastCall, eventCall);
modelTable.addInformation(eventCall);
} else if (isAllowed) {
// only called at first valid event
// (condition lastCall == null is not needed
modelTable.addInformation(eventCall);
}
lastCall = isAllowed ? eventCall : lastCall;
}
this.outputPort.send(modelTable);
}
}
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class BehaviorModelTableGenerationStage method execute.
@Override
protected void execute(final UserSessionCollectionModel entryCallSequenceModel) {
final List<UserSession> userSessions = entryCallSequenceModel.getUserSessions();
for (final UserSession userSession : userSessions) {
BehaviorModelTableGenerationStage.LOGGER.debug("entryCalls: {}", userSession.getEvents().size());
final List<EntryCallEvent> entryCalls = userSession.getEvents();
EntryCallEvent lastCall = null;
for (final EntryCallEvent eventCall : entryCalls) {
if (lastCall != null) {
this.modelTable.addTransition(lastCall, eventCall);
this.modelTable.addInformation(eventCall);
} else {
/**
* only called at first valid event (condition lastCall == null is not needed)
*/
this.modelTable.addInformation(eventCall);
}
lastCall = eventCall;
}
}
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class UserSessionToModelGeneratorTest method setup.
@Before
public void setup() {
final String[] parameters1 = { "view A" };
final String[] values1 = { "" };
final PayloadAwareEntryCallEvent event1 = TestHelper.createEvent(1, "A", parameters1, values1);
final String[] parameters2 = { "view B" };
final String[] values2 = { "" };
final PayloadAwareEntryCallEvent event2 = TestHelper.createEvent(2, "B", parameters2, values2);
final String[] parameters3 = { "stay at B" };
final String[] values3 = { "with value 1" };
final PayloadAwareEntryCallEvent event3 = TestHelper.createEvent(3, "B", parameters3, values3);
final String[] parameters4 = { "stay at B" };
final String[] values4 = { "with value 2" };
final PayloadAwareEntryCallEvent event4 = TestHelper.createEvent(4, "B", parameters4, values4);
final String[] parameters5 = { "stay at B with other parameter name" };
final String[] values5 = { "" };
final PayloadAwareEntryCallEvent event5 = TestHelper.createEvent(5, "B", parameters5, values5);
this.session = new UserSession("", "");
this.session.add(event1);
this.session.add(event2);
this.session.add(event3);
this.session.add(event4);
this.session.add(event5);
}
use of org.iobserve.analysis.session.data.UserSession in project iobserve-analysis by research-iobserve.
the class TEntryCallSequenceFilter 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;
}
Aggregations