-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BAH-3375 | Add. Rest Client Implementation for Create Lab Test, Lab P…
…anel and Radiology Test (#87) * BAH-3375 | Deepti, Parvathy | Add. Rest Client Implementation for Create Lab Test, Lab Panel and Radiology Test * BAH-3375 | Deepti, Parvathy | Refactor. Tests for lab order types * [Parvathy, Rahul] | BAH-3375 | Refactor. Split getOdooURIForJob Method Based on Client Strategy Co-authored-by: Parvathy Babu <[email protected]> * Parvathy|BAH-3375|Refactor. Normal and Failed Event Sequencing * Parvathy|BAH-3375|Refactor. Normal and Failed Event Sequencing * BAH-3375|Deepti,Parvathy|Add. null check to rest template and Lab test, panel and radiology event * BAH-3375|Deepti,Parvathy|Add. LoggerFactory to lab test and lab panel event worker. * Revert "BAH-3375|Deepti,Parvathy|Add. LoggerFactory to lab test and lab panel event worker." This reverts commit 9ebfe34. --------- Co-authored-by: Rahul Ramesh <[email protected]> Co-authored-by: deeptirawat1510 <[email protected]>
- Loading branch information
1 parent
6e5ef32
commit 6bb11a7
Showing
24 changed files
with
691 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
openerp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/job/OpenERPLabFeedJob.java
This file was deleted.
Oops, something went wrong.
22 changes: 22 additions & 0 deletions
22
...rp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/job/OpenERPLabPanelFeedJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package org.bahmni.feed.openerp.job; | ||
|
||
import com.sun.syndication.io.FeedException; | ||
|
||
public class OpenERPLabPanelFeedJob { | ||
private SimpleFeedJob openMRSFeedJob; | ||
|
||
public OpenERPLabPanelFeedJob() { | ||
} | ||
|
||
public OpenERPLabPanelFeedJob(SimpleFeedJob openMRSFeedJob) throws FeedException { | ||
this.openMRSFeedJob = openMRSFeedJob; | ||
} | ||
|
||
public void processFeed() { | ||
openMRSFeedJob.processFeed(Jobs.LAB_PANEL_FEED); | ||
} | ||
|
||
public void processFailedEvents() { | ||
openMRSFeedJob.processFailedEvents(Jobs.LAB_PANEL_FEED); | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
...erp-atomfeed-service/src/main/java/org/bahmni/feed/openerp/job/OpenERPLabTestFeedJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.bahmni.feed.openerp.job; | ||
|
||
import com.sun.syndication.io.FeedException; | ||
|
||
public class OpenERPLabTestFeedJob { | ||
|
||
private SimpleFeedJob openMRSFeedJob; | ||
|
||
public OpenERPLabTestFeedJob() { | ||
} | ||
|
||
public OpenERPLabTestFeedJob(SimpleFeedJob openMRSFeedJob) throws FeedException { | ||
this.openMRSFeedJob = openMRSFeedJob; | ||
} | ||
|
||
public void processFeed() { | ||
openMRSFeedJob.processFeed(Jobs.LAB_TEST_FEED); | ||
} | ||
|
||
public void processFailedEvents() { | ||
openMRSFeedJob.processFailedEvents(Jobs.LAB_TEST_FEED); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
...omfeed-service/src/main/java/org/bahmni/feed/openerp/job/OpenERPRadiologyTestFeedJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package org.bahmni.feed.openerp.job; | ||
|
||
import com.sun.syndication.io.FeedException; | ||
|
||
public class OpenERPRadiologyTestFeedJob { | ||
private SimpleFeedJob openMRSFeedJob; | ||
|
||
public OpenERPRadiologyTestFeedJob() { | ||
} | ||
|
||
public OpenERPRadiologyTestFeedJob(SimpleFeedJob openMRSFeedJob) throws FeedException { | ||
this.openMRSFeedJob = openMRSFeedJob; | ||
} | ||
|
||
public void processFeed() { | ||
openMRSFeedJob.processFeed(Jobs.RADIOLOGY_TEST_FEED); | ||
} | ||
|
||
public void processFailedEvents() { | ||
openMRSFeedJob.processFailedEvents(Jobs.RADIOLOGY_TEST_FEED); | ||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
...rvice/src/main/java/org/bahmni/feed/openerp/worker/OpenERPLabPanelServiceEventWorker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.bahmni.feed.openerp.worker; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.bahmni.feed.openerp.client.OpenMRSWebClient; | ||
import org.bahmni.feed.openerp.domain.labOrderType.OpenMRSLabOrderTypeEvent; | ||
import org.bahmni.feed.openerp.domain.labOrderType.OpenMRSLabPanelEvent; | ||
import org.bahmni.openerp.web.client.strategy.OpenERPContext; | ||
import org.bahmni.openerp.web.request.OpenERPRequest; | ||
import org.ict4h.atomfeed.client.domain.Event; | ||
import org.ict4h.atomfeed.client.service.EventWorker; | ||
|
||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class OpenERPLabPanelServiceEventWorker implements EventWorker { | ||
|
||
private static final Logger logger = LogManager.getLogger(OpenERPLabPanelServiceEventWorker.class); | ||
private final OpenERPContext openERPContext; | ||
private final String feedUrl; | ||
private final String odooURL; | ||
private final OpenMRSWebClient webClient; | ||
private final String urlPrefix; | ||
private Map<String, OpenMRSLabOrderTypeEvent> labOrderTypeEventMap = new HashMap<>(); | ||
|
||
|
||
//This event worker takes care of only lab panel master data. All the lab panel orders are handled by sale order event worker. | ||
public OpenERPLabPanelServiceEventWorker(String feedUrl, String odooURL, OpenERPContext openERPContext, OpenMRSWebClient openMRSWebClient, String urlPrefix) { | ||
this.openERPContext = openERPContext; | ||
this.feedUrl = feedUrl; | ||
this.odooURL = odooURL; | ||
this.webClient = openMRSWebClient; | ||
this.urlPrefix = urlPrefix; | ||
labOrderTypeEventMap.put(OpenMRSLabPanelEvent.LAB_PANEL_EVENT_NAME, new OpenMRSLabPanelEvent()); | ||
} | ||
|
||
@Override | ||
public void process(Event event) { | ||
logger.debug("Processing the event [{}]", event.getContent()); | ||
try { | ||
OpenMRSLabOrderTypeEvent openMRSLabOrderTypeEvent = labOrderTypeEventMap.get(event.getTitle()); | ||
if(openMRSLabOrderTypeEvent == null) return ; | ||
openERPContext.execute(mapRequest(event, openMRSLabOrderTypeEvent), odooURL); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
private OpenERPRequest mapRequest(Event event, OpenMRSLabOrderTypeEvent openMRSLabOrderTypeEvent) throws IOException { | ||
String labOrderTypeJson = webClient.get(URI.create(urlPrefix + event.getContent())); | ||
return openMRSLabOrderTypeEvent.mapEventToOpenERPRequest(event, labOrderTypeJson, feedUrl); | ||
} | ||
@Override | ||
public void cleanUp(Event event) { | ||
|
||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...ervice/src/main/java/org/bahmni/feed/openerp/worker/OpenERPLabTestServiceEventWorker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package org.bahmni.feed.openerp.worker; | ||
|
||
import org.apache.logging.log4j.LogManager; | ||
import org.apache.logging.log4j.Logger; | ||
import org.bahmni.feed.openerp.client.OpenMRSWebClient; | ||
import org.bahmni.feed.openerp.domain.labOrderType.OpenMRSLabOrderTypeEvent; | ||
import org.bahmni.feed.openerp.domain.labOrderType.OpenMRSLabTestEvent; | ||
import org.bahmni.openerp.web.client.strategy.OpenERPContext; | ||
import org.bahmni.openerp.web.request.OpenERPRequest; | ||
import org.ict4h.atomfeed.client.domain.Event; | ||
import org.ict4h.atomfeed.client.service.EventWorker; | ||
|
||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class OpenERPLabTestServiceEventWorker implements EventWorker { | ||
|
||
private static final Logger logger = LogManager.getLogger(OpenERPLabTestServiceEventWorker.class); | ||
private final OpenERPContext openERPContext; | ||
private final String feedUrl; | ||
private final String odooURL; | ||
private final OpenMRSWebClient webClient; | ||
private final String urlPrefix; | ||
private Map<String, OpenMRSLabOrderTypeEvent> labOrderTypeEventMap = new HashMap<>(); | ||
|
||
|
||
//This event worker takes care of only lab test master data. All the lab test orders are handled by sale order event worker. | ||
public OpenERPLabTestServiceEventWorker(String feedUrl, String odooURL, OpenERPContext openERPContext, OpenMRSWebClient openMRSWebClient, String urlPrefix) { | ||
this.openERPContext = openERPContext; | ||
this.feedUrl = feedUrl; | ||
this.odooURL = odooURL; | ||
this.webClient = openMRSWebClient; | ||
this.urlPrefix = urlPrefix; | ||
labOrderTypeEventMap.put(OpenMRSLabTestEvent.LAB_TEST_EVENT_NAME, new OpenMRSLabTestEvent()); | ||
} | ||
|
||
@Override | ||
public void process(Event event) { | ||
logger.debug("Processing the event [{}]", event.getContent()); | ||
try { | ||
OpenMRSLabOrderTypeEvent openMRSLabOrderTypeEvent = labOrderTypeEventMap.get(event.getTitle()); | ||
if(openMRSLabOrderTypeEvent == null) return ; | ||
openERPContext.execute(mapRequest(event, openMRSLabOrderTypeEvent), odooURL); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
private OpenERPRequest mapRequest(Event event, OpenMRSLabOrderTypeEvent openMRSLabOrderTypeEvent) throws IOException { | ||
String labOrderTypeJson = webClient.get(URI.create(urlPrefix + event.getContent())); | ||
return openMRSLabOrderTypeEvent.mapEventToOpenERPRequest(event, labOrderTypeJson, feedUrl); | ||
} | ||
@Override | ||
public void cleanUp(Event event) { | ||
|
||
} | ||
} |
Oops, something went wrong.