-
Notifications
You must be signed in to change notification settings - Fork 0
admin ui MVC set up #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 2 commits
a7d8fcd
b63e4f0
6254ba4
97ee7f8
93fd02e
23543a5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
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 <http://www.gnu.org/licenses/>. If | ||
you have any questions, contact <[email protected]>. | ||
*/ | ||
package femr.business.services.core; | ||
|
||
import femr.common.dtos.ServiceResponse; | ||
import femr.data.models.core.IKitStatus; | ||
import femr.data.models.core.INetworkStatus; | ||
import femr.data.models.core.IDatabaseStatus; | ||
|
||
import java.util.List; | ||
|
||
public interface IUpdatesService { | ||
|
||
/** | ||
* Retrieve network statuses. | ||
* | ||
* @return a list of current network statues. | ||
*/ | ||
ServiceResponse<List<? extends INetworkStatus>> retrieveNetworkStatuses(); | ||
|
||
/** | ||
* Update network statuses. | ||
* | ||
* @return a list of network statues after the update (update by running a script). | ||
*/ | ||
ServiceResponse<List<? extends INetworkStatus>> updateNetworkStatuses(); | ||
|
||
/** | ||
* Retrieve network statuses. | ||
* | ||
* @return a list of current network statues. | ||
*/ | ||
ServiceResponse<List<? extends IKitStatus>> retrieveKitStatuses(); | ||
|
||
/** | ||
* Update kit statuses. | ||
* | ||
* @return a list of kit statuses after the update (update by running a script?). | ||
*/ | ||
ServiceResponse<List<? extends IKitStatus>> updateKitStatuses(); | ||
|
||
/** | ||
* Retrieve database last update. | ||
* | ||
* @return a list of current database status. | ||
*/ | ||
ServiceResponse<List<? extends IDatabaseStatus>> retrieveDatabaseStatuses(); | ||
|
||
/** | ||
* Update database last update and do the backup via script. | ||
* | ||
* @return a list of kit database status. | ||
*/ | ||
ServiceResponse<List<? extends IDatabaseStatus>> updateDatabaseStatuses(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
/* | ||
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 <http://www.gnu.org/licenses/>. If | ||
you have any questions, contact <[email protected]>. | ||
*/ | ||
package femr.business.services.system; | ||
|
||
import com.google.inject.Inject; | ||
import femr.business.services.core.IUpdatesService; | ||
import femr.common.dtos.ServiceResponse; | ||
import femr.data.daos.IRepository; | ||
import femr.data.models.core.IKitStatus; | ||
import femr.data.models.core.INetworkStatus; | ||
import femr.data.models.core.IDatabaseStatus; | ||
import femr.data.models.mysql.KitStatus; | ||
import femr.data.models.mysql.NetworkStatus; | ||
import femr.data.models.mysql.DatabaseStatus; | ||
|
||
import java.util.List; | ||
|
||
public class UpdatesService implements IUpdatesService { | ||
|
||
private final IRepository<INetworkStatus> networkStatusRepository; | ||
private final IRepository<IKitStatus> kitStatusRepository; | ||
private final IRepository<IDatabaseStatus> databaseStatusRepository; | ||
|
||
@Inject | ||
public UpdatesService(IRepository<INetworkStatus> networkStatusRepository, | ||
IRepository<IKitStatus> kitStatusRepository, | ||
IRepository<IDatabaseStatus> databaseStatusRepository) { | ||
this.networkStatusRepository = networkStatusRepository; | ||
this.kitStatusRepository = kitStatusRepository; | ||
this.databaseStatusRepository = databaseStatusRepository; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public ServiceResponse<List<? extends INetworkStatus>> retrieveNetworkStatuses() { | ||
ServiceResponse<List<? extends INetworkStatus>> response = new ServiceResponse<>(); | ||
try { | ||
List<? extends INetworkStatus> networkStatuses = networkStatusRepository.findAll(NetworkStatus.class); | ||
response.setResponseObject(networkStatuses); | ||
|
||
} catch (Exception ex) { | ||
response.addError("", ex.getMessage()); | ||
} | ||
return response; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public ServiceResponse<List<? extends INetworkStatus>> updateNetworkStatuses() { | ||
ServiceResponse<List<? extends INetworkStatus>> response = new ServiceResponse<>(); | ||
//TODO: Lemur Team update the database with the right values | ||
return response; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public ServiceResponse<List<? extends IKitStatus>> retrieveKitStatuses() { | ||
ServiceResponse<List<? extends IKitStatus>> response = new ServiceResponse<>(); | ||
try { | ||
List<? extends IKitStatus> kitStatuses = kitStatusRepository.findAll(KitStatus.class); | ||
response.setResponseObject(kitStatuses); | ||
|
||
} catch (Exception ex) { | ||
response.addError("", ex.getMessage()); | ||
} | ||
return response; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public ServiceResponse<List<? extends IKitStatus>> updateKitStatuses() { | ||
ServiceResponse<List<? extends IKitStatus>> response = new ServiceResponse<>(); | ||
//TODO: Lemur Team update the database with the right values | ||
return response; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public ServiceResponse<List<? extends IDatabaseStatus>> retrieveDatabaseStatuses() { | ||
ServiceResponse<List<? extends IDatabaseStatus>> response = new ServiceResponse<>(); | ||
try { | ||
List<? extends IDatabaseStatus> kitStatuses = databaseStatusRepository.findAll(DatabaseStatus.class); | ||
response.setResponseObject(kitStatuses); | ||
|
||
} catch (Exception ex) { | ||
response.addError("", ex.getMessage()); | ||
} | ||
return response; | ||
} | ||
|
||
/** | ||
* {@inheritDoc} | ||
*/ | ||
@Override | ||
public ServiceResponse<List<? extends IDatabaseStatus>> updateDatabaseStatuses() { | ||
ServiceResponse<List<? extends IDatabaseStatus>> response = new ServiceResponse<>(); | ||
//TODO: Feather Team backup database ---> run script to see if it successsfully return if it succeeds or not | ||
|
||
String updated_date = java.time.LocalDate.now().toString().replace("-", "."); | ||
DatabaseStatus databaseStatus = new DatabaseStatus(); | ||
databaseStatus.setName("Last Backup"); | ||
databaseStatus.setValue(updated_date); | ||
databaseStatusRepository.update(databaseStatus); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still need this code? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think adding the date in two places was a backup thing? |
||
/*List<? extends ISystemSetting> allSystemSettings = systemSettingRepository.findAll(SystemSetting.class); | ||
|
||
try { | ||
if(systemSettings == null){ | ||
//If systemSettings is null, that means that all settings buttons were unchecked. | ||
for (ISystemSetting ss: allSystemSettings){ | ||
ss.setActive(false); | ||
systemSettingRepository.update(ss); | ||
} | ||
} else { | ||
for (ISystemSetting ss : allSystemSettings) { | ||
if (systemSettings.contains(ss.getName())) { | ||
ss.setActive(true); | ||
systemSettingRepository.update(ss); | ||
} else { | ||
ss.setActive(false); | ||
systemSettingRepository.update(ss); | ||
} | ||
} | ||
response.setResponseObject(allSystemSettings); | ||
} | ||
} catch (Exception ex) { | ||
response.addError("", ex.getMessage()); | ||
}*/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. remove commented out code if no longer needed |
||
return response; | ||
} | ||
|
||
|
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
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 <http://www.gnu.org/licenses/>. If | ||
you have any questions, contact <[email protected]>. | ||
*/ | ||
package femr.data.models.core; | ||
|
||
public interface IDatabaseStatus { | ||
int getId(); | ||
|
||
void setId(int id); | ||
|
||
String getName(); | ||
|
||
void setName(String name); | ||
|
||
String getValue(); | ||
|
||
void setValue(String value); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
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 <http://www.gnu.org/licenses/>. If | ||
you have any questions, contact <[email protected]>. | ||
*/ | ||
package femr.data.models.core; | ||
|
||
|
||
public interface IKitStatus { | ||
int getId(); | ||
|
||
void setId(int id); | ||
|
||
String getName(); | ||
|
||
void setName(String name); | ||
|
||
String getValue(); | ||
|
||
void setValue(String value); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
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 <http://www.gnu.org/licenses/>. If | ||
you have any questions, contact <[email protected]>. | ||
*/ | ||
package femr.data.models.core; | ||
|
||
public interface IKitUpdate { | ||
int getId(); | ||
|
||
void setId(int id); | ||
|
||
String getName(); | ||
|
||
void setName(String name); | ||
|
||
String getValue(); | ||
|
||
void setValue(String value); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
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 <http://www.gnu.org/licenses/>. If | ||
you have any questions, contact <[email protected]>. | ||
*/ | ||
package femr.data.models.core; | ||
|
||
public interface INetworkStatus { | ||
int getId(); | ||
|
||
void setId(int id); | ||
|
||
String getName(); | ||
|
||
void setName(String name); | ||
|
||
String getValue(); | ||
|
||
void setValue(String value); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn’t this variable be named databaseStatuses?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes sir, gotta change this... done!