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.validate;
17  
18  import org.openehealth.ipf.commons.ihe.xds.core.responses.ErrorCode;
19  
20  /**
21   * All error messages that can occur during validation.
22   * @author Jens Riemschneider
23   */
24  public enum ValidationMessage {
25      FOLDER_INVALID_AVAILABILITY_STATUS("Invalid availability status for a folder: %1s"),
26      SUBMISSION_SET_INVALID_AVAILABILITY_STATUS("Invalid availability status for a submission set: %1s"),
27      DOC_ENTRY_INVALID_AVAILABILITY_STATUS("Invalid availability status for a document entry: %1s"),
28      INVALID_AVAILABILITY_STATUS("Invalid availability status: %1s"),
29      EXACTLY_ONE_SUBMISSION_SET_MUST_EXIST("Exactly one submission set must be specified"),
30      INVALID_TITLE_ENCODING("Invalid encoding for document entry title: %1s"),
31      TITLE_TOO_LONG("Document entry title too long: %1s"),
32      UNIQUE_ID_MISSING("Document entries, folders and submission sets are required to define a unique ID"),
33      UNIQUE_ID_TOO_LONG("Unique IDs must not be longer than 128 characters"),
34      UNIQUE_ID_NOT_UNIQUE("Duplicate ID found"),
35      UUID_NOT_UNIQUE("Duplicate UUID found"),
36      DOC_ENTRY_PATIENT_ID_WRONG("Document entry and submission set must define the same patient ID", ErrorCode.PATIENT_ID_DOES_NOT_MATCH),
37      FOLDER_PATIENT_ID_WRONG("Folder and submission set must define the same patient ID", ErrorCode.PATIENT_ID_DOES_NOT_MATCH),
38      INVALID_ASSOCIATION_TYPE("Unsupported association type"),
39      TOO_MANY_SUBMISSION_SET_STATES("Exactly one submission set status must be defined for each association involving a document entry as its source"),
40      INVALID_SUBMISSION_SET_STATUS("Association specifies an unknown submission set status label"),
41      MISSING_ORIGINAL("Association specifies an original document entry, but it was not provided"),
42      SOURCE_UUID_NOT_FOUND("The source of an association for a document relationship did not specify a valid UUID of a document entry contained in the request"),
43      WRONG_NUMBER_OF_CLASSIFICATIONS("Unexpected amount of classifications of scheme %1s, allowed = [%2s-%3s], Was = %4s"),
44      NO_CLASSIFIED_OBJ("Classification does not classify any object: %1s"),
45      NO_CLASSIFICATION_NAME_OBJ("Required a display name element for classification scheme %s and classified object %s. The name is used to communicate the meaning of scheme %2$s to a human reader."),
46      WRONG_CLASSIFIED_OBJ("Classification does not classify expected object: %1s, Was = %2s"),
47      NODE_REPRESENTATION_MISSING("Classification does not specify its node representation. Scheme = %1s"),
48      NODE_REPRESENTATION_PROHIBITED("Classification shall not specify a node representation. Scheme = %1s"),
49      CX_TOO_MANY_COMPONENTS("Only the ID number and the assigning authority can be defined for a CX value"),
50      CX_NEEDS_ID("ID number must be specified for a CX/CXi value"),
51      CXI_TOO_MANY_COMPONENTS("Only the ID number, assigning authority, and identifier type code can be defined for a CXi value"),
52      CXI_INCOMPLETE_ASSIGNING_AUTHORITY("Either namespace ID or universal ID + universal ID type must be present in a CXi assigning authority"),
53      CXI_NEEDS_ID_TYPE_CODE("ID type code must be specified for a CXi value"),
54      HD_MUST_NOT_HAVE_NAMESPACE_ID("The namespace ID should not be defined for an assigning authority: %1s"),
55      UNIVERSAL_ID_TYPE_MUST_BE_ISO("The universal ID type of an assigning authority must be ISO: %1s"),
56      HD_NEEDS_UNIVERSAL_ID("The universal ID must be defined for an assigning authority: %1s"),
57      MISSING_EXTERNAL_IDENTIFIER("External identifier value is missing: %1s"),
58      INVALID_HASH_CODE("Invalid format of hash code: %1s"),
59      INVALID_LANGUAGE_CODE("Invalid format of language code: %1s"),
60      OID_TOO_LONG("OID must not be longer than 64 characters: %1s"),
61      INVALID_OID("OID contains invalid characters: %1s"),
62      INVALID_PID("Invalid HL7 field name (only PID fields are supported): %1s"),
63      INVALID_UUID("UUID contains invalid characters: %1s"),
64      UNSUPPORTED_PID("PID field with this number is prohibited in XDS: %1s"),
65      INVALID_NUMBER_FORMAT("Invalid number format: %1s"),
66      RECIPIENT_LIST_EMPTY("Recipient list should not be empty"),
67      RECIPIENT_EMPTY("Recipient list value should not be empty"),
68      INVALID_RECIPIENT("Invalid format of recipient list element: %1s"),
69      SLOT_VALUE_TOO_LONG("Slot value length exceeds ebXML limit in slot: %1s"),
70      MISSING_SLOT_NAME("Missing slot name"),
71      DUPLICATE_SLOT_NAME("Duplicate slot name: %1s"),
72      WRONG_QUERY_SLOT_NAME("Slot name must be preceded by '$': %s"),
73      WRONG_NUMBER_OF_SLOT_VALUES("Slot contains incorrect amount of values. Slot = %1s, allowed = [%2s-%3s], Was = %4s"),
74      EMPTY_SLOT_VALUE("Slot value is undefined. Slot = %1s"),
75      INVALID_TIME("Invalid time format: %1s"),
76      NULL_URI("URI slot did not contain a value"),
77      EMPTY_URI("Empty URI although slot is specified"),
78      INVALID_URI("Invalid URI: %1s"),
79      PERSON_MISSING_NAME_AND_ID("Either an id number or a name has to be specified for a person: %1s"),
80      PERSON_HD_MISSING("If an id number is specified for a person, the assigning authority has to be specified as well: %1s"),
81      ORGANIZATION_NAME_MISSING("An organization name has to be specified for an organization: %1s"),
82      ORGANIZATION_TOO_MANY_COMPONENTS("An organization should not specify data other than its ID and name"),
83      MISSING_DOC_ENTRY_FOR_DOCUMENT("A document was provided without a corresponding document entry. UUID=%1s", ErrorCode.MISSING_DOCUMENT_METADATA),
84      MISSING_DOCUMENT_FOR_DOC_ENTRY("A document entry was provided without a corresponding document. UUID=%1s", ErrorCode.MISSING_DOCUMENT),
85      DOCUMENT_NOT_ALLOWED_IN_DOC_ENTRY("Document attachment is not allowed in entry with UUID=%1s"),
86      UNKNOWN_QUERY_TYPE("Unknown query type: %1s"),
87      UNSUPPORTED_QUERY_TYPE("Query type not supported: %s"),
88      MISSING_SQL_QUERY_TEXT("Missing SQL query text"),
89      UNKNOWN_RETURN_TYPE("Unknown return type: %1s"),
90      MISSING_REQUIRED_QUERY_PARAMETER("Missing required query parameter: %1s"),
91      INVALID_QUERY_PARAMETER_VALUE("Invalid value for query parameter: %1s"),
92      QUERY_PARAMETERS_CANNOT_BE_SET_TOGETHER("Query contains parameters that are mutually exclusive to each other: %1s"),
93      TOO_MANY_VALUES_FOR_QUERY_PARAMETER("Too many values for query parameter: %1s"),
94      PARAMETER_VALUE_NOT_STRING("Query parameter value is not specified as a string: %1s"),
95      PARAMETER_VALUE_NOT_STRING_LIST("Query parameter value is not specified as a list of strings: %1s"),
96      STUDY_INSTANCE_UID_MUST_BE_SPECIFIED("The imaging document Study Instance UID is missing"),
97      TRANSFER_SYNTAX_UID_LIST_MUST_BE_SPECIFIED("The transfer syntax UID list is empty"),
98      SERIES_INSTANCE_UID_MUST_BE_SPECIFIED("The imaging document Series Instance UID is missing"),
99      REPO_ID_MUST_BE_SPECIFIED("The repository Unique ID is missing"),
100     DOC_ID_MUST_BE_SPECIFIED("The document Unique ID is missing"),
101     ON_DEMAND_DOC_ID_MUST_DIFFER("New ID of the document should differ from the On-Demand document entry ID"),
102     WRONG_DOCUMENT_ENTRY_TYPE("Wrong document entry type (stable/on-demand): %s"),
103     MIME_TYPE_MUST_BE_SPECIFIED("The document MIME type is missing"),
104     INVALID_STATUS_IN_RESPONSE("Invalid status in response"),
105     INVALID_ERROR_INFO_IN_RESPONSE("Invalid error info in response"),
106     INVALID_ERROR_CODE_IN_RESPONSE("Invalid error code in response"),
107     INVALID_SEVERITY_IN_RESPONSE("Invalid severity in response"),
108     MISSING_OBJ_REF("Missing object reference"),
109     DEPRECATED_OBJ_CANNOT_BE_TRANSFORMED("A deprecated entry cannot be transformed or appended", ErrorCode.REGISTRY_DEPRECATED_DOCUMENT_ERROR),
110     DIFFERENT_HASH_CODE_IN_RESUBMISSION("A document was resubmitted with a different hash code", ErrorCode.NON_IDENTICAL_HASH),
111     UNKNOWN_PATIENT_ID("Patient Id is unknown", ErrorCode.UNKNOWN_PATIENT_ID),
112     INCORRECT_HASH("Hash of submitted document does not match value supplied in the meta data"),
113     INCORRECT_SIZE("Size of submitted document does not match value supplied in the meta data"),
114     DOC_CODE_NOT_ALLOWED_ON_HAS_MEMBER("HasMember association may not specify a relationship type"),
115     RESULT_NOT_SINGLE_PATIENT("Query result contains entries for multiple patients", ErrorCode.RESULT_NOT_SINGLE_PATIENT),
116     HOME_COMMUNITY_ID_MUST_BE_SPECIFIED("Home community ID is missing", ErrorCode.MISSING_HOME_COMMUNITY_ID),
117     WRONG_QUERY_RETURN_TYPE("Wrong query return type: %s"),
118     AUTHOR_INCOMPLETE("At least an authorPerson, authorTelecommunication, or authorInstitution sub-attribute must be present in %s"),
119     MISSING_SNAPSHOT_ASSOCIATION("IsSnapshot Association specifies an %s document entry, but it was not provided: %s"),
120     WRONG_SNAPSHOT_ASSOCIATION_STATUS("The targetObject DocumentEntry has not availabilityStatus of Approved"),
121     LOGICAL_ID_MISSING("Logical ID is missing on Update Document Set request"),
122     LOGICAL_ID_EQUALS_ENTRY_UUID("Logical ID: %s required to have a different value then entryUUID: %s on Update Document Set request"),
123     LOGICAL_ID_SAME("Same logical ID %s appears more than once in a single request"),
124     VERSION_INFO_MISSING("Version Info is missing on Update Document Set request"),
125     MISSING_PREVIOUS_VERSION("A previous version must be defined for each association involving a document update"),
126     MISSING_ORIGINAL_STATUS("UpdateAvailabilityStatus Association must specify an original document status"),
127     MISSING_NEW_STATUS("UpdateAvailabilityStatus Association must specify an new document status"),
128     MISSING_HAS_MEMBER_ASSOCIATION("No SubmissionSet to DocumentEntry/Folder HasMember Association found for the entry: %s"),
129     MISSING_SUBMISSION_SET("Association specifies a sourceObject: %s submission set, but it was not provided"),
130     MISSING_ASSOCIATION("Association specifies a targetObject: %s association, but it was not provided"),
131     OBJECT_SHALL_NOT_BE_SPECIFIED("%s shall not be specified."),
132     EMPTY_REFERENCE_LIST("No object references specified for %s"),
133     WRONG_TELECOM_USE("Wrong telecom use code (XTN-2): %s"),
134     WRONG_TELECOM_TYPE("Wrong telecom type code (XTN-3): %s"),
135     MISSING_TELECOM_PARAM("A required telecom parameter is missing: %s"),
136     INCONSISTENT_TELECOM_PARAM("Inconsistent telecom parameters: %s"),
137     SUBMISSION_SET_STATUS_MANDATORY("Submission set status is mandatory for each association involving a submission set as a target and document entry as its source"),
138     INVALID_DOCUMENT_AVAILABILITY("Unsupported document availability: %s"),
139     WRONG_REFERENCE_ID_TYPE("Wrong reference ID type: %s"),
140     LIMITED_METADATA_REQUIRED("limitedMetadata classification must be provided in %s"),
141     LIMITED_METADATA_PROHIBITED("limitedMetadata classification is not allowed in %s"),
142     MISSING_FOLDER_NAME("Folder name not provided in %s"),
143     TIME_PRECISION_TOO_LOW("Precision of the timestamp is too low: %s"),
144     ASSOCIATION_ID_MISSING("Attribute 'id' must be provided in the Association"),
145     ;
146 
147 
148     private final String text;
149     private final ErrorCode errorCode;
150     
151     ValidationMessage(String text, ErrorCode errorCode) {
152         this.text = text;
153         this.errorCode = errorCode;
154     }
155 
156     ValidationMessage(String text) {
157         this.text = text;
158         errorCode = null;
159     }
160 
161     /**
162      * @return a textual representation of this message.
163      */
164     public String getText() {
165         return text;
166     }
167 
168     /**
169      * @return the error code associated with this message.
170      */
171     public ErrorCode getErrorCode() {
172         return errorCode;
173     }
174 }