org.nuxeo.ecm.core.event.Event.setImmediate()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(106)

本文整理了Java中org.nuxeo.ecm.core.event.Event.setImmediate()方法的一些代码示例,展示了Event.setImmediate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Event.setImmediate()方法的具体详情如下:
包路径:org.nuxeo.ecm.core.event.Event
类名称:Event
方法名:setImmediate

Event.setImmediate介绍

[英]Sets the immediate flag.
[中]

代码示例

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core

protected void notifyEvent(CoreSession session, String eventId, DocumentModel doc, boolean immediate) {
  DocumentEventContext ctx = new DocumentEventContext(session, session.getPrincipal(), doc);
  ctx.setProperties(new HashMap<>(doc.getContextData()));
  ctx.setCategory(DocumentEventCategories.EVENT_DOCUMENT_CATEGORY);
  ctx.setProperty(CoreEventConstants.REPOSITORY_NAME, session.getRepositoryName());
  ctx.setProperty(CoreEventConstants.SESSION_ID, session.getSessionId());
  Event event = ctx.newEvent(eventId);
  event.setInline(false);
  event.setImmediate(immediate);
  EventService eventService = Framework.getService(EventService.class);
  eventService.fireEvent(event);
}

代码示例来源:origin: org.nuxeo.ecm.core/nuxeo-core-bulk

protected void fireEvent(CoreSession session, String eventId, Collection<DocumentRef> refs) {
    EventService eventService = Framework.getService(EventService.class);
    DocumentModelList docs = session.getDocuments(refs.toArray(new DocumentRef[0]));
    docs.forEach(d -> {
      DocumentEventContext ctx = new DocumentEventContext(session, session.getPrincipal(), d);
      ctx.setProperty(REPOSITORY_NAME, session.getRepositoryName());
      ctx.setProperty(SESSION_ID, session.getSessionId());
      ctx.setCategory(EVENT_DOCUMENT_CATEGORY);
      Event event = ctx.newEvent(eventId);
      event.setImmediate(false);
      event.setInline(false);
      eventService.fireEvent(event);
    });
  }
}

相关文章