1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.openehealth.ipf.commons.ihe.xds.core.transform.requests.query;
17
18 import static org.openehealth.ipf.commons.ihe.xds.core.transform.requests.QueryParameter.*;
19
20 import org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLAdhocQueryRequest;
21 import org.openehealth.ipf.commons.ihe.xds.core.metadata.Hl7v2Based;
22 import org.openehealth.ipf.commons.ihe.xds.core.metadata.Identifiable;
23 import org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetAllQuery;
24
25
26
27
28
29 public class GetAllQueryTransformer extends AbstractStoredQueryTransformer<GetAllQuery> {
30
31
32
33
34
35
36
37
38
39
40 public void toEbXML(GetAllQuery query, EbXMLAdhocQueryRequest ebXML) {
41 if (query == null || ebXML == null) {
42 return;
43 }
44
45 super.toEbXML(query, ebXML);
46
47 QuerySlotHelper slots = new QuerySlotHelper(ebXML);
48
49 slots.fromString(PATIENT_ID, Hl7v2Based.render(query.getPatientId()));
50
51 slots.fromStatus(DOC_ENTRY_STATUS, query.getStatusDocuments());
52 slots.fromStatus(SUBMISSION_SET_STATUS, query.getStatusSubmissionSets());
53 slots.fromStatus(FOLDER_STATUS, query.getStatusFolders());
54
55 slots.fromCode(DOC_ENTRY_FORMAT_CODE, query.getFormatCodes());
56 slots.fromCode(DOC_ENTRY_CONFIDENTIALITY_CODE, query.getConfidentialityCodes());
57
58 slots.fromDocumentEntryType(DOC_ENTRY_TYPE, query.getDocumentEntryTypes());
59 slots.fromStatus(ASSOCIATION_STATUS, query.getAssociationStatuses());
60 slots.fromInteger(METADATA_LEVEL, query.getMetadataLevel());
61 }
62
63
64
65
66
67
68
69
70
71
72 public void fromEbXML(GetAllQuery query, EbXMLAdhocQueryRequest ebXML) {
73 if (query == null || ebXML == null) {
74 return;
75 }
76
77 super.fromEbXML(query, ebXML);
78
79 QuerySlotHelper slots = new QuerySlotHelper(ebXML);
80 String patientId = slots.toString(PATIENT_ID);
81 query.setPatientId(Hl7v2Based.parse(patientId, Identifiable.class));
82
83 query.setStatusDocuments(slots.toStatus(DOC_ENTRY_STATUS));
84 query.setStatusFolders(slots.toStatus(FOLDER_STATUS));
85 query.setStatusSubmissionSets(slots.toStatus(SUBMISSION_SET_STATUS));
86
87 query.setConfidentialityCodes(slots.toCodeQueryList(DOC_ENTRY_CONFIDENTIALITY_CODE, DOC_ENTRY_CONFIDENTIALITY_CODE_SCHEME));
88 query.setFormatCodes(slots.toCodeList(DOC_ENTRY_FORMAT_CODE));
89
90 query.setDocumentEntryTypes(slots.toDocumentEntryType(DOC_ENTRY_TYPE));
91 query.setAssociationStatuses(slots.toStatus(ASSOCIATION_STATUS));
92 query.setMetadataLevel(slots.toInteger(METADATA_LEVEL));
93 }
94 }