@Override public void setAsText(String text) throws IllegalArgumentException { if (text != null && text.trim().length() > 0) { LiveActivityGroup group = activityRepository.getLiveActivityGroupById(text); if (group != null) setValue(group); else throw new IllegalArgumentException("No live activity group with ID " + text); } else setValue(null); }
@Override public void onLiveActivityRuntimeStateChange( String uuid, ActivityState runtimeState, String detail) { LiveActivity liveActivity = activityRepository.getLiveActivityByUuid(uuid); if (liveActivity != null) { Map<String, Object> data = Maps.newHashMap(); data.put( MasterApiMessage.MASTER_API_PARAMETER_NAME_STATUS_TYPE, MasterApiMessage.MASTER_API_PARAMETER_VALUE_TYPE_STATUS_LIVE_ACTIVITY); data.put(MasterApiMessage.MASTER_API_PARAMETER_NAME_ENTITY_UUID, uuid); data.put(MasterApiMessage.MASTER_API_PARAMETER_NAME_ENTITY_ID, liveActivity.getId()); data.put( MasterApiMessage.MASTER_API_PARAMETER_NAME_STATUS_RUNTIME_STATE, runtimeState.name()); data.put( MasterApiMessage.MASTER_API_PARAMETER_NAME_STATUS_RUNTIME_STATE_DESCRIPTION, runtimeState.getDescription()); data.put(MasterApiMessage.MASTER_API_PARAMETER_NAME_STATUS_DETAIL, detail); data.put( MasterApiMessage.MASTER_API_PARAMETER_NAME_STATUS_TIME, new Date(spaceEnvironment.getTimeProvider().getCurrentTime())); Map<String, Object> message = Maps.newHashMap(); message.put( MasterApiMessage.MASTER_API_MESSAGE_ENVELOPE_TYPE, MasterApiMessage.MASTER_API_MESSAGE_TYPE_STATUS_UPDATE); message.put(MasterApiMessage.MASTER_API_MESSAGE_ENVELOPE_DATA, data); webSocketFactory.sendJson(message); } else { spaceEnvironment .getLog() .warn( String.format( "Recived status update in web socket master client for unknown live activity UUID %s", uuid)); } }