[507] | 1 | /*
|
---|
| 2 | * To change this template, choose Tools | Templates
|
---|
| 3 | * and open the template in the editor.
|
---|
| 4 | */
|
---|
| 5 | package gov.hhs.fha.nhinc.common.patientcorrelationfacade.dte.helpers;
|
---|
| 6 |
|
---|
| 7 | import gov.hhs.fha.nhinc.nhinclib.NullChecker;
|
---|
| 8 | import org.hl7.v3.CommunicationFunctionType;
|
---|
| 9 | import org.hl7.v3.II;
|
---|
| 10 | import org.hl7.v3.MCCIMT000100UV01Device;
|
---|
| 11 | import org.hl7.v3.MCCIMT000100UV01Receiver;
|
---|
| 12 | import org.hl7.v3.MCCIMT000100UV01Sender;
|
---|
| 13 | import org.hl7.v3.TELExplicit;
|
---|
| 14 |
|
---|
| 15 | /**
|
---|
| 16 | *
|
---|
| 17 | * @author rayj
|
---|
| 18 | */
|
---|
| 19 | public class SenderReceiverHelper {
|
---|
| 20 |
|
---|
| 21 | public static MCCIMT000100UV01Sender CreateSender(String senderDeviceId) {
|
---|
| 22 | MCCIMT000100UV01Sender sender = new MCCIMT000100UV01Sender();
|
---|
| 23 | sender.setTypeCode(CommunicationFunctionType.SND);
|
---|
| 24 | sender.setDevice(createDevice(senderDeviceId));
|
---|
| 25 | return sender;
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | public static MCCIMT000100UV01Sender CreateSender() {
|
---|
| 29 | return CreateSender(null);
|
---|
| 30 | }
|
---|
| 31 |
|
---|
| 32 | public static MCCIMT000100UV01Receiver CreateReceiver(String receiverDeviceId) {
|
---|
| 33 | MCCIMT000100UV01Receiver receiver = new MCCIMT000100UV01Receiver();
|
---|
| 34 | receiver.setTypeCode(CommunicationFunctionType.RCV);
|
---|
| 35 | receiver.setDevice(createDevice(receiverDeviceId));
|
---|
| 36 | return receiver;
|
---|
| 37 | }
|
---|
| 38 |
|
---|
| 39 | public static MCCIMT000100UV01Receiver CreateReceiver() {
|
---|
| 40 | return CreateReceiver(null);
|
---|
| 41 | }
|
---|
| 42 |
|
---|
| 43 | private static MCCIMT000100UV01Device createDevice(String deviceIdRoot) {
|
---|
| 44 |
|
---|
| 45 | MCCIMT000100UV01Device device = new MCCIMT000100UV01Device();
|
---|
| 46 | device.setDeterminerCode(Constants.determinerCodeValue);
|
---|
| 47 | II deviceId = null;
|
---|
| 48 |
|
---|
| 49 | if (NullChecker.isNullish(deviceIdRoot)) {
|
---|
| 50 | deviceId = IIHelper.IIFactoryCreateNull();
|
---|
| 51 | } else {
|
---|
| 52 | deviceId = IIHelper.IIFactory(deviceIdRoot, null);
|
---|
| 53 | }
|
---|
| 54 | device.getId().add(deviceId);
|
---|
| 55 |
|
---|
| 56 | // TELExplicit tel = new TELExplicit();
|
---|
| 57 | // tel.getNullFlavor().add("NA");
|
---|
| 58 | // device.getTelecom().add(tel);
|
---|
| 59 |
|
---|
| 60 | return device;
|
---|
| 61 | }
|
---|
| 62 | }
|
---|