Merge branch 'master' into tinder-for-non-java

This commit is contained in:
Bill Denton 2016-12-06 11:29:04 -08:00
commit 1ba2680acc
8 changed files with 146 additions and 38 deletions

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.context.support; package ca.uhn.fhir.context.support;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2016 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.List;
import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IBaseResource;

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.fluentpath; package ca.uhn.fhir.fluentpath;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2016 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.rest.server.exceptions.InternalErrorException; import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
/** /**

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.fluentpath; package ca.uhn.fhir.fluentpath;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2016 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.List;
import org.hl7.fhir.instance.model.api.IBase; import org.hl7.fhir.instance.model.api.IBase;

View File

@ -61,7 +61,7 @@ public class LenientErrorHandler implements IParserErrorHandler {
@Override @Override
public void incorrectJsonType(IParseLocation theLocation, String theElementName, ValueType theExpected, ValueType theFound) { public void incorrectJsonType(IParseLocation theLocation, String theElementName, ValueType theExpected, ValueType theFound) {
if (myLogErrors) { if (myLogErrors) {
ourLog.warn("Found incorrect type for element {} - Expected {} and found {}", theElementName, theExpected.name(), theFound.name()); ourLog.warn("Found incorrect type for element {} - Expected {} and found {}", new Object[]{theElementName, theExpected.name(), theFound.name()});
} }
} }

View File

@ -1,5 +1,25 @@
package ca.uhn.fhir.rest.server.interceptor; package ca.uhn.fhir.rest.server.interceptor;
/*
* #%L
* HAPI FHIR - Core Library
* %%
* Copyright (C) 2014 - 2016 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.io.IOException; import java.io.IOException;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;

View File

@ -245,7 +245,7 @@ public class ExampleDataUploader extends BaseCommand {
iter.remove(); iter.remove();
} }
} }
List<IBaseResource> subResourceList = new ArrayList<IBaseResource>(); List<IBaseResource> subResourceList = new ArrayList<IBaseResource>();
while (resources.size() > 0) { while (resources.size() > 0) {
@ -253,7 +253,7 @@ public class ExampleDataUploader extends BaseCommand {
subResourceList.add(nextAddedResource); subResourceList.add(nextAddedResource);
Set<String> checkedTargets = new HashSet<String>(); Set<String> checkedTargets = new HashSet<String>();
for (int i = 0; i < subResourceList.size(); i++) { for (int i = 0; i < subResourceList.size(); i++) {
IBaseResource nextCandidateSource = subResourceList.get(i); IBaseResource nextCandidateSource = subResourceList.get(i);
for (ResourceReferenceInfo nextRef : ctx.newTerser().getAllResourceReferences(nextCandidateSource)) { for (ResourceReferenceInfo nextRef : ctx.newTerser().getAllResourceReferences(nextCandidateSource)) {
@ -276,7 +276,7 @@ public class ExampleDataUploader extends BaseCommand {
boolean found = false; boolean found = false;
for (int j = 0; j < resources.size(); j++) { for (int j = 0; j < resources.size(); j++) {
String candidateTarget = resources.get(j).getIdElement().getValue(); String candidateTarget = resources.get(j).getIdElement().getValue();
if (isNotBlank(nextTarget) && nextTarget.equals(candidateTarget)) { if (isNotBlank(nextTarget) && nextTarget.equals(candidateTarget)) {
ourLog.info("Reflexively adding resource {} to bundle as it is a reference target", nextTarget); ourLog.info("Reflexively adding resource {} to bundle as it is a reference target", nextTarget);
subResourceList.add(resources.remove(j)); subResourceList.add(resources.remove(j));
@ -287,7 +287,6 @@ public class ExampleDataUploader extends BaseCommand {
} }
} }
if (subResourceList.size() < 10 && resources.size() > 0) { if (subResourceList.size() < 10 && resources.size() > 0) {
subResourceList.add(resources.remove(0)); subResourceList.add(resources.remove(0));
continue; continue;
@ -357,8 +356,8 @@ public class ExampleDataUploader extends BaseCommand {
Entry next = iterator.next(); Entry next = iterator.next();
// DataElement have giant IDs that seem invalid, need to investigate this.. // DataElement have giant IDs that seem invalid, need to investigate this..
if ("Subscription".equals(next.getResource().getResourceName()) || "DataElement".equals(next.getResource().getResourceName()) || "OperationOutcome".equals(next.getResource().getResourceName()) if ("Subscription".equals(next.getResource().getResourceName()) || "DataElement".equals(next.getResource().getResourceName())
|| "OperationDefinition".equals(next.getResource().getResourceName())) { || "OperationOutcome".equals(next.getResource().getResourceName()) || "OperationDefinition".equals(next.getResource().getResourceName())) {
ourLog.info("Skipping " + next.getResource().getResourceName() + " example"); ourLog.info("Skipping " + next.getResource().getResourceName() + " example");
iterator.remove(); iterator.remove();
} else { } else {
@ -399,7 +398,7 @@ public class ExampleDataUploader extends BaseCommand {
// } // }
nextRef.getResourceReference().setResource(null); nextRef.getResourceReference().setResource(null);
String value = nextRef.getResourceReference().getReferenceElement().toUnqualifiedVersionless().getValue(); String value = nextRef.getResourceReference().getReferenceElement().toUnqualifiedVersionless().getValue();
if (isNotBlank(value)) { if (isNotBlank(value)) {
if (!qualIds.contains(value) && !nextRef.getResourceReference().getReferenceElement().isLocal()) { if (!qualIds.contains(value) && !nextRef.getResourceReference().getReferenceElement().isLocal()) {
ourLog.info("Discarding unknown reference: {}", value); ourLog.info("Discarding unknown reference: {}", value);
@ -437,8 +436,8 @@ public class ExampleDataUploader extends BaseCommand {
BundleEntryComponent next = iterator.next(); BundleEntryComponent next = iterator.next();
// DataElement have giant IDs that seem invalid, need to investigate this.. // DataElement have giant IDs that seem invalid, need to investigate this..
if ("Subscription".equals(next.getResource().getResourceType()) || "DataElement".equals(next.getResource().getResourceType()) || "OperationOutcome".equals(next.getResource().getResourceType()) if ("Subscription".equals(next.getResource().getResourceType()) || "DataElement".equals(next.getResource().getResourceType())
|| "OperationDefinition".equals(next.getResource().getResourceType())) { || "OperationOutcome".equals(next.getResource().getResourceType()) || "OperationDefinition".equals(next.getResource().getResourceType())) {
ourLog.info("Skipping " + next.getResource().getResourceType() + " example"); ourLog.info("Skipping " + next.getResource().getResourceType() + " example");
iterator.remove(); iterator.remove();
} else { } else {
@ -479,7 +478,7 @@ public class ExampleDataUploader extends BaseCommand {
// } // }
nextRef.getResourceReference().setResource(null); nextRef.getResourceReference().setResource(null);
String value = nextRef.getResourceReference().getReferenceElement().toUnqualifiedVersionless().getValue(); String value = nextRef.getResourceReference().getReferenceElement().toUnqualifiedVersionless().getValue();
if (isNotBlank(value)) { if (isNotBlank(value)) {
if (!qualIds.contains(value) && !nextRef.getResourceReference().getReferenceElement().isLocal()) { if (!qualIds.contains(value) && !nextRef.getResourceReference().getReferenceElement().isLocal()) {
ourLog.info("Discarding unknown reference: {}", value); ourLog.info("Discarding unknown reference: {}", value);
@ -659,37 +658,41 @@ public class ExampleDataUploader extends BaseCommand {
private void downloadFileFromInternet(CloseableHttpResponse result, File localFile) throws IOException { private void downloadFileFromInternet(CloseableHttpResponse result, File localFile) throws IOException {
FileOutputStream buffer = FileUtils.openOutputStream(localFile); FileOutputStream buffer = FileUtils.openOutputStream(localFile);
try {
long maxLength = result.getEntity().getContentLength(); long maxLength = result.getEntity().getContentLength();
long nextLog = -1; long nextLog = -1;
// ByteArrayOutputStream buffer = new ByteArrayOutputStream(); // ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead; int nRead;
byte[] data = new byte[16384]; byte[] data = new byte[16384];
while ((nRead = result.getEntity().getContent().read(data, 0, data.length)) != -1) { while ((nRead = result.getEntity().getContent().read(data, 0, data.length)) != -1) {
buffer.write(data, 0, nRead); buffer.write(data, 0, nRead);
long fileSize = FileUtils.sizeOf(localFile); long fileSize = FileUtils.sizeOf(localFile);
if (fileSize > nextLog) { if (fileSize > nextLog) {
System.err.print("\r" + Ansi.ansi().eraseLine()); System.err.print("\r" + Ansi.ansi().eraseLine());
System.err.print(FileUtils.byteCountToDisplaySize(fileSize)); System.err.print(FileUtils.byteCountToDisplaySize(fileSize));
if (maxLength > 0) { if (maxLength > 0) {
System.err.print(" ["); System.err.print(" [");
int stars = (int) (50.0f * ((float) fileSize / (float) maxLength)); int stars = (int) (50.0f * ((float) fileSize / (float) maxLength));
for (int i = 0; i < stars; i++) { for (int i = 0; i < stars; i++) {
System.err.print("*"); System.err.print("*");
}
for (int i = stars; i < 50; i++) {
System.err.print(" ");
}
System.err.print("]");
} }
for (int i = stars; i < 50; i++) { System.err.flush();
System.err.print(" "); nextLog += 100000;
}
System.err.print("]");
} }
System.err.flush();
nextLog += 100000;
} }
} buffer.flush();
buffer.flush();
System.err.println(); System.err.println();
System.err.flush(); System.err.flush();
} finally {
IOUtils.closeQuietly(buffer);
}
} }
} }

View File

@ -82,6 +82,18 @@
<build> <build>
<plugins> <plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/ca/uhn/fhir/rest/server/interceptor/CorsInterceptor.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin> <plugin>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
<executions> <executions>

View File

@ -7,7 +7,16 @@
</properties> </properties>
<body> <body>
<release version="2.2" date="TBD"> <release version="2.2" date="TBD">
<action type="fix"> <!--<action type="add">
Bump the version of a few dependencies to the
latest versions (dependent HAPI modules listed in brackets):
<![CDATA[
<ul>
<li>spring (JPA): 4.3.1 -&gt; 4.3.4</li>
</ul>
]]>
</action>-->
<action type="fix">
Fix issue in AuthorizationIntetceptor where Fix issue in AuthorizationIntetceptor where
transactions are blocked even when they transactions are blocked even when they
should not be should not be
@ -66,6 +75,10 @@
external references (and therefore can't be loaded external references (and therefore can't be loaded
by the server). Thanks to Hannes Ulrich for reporting! by the server). Thanks to Hannes Ulrich for reporting!
</action> </action>
<action type="fix">
HAPI FHIR CLI failed to delete a file when uploading
example resources while running under Windows.
</action>
</release> </release>
<release version="2.1" date="2016-11-11"> <release version="2.1" date="2016-11-11">
<action type="add"> <action type="add">