io.cattle.platform.eventing.model.Event.getTransitioningMessage()方法的使用及代码示例

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

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

Event.getTransitioningMessage介绍

暂无

代码示例

代码示例来源:origin: rancher/cattle

@Override
public String getTransitioningMessage() {
  return event == null ? super.getTransitioningMessage() : event.getTransitioningMessage();
}

代码示例来源:origin: rancher/cattle

public static EventExecutionException fromEvent(Event event) {
  String internal = event.getTransitioningInternalMessage();
  if (internal != null && internal.startsWith("class:")) {
    String className = internal.split(":")[1];
    try {
      Class<?> clz = Class.forName(className);
      if (EventExecutionException.class.isAssignableFrom(clz)) {
        if (event instanceof EventVO) {
          ((EventVO<?>) event).setTransitioningInternalMessage(null);
        }
        return (EventExecutionException) clz.getConstructor(String.class, Event.class)
            .newInstance(event.getTransitioningMessage(), event);
      }
    } catch (ClassNotFoundException e) {
    } catch (InvocationTargetException e) {
    } catch (NoSuchMethodException e) {
    } catch (InstantiationException e) {
    } catch (IllegalAccessException e) {
    }
  }
  String message = event.getTransitioningInternalMessage() == null ?
      event.getTransitioningMessage() : event.getTransitioningInternalMessage();
  return new EventExecutionException(message, event);
}

代码示例来源:origin: rancher/cattle

@Override
  public void progress(Event event) {
    Map<String, Object> data = new HashMap<String, Object>();
    String transitioning = event.getTransitioningMessage();
    Integer progress = event.getTransitioningProgress();
    if (transitioning != null) {
      data.put(ObjectMetaDataManager.TRANSITIONING_MESSAGE_FIELD, transitioning);
    }
    if (progress != null) {
      data.put(ObjectMetaDataManager.TRANSITIONING_PROGRESS_FIELD, progress);
    }
    if (data.size() > 0) {
      DataChangedException dce = null;
      for (int i = 0; i < 3 ; i++) {
        try {
          Object reloaded = objectManager.reload(resource);
          objectManager.setFields(reloaded, data);
          dce = null;
          break;
        } catch (DataChangedException e) {
          dce = e;
        }
      }
      if (dce != null) {
        throw dce;
      }
    }
  }
});

代码示例来源:origin: rancher/cattle

@Override
  public void progress(Event event) {
    String message = event.getTransitioningMessage();
    if (message != null) {
      progressInstance.messsage(message);
    }
    Integer eventProgress = event.getTransitioningProgress();
    if (eventProgress != null) {
      progressInstance.progress(eventProgress);
    }
  }
});

代码示例来源:origin: rancher/cattle

public static void copyTransitioning(Event from, EventVO<?> to) {
    to.setTransitioning(from.getTransitioning());
    to.setTransitioningInternalMessage(from.getTransitioningInternalMessage());
    to.setTransitioningMessage(from.getTransitioningMessage());
    to.setTransitioningProgress(from.getTransitioningProgress());
  }
}

代码示例来源:origin: rancher/cattle

@SuppressWarnings("unchecked")
public EventVO(Event event, String replyTo) {
  this.replyTo = replyTo;
  this.id = event.getId();
  this.name = event.getName();
  this.previousIds = event.getPreviousIds();
  this.previousNames = event.getPreviousNames();
  this.data = (T) event.getData();
  this.time = event.getTime();
  this.publisher = event.getPublisher();
  this.resourceId = event.getResourceId();
  this.resourceType = event.getResourceType();
  this.transitioning = event.getTransitioning();
  this.transitioningMessage = event.getTransitioningMessage();
  this.transitioningInternalMessage = event.getTransitioningInternalMessage();
  this.transitioningProgress = event.getTransitioningProgress();
  this.context = event.getContext();
  this.timeoutMillis = event.getTimeoutMillis();
}

相关文章