#221 Conformance date now defaults to the build date/time
This commit is contained in:
parent
f403bd018b
commit
27764da19a
|
@ -188,6 +188,11 @@
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifestEntries>
|
||||||
|
<Build-Time>${maven.build.timestamp}</Build-Time>
|
||||||
|
</manifestEntries>
|
||||||
|
</archive>
|
||||||
<overlays>
|
<overlays>
|
||||||
<overlay>
|
<overlay>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
|
|
|
@ -198,6 +198,11 @@
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-war-plugin</artifactId>
|
<artifactId>maven-war-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifestEntries>
|
||||||
|
<Build-Time>${maven.build.timestamp}</Build-Time>
|
||||||
|
</manifestEntries>
|
||||||
|
</archive>
|
||||||
<overlays>
|
<overlays>
|
||||||
<overlay>
|
<overlay>
|
||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
|
|
|
@ -20,14 +20,15 @@ package ca.uhn.fhir.rest.server.provider;
|
||||||
* #L%
|
* #L%
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.io.InputStream;
|
||||||
import java.util.Comparator;
|
import java.text.DateFormat;
|
||||||
import java.util.HashSet;
|
import java.text.ParseException;
|
||||||
import java.util.List;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Set;
|
import java.util.*;
|
||||||
import java.util.TreeSet;
|
import java.util.jar.Manifest;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||||
|
@ -121,7 +122,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
Conformance retVal = new Conformance();
|
Conformance retVal = new Conformance();
|
||||||
|
|
||||||
retVal.setPublisher(myPublisher);
|
retVal.setPublisher(myPublisher);
|
||||||
retVal.setDate(DateTimeDt.withCurrentTime());
|
retVal.setDate(conformanceDate());
|
||||||
retVal.setFhirVersion("0.0.82-3059"); // TODO: pull from model
|
retVal.setFhirVersion("0.0.82-3059"); // TODO: pull from model
|
||||||
retVal.setAcceptUnknown(false); // TODO: make this configurable - this is a fairly big effort since the parser needs to be modified to actually allow it
|
retVal.setAcceptUnknown(false); // TODO: make this configurable - this is a fairly big effort since the parser needs to be modified to actually allow it
|
||||||
|
|
||||||
|
@ -213,6 +214,31 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DateTimeDt conformanceDate() {
|
||||||
|
String buildDate = getBuildDateFromManifest();
|
||||||
|
if (buildDate != null) {
|
||||||
|
try {
|
||||||
|
return new DateTimeDt(buildDate);
|
||||||
|
} catch (DataFormatException e) {
|
||||||
|
// fall through
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DateTimeDt.withCurrentTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBuildDateFromManifest() {
|
||||||
|
InputStream inputStream = myRestfulServer.getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF");
|
||||||
|
if (inputStream != null) {
|
||||||
|
try {
|
||||||
|
Manifest manifest = new Manifest(inputStream);
|
||||||
|
return manifest.getMainAttributes().getValue("Build-Time");
|
||||||
|
} catch (IOException e) {
|
||||||
|
// fall through
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void handleDynamicSearchMethodBinding(RestResource resource, RuntimeResourceDefinition def, TreeSet<String> includes, DynamicSearchMethodBinding searchMethodBinding) {
|
private void handleDynamicSearchMethodBinding(RestResource resource, RuntimeResourceDefinition def, TreeSet<String> includes, DynamicSearchMethodBinding searchMethodBinding) {
|
||||||
includes.addAll(searchMethodBinding.getIncludes());
|
includes.addAll(searchMethodBinding.getIncludes());
|
||||||
|
|
||||||
|
|
|
@ -22,21 +22,15 @@ package ca.uhn.fhir.rest.server.provider.dstu2;
|
||||||
|
|
||||||
import static org.apache.commons.lang3.StringUtils.*;
|
import static org.apache.commons.lang3.StringUtils.*;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.io.IOException;
|
||||||
import java.util.Collections;
|
import java.io.InputStream;
|
||||||
import java.util.Comparator;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.IdentityHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.jar.Manifest;
|
||||||
import java.util.TreeMap;
|
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
import ca.uhn.fhir.parser.DataFormatException;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||||
|
@ -173,7 +167,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
Conformance retVal = new Conformance();
|
Conformance retVal = new Conformance();
|
||||||
|
|
||||||
retVal.setPublisher(myPublisher);
|
retVal.setPublisher(myPublisher);
|
||||||
retVal.setDate(DateTimeDt.withCurrentTime());
|
retVal.setDate(conformanceDate());
|
||||||
retVal.setFhirVersion("1.0.0"); // TODO: pull from model
|
retVal.setFhirVersion("1.0.0"); // TODO: pull from model
|
||||||
retVal.setAcceptUnknown(UnknownContentCodeEnum.UNKNOWN_EXTENSIONS); // TODO: make this configurable - this is a fairly big effort since the parser
|
retVal.setAcceptUnknown(UnknownContentCodeEnum.UNKNOWN_EXTENSIONS); // TODO: make this configurable - this is a fairly big effort since the parser
|
||||||
// needs to be modified to actually allow it
|
// needs to be modified to actually allow it
|
||||||
|
@ -304,6 +298,31 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DateTimeDt conformanceDate() {
|
||||||
|
String buildDate = getBuildDateFromManifest();
|
||||||
|
if (buildDate != null) {
|
||||||
|
try {
|
||||||
|
return new DateTimeDt(buildDate);
|
||||||
|
} catch (DataFormatException e) {
|
||||||
|
// fall through
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return DateTimeDt.withCurrentTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBuildDateFromManifest() {
|
||||||
|
InputStream inputStream = myRestfulServer.getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF");
|
||||||
|
if (inputStream != null) {
|
||||||
|
try {
|
||||||
|
Manifest manifest = new Manifest(inputStream);
|
||||||
|
return manifest.getMainAttributes().getValue("Build-Time");
|
||||||
|
} catch (IOException e) {
|
||||||
|
// fall through
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void handleDynamicSearchMethodBinding(RestResource resource, RuntimeResourceDefinition def, TreeSet<String> includes, DynamicSearchMethodBinding searchMethodBinding) {
|
private void handleDynamicSearchMethodBinding(RestResource resource, RuntimeResourceDefinition def, TreeSet<String> includes, DynamicSearchMethodBinding searchMethodBinding) {
|
||||||
includes.addAll(searchMethodBinding.getIncludes());
|
includes.addAll(searchMethodBinding.getIncludes());
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,11 @@ package org.hl7.fhir.instance.conf;
|
||||||
*/
|
*/
|
||||||
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
import static org.apache.commons.lang3.StringUtils.isNotBlank;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
@ -34,6 +39,7 @@ import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
import java.util.jar.Manifest;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
@ -179,7 +185,7 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
Conformance retVal = new Conformance();
|
Conformance retVal = new Conformance();
|
||||||
|
|
||||||
retVal.setPublisher(myPublisher);
|
retVal.setPublisher(myPublisher);
|
||||||
retVal.setDate(new Date());
|
retVal.setDate(conformanceDate());
|
||||||
retVal.setFhirVersion("1.0.0"); // TODO: pull from model
|
retVal.setFhirVersion("1.0.0"); // TODO: pull from model
|
||||||
retVal.setAcceptUnknown(UnknownContentCode.EXTENSIONS); // TODO: make this configurable - this is a fairly big effort since the parser
|
retVal.setAcceptUnknown(UnknownContentCode.EXTENSIONS); // TODO: make this configurable - this is a fairly big effort since the parser
|
||||||
// needs to be modified to actually allow it
|
// needs to be modified to actually allow it
|
||||||
|
@ -315,6 +321,32 @@ public class ServerConformanceProvider implements IServerConformanceProvider<Con
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Date conformanceDate() {
|
||||||
|
String buildDate = getBuildDateFromManifest();
|
||||||
|
if (buildDate != null) {
|
||||||
|
DateFormat dateFormat = new SimpleDateFormat();
|
||||||
|
try {
|
||||||
|
return dateFormat.parse(buildDate);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
// fall through
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return new Date();
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getBuildDateFromManifest() {
|
||||||
|
InputStream inputStream = myRestfulServer.getServletContext().getResourceAsStream("/META-INF/MANIFEST.MF");
|
||||||
|
if (inputStream != null) {
|
||||||
|
try {
|
||||||
|
Manifest manifest = new Manifest(inputStream);
|
||||||
|
return manifest.getMainAttributes().getValue("Build-Time");
|
||||||
|
} catch (IOException e) {
|
||||||
|
// fall through
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void handleDynamicSearchMethodBinding(ConformanceRestResourceComponent resource,
|
private void handleDynamicSearchMethodBinding(ConformanceRestResourceComponent resource,
|
||||||
RuntimeResourceDefinition def, TreeSet<String> includes, DynamicSearchMethodBinding searchMethodBinding) {
|
RuntimeResourceDefinition def, TreeSet<String> includes, DynamicSearchMethodBinding searchMethodBinding) {
|
||||||
includes.addAll(searchMethodBinding.getIncludes());
|
includes.addAll(searchMethodBinding.getIncludes());
|
||||||
|
|
3
pom.xml
3
pom.xml
|
@ -196,6 +196,9 @@
|
||||||
</licenses>
|
</licenses>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
<!-- configure timestamp in MANIFEST.MF for maven-war-provider -->
|
||||||
|
<maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
|
||||||
|
|
||||||
<!-- This property is used in some of the site documentation where the version is shown, so that we can deploy the site even if the project is on a snapshot version. -->
|
<!-- This property is used in some of the site documentation where the version is shown, so that we can deploy the site even if the project is on a snapshot version. -->
|
||||||
<hapi_stable_version>1.1</hapi_stable_version>
|
<hapi_stable_version>1.1</hapi_stable_version>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue