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.requests;
17  
18  import static org.apache.commons.lang3.Validate.notNull;
19  
20  import lombok.EqualsAndHashCode;
21  import lombok.Getter;
22  import lombok.Setter;
23  import lombok.ToString;
24  import org.openehealth.ipf.commons.ihe.xds.core.requests.query.*;
25  
26  import javax.xml.bind.annotation.*;
27  import java.io.Serializable;
28  
29  /**
30   * Request object for the Query Registry and Registry Stored Query transactions.
31   * @author Jens Riemschneider
32   */
33  @XmlAccessorType(XmlAccessType.FIELD)
34  @XmlType(name = "QueryRegistry")
35  @XmlRootElement(name = "queryRegistry")
36  @EqualsAndHashCode(doNotUseGetters = true)
37  @ToString(doNotUseGetters = true)
38  public class QueryRegistry implements Serializable {
39      private static final long serialVersionUID = -7089029668323133489L;
40  
41      @XmlElementRefs({
42              @XmlElementRef(type = FetchQuery.class),
43              @XmlElementRef(type = FindDocumentsByReferenceIdQuery.class),
44              @XmlElementRef(type = FindDocumentsForMultiplePatientsQuery.class),
45              @XmlElementRef(type = FindDocumentsQuery.class),
46              @XmlElementRef(type = FindFoldersForMultiplePatientsQuery.class),
47              @XmlElementRef(type = FindFoldersQuery.class),
48              @XmlElementRef(type = FindSubmissionSetsQuery.class),
49              @XmlElementRef(type = GetAllQuery.class),
50              @XmlElementRef(type = GetAssociationsQuery.class),
51              @XmlElementRef(type = GetDocumentsAndAssociationsQuery.class),
52              @XmlElementRef(type = GetDocumentsQuery.class),
53              @XmlElementRef(type = GetFolderAndContentsQuery.class),
54              @XmlElementRef(type = GetFoldersForDocumentQuery.class),
55              @XmlElementRef(type = GetFoldersQuery.class),
56              @XmlElementRef(type = GetRelatedDocumentsQuery.class),
57              @XmlElementRef(type = GetSubmissionSetAndContentsQuery.class),
58              @XmlElementRef(type = GetSubmissionSetsQuery.class)})
59  
60      @Getter private Query query;
61      @XmlAttribute
62      @Getter @Setter private QueryReturnType returnType = QueryReturnType.OBJECT_REF;
63  
64      /**
65       * For JAXB serialization only.
66       */
67      public QueryRegistry() {
68      }
69  
70      /**
71       * Constructs the request.
72       * @param query
73       *          the query to use. Cannot be <code>null</code>.
74       */
75      public QueryRegistry(Query query) {
76          notNull(query, "query cannot be null");
77          this.query = query;
78      }
79  
80  }