1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package com.hack23.cia.web.impl.ui.application.views.admin.system.pagemode;
20
21 import java.util.Arrays;
22
23 import org.springframework.security.access.annotation.Secured;
24 import org.springframework.stereotype.Component;
25
26 import com.hack23.cia.model.internal.application.system.impl.ApplicationActionEvent;
27 import com.hack23.cia.model.internal.application.system.impl.ApplicationActionEvent_;
28 import com.hack23.cia.model.internal.application.system.impl.ApplicationEventGroup;
29 import com.hack23.cia.service.api.DataContainer;
30 import com.hack23.cia.web.impl.ui.application.action.ViewAction;
31 import com.hack23.cia.web.impl.ui.application.views.common.labelfactory.LabelFactory;
32 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.AdminViews;
33 import com.hack23.cia.web.impl.ui.application.views.common.viewnames.PageMode;
34 import com.hack23.cia.web.impl.ui.application.views.pageclicklistener.PageItemPropertyClickListener;
35 import com.vaadin.data.util.BeanItem;
36 import com.vaadin.data.util.BeanItemContainer;
37 import com.vaadin.ui.Layout;
38 import com.vaadin.ui.MenuBar;
39 import com.vaadin.ui.Panel;
40 import com.vaadin.ui.VerticalLayout;
41
42
43
44
45 @Component
46 public final class AdminApplicationEventsPageModContentFactoryImpl extends AbstractAdminSystemPageModContentFactoryImpl {
47
48
49 private static final String ADMIN_APPLICATION_ACTION_EVENT = "Admin Application Action Event";
50
51
52 public static final String NAME = AdminViews.ADMIN_APPLICATIONS_EVENTS_VIEW_NAME;
53
54
55
56
57
58 public AdminApplicationEventsPageModContentFactoryImpl() {
59 super();
60 }
61
62 @Override
63 public boolean matches(final String page, final String parameters) {
64 return NAME.equals(page) && (parameters == null || !parameters.contains(PageMode.CHARTS.toString()));
65 }
66
67 @Secured({ "ROLE_ADMIN" })
68 @Override
69 public Layout createContent(final String parameters, final MenuBar menuBar, final Panel panel) {
70 final VerticalLayout content = createPanelContent();
71
72 final String pageId = getPageId(parameters);
73 final int pageNr= getPageNr(parameters);
74
75 getMenuItemFactory().createMainPageMenuBar(menuBar);
76
77
78 LabelFactory.createHeader2Label(content,ADMIN_APPLICATION_ACTION_EVENT);
79
80 final DataContainer<ApplicationActionEvent, Long> dataContainer = getApplicationManager().getDataContainer(ApplicationActionEvent.class);
81
82 final BeanItemContainer<ApplicationActionEvent> politicianDocumentDataSource = new BeanItemContainer<>(ApplicationActionEvent.class,
83 dataContainer.getPageOrderBy(pageNr,DEFAULT_RESULTS_PER_PAGE, ApplicationActionEvent_.createdDate));
84
85 createPagingControls(content,NAME,pageId, dataContainer.getSize(), pageNr, DEFAULT_RESULTS_PER_PAGE);
86
87 getGridFactory().createBasicBeanItemGrid(content, politicianDocumentDataSource,
88 "ApplicationActionEvent",
89 new String[] { "hjid", "createdDate", "userId","actionName","errorMessage","applicationMessage", "page","pageMode","elementId", "modelObjectVersion" }, new String[] { "hjid", "modelObjectId","modelObjectVersion","sessionId", "eventGroup", "applicationOperation" },
90 new PageItemPropertyClickListener(AdminViews.ADMIN_APPLICATIONS_EVENTS_VIEW_NAME, "hjid"), null, null);
91
92 if (pageId != null && !pageId.isEmpty()) {
93
94 final ApplicationActionEvent applicationActionEvent = dataContainer.load(Long.valueOf(pageId));
95
96 if (applicationActionEvent != null) {
97
98 getFormFactory().addFormPanelTextFields(content, new BeanItem<>(applicationActionEvent), ApplicationActionEvent.class,
99 Arrays.asList(new String[] { "createdDate", "eventGroup", "applicationOperation","page","pageMode","elementId","actionName","userId","sessionId","errorMessage","applicationMessage"}));
100 }
101 }
102
103
104 getPageActionEventHelper().createPageEvent(ViewAction.VISIT_ADMIN_APPLICATION_EVENTS_VIEW, ApplicationEventGroup.ADMIN,
105 NAME, null, pageId);
106
107 return content;
108
109 }
110
111 }