use of org.opennms.netmgt.bsm.service.model.Status in project opennms by OpenNMS.
the class BusinessServicesTableCellStyleGenerator method getStyle.
@Override
public String getStyle(Table source, Object itemId, Object propertyId) {
if (propertyId == null) {
Long serviceId = (Long) itemId;
try {
BusinessService businessService = businessServiceManager.getBusinessServiceById(serviceId);
Status status = businessService.getOperationalStatus();
return String.format("alarm-%s", status.name().toLowerCase());
} catch (NoSuchElementException nse) {
return null;
}
}
return null;
}
use of org.opennms.netmgt.bsm.service.model.Status in project opennms by OpenNMS.
the class BusinessServiceEdgeStatusInfoPanelItemProvider method createComponent.
private Component createComponent(BusinessServiceEdge ref, GraphContainer container) {
FormLayout formLayout = new FormLayout();
formLayout.setMargin(false);
formLayout.setSpacing(false);
formLayout.addStyleName("severity");
final BusinessServiceStateMachine stateMachine = SimulationAwareStateMachineFactory.createStateMachine(businessServiceManager, container.getCriteria());
final Status outgoingStatus = BusinessServicesStatusProvider.getStatus(stateMachine, ref);
final Status incomingStatus = BusinessServicesStatusProvider.getStatus(stateMachine, ((AbstractBusinessServiceVertex) ref.getTarget().getVertex()));
formLayout.addComponent(createStatusLabel("Outgoing Severity", outgoingStatus));
formLayout.addComponent(createStatusLabel("Incoming Severity", incomingStatus));
return formLayout;
}
use of org.opennms.netmgt.bsm.service.model.Status in project opennms by OpenNMS.
the class BSMDashlet method createRow.
private HorizontalLayout createRow(BusinessService service) {
HorizontalLayout rowLayout = new HorizontalLayout();
rowLayout.setSizeFull();
rowLayout.setSpacing(true);
final Status severity = m_businessServiceManager.getOperationalStatus(service);
Label nameLabel = new Label(service.getName());
nameLabel.setSizeFull();
nameLabel.setStyleName("h3");
nameLabel.addStyleName("bright");
nameLabel.addStyleName("severity");
nameLabel.addStyleName(severity.getLabel());
rowLayout.addComponent(nameLabel);
return rowLayout;
}
use of org.opennms.netmgt.bsm.service.model.Status in project opennms by OpenNMS.
the class DefaultBusinessServiceStateMachine method reduceUpdateAndPropagateVertex.
private void reduceUpdateAndPropagateVertex(BusinessServiceGraph graph, GraphVertex vertex) {
if (vertex == null) {
// Nothing to do here
return;
}
// Calculate the weighed statuses from the child edges
List<StatusWithIndex> statuses = weighEdges(graph.getOutEdges(vertex));
// Reduce
Optional<StatusWithIndices> reducedStatus = vertex.getReductionFunction().reduce(statuses);
Status newStatus;
if (reducedStatus.isPresent()) {
newStatus = reducedStatus.get().getStatus();
} else {
newStatus = MIN_SEVERITY;
}
// Update and propagate
updateAndPropagateVertex(graph, vertex, newStatus);
}
use of org.opennms.netmgt.bsm.service.model.Status in project opennms by OpenNMS.
the class BusinessServiceEdgeEditWindow method getMapFunction.
@SuppressWarnings("unchecked")
private MapFunction getMapFunction() {
try {
final MapFunction mapFunction = ((Class<? extends MapFunction>) m_mapFunctionSelect.getValue()).newInstance();
mapFunction.accept(new MapFunctionVisitor<Void>() {
@Override
public Void visit(Decrease decrease) {
return null;
}
@Override
public Void visit(Identity identity) {
return null;
}
@Override
public Void visit(Ignore ignore) {
return null;
}
@Override
public Void visit(Increase increase) {
return null;
}
@Override
public Void visit(SetTo setTo) {
setTo.setStatus((Status) m_mapFunctionSeveritySelect.getValue());
return null;
}
});
return mapFunction;
} catch (final InstantiationException | IllegalAccessException e) {
throw Throwables.propagate(e);
}
}
Aggregations