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.GetAssociationsQuery;
22  import org.openehealth.ipf.commons.ihe.xds.core.requests.query.GetSubmissionSetsQuery;
23  
24  /**
25   * Transforms between {@link GetAssociationsQuery} and {@link EbXMLAdhocQueryRequest}.
26   * @author Jens Riemschneider
27   */
28  public class GetSubmissionSetsQueryTransformer extends GetByUUIDQueryTransformer<GetSubmissionSetsQuery> {
29      /**
30       * Constructs the transformer.
31       */
32      public GetSubmissionSetsQueryTransformer() {
33          super(UUID);
34      }
35  
36      /**
37       *
38       * @param query
39       *          the query. Can be <code>null</code>.
40       * @param ebXML
41       */
42      public void toEbXML(GetSubmissionSetsQuery query, EbXMLAdhocQueryRequest ebXML) {
43          if (query == null || ebXML == null) {
44              return;
45          }
46  
47          super.toEbXML(query, ebXML);
48  
49          QuerySlotHelper slots = new QuerySlotHelper(ebXML);
50          slots.fromInteger(METADATA_LEVEL, query.getMetadataLevel());
51      }
52  
53      /**
54       *
55       * @param query
56       *          the query. Can be <code>null</code>.
57       * @param ebXML
58       */
59      public void fromEbXML(GetSubmissionSetsQuery query, EbXMLAdhocQueryRequest ebXML) {
60          if (query == null || ebXML == null) {
61              return;
62          }
63  
64          super.fromEbXML(query, ebXML);
65  
66          QuerySlotHelper slots = new QuerySlotHelper(ebXML);
67          query.setMetadataLevel(slots.toInteger(METADATA_LEVEL));
68      }
69  }