View Javadoc
1   /*
2    * Copyright 2009 the original author or authors.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *     
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
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.requests.query.GetSubmissionSetAndContentsQuery;
22  
23  /**
24   * Transforms between a {@link GetSubmissionSetAndContentsQuery} and {@link EbXMLAdhocQueryRequest}.
25   * @author Jens Riemschneider
26   */
27  public class GetSubmissionSetAndContentsQueryTransformer extends GetByIDAndCodesQueryTransformer<GetSubmissionSetAndContentsQuery> {
28      /**
29       * Constructs the transformer.
30       */
31      public GetSubmissionSetAndContentsQueryTransformer() {
32          super(SUBMISSION_SET_UUID, 
33                  SUBMISSION_SET_UNIQUE_ID, 
34                  DOC_ENTRY_FORMAT_CODE, 
35                  DOC_ENTRY_FORMAT_CODE_SCHEME, 
36                  DOC_ENTRY_CONFIDENTIALITY_CODE,
37                  DOC_ENTRY_CONFIDENTIALITY_CODE_SCHEME);
38      }
39  
40      @Override
41      public void toEbXML(GetSubmissionSetAndContentsQuery query, EbXMLAdhocQueryRequest ebXML) {
42          if (query == null || ebXML == null) {
43              return;
44          }
45  
46          super.toEbXML(query, ebXML);
47          QuerySlotHelper slots = new QuerySlotHelper(ebXML);
48          slots.fromDocumentEntryType(DOC_ENTRY_TYPE, query.getDocumentEntryTypes());
49          slots.fromInteger(METADATA_LEVEL, query.getMetadataLevel());
50      }
51  
52      @Override
53      public void fromEbXML(GetSubmissionSetAndContentsQuery query, EbXMLAdhocQueryRequest ebXML) {
54          if (query == null || ebXML == null) {
55              return;
56          }
57  
58          super.fromEbXML(query, ebXML);
59          QuerySlotHelper slots = new QuerySlotHelper(ebXML);
60          query.setDocumentEntryTypes(slots.toDocumentEntryType(DOC_ENTRY_TYPE));
61          query.setMetadataLevel(slots.toInteger(METADATA_LEVEL));
62      }
63  }