diff --git a/src/main/java/org/openelisglobal/common/controller/BaseController.java b/src/main/java/org/openelisglobal/common/controller/BaseController.java index 5c36541ba..3086331f9 100644 --- a/src/main/java/org/openelisglobal/common/controller/BaseController.java +++ b/src/main/java/org/openelisglobal/common/controller/BaseController.java @@ -13,10 +13,10 @@ import org.openelisglobal.common.form.BaseForm; import org.openelisglobal.common.log.LogEvent; import org.openelisglobal.common.util.ConfigurationProperties; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.common.util.StringUtil; import org.openelisglobal.internationalization.MessageUtil; import org.openelisglobal.login.dao.UserModuleService; -import org.openelisglobal.login.valueholder.UserSessionData; import org.openelisglobal.view.PageBuilderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -28,7 +28,7 @@ import org.springframework.web.servlet.support.RequestContextUtils; @Component -public abstract class BaseController implements IActionConstants { +public abstract class BaseController extends ControllerUtills { // Request being autowired appears to be threadsafe because of how Spring // handles autowiring, despite all controllers being singletons @@ -183,17 +183,6 @@ protected void setPageTitles(HttpServletRequest request, BaseForm form) { } } - protected String getSysUserId(HttpServletRequest request) { - UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA); - if (usd == null) { - usd = (UserSessionData) request.getAttribute(USER_SESSION_DATA); - if (usd == null) { - return null; - } - } - return String.valueOf(usd.getSystemUserId()); - } - protected void setSuccessFlag(HttpServletRequest request, boolean success) { request.setAttribute(FWD_SUCCESS, success); } diff --git a/src/main/java/org/openelisglobal/common/rest/DisplayListController.java b/src/main/java/org/openelisglobal/common/rest/DisplayListController.java index 645119986..a54264415 100644 --- a/src/main/java/org/openelisglobal/common/rest/DisplayListController.java +++ b/src/main/java/org/openelisglobal/common/rest/DisplayListController.java @@ -28,6 +28,7 @@ import org.openelisglobal.common.services.StatusService.AnalysisStatus; import org.openelisglobal.common.util.ConfigurationProperties; import org.openelisglobal.common.util.ConfigurationProperties.Property; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.common.util.DateUtil; import org.openelisglobal.common.util.IdValuePair; import org.openelisglobal.common.util.LabelValuePair; @@ -73,7 +74,7 @@ @Controller @RequestMapping(value = "/rest/") -public class DisplayListController extends BaseRestController { +public class DisplayListController extends ControllerUtills { @Value("${org.itech.login.saml:false}") private Boolean useSAML; diff --git a/src/main/java/org/openelisglobal/common/rest/provider/AllTestsForSampleTypeProviderRestController.java b/src/main/java/org/openelisglobal/common/rest/provider/AllTestsForSampleTypeProviderRestController.java index 72050cb2e..dd4dbbff4 100644 --- a/src/main/java/org/openelisglobal/common/rest/provider/AllTestsForSampleTypeProviderRestController.java +++ b/src/main/java/org/openelisglobal/common/rest/provider/AllTestsForSampleTypeProviderRestController.java @@ -20,7 +20,7 @@ import org.json.simple.JSONArray; import org.json.simple.JSONObject; import org.openelisglobal.common.log.LogEvent; -import org.openelisglobal.common.rest.BaseRestController; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.spring.util.SpringContext; import org.openelisglobal.test.valueholder.Test; import org.openelisglobal.typeofsample.service.TypeOfSampleService; @@ -33,7 +33,7 @@ @RestController @RequestMapping("/rest") -public class AllTestsForSampleTypeProviderRestController extends BaseRestController { +public class AllTestsForSampleTypeProviderRestController extends ControllerUtills { private TypeOfSampleService typeOfSampleService = SpringContext.getBean(TypeOfSampleService.class); diff --git a/src/main/java/org/openelisglobal/common/rest/provider/PatientSearchRestController.java b/src/main/java/org/openelisglobal/common/rest/provider/PatientSearchRestController.java index 52d02541d..df7b26547 100644 --- a/src/main/java/org/openelisglobal/common/rest/provider/PatientSearchRestController.java +++ b/src/main/java/org/openelisglobal/common/rest/provider/PatientSearchRestController.java @@ -19,10 +19,10 @@ import org.openelisglobal.common.provider.query.workerObjects.PatientSearchLocalAndExternalWorker; import org.openelisglobal.common.provider.query.workerObjects.PatientSearchLocalWorker; import org.openelisglobal.common.provider.query.workerObjects.PatientSearchWorker; -import org.openelisglobal.common.rest.BaseRestController; import org.openelisglobal.common.rest.util.PatientSearchResultsPaging; import org.openelisglobal.common.util.ConfigurationProperties; import org.openelisglobal.common.util.ConfigurationProperties.Property; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.dataexchange.fhir.FhirConfig; import org.openelisglobal.dataexchange.fhir.FhirUtil; import org.openelisglobal.dataexchange.fhir.service.FhirTransformService; @@ -49,7 +49,7 @@ @Controller @RequestMapping(value = "/rest/") -public class PatientSearchRestController extends BaseRestController { +public class PatientSearchRestController extends ControllerUtills { @Autowired private FhirConfig fhirConfig; diff --git a/src/main/java/org/openelisglobal/common/rest/provider/PendingAnalysisForTestProviderRestController.java b/src/main/java/org/openelisglobal/common/rest/provider/PendingAnalysisForTestProviderRestController.java index 3e795ec95..f300f75f2 100644 --- a/src/main/java/org/openelisglobal/common/rest/provider/PendingAnalysisForTestProviderRestController.java +++ b/src/main/java/org/openelisglobal/common/rest/provider/PendingAnalysisForTestProviderRestController.java @@ -23,10 +23,10 @@ import org.openelisglobal.analysis.service.AnalysisService; import org.openelisglobal.analysis.valueholder.Analysis; import org.openelisglobal.common.log.LogEvent; -import org.openelisglobal.common.rest.BaseRestController; import org.openelisglobal.common.services.IStatusService; import org.openelisglobal.common.services.StatusService; import org.openelisglobal.common.servlet.validation.AjaxServlet; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.spring.util.SpringContext; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -37,7 +37,7 @@ @RestController @RequestMapping("/rest") -public class PendingAnalysisForTestProviderRestController extends BaseRestController { +public class PendingAnalysisForTestProviderRestController extends ControllerUtills { private static final List NOT_STARTED; private static final List TECH_REJECT; diff --git a/src/main/java/org/openelisglobal/common/rest/provider/SampleEntryTestsForTypeProviderRestController.java b/src/main/java/org/openelisglobal/common/rest/provider/SampleEntryTestsForTypeProviderRestController.java index 49603df50..5d8dcf763 100755 --- a/src/main/java/org/openelisglobal/common/rest/provider/SampleEntryTestsForTypeProviderRestController.java +++ b/src/main/java/org/openelisglobal/common/rest/provider/SampleEntryTestsForTypeProviderRestController.java @@ -13,7 +13,7 @@ import org.apache.commons.validator.GenericValidator; import org.openelisglobal.common.action.IActionConstants; import org.openelisglobal.common.constants.Constants; -import org.openelisglobal.common.rest.BaseRestController; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.common.util.IdValuePair; import org.openelisglobal.common.util.StringUtil; import org.openelisglobal.login.valueholder.UserSessionData; @@ -38,7 +38,7 @@ @Controller @RequestMapping(value = "/rest/") -public class SampleEntryTestsForTypeProviderRestController extends BaseRestController { +public class SampleEntryTestsForTypeProviderRestController extends ControllerUtills { private static String USER_TEST_SECTION_ID; diff --git a/src/main/java/org/openelisglobal/common/rest/BaseRestController.java b/src/main/java/org/openelisglobal/common/util/ControllerUtills.java similarity index 78% rename from src/main/java/org/openelisglobal/common/rest/BaseRestController.java rename to src/main/java/org/openelisglobal/common/util/ControllerUtills.java index 1309d9a5f..de59a5d9e 100644 --- a/src/main/java/org/openelisglobal/common/rest/BaseRestController.java +++ b/src/main/java/org/openelisglobal/common/util/ControllerUtills.java @@ -1,13 +1,12 @@ -package org.openelisglobal.common.rest; +package org.openelisglobal.common.util; import javax.servlet.http.HttpServletRequest; import org.openelisglobal.common.action.IActionConstants; import org.openelisglobal.login.valueholder.UserSessionData; -import org.springframework.stereotype.Component; - -@Component -public class BaseRestController implements IActionConstants { +import org.springframework.stereotype.Controller; +@Controller +public class ControllerUtills implements IActionConstants { protected String getSysUserId(HttpServletRequest request) { UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA); if (usd == null) { @@ -18,4 +17,5 @@ protected String getSysUserId(HttpServletRequest request) { } return String.valueOf(usd.getSystemUserId()); } + } diff --git a/src/main/java/org/openelisglobal/notifications/rest/NotificationRestController.java b/src/main/java/org/openelisglobal/notifications/rest/NotificationRestController.java index 2c8da886e..52329fe6b 100644 --- a/src/main/java/org/openelisglobal/notifications/rest/NotificationRestController.java +++ b/src/main/java/org/openelisglobal/notifications/rest/NotificationRestController.java @@ -10,7 +10,7 @@ import nl.martijndwars.webpush.PushService; import org.apache.http.HttpResponse; import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.openelisglobal.login.valueholder.UserSessionData; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.notifications.dao.NotificationDAO; import org.openelisglobal.notifications.dao.NotificationSubscriptionDAO; import org.openelisglobal.notifications.entity.Notification; @@ -31,12 +31,11 @@ @RequestMapping("/rest") @RestController -public class NotificationRestController { +public class NotificationRestController extends ControllerUtills { private final NotificationDAO notificationDAO; private final SystemUserService systemUserService; private final NotificationSubscriptionDAO notificationSubscriptionDAO; - private static final String USER_SESSION_DATA = "userSessionData"; @Autowired private ConfigurableEnvironment env; @@ -210,15 +209,4 @@ public ResponseEntity unsubscribe(HttpServletRequest request) { return ResponseEntity.ok().body("Unsubscribed successfully"); } - - protected String getSysUserId(HttpServletRequest request) { - UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA); - if (usd == null) { - usd = (UserSessionData) request.getAttribute(USER_SESSION_DATA); - if (usd == null) { - return null; - } - } - return String.valueOf(usd.getSystemUserId()); - } } diff --git a/src/main/java/org/openelisglobal/patient/controller/rest/PatientManagementRestController.java b/src/main/java/org/openelisglobal/patient/controller/rest/PatientManagementRestController.java index d7f966b64..1b594b554 100644 --- a/src/main/java/org/openelisglobal/patient/controller/rest/PatientManagementRestController.java +++ b/src/main/java/org/openelisglobal/patient/controller/rest/PatientManagementRestController.java @@ -9,7 +9,7 @@ import org.hibernate.StaleObjectStateException; import org.openelisglobal.common.exception.LIMSRuntimeException; import org.openelisglobal.common.log.LogEvent; -import org.openelisglobal.common.rest.BaseRestController; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.dataexchange.fhir.exception.FhirPersistanceException; import org.openelisglobal.dataexchange.fhir.exception.FhirTransformationException; import org.openelisglobal.dataexchange.fhir.service.FhirTransformService; @@ -37,7 +37,7 @@ @Controller @RequestMapping(value = "/rest/") -public class PatientManagementRestController extends BaseRestController { +public class PatientManagementRestController extends ControllerUtills { @Autowired SearchResultsService searchService; @Autowired diff --git a/src/main/java/org/openelisglobal/program/controller/ProgramController.java b/src/main/java/org/openelisglobal/program/controller/ProgramController.java index 7d6974dd0..b41271f4f 100644 --- a/src/main/java/org/openelisglobal/program/controller/ProgramController.java +++ b/src/main/java/org/openelisglobal/program/controller/ProgramController.java @@ -6,9 +6,9 @@ import org.apache.commons.lang3.StringUtils; import org.apache.commons.validator.GenericValidator; import org.hl7.fhir.r4.model.Questionnaire; -import org.openelisglobal.common.rest.BaseRestController; import org.openelisglobal.common.services.DisplayListService; import org.openelisglobal.common.services.DisplayListService.ListType; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.dataexchange.fhir.FhirUtil; import org.openelisglobal.dataexchange.fhir.exception.FhirLocalPersistingException; import org.openelisglobal.dataexchange.fhir.service.FhirPersistanceService; @@ -28,7 +28,7 @@ @RestController @RequestMapping(value = "/rest") -public class ProgramController extends BaseRestController { +public class ProgramController extends ControllerUtills { @Autowired private FhirPersistanceService fhirPersistanceService; diff --git a/src/main/java/org/openelisglobal/program/controller/cytology/CytologyController.java b/src/main/java/org/openelisglobal/program/controller/cytology/CytologyController.java index 16f2ddc7d..5a70ad888 100644 --- a/src/main/java/org/openelisglobal/program/controller/cytology/CytologyController.java +++ b/src/main/java/org/openelisglobal/program/controller/cytology/CytologyController.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; -import org.openelisglobal.common.rest.BaseRestController; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.program.bean.CytologyDashBoardCount; import org.openelisglobal.program.service.cytology.CytologyDisplayService; import org.openelisglobal.program.service.cytology.CytologySampleService; @@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController -public class CytologyController extends BaseRestController { +public class CytologyController extends ControllerUtills { @Autowired private CytologySampleService cytologySampleService; diff --git a/src/main/java/org/openelisglobal/program/controller/immunohistochemistry/ImmunohistochemistryController.java b/src/main/java/org/openelisglobal/program/controller/immunohistochemistry/ImmunohistochemistryController.java index c136d04bc..e4fb38524 100644 --- a/src/main/java/org/openelisglobal/program/controller/immunohistochemistry/ImmunohistochemistryController.java +++ b/src/main/java/org/openelisglobal/program/controller/immunohistochemistry/ImmunohistochemistryController.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; -import org.openelisglobal.common.rest.BaseRestController; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.program.bean.ImmunohistochemistryDashBoardCount; import org.openelisglobal.program.service.ImmunohistochemistryDisplayService; import org.openelisglobal.program.service.ImmunohistochemistrySampleService; @@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController -public class ImmunohistochemistryController extends BaseRestController { +public class ImmunohistochemistryController extends ControllerUtills { @Autowired private ImmunohistochemistrySampleService immunohistochemistrySampleService; diff --git a/src/main/java/org/openelisglobal/program/controller/pathology/PathologyController.java b/src/main/java/org/openelisglobal/program/controller/pathology/PathologyController.java index d0772bb68..ec05a7ae7 100644 --- a/src/main/java/org/openelisglobal/program/controller/pathology/PathologyController.java +++ b/src/main/java/org/openelisglobal/program/controller/pathology/PathologyController.java @@ -7,7 +7,7 @@ import java.util.List; import java.util.stream.Collectors; import javax.servlet.http.HttpServletRequest; -import org.openelisglobal.common.rest.BaseRestController; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.program.bean.PathologyDashBoardCount; import org.openelisglobal.program.service.PathologyDisplayService; import org.openelisglobal.program.service.PathologySampleService; @@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController -public class PathologyController extends BaseRestController { +public class PathologyController extends ControllerUtills { @Autowired private PathologySampleService pathologySampleService; diff --git a/src/main/java/org/openelisglobal/qaevent/controller/rest/NonConformingEventsCorrectionActionRestController.java b/src/main/java/org/openelisglobal/qaevent/controller/rest/NonConformingEventsCorrectionActionRestController.java index b511a058e..dc9b2d4cb 100644 --- a/src/main/java/org/openelisglobal/qaevent/controller/rest/NonConformingEventsCorrectionActionRestController.java +++ b/src/main/java/org/openelisglobal/qaevent/controller/rest/NonConformingEventsCorrectionActionRestController.java @@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletRequest; import org.apache.commons.validator.GenericValidator; import org.openelisglobal.common.services.DisplayListService; -import org.openelisglobal.login.valueholder.UserSessionData; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.patient.action.bean.PatientSearch; import org.openelisglobal.qaevent.form.NonConformingEventForm; import org.openelisglobal.qaevent.service.NCEventService; @@ -26,12 +26,10 @@ @RestController @RequestMapping(value = "/rest") -public class NonConformingEventsCorrectionActionRestController { +public class NonConformingEventsCorrectionActionRestController extends ControllerUtills { private NCEventService ncEventService = SpringContext.getBean(NCEventService.class); - private static final String USER_SESSION_DATA = "userSessionData"; - @Autowired private NonConformingEventWorker nonConformingEventWorker; @@ -90,15 +88,4 @@ public ResponseEntity updateNCECorretiveActionForm(@RequestBody NonConforming return ResponseEntity.ok().body(Map.of("success", false)); } } - - protected String getSysUserId(HttpServletRequest request) { - UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA); - if (usd == null) { - usd = (UserSessionData) request.getAttribute(USER_SESSION_DATA); - if (usd == null) { - return null; - } - } - return String.valueOf(usd.getSystemUserId()); - } } diff --git a/src/main/java/org/openelisglobal/qaevent/controller/rest/ReportNonConformEventsRestController.java b/src/main/java/org/openelisglobal/qaevent/controller/rest/ReportNonConformEventsRestController.java index 15152f669..c5f3cb627 100644 --- a/src/main/java/org/openelisglobal/qaevent/controller/rest/ReportNonConformEventsRestController.java +++ b/src/main/java/org/openelisglobal/qaevent/controller/rest/ReportNonConformEventsRestController.java @@ -9,8 +9,8 @@ import org.openelisglobal.common.rest.bean.NceSampleItemInfo; import org.openelisglobal.common.services.DisplayListService; import org.openelisglobal.common.services.RequesterService; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.common.util.DateUtil; -import org.openelisglobal.login.valueholder.UserSessionData; import org.openelisglobal.qaevent.form.NonConformingEventForm; import org.openelisglobal.qaevent.service.NceCategoryService; import org.openelisglobal.qaevent.valueholder.NcEvent; @@ -33,7 +33,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController -public class ReportNonConformEventsRestController { +public class ReportNonConformEventsRestController extends ControllerUtills { private final SampleService sampleService; private final SampleItemService sampleItemService; @@ -42,8 +42,6 @@ public class ReportNonConformEventsRestController { private final NceCategoryService nceCategoryService; private final RequesterService requesterService; - private static final String USER_SESSION_DATA = "userSessionData"; - @Autowired private SystemUserService systemUserService; @@ -175,17 +173,6 @@ private NceSampleInfo addSample(Sample sample) { return sampleInfo; } - protected String getSysUserId(HttpServletRequest request) { - UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA); - if (usd == null) { - usd = (UserSessionData) request.getAttribute(USER_SESSION_DATA); - if (usd == null) { - return null; - } - } - return String.valueOf(usd.getSystemUserId()); - } - private Sample getSampleForLabNumber(String labNumber) throws LIMSInvalidConfigurationException { return sampleService.getSampleByAccessionNumber(labNumber); } diff --git a/src/main/java/org/openelisglobal/qaevent/controller/rest/ViewNonConformEventsRestController.java b/src/main/java/org/openelisglobal/qaevent/controller/rest/ViewNonConformEventsRestController.java index abfd7bcb3..e6047efc7 100644 --- a/src/main/java/org/openelisglobal/qaevent/controller/rest/ViewNonConformEventsRestController.java +++ b/src/main/java/org/openelisglobal/qaevent/controller/rest/ViewNonConformEventsRestController.java @@ -6,8 +6,8 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import org.openelisglobal.common.services.DisplayListService; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.common.util.DateUtil; -import org.openelisglobal.login.valueholder.UserSessionData; import org.openelisglobal.qaevent.form.NonConformingEventForm; import org.openelisglobal.qaevent.service.NCEventService; import org.openelisglobal.qaevent.service.NceCategoryService; @@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController -public class ViewNonConformEventsRestController { +public class ViewNonConformEventsRestController extends ControllerUtills { @Autowired private NCEventService ncEventService; @@ -46,8 +46,6 @@ public class ViewNonConformEventsRestController { @Autowired private SampleItemService sampleItemService; - private static final String USER_SESSION_DATA = "userSessionData"; - private final NonConformingEventWorker nonConformingEventWorker; public ViewNonConformEventsRestController(NonConformingEventWorker nonConformingEventWorker) { @@ -120,15 +118,4 @@ public ResponseEntity postReportNonConformingEvent(@RequestBody NonConforming .body("An error occurred while processing the request." + e); } } - - protected String getSysUserId(HttpServletRequest request) { - UserSessionData usd = (UserSessionData) request.getSession().getAttribute(USER_SESSION_DATA); - if (usd == null) { - usd = (UserSessionData) request.getAttribute(USER_SESSION_DATA); - if (usd == null) { - return null; - } - } - return String.valueOf(usd.getSystemUserId()); - } } diff --git a/src/main/java/org/openelisglobal/reports/controller/rest/ReportRestController.java b/src/main/java/org/openelisglobal/reports/controller/rest/ReportRestController.java index 9893169b3..c409f83db 100644 --- a/src/main/java/org/openelisglobal/reports/controller/rest/ReportRestController.java +++ b/src/main/java/org/openelisglobal/reports/controller/rest/ReportRestController.java @@ -16,7 +16,7 @@ import net.sf.jasperreports.engine.JRException; import org.openelisglobal.common.exception.LIMSRuntimeException; import org.openelisglobal.common.log.LogEvent; -import org.openelisglobal.common.rest.BaseRestController; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.common.util.validator.GenericValidator; import org.openelisglobal.reports.action.implementation.IReportCreator; import org.openelisglobal.reports.action.implementation.ReportImplementationFactory; @@ -30,7 +30,7 @@ @Controller @RequestMapping(value = "/rest/") -public class ReportRestController extends BaseRestController { +public class ReportRestController extends ControllerUtills { @Autowired private ServletContext context; diff --git a/src/main/java/org/openelisglobal/sample/service/PatientManagementUpdate.java b/src/main/java/org/openelisglobal/sample/service/PatientManagementUpdate.java index ec39ca9e2..860cc34c8 100644 --- a/src/main/java/org/openelisglobal/sample/service/PatientManagementUpdate.java +++ b/src/main/java/org/openelisglobal/sample/service/PatientManagementUpdate.java @@ -16,6 +16,7 @@ import org.openelisglobal.common.action.IActionConstants; import org.openelisglobal.common.exception.LIMSRuntimeException; import org.openelisglobal.common.log.LogEvent; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.common.validator.BaseErrors; import org.openelisglobal.login.valueholder.UserSessionData; import org.openelisglobal.patient.action.IPatientUpdate; @@ -39,7 +40,7 @@ @Service @Scope("prototype") -public class PatientManagementUpdate implements IPatientUpdate { +public class PatientManagementUpdate extends ControllerUtills implements IPatientUpdate { private String currentUserId; protected Patient patient; @@ -78,11 +79,6 @@ public void initializeGlobalVariables() { } } - protected String getSysUserId(HttpServletRequest request) { - UserSessionData usd = (UserSessionData) request.getSession().getAttribute(IActionConstants.USER_SESSION_DATA); - return String.valueOf(usd.getSystemUserId()); - } - public void setSysUserIdFromRequest(HttpServletRequest request) { UserSessionData usd = (UserSessionData) request.getSession().getAttribute(IActionConstants.USER_SESSION_DATA); currentUserId = String.valueOf(usd.getSystemUserId()); diff --git a/src/main/java/org/openelisglobal/workplan/controller/rest/PrintWorkplanReportRestController.java b/src/main/java/org/openelisglobal/workplan/controller/rest/PrintWorkplanReportRestController.java index 11a8d7f21..2f6e11829 100644 --- a/src/main/java/org/openelisglobal/workplan/controller/rest/PrintWorkplanReportRestController.java +++ b/src/main/java/org/openelisglobal/workplan/controller/rest/PrintWorkplanReportRestController.java @@ -15,7 +15,7 @@ import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource; import org.openelisglobal.common.exception.LIMSRuntimeException; import org.openelisglobal.common.log.LogEvent; -import org.openelisglobal.common.rest.BaseRestController; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.test.service.TestServiceImpl; import org.openelisglobal.workplan.form.WorkplanForm; import org.openelisglobal.workplan.form.WorkplanForm.PrintWorkplan; @@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.RestController; @RestController("PrintWorkplanReportRestController") -public class PrintWorkplanReportRestController extends BaseRestController { +public class PrintWorkplanReportRestController extends ControllerUtills { private String reportPath = null; diff --git a/src/main/java/org/openelisglobal/workplan/controller/rest/WorkplanRestController.java b/src/main/java/org/openelisglobal/workplan/controller/rest/WorkplanRestController.java index a6e78e95d..ca09bbe30 100644 --- a/src/main/java/org/openelisglobal/workplan/controller/rest/WorkplanRestController.java +++ b/src/main/java/org/openelisglobal/workplan/controller/rest/WorkplanRestController.java @@ -7,11 +7,11 @@ import org.openelisglobal.analysis.valueholder.Analysis; import org.openelisglobal.common.formfields.FormFields; import org.openelisglobal.common.formfields.FormFields.Field; -import org.openelisglobal.common.rest.BaseRestController; import org.openelisglobal.common.services.IStatusService; import org.openelisglobal.common.services.StatusService.AnalysisStatus; import org.openelisglobal.common.util.ConfigurationProperties; import org.openelisglobal.common.util.ConfigurationProperties.Property; +import org.openelisglobal.common.util.ControllerUtills; import org.openelisglobal.common.util.IdValuePair; import org.openelisglobal.common.util.StringUtil; import org.openelisglobal.observationhistory.service.ObservationHistoryService; @@ -27,7 +27,7 @@ import org.springframework.stereotype.Controller; @Controller -public class WorkplanRestController extends BaseRestController { +public class WorkplanRestController extends ControllerUtills { @Autowired protected TestService testService;