diff --git a/app/femr/util/dependencyinjection/modules/BusinessLayerModule.java b/app/femr/util/dependencyinjection/modules/BusinessLayerModule.java
index 1b8b8be42..96ab4f5b9 100644
--- a/app/femr/util/dependencyinjection/modules/BusinessLayerModule.java
+++ b/app/femr/util/dependencyinjection/modules/BusinessLayerModule.java
@@ -31,6 +31,7 @@ protected void configure() {
//Business Service Injection
bind(IConceptService.class).to(ConceptService.class);
bind(IConfigureService.class).to(ConfigureService.class);
+ bind(IUpdatesService.class).to(UpdatesService.class);
bind(ITabService.class).to(TabService.class);
bind(IEncounterService.class).to(EncounterService.class);
bind(IInventoryService.class).to(InventoryService.class);
diff --git a/app/femr/util/dependencyinjection/modules/DataLayerModule.java b/app/femr/util/dependencyinjection/modules/DataLayerModule.java
index 5315f7ed9..7ab5d18b0 100644
--- a/app/femr/util/dependencyinjection/modules/DataLayerModule.java
+++ b/app/femr/util/dependencyinjection/modules/DataLayerModule.java
@@ -60,6 +60,9 @@ protected void configure() {
bind(IPhoto.class).toProvider(PhotoProvider.class);
bind(IRole.class).toProvider(RoleProvider.class);
bind(ISystemSetting.class).toProvider(SystemSettingProvider.class);
+ bind(INetworkStatus.class).toProvider(NetworkStatusProvider.class);
+ bind(IKitStatus.class).toProvider(KitStatusProvider.class);
+ bind(IDatabaseStatus.class).toProvider(DatabaseStatusProvider.class);
bind(ITab.class).toProvider(TabProvider.class);
bind(ITabField.class).toProvider(TabFieldProvider.class);
bind(ITabFieldType.class).toProvider(TabFieldTypeProvider.class);
@@ -89,6 +92,9 @@ protected void configure() {
bind(new TypeLiteral>(){}).to(new TypeLiteral>(){});
bind(new TypeLiteral>() {}).to(new TypeLiteral>() {});
bind(new TypeLiteral>() {}).to(new TypeLiteral>(){});
+ bind(new TypeLiteral>() {}).to(new TypeLiteral>(){});
+ bind(new TypeLiteral>() {}).to(new TypeLiteral>(){});
+ bind(new TypeLiteral>() {}).to(new TypeLiteral>(){});
bind(new TypeLiteral>(){}).to(new TypeLiteral>(){});
bind(new TypeLiteral>(){}).to(new TypeLiteral>(){});
bind(new TypeLiteral>(){}).to(new TypeLiteral>(){});
diff --git a/app/femr/util/dependencyinjection/providers/DatabaseStatusProvider.java b/app/femr/util/dependencyinjection/providers/DatabaseStatusProvider.java
new file mode 100644
index 000000000..0edb9472a
--- /dev/null
+++ b/app/femr/util/dependencyinjection/providers/DatabaseStatusProvider.java
@@ -0,0 +1,30 @@
+/*
+ fEMR - fast Electronic Medical Records
+ Copyright (C) 2014 Team fEMR
+
+ fEMR is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ fEMR is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fEMR. If not, see . If
+ you have any questions, contact .
+*/
+package femr.util.dependencyinjection.providers;
+
+import com.google.inject.Provider;
+import femr.data.models.core.IDatabaseStatus;
+import femr.data.models.mysql.DatabaseStatus;
+
+public class DatabaseStatusProvider implements Provider {
+ @Override
+ public IDatabaseStatus get() {
+ return new DatabaseStatus();
+ }
+}
\ No newline at end of file
diff --git a/app/femr/util/dependencyinjection/providers/KitStatusProvider.java b/app/femr/util/dependencyinjection/providers/KitStatusProvider.java
new file mode 100644
index 000000000..bea0ac7e0
--- /dev/null
+++ b/app/femr/util/dependencyinjection/providers/KitStatusProvider.java
@@ -0,0 +1,30 @@
+/*
+ fEMR - fast Electronic Medical Records
+ Copyright (C) 2014 Team fEMR
+
+ fEMR is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ fEMR is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fEMR. If not, see . If
+ you have any questions, contact .
+*/
+package femr.util.dependencyinjection.providers;
+
+import com.google.inject.Provider;
+import femr.data.models.core.IKitStatus;
+import femr.data.models.mysql.KitStatus;
+
+public class KitStatusProvider implements Provider {
+ @Override
+ public IKitStatus get() {
+ return new KitStatus();
+ }
+}
\ No newline at end of file
diff --git a/app/femr/util/dependencyinjection/providers/NetworkStatusProvider.java b/app/femr/util/dependencyinjection/providers/NetworkStatusProvider.java
new file mode 100644
index 000000000..1d761a2ce
--- /dev/null
+++ b/app/femr/util/dependencyinjection/providers/NetworkStatusProvider.java
@@ -0,0 +1,30 @@
+/*
+ fEMR - fast Electronic Medical Records
+ Copyright (C) 2014 Team fEMR
+
+ fEMR is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ fEMR is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with fEMR. If not, see . If
+ you have any questions, contact .
+*/
+package femr.util.dependencyinjection.providers;
+
+import com.google.inject.Provider;
+import femr.data.models.core.INetworkStatus;
+import femr.data.models.mysql.NetworkStatus;
+
+public class NetworkStatusProvider implements Provider {
+ @Override
+ public INetworkStatus get() {
+ return new NetworkStatus();
+ }
+}
\ No newline at end of file
diff --git a/app/femr/util/startup/DatabaseSeeder.java b/app/femr/util/startup/DatabaseSeeder.java
index 227e6e97d..ef582f823 100644
--- a/app/femr/util/startup/DatabaseSeeder.java
+++ b/app/femr/util/startup/DatabaseSeeder.java
@@ -47,6 +47,9 @@ public class DatabaseSeeder {
private final IRepository missionCityRepository;
private final IRepository missionTeamRepository;
private final IRepository systemSettingRepository;
+ private final IRepository networkStatusRepository;
+ private final IRepository kitStatusRepository;
+ private final IRepository databaseStatusRepository;
private final IRepository tabFieldRepository;
private final IRepository tabFieldSizeRepository;
private final IRepository tabFieldTypeRepository;
@@ -64,6 +67,9 @@ public DatabaseSeeder(IPatientRepository patientRepository,
IRepository missionCityRepository,
IRepository missionTeamRepository,
IRepository systemSettingRepository,
+ IRepository networkStatusRepository,
+ IRepository kitStatusRepository,
+ IRepository databaseStatusRepository,
IRepository tabFieldRepository,
IRepository tabFieldSizeRepository,
IRepository tabFieldTypeRepository,
@@ -79,6 +85,9 @@ public DatabaseSeeder(IPatientRepository patientRepository,
this.passwordEncryptor = passwordEncryptor;
this.diagnosisRepository = diagnosisRepository;
this.systemSettingRepository = systemSettingRepository;
+ this.networkStatusRepository = networkStatusRepository;
+ this.kitStatusRepository = kitStatusRepository;
+ this.databaseStatusRepository = databaseStatusRepository;
this.tabFieldRepository = tabFieldRepository;
this.tabFieldSizeRepository = tabFieldSizeRepository;
this.tabFieldTypeRepository = tabFieldTypeRepository;
@@ -94,6 +103,9 @@ public DatabaseSeeder(IPatientRepository patientRepository,
private void seed() {
seedMissionTripInformation();
+ seedNetworkStatus();
+ seedKitStatus();
+ seedDatabaseStatus();
seedSystemSettings();
seedSystemSettingsDescriptions();
seedAdminUser();
@@ -107,6 +119,85 @@ private void seed() {
seedVitals();
}
+ private void seedDatabaseStatus() {
+ //TODO Feather to set initial values
+ List extends IDatabaseStatus> databaseStatuses = databaseStatusRepository.findAll(DatabaseStatus.class);
+ DatabaseStatus databaseStatus;
+ if (databaseStatuses != null && !containDatabaseStatus(databaseStatuses, "Last Backup")) {
+ databaseStatus = new DatabaseStatus();
+ databaseStatus.setName("Last Backup");
+ databaseStatus.setValue("2021.02.17");
+ databaseStatusRepository.create(databaseStatus);
+ }
+ }
+
+ private void seedKitStatus() {
+ //TODO Lemur to set initial values
+ List extends IKitStatus> kitStatuses = kitStatusRepository.findAll(KitStatus.class);
+ KitStatus kitStatus;
+ if (kitStatuses != null && !containKitStatus(kitStatuses, "Status")) {
+ kitStatus = new KitStatus();
+ kitStatus.setName("Status");
+ kitStatus.setValue("Currently Online");
+ kitStatusRepository.create(kitStatus);
+ }
+ if (kitStatuses != null && !containKitStatus(kitStatuses, "Version")) {
+ kitStatus = new KitStatus();
+ kitStatus.setName("Version");
+ kitStatus.setValue("1.0.0");
+ kitStatusRepository.create(kitStatus);
+ }
+ if (kitStatuses != null && !containKitStatus(kitStatuses, "Last Update")) {
+ kitStatus = new KitStatus();
+ kitStatus.setName("Last Update");
+ kitStatus.setValue("2021.02.17");
+ kitStatusRepository.create(kitStatus);
+ }
+ if (kitStatuses != null && !containKitStatus(kitStatuses, "Type")) {
+ kitStatus = new KitStatus();
+ kitStatus.setName("Type");
+ kitStatus.setValue("Docker Container");
+ kitStatusRepository.create(kitStatus);
+ }
+ }
+
+ private void seedNetworkStatus() {
+ //TODO Lemur to set initial values
+ List extends INetworkStatus> networkStatuses = networkStatusRepository.findAll(NetworkStatus.class);
+ NetworkStatus networkStatus;
+ if (networkStatuses != null && !containNetworkStatus(networkStatuses, "Status")) {
+ networkStatus = new NetworkStatus();
+ networkStatus.setName("Status");
+ networkStatus.setValue("Connection Stable");
+ networkStatusRepository.create(networkStatus);
+ }
+ if (networkStatuses != null && !containNetworkStatus(networkStatuses, "Download")) {
+ networkStatus = new NetworkStatus();
+ networkStatus.setName("Download");
+ networkStatus.setValue("10 Mbps");
+ networkStatusRepository.create(networkStatus);
+ }
+ if (networkStatuses != null && !containNetworkStatus(networkStatuses, "Upload")) {
+ networkStatus = new NetworkStatus();
+ networkStatus.setName("Upload");
+ networkStatus.setValue("1 Mbps");
+ networkStatusRepository.create(networkStatus);
+ }
+ if (networkStatuses != null && !containNetworkStatus(networkStatuses, "Ping")) {
+ networkStatus = new NetworkStatus();
+ networkStatus.setName("Ping");
+ networkStatus.setValue("76 ms");
+ networkStatusRepository.create(networkStatus);
+ }
+ if (networkStatuses != null && !containNetworkStatus(networkStatuses, "Last Available")) {
+ networkStatus = new NetworkStatus();
+ networkStatus.setName("Last Available");
+ networkStatus.setValue("2021.02.17");
+ networkStatusRepository.create(networkStatus);
+ }
+ }
+
+
private void seedVitals() {
List extends IVital> vitals = vitalRepository.findAll(Vital.class);
@@ -1073,6 +1164,33 @@ private static boolean containSetting(List extends ISystemSetting> systemSetti
return false;
}
+ private static boolean containNetworkStatus(List extends INetworkStatus> networkStatuses, String name) {
+ for (INetworkStatus ns : networkStatuses) {
+ if (ns.getName().equals(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static boolean containKitStatus(List extends IKitStatus> kitStatuses, String name) {
+ for (IKitStatus ks : kitStatuses) {
+ if (ks.getName().equals(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static boolean containDatabaseStatus(List extends IDatabaseStatus> databaseStatuses, String name) {
+ for (IDatabaseStatus ds : databaseStatuses) {
+ if (ds.getName().equals(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private static boolean containTabField(List extends ITabField> tabFields, String tabField) {
for (ITabField tf : tabFields) {
if (tf.getName().equals(tabField)) {
diff --git a/conf/evolutions/default/110.sql b/conf/evolutions/default/110.sql
new file mode 100644
index 000000000..f031b00a4
--- /dev/null
+++ b/conf/evolutions/default/110.sql
@@ -0,0 +1,12 @@
+# --- !Ups
+
+CREATE TABLE `network_status` (
+ `id` INT(11) NOT NULL AUTO_INCREMENT,
+ `name` VARCHAR(255) NOT NULL,
+ `val` VARCHAR(255) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE INDEX `id_UNIQUE` (`id` ASC));
+
+# --- !Downs
+
+DROP TABLE `network_status`;
\ No newline at end of file
diff --git a/conf/evolutions/default/111.sql b/conf/evolutions/default/111.sql
new file mode 100644
index 000000000..8ba69d2ed
--- /dev/null
+++ b/conf/evolutions/default/111.sql
@@ -0,0 +1,12 @@
+# --- !Ups
+
+CREATE TABLE `kit_status` (
+ `id` INT(11) NOT NULL AUTO_INCREMENT,
+ `name` VARCHAR(255) NOT NULL,
+ `val` VARCHAR(255) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE INDEX `id_UNIQUE` (`id` ASC));
+
+# --- !Downs
+
+DROP TABLE `kit_status`;
\ No newline at end of file
diff --git a/conf/evolutions/default/112.sql b/conf/evolutions/default/112.sql
new file mode 100644
index 000000000..0218fb75c
--- /dev/null
+++ b/conf/evolutions/default/112.sql
@@ -0,0 +1,12 @@
+# --- !Ups
+
+CREATE TABLE `database_status` (
+ `id` INT(11) NOT NULL AUTO_INCREMENT,
+ `name` VARCHAR(255) NOT NULL,
+ `val` VARCHAR(255) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE INDEX `id_UNIQUE` (`id` ASC));
+
+# --- !Downs
+
+DROP TABLE `database_status`;
\ No newline at end of file
diff --git a/conf/routes b/conf/routes
index d7fbb5d63..389e00b75 100644
--- a/conf/routes
+++ b/conf/routes
@@ -28,6 +28,9 @@ POST /admin/inventory/editCurrent/:id/:tripId @femr.ui.controll
POST /admin/inventory/editTotal/:id/:tripId @femr.ui.controllers.admin.InventoryController.ajaxEditTotal(id: Integer, tripId: Integer)
GET /admin/configure @femr.ui.controllers.admin.ConfigureController.manageGet()
POST /admin/configure @femr.ui.controllers.admin.ConfigureController.managePost()
+GET /admin/updates @femr.ui.controllers.admin.UpdatesController.manageGet()
+POST /admin/updates/database @femr.ui.controllers.admin.UpdatesController.databasePost()
+POST /admin/updates/kit @femr.ui.controllers.admin.UpdatesController.kitUpdatePost()
GET /admin/trips @femr.ui.controllers.admin.TripController.manageGet()
POST /admin/trips @femr.ui.controllers.admin.TripController.managePost()
GET /admin/trips/edit/:id @femr.ui.controllers.admin.TripController.editGet(id: Integer)
diff --git a/test/unit/app/femr/data/models/mysql/DatabaseStatusTest.java b/test/unit/app/femr/data/models/mysql/DatabaseStatusTest.java
new file mode 100644
index 000000000..aa50bc03a
--- /dev/null
+++ b/test/unit/app/femr/data/models/mysql/DatabaseStatusTest.java
@@ -0,0 +1,33 @@
+package unit.app.femr.data.models.mysql;
+
+import femr.data.models.mysql.DatabaseStatus;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+public class DatabaseStatusTest {
+ DatabaseStatus ds;
+
+ @Before
+ public void setUp() {
+ ds = new DatabaseStatus();
+ }
+
+ @Test
+ public void checkId(){
+ ds.setId(123);
+ assertEquals(123, ds.getId());
+ }
+
+ @Test
+ public void checkName(){
+ ds.setName("very cool database");
+ assertEquals("very cool database", ds.getName());
+ }
+
+ @Test
+ public void checkValue(){
+ ds.setValue("connected");
+ assertEquals("connected", ds.getValue());
+ }
+}
diff --git a/test/unit/app/femr/data/models/mysql/KitStatusTest.java b/test/unit/app/femr/data/models/mysql/KitStatusTest.java
new file mode 100644
index 000000000..803105d64
--- /dev/null
+++ b/test/unit/app/femr/data/models/mysql/KitStatusTest.java
@@ -0,0 +1,33 @@
+package unit.app.femr.data.models.mysql;
+
+import femr.data.models.mysql.KitStatus;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+public class KitStatusTest {
+ KitStatus ks;
+
+ @Before
+ public void setUp() {
+ ks = new KitStatus();
+ }
+
+ @Test
+ public void checkId(){
+ ks.setId(123);
+ assertEquals(123, ks.getId());
+ }
+
+ @Test
+ public void checkName(){
+ ks.setName("KitA");
+ assertEquals("KitA", ks.getName());
+ }
+
+ @Test
+ public void checkValue(){
+ ks.setValue("deployed");
+ assertEquals("deployed", ks.getValue());
+ }
+}
diff --git a/test/unit/app/femr/data/models/mysql/KitUpdateTest.java b/test/unit/app/femr/data/models/mysql/KitUpdateTest.java
new file mode 100644
index 000000000..1ad8f2814
--- /dev/null
+++ b/test/unit/app/femr/data/models/mysql/KitUpdateTest.java
@@ -0,0 +1,33 @@
+package unit.app.femr.data.models.mysql;
+
+import femr.data.models.mysql.KitUpdate;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+public class KitUpdateTest {
+ KitUpdate ku;
+
+ @Before
+ public void setUp() {
+ ku = new KitUpdate();
+ }
+
+ @Test
+ public void checkId(){
+ ku.setId(123);
+ assertEquals(123, ku.getId());
+ }
+
+ @Test
+ public void checkName(){
+ ku.setName("new schema update");
+ assertEquals("new schema update", ku.getName());
+ }
+
+ @Test
+ public void checkValue(){
+ ku.setValue("completed");
+ assertEquals("completed", ku.getValue());
+ }
+}
diff --git a/test/unit/app/femr/data/models/mysql/NetworkStatusTest.java b/test/unit/app/femr/data/models/mysql/NetworkStatusTest.java
new file mode 100644
index 000000000..cec399f43
--- /dev/null
+++ b/test/unit/app/femr/data/models/mysql/NetworkStatusTest.java
@@ -0,0 +1,34 @@
+package unit.app.femr.data.models.mysql;
+
+import femr.data.models.mysql.NetworkStatus;
+import org.junit.Before;
+import org.junit.Test;
+import static org.junit.Assert.assertEquals;
+
+public class NetworkStatusTest {
+ NetworkStatus nt;
+
+ @Before
+ public void setUp() {
+ nt = new NetworkStatus();
+ }
+
+ @Test
+ public void checkId(){
+ nt.setId(123);
+ assertEquals(123, nt.getId());
+ }
+
+ @Test
+ public void checkName(){
+ nt.setName("NetworkA");
+ assertEquals("NetworkA", nt.getName());
+ }
+
+ @Test
+ public void checkValue(){
+ nt.setValue("connected");
+ assertEquals("connected", nt.getValue());
+ }
+
+}