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

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

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

Event.setInline介绍

[英]Set the inline 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);
    });
  }
}

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

protected void notifyEvent(String eventId, DocumentModel source, Map<String, Serializable> options, String category,
    String comment, boolean withLifeCycle, boolean inline) {
  DocumentEventContext ctx = new DocumentEventContext(this, getPrincipal(), source);
  // compatibility with old code (< 5.2.M4) - import info from old event
  // model
  if (options != null) {
    ctx.setProperties(options);
  }
  ctx.setProperty(CoreEventConstants.REPOSITORY_NAME, getRepositoryName());
  ctx.setProperty(CoreEventConstants.SESSION_ID, getSessionId());
  // Document life cycle
  if (source != null && withLifeCycle) {
    String currentLifeCycleState = source.getCurrentLifeCycleState();
    ctx.setProperty(CoreEventConstants.DOC_LIFE_CYCLE, currentLifeCycleState);
  }
  if (comment != null) {
    ctx.setProperty("comment", comment);
  }
  ctx.setProperty("category", category == null ? DocumentEventCategories.EVENT_DOCUMENT_CATEGORY : category);
  // compat code: mark SAVE event as a commit event
  Event event = ctx.newEvent(eventId);
  if (DocumentEventTypes.SESSION_SAVED.equals(eventId)) {
    event.setIsCommitEvent(true);
  }
  if (inline) {
    event.setInline(true);
  }
  Framework.getService(EventService.class).fireEvent(event);
}

相关文章

微信公众号

最新文章

更多