null
- */
- public BaseOperationOutcome getOperationOutcome() {
- return myBaseOperationOutcome;
- }
-
- /**
- * In a RESTful client, this method will be populated with the body of the HTTP respone if one was provided by the server, or null
otherwise.
- * - * In a restful server, this method is currently ignored. - *
- */ - public String getResponseBody() { - return myResponseBody; - } - - /** - * In a RESTful client, this method will be populated with the HTTP status code that was returned with the HTTP response. - *- * In a restful server, this method is currently ignored. - *
- */ - public String getResponseMimeType() { - return myResponseMimeType; - } - - /** - * Returns the HTTP status code corresponding to this problem - */ - public int getStatusCode() { - return myStatusCode; - } - - /** -<<<<<<< HEAD - * Sets the BaseOperationOutcome resource associated with this exception. In server - * implementations, this is the OperartionOutcome resource to include with the HTTP response. In - * client implementations you should not call this method. - * - * @param theBaseOperationOutcome The BaseOperationOutcome resource -======= - * Sets the BaseOperationOutcome resource associated with this exception. In server implementations, this is the OperartionOutcome resource to include with the HTTP response. In client - * implementations you should not call this method. - * - * @param theBaseOperationOutcome - * The BaseOperationOutcome resource ->>>>>>> d22a35788f57e9f7ce64bc8afc2ee7eaf29d94f2 - */ - public void setOperationOutcome(BaseOperationOutcome theBaseOperationOutcome) { - myBaseOperationOutcome = theBaseOperationOutcome; - } - - /** - * This method is currently only called internally by HAPI, it should not be called by user code. - */ - public void setResponseBody(String theResponseBody) { - myResponseBody = theResponseBody; - } - - /** - * This method is currently only called internally by HAPI, it should not be called by user code. - */ - public void setResponseMimeType(String theResponseMimeType) { - myResponseMimeType = theResponseMimeType; - } - - /** - * For unit tests only - */ - static boolean isExceptionTypeRegistered(Class> theType) { - return ourStatusCodeToExceptionType.values().contains(theType); - } - - public static BaseServerResponseException newInstance(int theStatusCode, String theMessage) { - if (ourStatusCodeToExceptionType.containsKey(theStatusCode)) { - try { - return ourStatusCodeToExceptionType.get(theStatusCode).getConstructor(new Class[] { String.class }).newInstance(theMessage); - } catch (InstantiationException e) { - throw new InternalErrorException(e); - } catch (IllegalAccessException e) { - throw new InternalErrorException(e); - } catch (IllegalArgumentException e) { - throw new InternalErrorException(e); - } catch (InvocationTargetException e) { - throw new InternalErrorException(e); - } catch (NoSuchMethodException e) { - throw new InternalErrorException(e); - } catch (SecurityException e) { - throw new InternalErrorException(e); - } - } else { - return new UnclassifiedServerFailureException(theStatusCode, theMessage); - } - } - - static void registerExceptionType(int theStatusCode, Class extends BaseServerResponseException> theType) { - if (ourStatusCodeToExceptionType.containsKey(theStatusCode)) { - throw new Error("Can not register " + theType + " to status code " + theStatusCode + " because " + ourStatusCodeToExceptionType.get(theStatusCode) + " already registers that code"); - } - ourStatusCodeToExceptionType.put(theStatusCode, theType); - } - -} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.java index c9b17311245..c3eb87ea6e6 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.java @@ -20,16 +20,7 @@ package ca.uhn.fhir.rest.server.exceptions; * #L% */ -import java.util.List; -import java.util.Map; - -import ca.uhn.fhir.model.api.IElement; -import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; import ca.uhn.fhir.model.base.resource.BaseOperationOutcome; -import ca.uhn.fhir.model.dstu.composite.ContainedDt; -import ca.uhn.fhir.model.dstu.composite.NarrativeDt; -import ca.uhn.fhir.model.primitive.CodeDt; -import ca.uhn.fhir.model.primitive.IdDt; import ca.uhn.fhir.rest.server.Constants; /** diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.java.orig b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.java.orig deleted file mode 100644 index 7439ef94f15..00000000000 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/server/exceptions/UnprocessableEntityException.java.orig +++ /dev/null @@ -1,87 +0,0 @@ -package ca.uhn.fhir.rest.server.exceptions; - -/* - * #%L - * HAPI FHIR - Core Library - * %% - * Copyright (C) 2014 University Health Network - * %% - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * #L% - */ - -import java.util.List; -import java.util.Map; - -import ca.uhn.fhir.model.api.IElement; -import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; -import ca.uhn.fhir.model.base.resource.BaseOperationOutcome; -import ca.uhn.fhir.model.dstu.composite.ContainedDt; -import ca.uhn.fhir.model.dstu.composite.NarrativeDt; -import ca.uhn.fhir.model.primitive.CodeDt; -import ca.uhn.fhir.model.primitive.IdDt; -import ca.uhn.fhir.rest.server.Constants; - -/** - * Represents an HTTP 422 Unprocessable Entity response, which means that a resource was rejected by the server because it "violated applicable FHIR profiles or server business rules". - * - *- * This exception will generally contain an {@link BaseOperationOutcome} instance which details the failure. - *
- * - * @see InvalidRequestException Which corresponds to an HTTP 400 Bad Request failure - */ -public class UnprocessableEntityException extends BaseServerResponseException { - - private static final String DEFAULT_MESSAGE = "Unprocessable Entity"; - private static final long serialVersionUID = 1L; - public static final int STATUS_CODE = Constants.STATUS_HTTP_422_UNPROCESSABLE_ENTITY; - - /** - * Constructor - * - * @param theMessage - * The message to add to the status line - * @param theOperationOutcome The BaseOperationOutcome resource to return to the client - */ - public UnprocessableEntityException(String theMessage, BaseOperationOutcome theOperationOutcome) { - super(STATUS_CODE, theMessage, theOperationOutcome); - } - - - /** - * Constructor which accepts an {@link BaseOperationOutcome} resource which will be supplied in the response - */ - public UnprocessableEntityException(BaseOperationOutcome theOperationOutcome) { - super(STATUS_CODE, DEFAULT_MESSAGE, theOperationOutcome); - } - - /** - * Constructor which accepts a String describing the issue. This string will be translated into an {@link BaseOperationOutcome} resource which will be supplied in the response. - */ - public UnprocessableEntityException(String theMessage) { - super(STATUS_CODE, theMessage); - } - - /** - * Constructor which accepts an array of Strings describing the issue. This strings will be translated into an {@link BaseOperationOutcome} resource which will be supplied in the response. - */ - public UnprocessableEntityException(String... theMessage) { -<<<<<<< HEAD - super(STATUS_CODE, theMessage[0]); // TODO: this used to generate an OperationOutcome - why? -======= - super(STATUS_CODE, theMessage); ->>>>>>> d22a35788f57e9f7ce64bc8afc2ee7eaf29d94f2 - } - -} diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java index 284be21462a..63a0aa0f7ea 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/validation/FhirValidator.java @@ -31,10 +31,6 @@ import ca.uhn.fhir.model.api.Bundle; import ca.uhn.fhir.model.api.IResource; import ca.uhn.fhir.model.base.resource.BaseOperationOutcome; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - /** * Resource validator, which checks resources for compliance against various validation schemes (schemas, schematrons, etc.) * diff --git a/hapi-fhir-oauth2/pom.xml b/hapi-fhir-oauth2/pom.xml index b8f182797ab..5171085fdce 100644 --- a/hapi-fhir-oauth2/pom.xml +++ b/hapi-fhir-oauth2/pom.xml @@ -12,6 +12,7 @@