@Override public Event newEvent(String name) { int flags = boundToCoreSession ? Event.FLAG_NONE : Event.FLAG_IMMEDIATE; return newEvent(name, flags); }
public UnboundEventContext(CoreSession session, NuxeoPrincipal principal, Map<String, Serializable> properties) { super(session, principal); setProperties(properties); boundToCoreSession = session != null; }
protected static boolean sendAuthenticationEvent(UserIdentificationInfo userInfo, String eventId, String comment) { LoginContext loginContext = null; try { try { loginContext = Framework.login(); } catch (LoginException e) { log.error("Unable to log in in order to log Login event" + e.getMessage()); return false; } EventProducer evtProducer = Framework.getService(EventProducer.class); NuxeoPrincipal principal = new UserPrincipal(userInfo.getUserName(), null, false, false); Map<String, Serializable> props = new HashMap<>(); props.put("AuthenticationPlugin", userInfo.getAuthPluginName()); props.put("LoginPlugin", userInfo.getLoginPluginName()); props.put("category", LOGIN_CATEGORY); props.put("comment", comment); EventContext ctx = new UnboundEventContext(principal, props); evtProducer.fireEvent(ctx.newEvent(eventId)); return true; } finally { if (loginContext != null) { try { loginContext.logout(); } catch (LoginException e) { log.error("Unable to logout: " + e.getMessage()); } } } }
EventContext ctx = new UnboundEventContext(principal, props); es.fireEvent(ctx.newEvent("search"));