web stats
Mirth Community - View Single Post - Trying to Understand JAVA Code Output
View Single Post
  #1  
Old 11-19-2019, 09:38 AM
Teachmeh Teachmeh is offline
What's HL7?
 
Join Date: Nov 2019
Posts: 1
Teachmeh is on a distinguished road
Default Trying to Understand JAVA Code Output

I am fairly new to Mirth and recently setup a Mirth service on a VM I am running. I am trying to understand some of the JAVA code used in Mirth. I placed the following code on a destination transformer of a channel that was setup to pick up a file and move it to another folder. It is a PDF file if you need to know that. The move works but then I was trying to do some manipulation of the data through JAVA I was having some issue getting the data into a variable and working with it.

Code:
    var pdfString = new String;
    var tiff = getAttachments().get(0).getContent();
    pdfString = getAttachments().get(0);
    logger.info(pdfString)
    pdfString = FileUtil.decode(new java.lang.String(getAttachments().get(0).getContent()));
    logger.info(pdfString)
    pdfString = getAttachments();
    logger.info(pdfString)
 
	tiff = FileUtil.decode(new java.lang.String(tiff));
	logger.info(tiff);
	tiff = getAttachments().get(0).getContent();
	pdfString = getAttachments().get(0);
    logger.info(pdfString)
    pdfString = FileUtil.decode(new java.lang.String(getAttachments().get(0).getContent()));
    logger.info(pdfString)
    pdfString = getAttachments();
    logger.info(pdfString)
 
	tiff = FileUtil.decode(new java.lang.String(tiff));
	logger.info(tiff);
I didn't understand what was being displayed in the log output and it made it even more confusing when I did the exact same code twice as I got two different sets of output. Can someone maybe explain what I am seeing in the log(see below) and why when I run the same exact code twice I get different outputs in the log.

Quote:

INFO 2019-11-19 11:19:10,027 [Destination Filter/Transformer JavaScript Task on Multiple Page PDF to TIFF (aba35fd3-a5f4-45c0-a79a-3efd8ccb96a0), Destination 1 (1) < pool-1-thread-34] transformer: com.mirth.connect.server.userutil.Attachment@16bbb b0
INFO 2019-11-19 11:19:10,039 [Destination Filter/Transformer JavaScript Task on Multiple Page PDF to TIFF (aba35fd3-a5f4-45c0-a79a-3efd8ccb96a0), Destination 1 (1) < pool-1-thread-34] transformer: [B@fb2834
INFO 2019-11-19 11:19:10,041 [Destination Filter/Transformer JavaScript Task on Multiple Page PDF to TIFF (aba35fd3-a5f4-45c0-a79a-3efd8ccb96a0), Destination 1 (1) < pool-1-thread-34] transformer: [com.mirth.connect.server.userutil.Attachment@19b80 08]
INFO 2019-11-19 11:19:10,050 [Destination Filter/Transformer JavaScript Task on Multiple Page PDF to TIFF (aba35fd3-a5f4-45c0-a79a-3efd8ccb96a0), Destination 1 (1) < pool-1-thread-34] transformer: [B@76f548
INFO 2019-11-19 11:19:10,052 [Destination Filter/Transformer JavaScript Task on Multiple Page PDF to TIFF (aba35fd3-a5f4-45c0-a79a-3efd8ccb96a0), Destination 1 (1) < pool-1-thread-34] transformer: com.mirth.connect.server.userutil.Attachment@12890 52
INFO 2019-11-19 11:19:10,058 [Destination Filter/Transformer JavaScript Task on Multiple Page PDF to TIFF (aba35fd3-a5f4-45c0-a79a-3efd8ccb96a0), Destination 1 (1) < pool-1-thread-34] transformer: [B@faff84
INFO 2019-11-19 11:19:10,059 [Destination Filter/Transformer JavaScript Task on Multiple Page PDF to TIFF (aba35fd3-a5f4-45c0-a79a-3efd8ccb96a0), Destination 1 (1) < pool-1-thread-34] transformer: [com.mirth.connect.server.userutil.Attachment@67691 9]
INFO 2019-11-19 11:19:10,060 [Destination Filter/Transformer JavaScript Task on Multiple Page PDF to TIFF (aba35fd3-a5f4-45c0-a79a-3efd8ccb96a0), Destination 1 (1) < pool-1-thread-34] transformer: [B@9adf9
Shouldn't the .getContent() be a text representation of the PDF document? I might be misunderstanding what that should be returning exactly.
Reply With Quote