Skip to content

Commit

Permalink
shorten --use-uuid-for-filename to --uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
gunterze committed Jun 22, 2022
1 parent c9e7f26 commit 05ca041
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
12 changes: 10 additions & 2 deletions dcm4che-tool/dcm4che-tool-hl7rcv/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ Options:
--directory <path> directory to which received HL7 V2
messages are stored, using its
Message Type as sub-directory name
and its Message Control ID as file
name. '.' by default
and its Message Control ID or a
random uuid as file name. '.' by
default
-h,--help display this help and exit
--idle-timeout <ms> timeout in ms for receiving HL7
messages, no timeout by default
Expand Down Expand Up @@ -72,6 +73,11 @@ Options:
Cipher Suite. Multiple Cipher Suites
may be enabled by multiple
--tls-cipher options
--tls-eia-https enable server endpoint identification
according RFC 2818: HTTP Over TLS
--tls-eia-ldaps enable server endpoint identification
according RFC 2830: LDAP Extension
for TLS
--tls-noauth disable client authentification for
TLS
--tls-null enable TLS connection without
Expand Down Expand Up @@ -99,6 +105,8 @@ Options:
certificates, 'secret' by default
--trust-store-type <storetype> type of key store with trusted
certificates, PKCS12 by default
--uuid use a random uuid for message
filename instead of MSH-9
-V,--version output version information and exit
-x,--xsl <xsl-file> generate response by applying
specified XSLT stylesheet, return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private static CommandLine parseComandLine(String[] args)
@SuppressWarnings("static-access")
public static void addOptions(Options opts) {
opts.addOption(null, "ignore", false, rb.getString("ignore"));
opts.addOption(null, "use-uuid-for-filename", false, rb.getString("use-uuid-for-filename"));
opts.addOption(null, "uuid", false, rb.getString("uuid"));
opts.addOption(Option.builder()
.hasArg()
.argName("path")
Expand Down Expand Up @@ -213,7 +213,7 @@ public static void main(String[] args) {

private static void configure(HL7Rcv main, CommandLine cl)
throws Exception {
main.setUseUUIDForFilename(cl.hasOption("use-uuid-for-filename"));
main.setUseUUIDForFilename(cl.hasOption("uuid"));
if (!cl.hasOption("ignore"))
main.setStorageDirectory(
cl.getOptionValue("directory", "."));
Expand Down Expand Up @@ -246,22 +246,14 @@ private UnparsedHL7Message onMessage(UnparsedHL7Message msg)
if (storageDir != null)
storeToFile(msg.data(), new File(
new File(storageDir, msg.msh().getMessageType()),
getMessageFilename(msg)));
useUUIDForFilename
? UUID.randomUUID().toString()
: msg.msh().getField(9, "_NULL_")));
return new UnparsedHL7Message(tpls == null
? HL7Message.makeACK(msg.msh(), HL7Exception.AA, null).getBytes(null)
: xslt(msg));
}

private String getMessageFilename(UnparsedHL7Message msg) {
if (this.useUUIDForFilename)
{
return String.valueOf(UUID.randomUUID());
}
else {
return msg.msh().getField(9, "_NULL_");
}
}

private void storeToFile(byte[] data, File f) throws IOException {
Connection.LOG.info("M-WRITE {}", f);
f.getParentFile().mkdirs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ xsl-param=specify additional XSLT parameters, "MessageControlID" and \
charset=HL7 Character Set used to decode message if not specified by MSH-18, \
ASCII by default
ignore=do not store received HL7 V2 messages in files
use-uuid-for-filename=use a random uuid for message filename instead of MSH-9
uuid=use a random uuid for message filename instead of MSH-9
directory=directory to which received HL7 V2 messages are stored, using its \
Message Type as sub-directory name and its Message Control ID as file name. \
Message Type as sub-directory name and its Message Control ID or a random uuid as file name. \
'.' by default

0 comments on commit 05ca041

Please sign in to comment.