Map<String, Object> map = mapper.readValue(data, HashMap.class);
String id = stringValue(map, "id", "container");
if (id != null) {
String container = stringValue(map, "container", "agent");
String statusPath = String.format("%s/%s", container, id);
MQBrokerStatusDTO containerStatus = containerMap.get(statusPath);
if (containerStatus != null) {
Boolean master = null;
List services = listValue(map, "services");
if (services != null) {
if (!services.isEmpty()) {
List<String> serviceTexts = new ArrayList<String>();
for (Object service : services) {
String serviceText = getSubstitutedData(curator, service.toString());
if (Strings.isNotBlank(serviceText)) {
serviceTexts.add(serviceText);
}
containerStatus.setServices(serviceTexts);
}
master = Boolean.TRUE;
} else {
master = Boolean.FALSE;
}
} else {
master = Boolean.FALSE;
}
containerStatus.setMaster(master);
}
}
}
}
}