add summary board
*/
package com.hack23.cia.web.impl.ui.application.views.user.parliament.pagemode;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
+import com.github.markash.ui.component.card.CounterStatisticModel;
+import com.github.markash.ui.component.card.CounterStatisticsCard;
+import com.github.markash.ui.component.card.StatisticShow;
import com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup;
import com.hack23.cia.service.api.action.kpi.ComplianceCheck;
import com.hack23.cia.service.api.action.kpi.ComplianceCheckRequest;
import com.hack23.cia.service.api.action.kpi.ComplianceCheckResponse;
+import com.hack23.cia.service.api.action.kpi.ResourceType;
+import com.hack23.cia.service.api.action.kpi.Status;
import com.hack23.cia.web.impl.ui.application.action.ViewAction;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
import com.hack23.cia.web.impl.ui.application.views.common.viewnames.RiskIndicators;
+import com.vaadin.icons.VaadinIcons;
+import com.vaadin.ui.HorizontalLayout;
import com.vaadin.ui.Layout;
import com.vaadin.ui.MenuBar;
import com.vaadin.ui.Panel;
@@ -70,6 +81,23 @@ public Layout createContent(final String parameters, final MenuBar menuBar, fina
ComplianceCheckResponse serviceResponse = (ComplianceCheckResponse) getApplicationManager()
.service(serviceRequest);
+ HorizontalLayout horizontalLayout = new HorizontalLayout();
+
+ for (Entry<Status, List<ComplianceCheck>> statusEntry : serviceResponse.getStatusMap().entrySet()) {
+ horizontalLayout.addComponent(new CounterStatisticsCard(
+ VaadinIcons.WARNING,new CounterStatisticModel("ALL:" +statusEntry.getKey().toString(),statusEntry.getValue().size()).withShow(StatisticShow.Sum)
+ .withIconHidden().withShowOnlyStatistic(true),"ALL:" +statusEntry.getKey().toString()));
+ }
+
+ for (Entry<ResourceType, List<ComplianceCheck>> statusEntry : serviceResponse.getResourceTypeMap().entrySet()) {
+ horizontalLayout.addComponent(new CounterStatisticsCard(
+ VaadinIcons.WARNING,new CounterStatisticModel("ALL:" +statusEntry.getKey().toString(),statusEntry.getValue().size()).withShow(StatisticShow.Sum)
+ .withIconHidden().withShowOnlyStatistic(true),"ALL:" +statusEntry.getKey().toString()));
+ }
+
+
+ panelContent.addComponent(horizontalLayout);
+
getGridFactory().createBasicBeanItemGrid(panelContent, ComplianceCheck.class, serviceResponse.getList(), "Risk",
new String[] { "name", "status", "resourceType", "ruleName" }, new String[] { "id", "ruleDescription" }, null, null, null);
