Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
wandechris committed Nov 16, 2020
1 parent 31b63ca commit f1bff78
Show file tree
Hide file tree
Showing 5 changed files with 356 additions and 337 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,9 @@ public List<NDRExportBatch> getExportBatchByStartMode(boolean startMode, boolean
criteria.addOrder(Order.desc("dateCreated"));
return criteria.list();
}

public String getSqlVersion() {
SQLQuery sql = getSession().createSQLQuery("Select version() as version");
return (String) sql.uniqueResult();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,8 @@ public interface NigeriaemrService extends OpenmrsService {
@Authorized(NigeriaemrConfig.MODULE_PRIVILEGE)
@Transactional
void deleteExports(int idInt) throws APIException;

@Authorized(NigeriaemrConfig.MODULE_PRIVILEGE)
@Transactional
String getSqlVersion() throws APIException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -205,4 +205,9 @@ public DatimMap getDatatimMapByDataimId(String datimId) throws APIException {
public void deleteExports(int batchId) throws APIException {
dao.deleteExports(batchId);
}

@Override
public String getSqlVersion() throws APIException {
return dao.getSqlVersion();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import org.openmrs.api.context.Context;
import org.openmrs.module.nigeriaemr.api.service.NigeriaEncounterService;
import org.openmrs.module.nigeriaemr.api.service.NigeriaObsService;
import org.openmrs.module.nigeriaemr.api.service.NigeriaemrService;
import org.openmrs.module.nigeriaemr.model.ndr.*;
import org.openmrs.module.nigeriaemr.ndrUtils.ConstantsUtil;
import org.openmrs.module.nigeriaemr.ndrUtils.LoggerUtils;
Expand Down Expand Up @@ -434,6 +435,8 @@ private MessageHeaderType createMessageHeaderType(Patient pts, boolean hasUpdate
}

public String getValidation(String id) {
NigeriaemrService nigeriaemrService = Context.getService(NigeriaemrService.class);
String sqlV = nigeriaemrService.getSqlVersion();
StringBuilder textToEnc = new StringBuilder();
textToEnc.append(System.getProperty("os.arch"));
textToEnc.append("|");
Expand All @@ -446,6 +449,8 @@ public String getValidation(String id) {
textToEnc.append(System.getProperty("java.version"));
textToEnc.append("|");
textToEnc.append(System.getProperty("user.home"));
textToEnc.append("|");
textToEnc.append(sqlV);
textToEnc.append("|");
textToEnc.append(Utils.getModules()); // list of modules and versions
textToEnc.append("|");
Expand Down
Loading

0 comments on commit f1bff78

Please sign in to comment.