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;
17  
18  import org.openehealth.ipf.commons.ihe.xds.core.metadata.Association;
19  import org.openehealth.ipf.commons.ihe.xds.core.metadata.DocumentEntry;
20  import org.openehealth.ipf.commons.ihe.xds.core.metadata.Folder;
21  import org.openehealth.ipf.commons.ihe.xds.core.metadata.SubmissionSet;
22  import org.openehealth.ipf.commons.ihe.xds.core.metadata.XDSMetaClass;
23  
24  /**
25   * Query parameters used for the stored queries.
26   * @author Jens Riemschneider
27   */
28  public enum QueryParameter {
29      /** Used to filter {@link DocumentEntry#getPatientId()}. */
30      DOC_ENTRY_PATIENT_ID("$XDSDocumentEntryPatientId"),
31      /** Used to filter {@link DocumentEntry#getClassCode()}. */
32      DOC_ENTRY_CLASS_CODE("$XDSDocumentEntryClassCode"),
33      /** Used to filter {@link DocumentEntry#getTypeCode()}. */
34      DOC_ENTRY_TYPE_CODE("$XDSDocumentEntryTypeCode"),
35      /** Used to filter {@link DocumentEntry#getClassCode()}. */
36      DOC_ENTRY_CLASS_CODE_SCHEME("$XDSDocumentEntryClassCodeScheme"),
37      /** Used to filter {@link DocumentEntry#getAuthors()}. */
38      DOC_ENTRY_AUTHOR_PERSON("$XDSDocumentEntryAuthorPerson"),
39      /** Used to filter {@link DocumentEntry#getCreationTime()}. */
40      DOC_ENTRY_CREATION_TIME_FROM("$XDSDocumentEntryCreationTimeFrom"),
41      /** Used to filter {@link DocumentEntry#getCreationTime()}. */
42      DOC_ENTRY_CREATION_TIME_TO("$XDSDocumentEntryCreationTimeTo"),
43      /** Used to filter {@link DocumentEntry#getFormatCode()}. */
44      DOC_ENTRY_FORMAT_CODE("$XDSDocumentEntryFormatCode"),
45      /** Used to filter {@link DocumentEntry#getFormatCode()}. */
46      DOC_ENTRY_FORMAT_CODE_SCHEME("$XDSDocumentEntryFormatCodeScheme"),
47      /** Used to filter {@link DocumentEntry#getHealthcareFacilityTypeCode()}. */
48      DOC_ENTRY_HEALTHCARE_FACILITY_TYPE_CODE("$XDSDocumentEntryHealthcareFacilityTypeCode"),
49      /** Used to filter {@link DocumentEntry#getHealthcareFacilityTypeCode()}. */
50      DOC_ENTRY_HEALTHCARE_FACILITY_TYPE_CODE_SCHEME("$XDSDocumentEntryHealthcareFacilityTypeCodeScheme"),
51      /** Used to filter {@link DocumentEntry#getPracticeSettingCode()}. */
52      DOC_ENTRY_PRACTICE_SETTING_CODE("$XDSDocumentEntryPracticeSettingCode"),
53      /** Used to filter {@link DocumentEntry#getPracticeSettingCode()}. */
54      DOC_ENTRY_PRACTICE_SETTING_CODE_SCHEME("$XDSDocumentEntryPracticeSettingCodeScheme"),
55      /** Used to filter {@link DocumentEntry#getServiceStartTime()}. */
56      DOC_ENTRY_SERVICE_START_TIME_FROM("$XDSDocumentEntryServiceStartTimeFrom"),
57      /** Used to filter {@link DocumentEntry#getServiceStartTime()}. */
58      DOC_ENTRY_SERVICE_START_TIME_TO("$XDSDocumentEntryServiceStartTimeTo"),
59      /** Used to filter {@link DocumentEntry#getServiceStopTime()}. */
60      DOC_ENTRY_SERVICE_STOP_TIME_FROM("$XDSDocumentEntryServiceStopTimeFrom"),
61      /** Used to filter {@link DocumentEntry#getServiceStopTime()}. */
62      DOC_ENTRY_SERVICE_STOP_TIME_TO("$XDSDocumentEntryServiceStopTimeTo"),
63      /** Used to filter {@link DocumentEntry#getAvailabilityStatus()}. */
64      DOC_ENTRY_STATUS("$XDSDocumentEntryStatus"),
65      /** Used to filter {@link DocumentEntry#getEventCodeList()}. */
66      DOC_ENTRY_EVENT_CODE("$XDSDocumentEntryEventCodeList"),
67      /** Used to filter {@link DocumentEntry#getEventCodeList()}. */
68      DOC_ENTRY_EVENT_CODE_SCHEME("$XDSDocumentEntryEventCodeListScheme"),
69      /** Used to filter {@link DocumentEntry#getConfidentialityCodes()}. */
70      DOC_ENTRY_CONFIDENTIALITY_CODE("$XDSDocumentEntryConfidentialityCode"),
71      /** Used to filter {@link DocumentEntry#getConfidentialityCodes()}. */
72      DOC_ENTRY_CONFIDENTIALITY_CODE_SCHEME("$XDSDocumentEntryConfidentialityCodeScheme"),
73      /** Used to filter {@link DocumentEntry#getEntryUuid()}. */
74      DOC_ENTRY_UUID("$XDSDocumentEntryEntryUUID"),
75      /** Used to filter {@link DocumentEntry#getUniqueId()}. */
76      DOC_ENTRY_UNIQUE_ID("$XDSDocumentEntryUniqueId"),
77      /** Used to filter {@link DocumentEntry#getType()}. */
78      DOC_ENTRY_TYPE("$XDSDocumentEntryType"),
79      /** Used to filter {@link DocumentEntry#referenceIdList}. */
80      DOC_ENTRY_REFERENCE_IDS("$XDSDocumentEntryReferenceIdList"),
81      /** Used to filter {@link DocumentEntry#documentAvailability}. */
82      DOC_ENTRY_DOCUMENT_AVAILABILITY("$XDSDocumentEntryDocumentAvailability"),
83      /** Used to filter {@link DocumentEntry#logicalUuid}. */
84      DOC_ENTRY_LOGICAL_ID("$XDSDocumentEntryLogicalID"),
85       
86      /** Used to filter {@link Folder#getCodeList()}. */
87      FOLDER_CODES("$XDSFolderCodeList"),
88      /** Used to filter {@link Folder#getCodeList()}. */
89      FOLDER_CODES_SCHEME("$XDSFolderCodeListScheme"),
90      /** Used to filter {@link Folder#getLastUpdateTime()}. */
91      FOLDER_LAST_UPDATE_TIME_FROM("$XDSFolderLastUpdateTimeFrom"),
92      /** Used to filter {@link Folder#getLastUpdateTime()}. */
93      FOLDER_LAST_UPDATE_TIME_TO("$XDSFolderLastUpdateTimeTo"),
94      /** Used to filter {@link Folder#getPatientId()}. */
95      FOLDER_PATIENT_ID("$XDSFolderPatientId"),
96      /** Used to filter {@link Folder#getAvailabilityStatus()}. */
97      FOLDER_STATUS("$XDSFolderStatus"),
98      /** Used to filter {@link Folder#getEntryUuid()}. */
99      FOLDER_UUID("$XDSFolderEntryUUID"),
100     /** Used to filter {@link Folder#getUniqueId()}. */
101     FOLDER_UNIQUE_ID("$XDSFolderUniqueId"),
102     /** Used to filter {@link Folder#logicalUuid}. */
103     FOLDER_LOGICAL_ID("$XDSFolderLogicalID"),
104     
105     /** Used to filter {@link SubmissionSet#getPatientId()}. */
106     SUBMISSION_SET_PATIENT_ID("$XDSSubmissionSetPatientId"),
107     /** Used to filter {@link SubmissionSet#getSourceId()}. */
108     SUBMISSION_SET_SOURCE_ID("$XDSSubmissionSetSourceId"),
109     /** Used to filter {@link SubmissionSet#getSubmissionTime()}. */
110     SUBMISSION_SET_SUBMISSION_TIME_FROM("$XDSSubmissionSetSubmissionTimeFrom"),
111     /** Used to filter {@link SubmissionSet#getSubmissionTime()}. */
112     SUBMISSION_SET_SUBMISSION_TIME_TO("$XDSSubmissionSetSubmissionTimeTo"),
113     /** Used to filter {@link SubmissionSet#getAuthors()}. */
114     SUBMISSION_SET_AUTHOR_PERSON("$XDSSubmissionSetAuthorPerson"),
115     /** Used to filter {@link SubmissionSet#getContentTypeCode()}. */
116     SUBMISSION_SET_CONTENT_TYPE_CODE("$XDSSubmissionSetContentType"),
117     /** Used to filter {@link SubmissionSet#getContentTypeCode()}. */
118     SUBMISSION_SET_CONTENT_TYPE_CODE_SCHEME("$XDSSubmissionSetContentTypeScheme"),
119     /** Used to filter {@link SubmissionSet#getAvailabilityStatus()}. */
120     SUBMISSION_SET_STATUS("$XDSSubmissionSetStatus"),
121     /** Used to filter {@link SubmissionSet#getEntryUuid()}. */
122     SUBMISSION_SET_UUID("$XDSSubmissionSetEntryUUID"),
123     /** Used to filter {@link SubmissionSet#getUniqueId()}. */
124     SUBMISSION_SET_UNIQUE_ID("$XDSSubmissionSetUniqueId"),
125 
126     /** Used to filter {@link XDSMetaClass#getEntryUuid()}. */
127     UUID("$uuid"),
128     /** Used to filter {@link XDSMetaClass#getPatientId()}. */
129     PATIENT_ID("$patientId"),
130     /** Used to filter {@link Association#getAssociationType()}. */
131     ASSOCIATION_TYPE("$AssociationTypes"),
132     /** Used to filter {@link Association#getAvailabilityStatus()}. */
133     ASSOCIATION_STATUS("$XDSAssociationStatus"),
134     /** Used to filter {none}. */
135     METADATA_LEVEL("$MetadataLevel");
136     
137     private final String slotName;
138     
139     QueryParameter(String slotName) {
140         this.slotName = slotName;
141     }
142 
143     /**
144      * @return name of the slot used in the ebXML representation of the parameter.
145      */
146     public String getSlotName() {
147         return slotName;
148     }
149 
150 
151     /**
152      * @param slotName
153      *      query slot name.
154      * @return
155      *      a {@link QueryParameter} element which corresponds to the given
156      *      slot name, or <code>null</code> when none found.
157      */
158     public static QueryParameter valueOfSlotName(String slotName) {
159         if (slotName == null) {
160             return null;
161         }
162 
163         for (QueryParameter queryParameter : QueryParameter.values()) {
164             if (slotName.equals(queryParameter.getSlotName())) {
165                 return queryParameter;
166             }
167         }
168 
169         return null;
170     }
171 
172 }