@@ -66,12 +66,19 @@ public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, Strin
6666 params );
6767 }
6868
69+ boolean isCaseSurveillanceEnabled = FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .CASE_SURVEILANCE );
70+ boolean isAnySurveillanceEnabled = isCaseSurveillanceEnabled
71+ || FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .EVENT_SURVEILLANCE )
72+ || FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .AGGREGATE_REPORTING );
73+
6974 if (UserProvider .getCurrent ().hasUserRight (UserRight .INFRASTRUCTURE_VIEW )) {
70- menu .addView (
71- CountriesView .VIEW_NAME ,
72- I18nProperties .getPrefixCaption ("View" , CountriesView .VIEW_NAME .replaceAll ("/" , "." ) + ".short" , "" ),
73- null ,
74- false );
75+ if (isAnySurveillanceEnabled ) {
76+ menu .addView (
77+ CountriesView .VIEW_NAME ,
78+ I18nProperties .getPrefixCaption ("View" , CountriesView .VIEW_NAME .replaceAll ("/" , "." ) + ".short" , "" ),
79+ null ,
80+ false );
81+ }
7582 if (FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .INFRASTRUCTURE_TYPE_AREA )) {
7683 menu .addView (
7784 AreasView .VIEW_NAME ,
@@ -94,16 +101,14 @@ public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, Strin
94101 I18nProperties .getPrefixCaption ("View" , CommunitiesView .VIEW_NAME .replaceAll ("/" , "." ) + ".short" , "" ),
95102 null ,
96103 false );
97- if (FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .CASE_SURVEILANCE )
98- || FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .EVENT_SURVEILLANCE )
99- || FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .AGGREGATE_REPORTING )) {
104+ if (isAnySurveillanceEnabled ) {
100105 menu .addView (
101106 FacilitiesView .VIEW_NAME ,
102107 I18nProperties .getPrefixCaption ("View" , FacilitiesView .VIEW_NAME .replaceAll ("/" , "." ) + ".short" , "" ),
103108 null ,
104109 false );
105110 }
106- if (FacadeProvider . getFeatureConfigurationFacade (). isFeatureEnabled ( FeatureType . CASE_SURVEILANCE ) ) {
111+ if (isCaseSurveillanceEnabled ) {
107112 menu .addView (
108113 PointsOfEntryView .VIEW_NAME ,
109114 I18nProperties .getPrefixCaption ("View" , PointsOfEntryView .VIEW_NAME .replaceAll ("/" , "." ) + ".short" , "" ),
@@ -125,16 +130,15 @@ public void refreshMenu(SubMenu menu, Label infoLabel, Label infoLabelSub, Strin
125130 // UserRightsView.VIEW_NAME.replaceAll("/", ".") + ".short", ""), params);
126131 // }
127132
128- if (FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .LINE_LISTING )
129- && UserProvider .getCurrent ().hasUserRight (UserRight .LINE_LISTING_CONFIGURE )) {
133+ if (isCaseSurveillanceEnabled && UserProvider .getCurrent ().hasUserRight (UserRight .LINE_LISTING_CONFIGURE )) {
130134 RegionReferenceDto region = UserProvider .getCurrent ().getUser ().getRegion ();
131135 menu .addView (
132136 LineListingConfigurationView .VIEW_NAME ,
133137 I18nProperties .getPrefixCaption ("View" , LineListingConfigurationView .VIEW_NAME .replaceAll ("/" , "." ) + ".short" , "" ),
134138 region != null ? region .getUuid () : null ,
135139 false );
136140 }
137- if (UserProvider .getCurrent ().hasUserRight (UserRight .DOCUMENT_TEMPLATE_MANAGEMENT )) {
141+ if (isAnySurveillanceEnabled && UserProvider .getCurrent ().hasUserRight (UserRight .DOCUMENT_TEMPLATE_MANAGEMENT )) {
138142 menu .addView (
139143 DocumentTemplatesView .VIEW_NAME ,
140144 I18nProperties .getPrefixCaption ("View" , DocumentTemplatesView .VIEW_NAME .replaceAll ("/" , "." ) + ".short" , "" ),
@@ -156,20 +160,25 @@ public static void registerViews(Navigator navigator) {
156160 navigator .addView (OutbreaksView .VIEW_NAME , OutbreaksView .class );
157161 }
158162
163+ boolean isCaseSurveillanceEnabled = FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .CASE_SURVEILANCE );
164+ boolean isAnySurveillanceEnabled = isCaseSurveillanceEnabled
165+ || FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .EVENT_SURVEILLANCE )
166+ || FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .AGGREGATE_REPORTING );
167+
159168 if (UserProvider .getCurrent ().hasUserRight (UserRight .INFRASTRUCTURE_VIEW )) {
160169 if (FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .INFRASTRUCTURE_TYPE_AREA )) {
161170 navigator .addView (AreasView .VIEW_NAME , AreasView .class );
162171 }
163- navigator .addView (CountriesView .VIEW_NAME , CountriesView .class );
172+ if (isAnySurveillanceEnabled ) {
173+ navigator .addView (CountriesView .VIEW_NAME , CountriesView .class );
174+ }
164175 navigator .addView (RegionsView .VIEW_NAME , RegionsView .class );
165176 navigator .addView (DistrictsView .VIEW_NAME , DistrictsView .class );
166177 navigator .addView (CommunitiesView .VIEW_NAME , CommunitiesView .class );
167- if (FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .CASE_SURVEILANCE )
168- || FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .EVENT_SURVEILLANCE )
169- || FacadeProvider .getFeatureConfigurationFacade ().isFeatureEnabled (FeatureType .AGGREGATE_REPORTING )) {
178+ if (isAnySurveillanceEnabled ) {
170179 navigator .addView (FacilitiesView .VIEW_NAME , FacilitiesView .class );
171180 }
172- if (FacadeProvider . getFeatureConfigurationFacade (). isFeatureEnabled ( FeatureType . CASE_SURVEILANCE ) ) {
181+ if (isCaseSurveillanceEnabled ) {
173182 navigator .addView (PointsOfEntryView .VIEW_NAME , PointsOfEntryView .class );
174183 }
175184
@@ -182,11 +191,11 @@ public static void registerViews(Navigator navigator) {
182191 // navigator.addView(UserRightsView.VIEW_NAME, UserRightsView.class);
183192 // }
184193
185- if (UserProvider .getCurrent ().hasUserRight (UserRight .LINE_LISTING_CONFIGURE )) {
194+ if (isCaseSurveillanceEnabled && UserProvider .getCurrent ().hasUserRight (UserRight .LINE_LISTING_CONFIGURE )) {
186195 navigator .addView (LineListingConfigurationView .VIEW_NAME , LineListingConfigurationView .class );
187196 }
188197
189- if (UserProvider .getCurrent ().hasUserRight (UserRight .DOCUMENT_TEMPLATE_MANAGEMENT )) {
198+ if (isAnySurveillanceEnabled && UserProvider .getCurrent ().hasUserRight (UserRight .DOCUMENT_TEMPLATE_MANAGEMENT )) {
190199 navigator .addView (DocumentTemplatesView .VIEW_NAME , DocumentTemplatesView .class );
191200 }
192201
0 commit comments