use of com.hack23.cia.service.api.action.common.ServiceResponse in project cia by Hack23.
the class UpdateApplicationConfigurationClickListener method buttonClick.
@Override
public void buttonClick(final ClickEvent event) {
final ServiceResponse response = ApplicationMangerAccess.getApplicationManager().service(request);
if (ServiceResult.SUCCESS == response.getResult()) {
LOGGER.info(LOG_UPDATE_APPLICATION_CONFIGURATION, request.getApplicationConfigurationId());
UI.getCurrent().getNavigator().navigateTo(AdminViews.ADMIN_APPLICATIONS_CONFIGURATION_VIEW_NAME + "/" + request.getApplicationConfigurationId());
} else {
Notification.show(UPDATE_APPLICATION_CONFIGURATION_FAILED, ERROR_MESSAGE, Notification.Type.WARNING_MESSAGE);
LOGGER.info(LOG_MSG_UPDATE_APPLICATION_CONFIGURATION_FAILURE, request.getApplicationConfigurationId());
}
}
use of com.hack23.cia.service.api.action.common.ServiceResponse in project cia by Hack23.
the class RegisterUserClickListener method buttonClick.
@Override
public void buttonClick(final ClickEvent event) {
final ServiceResponse response = ApplicationMangerAccess.getApplicationManager().service(reqisterRequest);
if (ServiceResult.SUCCESS == response.getResult()) {
LOGGER.info(LOG_MSG_REGISTER_USER, reqisterRequest.getUsername());
UI.getCurrent().getNavigator().navigateTo(UserViews.USERHOME_VIEW_NAME);
} else {
Notification.show(REGISTER_FAILED, response.getErrorMessage(), Notification.Type.WARNING_MESSAGE);
LOGGER.info(REGISTER_USER_FAILURE, reqisterRequest.getUsername());
}
}
use of com.hack23.cia.service.api.action.common.ServiceResponse in project cia by Hack23.
the class CitizenIntelligenceAgencyUI method init.
@Override
protected void init(final VaadinRequest request) {
VaadinSession.getCurrent().setErrorHandler(new UiInstanceErrorHandler(this));
setSizeFull();
springNavigator.addView(CRLF_REPLACEMENT, mainView);
setNavigator(springNavigator);
final Page currentPage = Page.getCurrent();
final String requestUrl = currentPage.getLocation().toString();
final String language = request.getLocale().getLanguage();
final UserConfiguration userConfiguration = configurationManager.getUserConfiguration(requestUrl, language);
currentPage.setTitle(userConfiguration.getAgency().getAgencyName() + ":" + userConfiguration.getPortal().getPortalName() + ":" + userConfiguration.getLanguage().getLanguageName());
if (getSession().getUIs().isEmpty()) {
final WebBrowser webBrowser = currentPage.getWebBrowser();
final CreateApplicationSessionRequest serviceRequest = new CreateApplicationSessionRequest();
serviceRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
final String ipInformation = WebBrowserUtil.getIpInformation(webBrowser);
serviceRequest.setIpInformation(ipInformation);
serviceRequest.setTimeZone(webBrowser.getTimeZoneId());
serviceRequest.setScreenSize(webBrowser.getScreenWidth() + "x" + webBrowser.getScreenHeight());
serviceRequest.setUserAgentInformation(webBrowser.getBrowserApplication());
serviceRequest.setLocale(webBrowser.getLocale().toString());
serviceRequest.setOperatingSystem(WebBrowserUtil.getOperatingSystem(webBrowser));
serviceRequest.setSessionType(ApplicationSessionType.ANONYMOUS);
final ServiceResponse serviceResponse = applicationManager.service(serviceRequest);
LOGGER.info(LOG_INFO_BROWSER_ADDRESS_APPLICATION_SESSION_ID_RESULT, requestUrl.replaceAll(CRLF, CRLF_REPLACEMENT), language.replaceAll(CRLF, CRLF_REPLACEMENT), ipInformation.replaceAll(CRLF, CRLF_REPLACEMENT), webBrowser.getBrowserApplication().replaceAll(CRLF, CRLF_REPLACEMENT), serviceRequest.getSessionId().replaceAll(CRLF, CRLF_REPLACEMENT), serviceResponse.getResult().toString().replaceAll(CRLF, CRLF_REPLACEMENT));
}
}
use of com.hack23.cia.service.api.action.common.ServiceResponse 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 ComplianceCheckRequest serviceRequest = new ComplianceCheckRequest();
serviceRequest.setSessionId(RequestContextHolder.currentRequestAttributes().getSessionId());
final ComplianceCheckResponse serviceResponse = (ComplianceCheckResponse) getApplicationManager().service(serviceRequest);
final HorizontalLayout horizontalLayout = new HorizontalLayout();
for (final Entry<Status, List<RuleViolation>> statusEntry : serviceResponse.getStatusMap().entrySet()) {
horizontalLayout.addComponent(new CounterStatisticsCard(VaadinIcons.WARNING, new CounterStatisticModel("ALL:" + statusEntry.getKey(), statusEntry.getValue().size()).withShow(StatisticShow.Sum).withIconHidden().withShowOnlyStatistic(true), "ALL:" + statusEntry.getKey()));
}
final List<RuleViolation> ruleViolations = new ArrayList<>();
for (final Entry<ResourceType, List<RuleViolation>> statusEntry : serviceResponse.getResourceTypeMap().entrySet()) {
horizontalLayout.addComponent(new CounterStatisticsCard(VaadinIcons.WARNING, new CounterStatisticModel("ALL:" + statusEntry.getKey(), statusEntry.getValue().size()).withShow(StatisticShow.Sum).withIconHidden().withShowOnlyStatistic(true), "ALL:" + statusEntry.getKey()));
ruleViolations.addAll(statusEntry.getValue());
}
panelContent.addComponent(horizontalLayout);
Collections.sort(ruleViolations, new Comparator<RuleViolation>() {
@Override
public int compare(final RuleViolation o1, final RuleViolation o2) {
return o2.getStatus().compareTo(o1.getStatus());
}
});
getGridFactory().createBasicBeanItemGrid(panelContent, RuleViolation.class, ruleViolations, "Risk", new String[] { "name", "status", "resourceType", "ruleName", "ruleGroup", "ruleDescription", "positive" }, new String[] { "id" }, 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