source: ccr/trunk/nhin-vista/projects/NHINC/Current/Product/Production/Common/NhincDataTransformsLib/src/gov/hhs/fha/nhinc/transform/subdisc/HL7MessageIdGenerator.java@ 507

Last change on this file since 507 was 507, checked in by George Lilly, 15 years ago

NHIN gateway and adaptor for use on linux with VistA EHR and RPMS

File size: 1.3 KB
Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package gov.hhs.fha.nhinc.transform.subdisc;
6
7import org.apache.commons.logging.Log;
8import org.apache.commons.logging.LogFactory;
9import org.hl7.v3.*;
10import gov.hhs.fha.nhinc.nhinclib.NullChecker;
11
12/**
13 *
14 * @author Jon Hoppesch
15 */
16public class HL7MessageIdGenerator {
17 private static Log log = LogFactory.getLog(HL7MessageIdGenerator.class);
18
19 public static II GenerateHL7MessageId(String myDeviceId) {
20 II messageId = new II();
21
22 if (NullChecker.isNullish(myDeviceId)) {
23 myDeviceId = getDefaultLocalDeviceId();
24 }
25
26 log.debug("Using local device id " + myDeviceId);
27 messageId.setRoot(myDeviceId);
28 messageId.setExtension(GenerateMessageId());
29 return messageId;
30 }
31
32 public static II GenerateHL7MessageId() {
33 String deviceId = getDefaultLocalDeviceId();
34
35 return GenerateHL7MessageId(deviceId);
36 }
37
38 private static String getDefaultLocalDeviceId() {
39 return HL7Constants.DEFAULT_LOCAL_DEVICE_ID;
40 }
41
42 public static String GenerateMessageId() {
43 java.rmi.server.UID uid = new java.rmi.server.UID();
44 log.debug("generated message id=" + uid.toString());
45 return uid.toString();
46 }
47}
Note: See TracBrowser for help on using the repository browser.