From 1bd51f61186ecb798dac08bcf7e624d3fe6fb24a Mon Sep 17 00:00:00 2001 From: James Agnew Date: Mon, 3 Nov 2014 18:48:32 -0500 Subject: [PATCH 1/2] Potential solution for #47 (bad test) --- .../ca/uhn/fhir/rest/client/ClientTest.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java index 9e0c8e06914..d1ab070b66e 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java @@ -15,6 +15,7 @@ import java.nio.charset.Charset; import java.util.Arrays; import java.util.Date; import java.util.List; +import java.util.TimeZone; import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.ReaderInputStream; @@ -507,7 +508,7 @@ public class ClientTest { @Test public void testHistoryWithParams() throws Exception { - + //@formatter:off final String msg = "<id>6c1d93be-027f-468d-9d47-f826cd15cf42</id><link rel=\"self\" href=\"http://localhost:51698/Patient/222/_history\"/><link rel=\"fhir-base\" href=\"http://localhost:51698\"/><os:totalResults xmlns:os=\"http://a9.com/-/spec/opensearch/1.1/\">2</os:totalResults><published>2014-04-13T18:24:50-04:00</published><author><name>ca.uhn.fhir.rest.method.HistoryMethodBinding</name></author><entry><title>Patient 2222221969-12-31T19:00:20.000-05:001969-12-31T19:00:10.000-05:00Patient 2222221969-12-31T19:00:30.000-05:001969-12-31T19:00:10.000-05:00"; //@formatter:on @@ -525,17 +526,16 @@ public class ClientTest { ITestClient client = ctx.newRestfulClient(ITestClient.class, "http://foo"); - client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T00:01:02"), new IntegerDt(12)); + // ensures the local timezone + String expectedDateString = new InstantDt(new InstantDt("2012-01-02T12:01:02").getValue()).getValueAsString(); + expectedDateString = expectedDateString.replace(":", "%3A").replace("+", "%2B"); + + client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T12:01:02"), new IntegerDt(12)); assertThat(capt.getAllValues().get(0).getURI().toString(), containsString("http://foo/Patient/111/_history?")); - assertThat(capt.getAllValues().get(0).getURI().toString(), containsString("_since=2012-01-02T00%3A01%3A02")); + assertThat(capt.getAllValues().get(0).getURI().toString(), containsString("_since="+expectedDateString.replaceAll("\\..*", ""))); assertThat(capt.getAllValues().get(0).getURI().toString(), containsString("_count=12")); - String expectedDateString = new InstantDt(new InstantDt("2012-01-02T00:01:02").getValue()).getValueAsString(); // ensures - // the - // local - // timezone - expectedDateString = expectedDateString.replace(":", "%3A"); - client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T00:01:02").getValue(), new IntegerDt(12).getValue()); + client.getHistoryPatientInstance(new IdDt("111"), new InstantDt("2012-01-02T12:01:02").getValue(), new IntegerDt(12).getValue()); assertThat(capt.getAllValues().get(1).getURI().toString(), containsString("http://foo/Patient/111/_history?")); assertThat(capt.getAllValues().get(1).getURI().toString(), containsString("_since="+expectedDateString)); assertThat(capt.getAllValues().get(1).getURI().toString(), containsString("_count=12")); From 4e769da4cada255650cd1d8296933549091ffead Mon Sep 17 00:00:00 2001 From: James Agnew Date: Tue, 4 Nov 2014 13:29:21 -0500 Subject: [PATCH 2/2] Give securityevent a common parent --- .../base/resource/BaseOperationOutcome.java | 10 +++--- .../base/resource/BaseSecurityEvent.java | 28 +++++++++++++++ .../ca/uhn/fhir/rest/client/ClientTest.java | 1 - .../src/main/resources/vm/resource.vm | 2 +- .../src/main/resources/vm/resource_dstu.vm | 2 +- src/site/xdoc/doc_upgrading.xml | 35 +++++++++++++++++++ 6 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseSecurityEvent.java diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseOperationOutcome.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseOperationOutcome.java index ce4e55a616b..0ff5e9c3b3a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseOperationOutcome.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseOperationOutcome.java @@ -39,21 +39,19 @@ public abstract class BaseOperationOutcome extends BaseResource implements IReso public abstract BaseIssue getIssueFirstRep(); public static abstract class BaseIssue extends BaseIdentifiableElement implements IResourceBlock { - + public abstract CodeDt getSeverityElement(); - + public abstract StringDt getDetailsElement(); public abstract BaseCodingDt getType(); - public abstract BaseIssue addLocation( String theString); + public abstract BaseIssue addLocation(String theString); public abstract BaseIssue setDetails(String theString); public abstract StringDt getLocationFirstRep(); - + } - - } diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseSecurityEvent.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseSecurityEvent.java new file mode 100644 index 00000000000..c35daaec293 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/model/base/resource/BaseSecurityEvent.java @@ -0,0 +1,28 @@ +package ca.uhn.fhir.model.base.resource; + +/* + * #%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 ca.uhn.fhir.model.api.BaseResource; +import ca.uhn.fhir.model.api.IResource; + +public abstract class BaseSecurityEvent extends BaseResource implements IResource { + +} diff --git a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java index d1ab070b66e..182b6947e17 100644 --- a/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java +++ b/hapi-fhir-structures-dstu/src/test/java/ca/uhn/fhir/rest/client/ClientTest.java @@ -15,7 +15,6 @@ import java.nio.charset.Charset; import java.util.Arrays; import java.util.Date; import java.util.List; -import java.util.TimeZone; import org.apache.commons.io.IOUtils; import org.apache.commons.io.input.ReaderInputStream; diff --git a/hapi-tinder-plugin/src/main/resources/vm/resource.vm b/hapi-tinder-plugin/src/main/resources/vm/resource.vm index 1bfcdf615eb..b66e408c89e 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/resource.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/resource.vm @@ -40,7 +40,7 @@ import ${import}; */ @ResourceDef(name="${elementName}", profile="${profile}", id="${id}") public class ${className} - extends #{if}( ${className}=="OperationOutcome" || ${className}=="Conformance" ) ca.uhn.fhir.model.base.resource.Base${className} #{else} BaseResource #{end} + extends #{if}( ${className}=="OperationOutcome" || ${className}=="Conformance" || ${className}=="SecurityEvent" ) ca.uhn.fhir.model.base.resource.Base${className} #{else} BaseResource #{end} implements IResource { #foreach ( $param in $searchParams ) diff --git a/hapi-tinder-plugin/src/main/resources/vm/resource_dstu.vm b/hapi-tinder-plugin/src/main/resources/vm/resource_dstu.vm index ea065de17af..b8f7cb50bf9 100644 --- a/hapi-tinder-plugin/src/main/resources/vm/resource_dstu.vm +++ b/hapi-tinder-plugin/src/main/resources/vm/resource_dstu.vm @@ -39,7 +39,7 @@ import ${import}; */ @ResourceDef(name="${elementName}", profile="${profile}", id="${id}") public class ${className} - extends #{if}( ${className}=="OperationOutcome" || ${className}=="Conformance" ) ca.uhn.fhir.model.base.resource.Base${className} #{else} BaseResource #{end} + extends #{if}( ${className}=="OperationOutcome" || ${className}=="Conformance" || ${className}=="SecurityEvent" ) ca.uhn.fhir.model.base.resource.Base${className} #{else} BaseResource #{end} implements IResource { #foreach ( $param in $searchParams ) diff --git a/src/site/xdoc/doc_upgrading.xml b/src/site/xdoc/doc_upgrading.xml index 7481a2dcf24..926e3ee57aa 100644 --- a/src/site/xdoc/doc_upgrading.xml +++ b/src/site/xdoc/doc_upgrading.xml @@ -13,6 +13,41 @@ +

+ This section is still incomplete: Note that HAPI 0.8 has not + yet been released. This section provides details about how to use the + latest SNAPSHOT release, but it will continue to be enhanced as we move towards + the final 0.8 release. +

+ + + +

+ Beginning in HAPI-FHIR 0.8, the main distribution has been split from one + JAR to a set of JAR files. You will need at least two to use HAPI: +

+
    +
  • + The hapi-fhir-base-[version].jar file containing the core library. +
  • +
  • + The hapi-fhir-structures-dstu-[version].jar file containing the FHIR model classes + for DSTU1 (all contents of this JAR were previously found in hapi-fhir-base). +
  • +
  • + Optionally: You may also choose to include the + hapi-fhir-structures-dev-[version].jar. This JAR contains structures for the + latest DEV version of FHIR. You may create a client/server which supports either DSTU1 or DEV + resources, or both depending on your needs. Note that using DEV resources may introduce + incompatibilities with other frameworks however.

    + You must also include hapi-fhir-structures-dstu-[version].jar if you include + the dev structures JAR at this time. Hopefully at some point soon this requirement + will be relaxed. +
  • +
+ +
+