File tree Expand file tree Collapse file tree
java/org/openmrs/module/referenceapplication/administrativenotification Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package org .openmrs .module .referenceapplication .administrativenotification ;
2+
3+ import java .util .List ;
4+ import java .util .Arrays ;
5+
6+ import org .openmrs .api .context .Context ;
7+ import org .openmrs .module .appframework .factory .AdministrativeNotificationProducer ;
8+ import org .openmrs .module .appframework .domain .AdministrativeNotification ;
9+ import org .springframework .stereotype .Component ;
10+
11+ @ Component
12+ public class DuplicateConceptNotification implements AdministrativeNotificationProducer {
13+
14+
15+
16+ @ Override
17+ public List <AdministrativeNotification > generateNotifications () {
18+
19+
20+ if (!Context .hasPrivilege ("Manage Concepts" )) {
21+ return null ;
22+ }
23+
24+ AdministrativeNotification notification = new AdministrativeNotification ();
25+
26+
27+ // checking whether concepts 1 and 2 exist in the system
28+ try {
29+ Integer concept1 = Context .getConceptService ().getConcept (1 ).getConceptId ();
30+ Integer concept2 = Context .getConceptService ().getConcept (2 ).getConceptId ();
31+ }catch (NullPointerException e ) {
32+ return null ;
33+ }
34+
35+
36+ notification .setId ("DuplicateConcepts.id" );
37+ notification .setIcon ("icon-info-sign" );
38+ notification .setCssClass ("success" );
39+ notification .setLabel ("DuplicateConcepts.label" );
40+ notification .setRequiredPrivilege ("Manage Concepts" );
41+
42+
43+
44+ return Arrays .asList (notification );
45+ }
46+ }
Original file line number Diff line number Diff line change @@ -107,3 +107,6 @@ referenceapplication.formentryapp.manageforms.label=Manage Forms
107107
108108general.auditInfo =Audit Info
109109
110+ DuplicateConcepts.label = Duplicate concepts exist. Please Upgrade to the latest version of reference Metadata Module
111+ DuplicateConcepts.id = Duplicate
112+
You can’t perform that action at this time.
0 commit comments