org.tinygroup.event.Event.setServiceRequest()方法的使用及代码示例

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

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

Event.setServiceRequest介绍

暂无

代码示例

代码示例来源:origin: org.tinygroup/org.tinygroup.imda

private Event getEvent(Context context, String serviceId) {
    Event event = new Event(UUID.randomUUID().toString()
        .replaceAll("-", ""));
    ServiceRequest serviceRequest = new ServiceRequest();
    event.setServiceRequest(serviceRequest);
    serviceRequest.setServiceId(serviceId);
    serviceRequest.setContext(context);
    return event;
  }
}

代码示例来源:origin: org.tinygroup/org.tinygroup.imda

private Event getEvent(ModelRequestInfo modelRequestInfo, Context context) {
  Event event = new Event(UUID.randomUUID().toString()
      .replaceAll("-", ""));
  Context eventContext = ContextFactory.getContext();
  eventContext.put("modelRequestInfo", modelRequestInfo);
  eventContext.put("modelRequestContext", context);
  ServiceRequest serviceRequest = new ServiceRequest();
  event.setServiceRequest(serviceRequest);
  serviceRequest.setServiceId("processModelService");
  serviceRequest.setContext(eventContext);
  return event;
}

代码示例来源:origin: org.tinygroup/event

public static Event createEvent(String serviceId, Context context) {
    Event event = new Event();
    ServiceRequest serviceRequest = new ServiceRequest();
    serviceRequest.setServiceId(serviceId);
    serviceRequest.setContext(context);
    event.setServiceRequest(serviceRequest);
    return event;
  }
}

代码示例来源:origin: org.tinygroup/weblayer

private Object callService(String serviceId, Context context) {
  CEPCore core = SpringUtil.getBean(CEPCore.CEP_CORE_BEAN);
  Event event = new Event();
  ServiceRequest sq = new ServiceRequest();
  sq.setServiceId(serviceId);
  sq.setContext(context);
  event.setServiceRequest(sq);
  core.process(event);
  ServiceInfo info = core.getServiceInfo(serviceId);
  List<Parameter> resultsParam = info.getResults();
  if (resultsParam.size() == 0) {
    return null;
  }
  return event.getServiceRequest().getContext()
      .get(resultsParam.get(0).getName());
}

代码示例来源:origin: org.tinygroup/org.tinygroup.servicewrapper

private Event getEvent(String serviceId, Context context) throws Exception {
  Event event = new Event();
  event.setEventId(UUID.randomUUID().toString());
  ServiceRequest serviceRequest = new ServiceRequest();
  serviceRequest.setContext(context);
  serviceRequest.setServiceId(serviceId);
  try {
    String nodeName = InvokeNodeSetter.getNodeName();
    int eventMode = EventModeSetter.getEventMode();
    if (!StringUtil.isBlank(nodeName)) {
      serviceRequest.setNodeName(nodeName);
    }
    event.setMode(eventMode);
  } finally {
    InvokeNodeSetter.removeNodeName();
    EventModeSetter.removeEventMode();
  }
  event.setServiceRequest(serviceRequest);
  return event;
}

代码示例来源:origin: org.tinygroup/org.tinygroup.cepcore

public static Object execute(String serviceId, Object[] paramArray,
               ClassLoader loader) {
  CEPCore cepcore = BeanContainerFactory.getBeanContainer(loader)
      .getBean(CEPCore.CEP_CORE_BEAN);
  // 获取服务信息
  ServiceInfo serviceInfo = cepcore.getServiceInfo(serviceId);
  // 将服务参数值与key映射起来,组装一个context出来
  List<Parameter> params = serviceInfo.getParameters();
  Context context = ContextFactory.getContext();
  for (int i = 0; i < params.size(); i++) {
    context.put(params.get(i).getName(), paramArray[i]);
  }
  // 组装Event
  Event event = new Event();
  ServiceRequest request = new ServiceRequest();
  request.setServiceId(serviceId);
  request.setContext(context);
  event.setServiceRequest(request);
  cepcore.process(event);
  List<Parameter> result = serviceInfo.getResults();
  if (result == null || result.isEmpty())
    return null;
  return event.getServiceRequest().getContext()
      .get(result.get(0).getName());
}

相关文章