@Post("/alarm/{applicationId}") public String alarm(@Param("applicationId") String applicationId, Invocation invocation) { ApplicationAvailableInf applicationAvailableInf = (ApplicationAvailableInf) invocation.getModel("applicationAvailableInf"); ApplicationDetailAlarmViewModel applicationDetailAlarmViewModel = applicationDetailService.generateAlarmViewModel(applicationId); String availability = "iup"; if (applicationAvailableInf != null) { if (applicationAvailableInf.getTrend() == Trend.DROP) { availability = "idown"; } else if (applicationAvailableInf.getTrend() == Trend.RISE) { availability = "iup"; } } applicationDetailAlarmViewModel.setAvailability(availability); invocation.addModel("alarmViewModel", applicationDetailAlarmViewModel); return "applicationDetailAlarm"; }
@Post("/pie/{applicationId}") public String pie(@Param("applicationId") String applicationId, Invocation invocation) { ApplicationDetailPieViewModel applicationDetailPieViewModel = applicationDetailService.generatePieViewModel(applicationId); ApplicationAvailableInf applicationAvailableInf = (ApplicationAvailableInf) invocation.getModel("applicationAvailableInf"); if (applicationAvailableInf == null) { applicationDetailPieViewModel.setAvailabilityCount(0); applicationDetailPieViewModel.setUnavailabilityCount(0); } else { applicationDetailPieViewModel.setAvailabilityCount( applicationAvailableInf.getAvailableCount()); applicationDetailPieViewModel.setUnavailabilityCount( applicationAvailableInf.getCount() - applicationAvailableInf.getAvailableCount()); } invocation.addModel("pieViewModel", applicationDetailPieViewModel); return "applicationDetailPie"; }