public Collection<EventLog> matches(String klass, String action) { List<EventLog> rv = new ArrayList<EventLog>(); for (EventLog el : logs.get(klass)) { if (el.getAction().equals(action)) { rv.add(el); } } return rv; } }
/** * Removes and returns the next {@link EventLog} instance or null if none is * present. Also cleans up any tracking information for the given * {@link EventLog}. * * @return See above. */ public synchronized EventLog remove() { if (logs.size() == 0) { contained.clear(); return null; // EARLY EXIT } adding = false; EventLog log = logs.remove(0); // None of these can be null as long as the log is still contained Map<String, Set<String>> class2action = contained .get(log.getEntityId()); Set<String> actions = class2action.get(log.getEntityType()); assert actions.remove(log.getAction()); if (actions.size() == 0) { class2action.remove(log.getEntityType()); if (class2action.size() == 0) { contained.remove(log.getEntityId()); } } return log; }
@Override public Object retrieve(String field) { if (field == null) { return null; } else if (field.equals(ID)) { return getId(); } else if (field.equals(ENTITYID)) { return getEntityId(); } else if (field.equals(ENTITYTYPE)) { return getEntityType(); } else if (field.equals(ACTION)) { return getAction(); } else if (field.equals(EVENT)) { return getEvent(); } else if (field.equals(DETAILS)) { return getDetails(); } else { if (_dynamicFields != null) { return _dynamicFields.get(field); } return null; } }
|| log.getEntityId() == null || log.getAction() == null) { throw new IllegalArgumentException( "EventLog must contain entityType, entityId, and action"); boolean contained = actions.contains(log.getAction()); if (contained) { if (logger.isInfoEnabled()) { actions.add(log.getAction()); logs.add(log); if (logger.isInfoEnabled()) {
protected void handleEventLog(FullTextSession session, EventLog eventLog) { String act = eventLog.getAction(); Class type = asClassOrNull(eventLog.getEntityType()); if (type != null) {
sb.append(el.getEntityId()); sb.append(" - "); sb.append(el.getAction()); sb.append("\n");