@java.lang.Override protected DataTable buildDataTable() { Query query = new Query(); query.setSortby("lastEventDate:desc"); query.setLimit(maxEntries); Condition matchAllCondition = new Condition(definitionsService.getConditionType("matchAllCondition")); query.setCondition(matchAllCondition); PartialList<Session> lastModifiedProfiles = profileService.searchSessions(query); DataTable dataTable = new DataTable(); for (Session session : lastModifiedProfiles.getList()) { ArrayList<Comparable> rowData = new ArrayList<>(); rowData.add(session.getItemId()); rowData.add(session.getScope()); rowData.add(session.getLastEventDate()); rowData.add(session.getDuration()); rowData.add(session.getProfileId()); rowData.add(session.getTimeStamp()); dataTable.addRow(rowData.toArray(new Comparable[rowData.size()])); } return dataTable; } }
Session session = (Session) item; if ("timeStamp".equals(expression)) { return session.getTimeStamp();
@Override public boolean execute() { try { for (Profile profile : profiles) { String profileId = profile.getItemId(); if (!StringUtils.equals(profileId, masterProfileId)) { List<Session> sessions = persistenceService.query("profileId", profileId, null, Session.class); if (masterProfileId.equals(profileId) && !sessions.contains(currentSession)) { sessions.add(currentSession); } for (Session session : sessions) { persistenceService.update(session.getItemId(), session.getTimeStamp(), Session.class, "profileId", anonymousBrowsing ? null : masterProfileId); } List<Event> events = persistenceService.query("profileId", profileId, null, Event.class); for (Event event : events) { persistenceService.update(event.getItemId(), event.getTimeStamp(), Event.class, "profileId", anonymousBrowsing ? null : masterProfileId); } // we must mark all the profiles that we merged into the master as merged with the master, and they will // be deleted upon next load profile.setMergedWith(masterProfileId); persistenceService.update(profile.getItemId(), null, Profile.class, "mergedWith", masterProfileId); } } } catch (Exception e) { logger.error("unable to execute callback action, profile and session will not be saved", e); return false; } return true; } });
profile.setProperty("firstVisit", currentSession.getTimeStamp()); profile.getSystemProperties().put(mergeProfilePropertyName, mergeProfilePropertyValue);