Skip to content

Commit

Permalink
Neha | bdshr-1272 | minor refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
nehashri committed May 26, 2016
1 parent 81f1c57 commit b04ca90
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,20 @@

@Component
public class SHREncounterEventService {
private AtomFeedSpringTransactionManager atomFeedSpringTransactionManager;
private final EventService eventService;
private GlobalPropertyLookUpService globalPropertyLookUpService;

@Autowired
public SHREncounterEventService(GlobalPropertyLookUpService globalPropertyLookUpService) {
this.globalPropertyLookUpService = globalPropertyLookUpService;
this.atomFeedSpringTransactionManager = findTransactionManager();
this.eventService = getEventService(atomFeedSpringTransactionManager);
}

public void raiseShrEncounterDownloadEvent(Encounter newEmrEncounter) {
String shrEncounterEventCategory = globalPropertyLookUpService.getGlobalPropertyValue(GLOBAL_PROPERTY_SHR_CATEGORY_EVENT);
if (StringUtils.isNotBlank(shrEncounterEventCategory)) {
String url = String.format(ENCOUNTER_REST_URL, newEmrEncounter.getUuid());
final Event event = new Event(UUID.randomUUID().toString(), shrEncounterEventCategory, DateTime.now(), (URI) null, url, shrEncounterEventCategory);
AtomFeedSpringTransactionManager atomFeedSpringTransactionManager = findTransactionManager();
final EventService eventService = getEventService(atomFeedSpringTransactionManager);
atomFeedSpringTransactionManager.executeWithTransaction(
new AFTransactionWorkWithoutResult() {
@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@
import org.openmrs.*;
import org.openmrs.api.*;
import org.openmrs.module.fhir.mapper.emr.FHIRMapper;
import org.openmrs.api.EncounterService;
import org.openmrs.api.PatientService;
import org.openmrs.api.ProviderService;
import org.openmrs.api.VisitService;
import org.openmrs.module.fhir.utils.DateUtil;
import org.openmrs.module.fhir.utils.FHIRBundleHelper;
import org.openmrs.module.shrclient.advice.SHREncounterEventService;
Expand Down Expand Up @@ -72,14 +68,13 @@ public class EMREncounterServiceIT extends BaseModuleWebContextSensitiveTest {
private EMRPatientMergeService emrPatientMergeService;
@Autowired
private VisitLookupService visitLookupService;
@Mock
@Autowired
private SHREncounterEventService shrEncounterEventService;

private EMREncounterService emrEncounterService;

@Before
public void setUp() throws Exception {
initMocks();
emrEncounterService = new EMREncounterServiceImpl(emrPatientService, idMappingRepository, propertiesReader, systemUserService,
visitService, fhirMapper, orderService, patientDeathService, emrPatientMergeService, visitLookupService, shrEncounterEventService);
executeDataSet("testDataSets/omrsGlobalPropertyTestDS.xml");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@
<shr_id_mapping id="222" internal_id="50ab30be-98af-4dfd-bd04-5455937c443f" external_id="10000069" type="fr_location" uri="http://localhost:9997/api/1.0/facilities/10000069.json"></shr_id_mapping>

<global_property property="shr.system.user" property_value="777" description="Shr System User" uuid="lkieyg88-efd9-fda3-2b99-z12aalsa677h"/>
<global_property property="shr.system.shrCategoryForEncounterEvents" property_value="ShrEncounter" description="Shr System Encounter Event Category" uuid="lkieyg88-efd9-fda3-2b99-z12aalsx67xh"/>


<concept_reference_source concept_source_id="1" name="ICD10-BD" creator="1" date_created="2004-08-12 00:00:00.0" uuid="b5e44116-778f-11e2-ad73-903c7bb72694"/>

Expand Down

0 comments on commit b04ca90

Please sign in to comment.