boolean isWarning() { return this.healthStateLevel.equals(HealthStateLevel.WARNING); }
public ServerHealthState trump(ServerHealthState otherServerHealthState) { int result = healthStateLevel.compareTo(otherServerHealthState.healthStateLevel); return result > 0 ? this : otherServerHealthState; }
public Map<String, String> asJson() { Map<String, String> json = new LinkedHashMap<>(); json.put("message", getMessage()); json.put("detail", getDescription()); json.put("level", healthStateLevel.toString()); return json; }
public int hashCode() { int result = healthStateLevel.hashCode(); result = 31 * result + type.hashCode(); result = 31 * result + message.hashCode(); result = 31 * result + description.hashCode(); return result; }
public static void toJSON(OutputListWriter outputListWriter, Collection<ServerHealthState> healthStates) { healthStates.forEach(healthState -> outputListWriter.addChild(writer -> writer.add("message", healthState.getMessage()) .add("detail", healthState.getDescription()) .add("level", healthState.getLogLevel().toString()) .add("time", healthState.getTimestamp())) ); } }
public boolean isRealSuccess() { return this.healthStateLevel.equals(HealthStateLevel.OK); }
private boolean equals(ServerHealthState that) { if (!this.healthStateLevel.equals(that.healthStateLevel)) { return false; } if (!this.type.equals(that.type)) { return false; } if (!this.description.equals(that.description)) { return false; } if (!this.message.equals(that.message)) { return false; } return true; }
public boolean matchesSafely(ServerHealthService item) { allLogs = item.logs(); for (ServerHealthState serverHealthState : allLogs) { if (serverHealthState.getType().equals(healthStateType)) { entry = serverHealthState; } } if (!(entry != null)) { return false; } else { levelMatches = healthStateLevel == null || healthStateLevel.equals(entry.getLogLevel()); messageMatches = message == null || message.equals(entry.getMessage()); return levelMatches && messageMatches; } }