Skip to content

Commit

Permalink
Refactor code to replace component annotations with xml configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
moshonk committed Sep 7, 2024
1 parent 1c1518e commit e597f18
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

@Component
public class LabOnFhirActivator extends BaseModuleActivator implements ApplicationContextAware, DaemonTokenAware {

private static final Logger log = LoggerFactory.getLogger(LabOnFhirActivator.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Component

@Configuration
public class LabOnFhirConfig implements ApplicationContextAware {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@
import org.openmrs.module.labonfhir.LabOnFhirConfig;
import org.openmrs.module.labonfhir.api.fhir.OrderCreationException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component

public class LabOrderHandler {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class LabOrderManager implements GlobalPropertyListener {

private static final Logger log = LoggerFactory.getLogger(LabOrderManager.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("labEncounterListener")
public class EncounterCreationListener extends LabCreationListener {
private static final Logger log = LoggerFactory.getLogger(OrderCreationListener.class);
@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("labOrderListener")
public class OrderCreationListener extends LabCreationListener {

private static final Logger log = LoggerFactory.getLogger(OrderCreationListener.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@

import java.text.SimpleDateFormat;

@Component
@Setter(AccessLevel.PACKAGE)
public class FetchTaskUpdates extends AbstractTask implements ApplicationContextAware {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;

import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.client.api.IGenericClient;

@Component
public class RetryFailedTasks extends AbstractTask implements ApplicationContextAware {
private static Log log = LogFactory.getLog(RetryFailedTasks.class);

Expand Down
11 changes: 9 additions & 2 deletions api/src/main/resources/moduleApplicationContext.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<context:component-scan base-package="org.openmrs.module.labonfhir"/>

<bean id="labEncounterListener" class="org.openmrs.module.labonfhir.api.event.EncounterCreationListener"></bean>
<bean id="labOrderListener" class="org.openmrs.module.labonfhir.api.event.OrderCreationListener"></bean>
<bean id="labOnFhirActivator" class="org.openmrs.module.labonfhir.LabOnFhirActivator"></bean>
<bean id="fetchTaskUpdates" class="org.openmrs.module.labonfhir.api.scheduler.FetchTaskUpdates"></bean>
<bean id="retryFailedTasks" class="org.openmrs.module.labonfhir.api.scheduler.RetryFailedTasks"></bean>
<bean id ="labOrderManager" class="org.openmrs.module.labonfhir.api.LabOrderManager"></bean>
<bean id="labOrderHandler" class="org.openmrs.module.labonfhir.api.LabOrderHandler"></bean>
<bean id="labOnFhirConfig" class="org.openmrs.module.labonfhir.LabOnFhirConfig"></bean>

<bean parent="openmrsEventListeners">
<property name="globalPropertyListeners">
<list merge="true">
Expand Down

0 comments on commit e597f18

Please sign in to comment.