public Task(Long id, String name, Status status, String date, String info) { this.id = id; this.name = name; this.status = status.getValue(); this.date = date; this.info = info; }
public static Status parse(String val) { Status status = null; for (Status item : Status.values()) { if (item.getValue() == val) { status = item; break; } } return status; }
/** * Get the {@link ServiceStatus} for the rolled up service. The name for the ServiceStatus is the * name of this rolled up service. The {@link Status} is computed based on the status of the * critical and non-critical subsystems. The {@link List} of reasons contains the reasons reported * for each system. Each service returns the service name in addition to the reason that it has * that status (which is reported by the service itself) * * @return the {@link ServiceStatus}. */ @Override public ServiceStatus getServiceStatus() { final List<String> reasons = new ArrayList<String>(); Status criticalStatus = Status.UP; for (final MonitoredService m : criticals) { final ServiceStatus serviceStatus = m.getServiceStatus(); final Status status = serviceStatus.getStatus(); if (statusIsNotUp(status)) { for (final String reason : serviceStatus.getReasons()) { reasons.add(serviceStatus.getName() + ":" + reason); } } if (status.getValue() < criticalStatus.getValue()) { criticalStatus = status; } } Status result = Status.UP; for (final MonitoredService m : noncriticals) { final ServiceStatus serviceStatus = m.getServiceStatus(); final Status status = serviceStatus.getStatus(); if (statusIsNotUp(status)) { for (final String reason : serviceStatus.getReasons()) { reasons.add(serviceStatus.getName() + ":" + reason); } result = Status.DEGRADED; } } if (criticalStatus.getValue() < result.getValue()) { result = criticalStatus; } return new ServiceStatus(name, result, reasons); }
/** * toString * * @return a {@link java.lang.String} object. */ public String toString() { return new ToStringBuilder(this) .append("NodeId", m_node.getId()) .append("ospfRouterId", str(m_ospfRouterId)) .append("ospfRouterIdNetmask", str(m_ospfRouterIdNetmask)) .append("ospfRouterIdIfindex", m_ospfRouterIdIfindex) .append("ospfAdminStat", Status.getTypeString(m_ospfAdminStat.getValue())) .append("ospfVersionNumber", m_ospfVersionNumber) .append("ospfBdrRtrStatus", TruthValue.getTypeString(m_ospfBdrRtrStatus.getValue())) .append("ospfASBdrRtrStatus", TruthValue.getTypeString(m_ospfASBdrRtrStatus.getValue())) .append("createTime", m_ospfNodeCreateTime) .append("lastPollTime", m_ospfNodeLastPollTime) .toString(); }
static { for (Status s : EnumSet.allOf(Status.class)) lookup.put(s.getValue(), s); }
public void setStatus(Status status) { propertyChangeSupport.firePropertyChange( "status", this.status, this.status = status.getValue()); }