use of com.hack23.cia.model.internal.application.data.rules.impl.ResourceType in project cia by Hack23.
the class DashboardViewOverviewPageModContentFactoryImpl method createDashboardPartRiskByType.
private void createDashboardPartRiskByType(final ResponsiveRow row) {
final CssLayout layout = new CssLayout();
layout.addStyleName("v-layout-content-overview-dashboard-panel-level2");
Responsive.makeResponsive(layout);
layout.setSizeUndefined();
final Label titleLabel = new Label("Number of risk by each type");
Responsive.makeResponsive(titleLabel);
// button.setStyleName(LINK_STYLE_NAME);
titleLabel.addStyleName("title");
titleLabel.setWidth(100, Unit.PERCENTAGE);
layout.addComponent(titleLabel);
final HorizontalLayout horizontalLayout = new HorizontalLayout();
Responsive.makeResponsive(horizontalLayout);
final DataContainer<RuleViolation, String> dataContainer = getApplicationManager().getDataContainer(RuleViolation.class);
final List<RuleViolation> ruleViolations = dataContainer.getAll();
for (final Entry<ResourceType, List<RuleViolation>> statusEntry : ruleViolations.stream().collect(Collectors.groupingBy(RuleViolation::getResourceType)).entrySet()) {
horizontalLayout.addComponent(new CounterStatisticsCard(VaadinIcons.WARNING, new CounterStatisticModel("" + statusEntry.getKey(), statusEntry.getValue().size()).withShow(StatisticShow.Sum).withIconHidden().withShowOnlyStatistic(true), "" + statusEntry.getKey()));
}
layout.addComponent(horizontalLayout);
row.addColumn().withDisplayRules(DISPLAY_SIZE_XS_DEVICE, DISPLAYS_SIZE_XM_DEVICE, DISPLAY_SIZE_MD_DEVICE, DISPLAY_SIZE_LG_DEVICE).withComponent(layout);
}
use of com.hack23.cia.model.internal.application.data.rules.impl.ResourceType in project cia by Hack23.
the class ParliamentRiskPageModContentFactoryImpl method createContent.
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
final VerticalLayout panelContent = createPanelContent();
getParliamentMenuItemFactory().createParliamentTopicMenu(menuBar);
final String pageId = getPageId(parameters);
final HorizontalLayout horizontalLayout = new HorizontalLayout();
final DataContainer<RuleViolation, String> dataContainer = getApplicationManager().getDataContainer(RuleViolation.class);
final List<RuleViolation> ruleViolations = dataContainer.getAll();
final List<ComplianceCheckImpl> checks = new ArrayList<>();
for (final Entry<String, List<RuleViolation>> idMapViolations : ruleViolations.stream().collect(Collectors.groupingBy(RuleViolation::getReferenceId)).entrySet()) {
checks.add(new ComplianceCheckImpl(idMapViolations.getValue()));
}
Collections.sort(checks, (o1, o2) -> Integer.compare(o2.getRuleViolations().size(), o1.getRuleViolations().size()));
for (final Entry<Status, List<RuleViolation>> statusEntry : ruleViolations.stream().collect(Collectors.groupingBy(RuleViolation::getStatus)).entrySet()) {
horizontalLayout.addComponent(new CounterStatisticsCard(VaadinIcons.WARNING, new CounterStatisticModel("ALL:" + statusEntry.getKey(), statusEntry.getValue().size()).withShow(StatisticShow.Sum).withIconHidden().withShowOnlyStatistic(true), "ALL:" + statusEntry.getKey()));
}
for (final Entry<ResourceType, List<RuleViolation>> statusEntry : ruleViolations.stream().collect(Collectors.groupingBy(RuleViolation::getResourceType)).entrySet()) {
horizontalLayout.addComponent(new CounterStatisticsCard(VaadinIcons.WARNING, new CounterStatisticModel("ALL:" + statusEntry.getKey(), statusEntry.getValue().size()).withShow(StatisticShow.Sum).withIconHidden().withShowOnlyStatistic(true), "ALL:" + statusEntry.getKey()));
}
panelContent.addComponent(horizontalLayout);
getGridFactory().createBasicBeanItemGrid(panelContent, ComplianceCheckImpl.class, checks, "Risk", new String[] { "name", "resourceType", "numberRuleViolations", "ruleSummary" }, new String[] { "id", "ruleViolations" }, CLICK_LISTENER, null, null);
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_PARLIAMENT_RANKING_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
panel.setCaption(new StringBuilder().append(NAME).append("::").append(PARLIAMENT_RISK_SUMMARY).toString());
return panelContent;
}
use of com.hack23.cia.model.internal.application.data.rules.impl.ResourceType in project cia by Hack23.
the class ParliamentRuleViolationsPageModContentFactoryImpl method createContent.
@Secured({ "ROLE_ANONYMOUS", "ROLE_USER", "ROLE_ADMIN" })
@Override
public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
final VerticalLayout panelContent = createPanelContent();
getParliamentMenuItemFactory().createParliamentTopicMenu(menuBar);
final HorizontalLayout horizontalLayout = new HorizontalLayout();
final DataContainer<RuleViolation, String> dataContainer = getApplicationManager().getDataContainer(RuleViolation.class);
final List<RuleViolation> ruleViolations = dataContainer.getAll();
for (final Entry<Status, List<RuleViolation>> statusEntry : ruleViolations.stream().collect(Collectors.groupingBy(RuleViolation::getStatus)).entrySet()) {
horizontalLayout.addComponent(new CounterStatisticsCard(VaadinIcons.WARNING, new CounterStatisticModel("ALL:" + statusEntry.getKey(), statusEntry.getValue().size()).withShow(StatisticShow.Sum).withIconHidden().withShowOnlyStatistic(true), "ALL:" + statusEntry.getKey()));
}
for (final Entry<ResourceType, List<RuleViolation>> statusEntry : ruleViolations.stream().collect(Collectors.groupingBy(RuleViolation::getResourceType)).entrySet()) {
horizontalLayout.addComponent(new CounterStatisticsCard(VaadinIcons.WARNING, new CounterStatisticModel("ALL:" + statusEntry.getKey(), statusEntry.getValue().size()).withShow(StatisticShow.Sum).withIconHidden().withShowOnlyStatistic(true), "ALL:" + statusEntry.getKey()));
}
panelContent.addComponent(horizontalLayout);
Collections.sort(ruleViolations, (o1, o2) -> o2.getStatus().compareTo(o1.getStatus()));
getGridFactory().createBasicBeanItemGrid(panelContent, RuleViolation.class, ruleViolations, "Risk", new String[] { "name", "status", "resourceType", "ruleName", "ruleGroup", "ruleDescription", "positive" }, new String[] { "referenceId" }, CLICK_LISTENER, null, null);
final String pageId = getPageId(parameters);
getPageActionEventHelper().createPageEvent(ViewAction.VISIT_PARLIAMENT_RANKING_VIEW, ApplicationEventGroup.USER, NAME, parameters, pageId);
panel.setCaption(new StringBuilder().append(NAME).append("::").append(PARLIAMENT_RULE_VIOLATIONS).toString());
return panelContent;
}
Aggregations