private void validate(APIChangeHostStateMsg msg){ HostStatus hostStatus = Q.New(HostVO.class) .select(HostVO_.status) .eq(HostVO_.uuid,msg.getHostUuid()) .findValue(); if (hostStatus != HostStatus.Connected && msg.getStateEvent().equals(HostStateEvent.maintain.toString())){ throw new ApiMessageInterceptionException(operr("can not maintain host[uuid:%s, status:%s]which is not Connected", msg.getHostUuid(), hostStatus)); } } }
@Override public void run(final SyncTaskChain chain) { final APIChangeHostStateEvent evt = new APIChangeHostStateEvent(msg.getId()); HostStateEvent stateEvent = HostStateEvent.valueOf(msg.getStateEvent()); stateEvent = stateEvent == HostStateEvent.maintain ? HostStateEvent.preMaintain : stateEvent; try {