Skip to content

Commit

Permalink
Merge pull request #16 from jembi/xop-fix
Browse files Browse the repository at this point in the history
XOP fix
  • Loading branch information
hnnesv committed May 12, 2015
2 parents 87cdde9 + 91a9658 commit 2347053
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;

import javax.xml.bind.DatatypeConverter;
import javax.xml.bind.JAXBException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
Expand Down Expand Up @@ -461,7 +462,8 @@ private void autoRegisterPatient() {
String document = originalRequest.getDocument(); //is mime?
if (document == null) { //else get from parsed message
if (parsedRequest.getDocument()!=null && parsedRequest.getDocument().size()>=1) {
document = new String(parsedRequest.getDocument().get(0).getValue());
document = parsedRequest.getDocument().get(0).getContent().get(0).toString();
document = new String(DatatypeConverter.parseBase64Binary(document));
}
}

Expand Down
21 changes: 10 additions & 11 deletions src/main/resources/schema/IHE/XDS.b_DocumentRepository.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,16 @@
<xs:sequence>
<xs:element ref="lcm:SubmitObjectsRequest"/>
<xs:sequence minOccurs="0">
<xs:element name="Document" maxOccurs="unbounded" xmime:expectedContentTypes="application/octet-stream">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:base64Binary">
<xs:attribute name="id" type="xs:anyURI" use="required">
<xs:annotation>
<xs:documentation>This corresponds to the ExtrinsicObject id in the eb RIM metadata a provides a linkage between the actual document data and its metadata</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
<xs:element name="Document" maxOccurs="unbounded" type="xs:string">
<xs:complexType mixed="true">
<xs:sequence>
<xs:any/>
</xs:sequence>
<xs:attribute name="id" type="xs:anyURI" use="required">
<xs:annotation>
<xs:documentation>This corresponds to the ExtrinsicObject id in the eb RIM metadata a provides a linkage between the actual document data and its metadata</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
Expand Down
6 changes: 3 additions & 3 deletions src/test/resources/mock-services/smart-pix-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ net.createServer(function(c) {
data += chunk;

if (chunk.toString().indexOf(footer) != -1) {
console.log('Recieved message:\n' + data.replace('\r', '\n') + '\n\n');
console.log('Recieved message:\n' + data.replace(/\r/g, '\n') + '\n\n');

var regex = /(PID|QPD)\|[\w\s]*\|[\w\s\-\.]*\|([\w\.\^\&\~]+)/g;

var pids = regex.exec(data)[2].split('~');
var _i, _len;
for (_i = 0, _len = pids.length; _i < _len; _i++) {
if (pids[_i].indexOf('ISO') > -1) {
pids[_i] = pids[_i].substr(0, pids[_i].indexOf('ISO'));
if (pids[_i].indexOf('&') > -1) {
pids[_i] = pids[_i].substr(0, pids[_i].indexOf('&'));
}
}
console.log("PID: " + pids);
Expand Down

0 comments on commit 2347053

Please sign in to comment.