Version bunp for 1.2

This commit is contained in:
James Agnew 2015-07-14 18:08:06 -04:00
parent 2b69817ad9
commit 901c5c29cf
765 changed files with 162529 additions and 5478 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -18,17 +18,17 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
@ -37,13 +37,13 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -36,7 +36,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>
@ -51,7 +51,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>
@ -62,7 +62,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -34,7 +34,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>
@ -49,7 +49,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>
@ -60,7 +60,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>woodstox-core-asl</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -275,16 +275,17 @@ public abstract class BaseParser implements IParser {
return stringWriter.toString();
}
/**
* If individual resources in the bundle have an ID that has the base set, we make sure that Bundle.entry.base gets set as needed.
*/
private void fixBaseLinksForBundle(IBaseBundle theBundle) {
if (myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) {
return;
}
/*
* ATTENTION IF YOU ARE EDITING THIS:
* There are two versions of this method, one for DSTU1/atom bundle and
* one for DSTU2/resource bundle. If you edit one, edit both and also
* update unit tests for both.
* ATTENTION IF YOU ARE EDITING THIS: There are two versions of this method, one for DSTU1/atom bundle and one for DSTU2/resource bundle. If you edit one, edit both and also update unit tests
* for both.
*/
FhirTerser t = myContext.newTerser();
IPrimitiveType<?> element = t.getSingleValueOrNull(theBundle, "base", IPrimitiveType.class);
@ -375,11 +376,15 @@ public abstract class BaseParser implements IParser {
RuntimeResourceDefinition def = myContext.getResourceDefinition(retVal);
if ("Bundle".equals(def.getName())) {
List<IBase> base = def.getChildByName("base").getAccessor().getValues(retVal);
if (base != null && base.size() > 0) {
IPrimitiveType<?> baseType = (IPrimitiveType<?>) base.get(0);
IBaseResource res = (retVal);
res.setId(new IdDt(baseType.getValueAsString(), def.getName(), res.getIdElement().getIdPart(), res.getIdElement().getVersionIdPart()));
List<IBase> base = null;
if (!myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) {
base = def.getChildByName("base").getAccessor().getValues(retVal);
if (base != null && base.size() > 0) {
IPrimitiveType<?> baseType = (IPrimitiveType<?>) base.get(0);
IBaseResource res = (retVal);
res.setId(new IdDt(baseType.getValueAsString(), def.getName(), res.getIdElement().getIdPart(), res.getIdElement().getVersionIdPart()));
}
}
BaseRuntimeChildDefinition entryChild = def.getChildByName("entry");
@ -387,35 +392,56 @@ public abstract class BaseParser implements IParser {
List<IBase> entries = entryChild.getAccessor().getValues(retVal);
if (entries != null) {
for (IBase nextEntry : entries) {
List<IBase> entryBase = entryDef.getChildByName("base").getAccessor().getValues(nextEntry);
if (entryBase == null || entryBase.isEmpty()) {
entryBase = base;
}
if (!myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) {
List<IBase> entryBase = entryDef.getChildByName("base").getAccessor().getValues(nextEntry);
if (entryBase == null || entryBase.isEmpty()) {
entryBase = base;
}
if (entryBase != null && entryBase.size() > 0) {
IPrimitiveType<?> baseType = (IPrimitiveType<?>) entryBase.get(0);
if (entryBase != null && entryBase.size() > 0) {
IPrimitiveType<?> baseType = (IPrimitiveType<?>) entryBase.get(0);
List<IBase> entryResources = entryDef.getChildByName("resource").getAccessor().getValues(nextEntry);
if (entryResources != null && entryResources.size() > 0) {
IBaseResource res = (IBaseResource) entryResources.get(0);
RuntimeResourceDefinition resDef = myContext.getResourceDefinition(res);
String versionIdPart = res.getIdElement().getVersionIdPart();
if (isBlank(versionIdPart) && res instanceof IResource) {
versionIdPart = ResourceMetadataKeyEnum.VERSION.get((IResource) res);
List<IBase> entryResources = entryDef.getChildByName("resource").getAccessor().getValues(nextEntry);
if (entryResources != null && entryResources.size() > 0) {
IBaseResource res = (IBaseResource) entryResources.get(0);
RuntimeResourceDefinition resDef = myContext.getResourceDefinition(res);
String versionIdPart = res.getIdElement().getVersionIdPart();
if (isBlank(versionIdPart) && res instanceof IResource) {
versionIdPart = ResourceMetadataKeyEnum.VERSION.get((IResource) res);
}
String baseUrl = baseType.getValueAsString();
String idPart = res.getIdElement().getIdPart();
String resourceName = resDef.getName();
if (!baseUrl.startsWith("cid:") && !baseUrl.startsWith("urn:")) {
res.setId(new IdDt(baseUrl, resourceName, idPart, versionIdPart));
} else {
if (baseUrl.endsWith(":")) {
res.setId(new IdDt(baseUrl + idPart));
} else {
res.setId(new IdDt(baseUrl + ':' + idPart));
}
}
}
String baseUrl = baseType.getValueAsString();
String idPart = res.getIdElement().getIdPart();
}
String resourceName = resDef.getName();
if (!baseUrl.startsWith("cid:") && !baseUrl.startsWith("urn:")) {
res.setId(new IdDt(baseUrl, resourceName, idPart, versionIdPart));
} else {
if (baseUrl.endsWith(":")) {
res.setId(new IdDt(baseUrl + idPart));
} else {
res.setId(new IdDt(baseUrl + ':' + idPart));
} else {
// DSTU2 after 0.5.0
/**
* If Bundle.entry.fullUrl is populated, set the resource ID to that
*/
List<IBase> fullUrl = entryDef.getChildByName("fullUrl").getAccessor().getValues(nextEntry);
if (fullUrl != null && !fullUrl.isEmpty()) {
IPrimitiveType<?> value = (IPrimitiveType<?>) fullUrl.get(0);
if (value.isEmpty() == false) {
List<IBase> entryResources = entryDef.getChildByName("resource").getAccessor().getValues(nextEntry);
if (entryResources != null && entryResources.size() > 0) {
IBaseResource res = (IBaseResource) entryResources.get(0);
res.setId(value.getValueAsString());
}
}
}

View File

@ -267,7 +267,11 @@ public class JsonParser extends BaseParser implements IParser {
}
writeOptionalTagWithTextNode(theEventWriter, "type", theBundle.getType());
writeOptionalTagWithTextNode(theEventWriter, "base", theBundle.getLinkBase());
if (!myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) {
writeOptionalTagWithTextNode(theEventWriter, "base", theBundle.getLinkBase());
}
writeOptionalTagWithNumberNode(theEventWriter, "total", theBundle.getTotalResults());
boolean linkStarted = false;
@ -284,8 +288,14 @@ public class JsonParser extends BaseParser implements IParser {
for (BundleEntry nextEntry : theBundle.getEntries()) {
theEventWriter.writeStartObject();
writeOptionalTagWithTextNode(theEventWriter, "base", determineResourceBaseUrl(theBundle.getLinkBase().getValue(), nextEntry));
if (!myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) {
writeOptionalTagWithTextNode(theEventWriter, "base", determineResourceBaseUrl(theBundle.getLinkBase().getValue(), nextEntry));
} else {
if (nextEntry.getResource() != null && nextEntry.getResource().getId().getBaseUrl() != null) {
writeOptionalTagWithTextNode(theEventWriter, "fullUrl", nextEntry.getResource().getId().getValue());
}
}
boolean deleted = nextEntry.getDeletedAt() != null && nextEntry.getDeletedAt().isEmpty() == false;
IResource resource = nextEntry.getResource();
if (resource != null && !resource.isEmpty() && !deleted) {

View File

@ -385,7 +385,9 @@ public class XmlParser extends BaseParser implements IParser {
String bundleBaseUrl = theBundle.getLinkBase().getValue();
writeOptionalTagWithValue(theEventWriter, "type", theBundle.getType().getValue());
writeOptionalTagWithValue(theEventWriter, "base", bundleBaseUrl);
if (!myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) {
writeOptionalTagWithValue(theEventWriter, "base", bundleBaseUrl);
}
writeOptionalTagWithValue(theEventWriter, "total", theBundle.getTotalResults().getValueAsString());
writeBundleResourceLink(theEventWriter, "first", theBundle.getLinkFirst());
@ -402,10 +404,18 @@ public class XmlParser extends BaseParser implements IParser {
deleted = true;
}
writeOptionalTagWithValue(theEventWriter, "base", determineResourceBaseUrl(bundleBaseUrl, nextEntry));
if (!myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) {
writeOptionalTagWithValue(theEventWriter, "base", determineResourceBaseUrl(bundleBaseUrl, nextEntry));
}
writeBundleResourceLink(theEventWriter, "alternate", nextEntry.getLinkAlternate());
if (myContext.getVersion().getVersion().equals(FhirVersionEnum.DSTU2_HL7ORG)) {
if (nextEntry.getResource() != null && nextEntry.getResource().getId().getBaseUrl() != null) {
writeOptionalTagWithValue(theEventWriter, "fullUrl", nextEntry.getResource().getId().getValue());
}
}
IResource resource = nextEntry.getResource();
if (resource != null && !resource.isEmpty() && !deleted) {
theEventWriter.writeStartElement("resource");

View File

@ -283,7 +283,7 @@ public class MethodUtil {
public static EncodingEnum detectEncoding(String theBody) {
EncodingEnum retVal = detectEncodingNoDefault(theBody);
if (retVal == null) {
retVal = EncodingEnum.XML;
retVal = EncodingEnum.XML;
}
return retVal;
}

View File

@ -0,0 +1,35 @@
package ca.uhn.fhir.validation;
import java.util.ArrayList;
import java.util.List;
import org.thymeleaf.util.Validate;
import ca.uhn.fhir.context.FhirContext;
abstract class BaseValidationContext<T> implements IValidationContext<T> {
protected final FhirContext myFhirContext;
private List<SingleValidationMessage> myMessages = new ArrayList<SingleValidationMessage>();
BaseValidationContext(FhirContext theFhirContext) {
myFhirContext = theFhirContext;
}
@Override
public void addValidationMessage(SingleValidationMessage theMessage) {
Validate.notNull(theMessage, "theMessage must not be null");
myMessages.add(theMessage);
}
@Override
public FhirContext getFhirContext() {
return myFhirContext;
}
@Override
public ValidationResult toResult() {
return new ValidationResult(myFhirContext, myMessages);
}
}

View File

@ -34,22 +34,27 @@ import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.util.OperationOutcomeUtil;
/**
* Resource validator, which checks resources for compliance against various validation schemes (schemas, schematrons, etc.)
* Resource validator, which checks resources for compliance against various validation schemes (schemas, schematrons, profiles, etc.)
*
* <p>
* To obtain a resource validator, call {@link FhirContext#newValidator()}
* </p>
*
* <p>
* <b>Thread safety note:</b> This class is thread safe, so you may register or unregister validator modules at any time. Individual modules are not guaranteed to be thread safe however. Reconfigure
* them with caution.
* </p>
*/
public class FhirValidator {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirValidator.class);
private static final String I18N_KEY_NO_PHLOC_WARNING = FhirValidator.class.getName() + ".noPhlocWarningOnStartup";
private static final String I18N_KEY_NO_PHLOC_ERROR = FhirValidator.class.getName() + ".noPhlocError";
private FhirContext myContext;
private List<IValidator> myValidators = new ArrayList<IValidator>();
private static final String I18N_KEY_NO_PHLOC_WARNING = FhirValidator.class.getName() + ".noPhlocWarningOnStartup";
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirValidator.class);
private static volatile Boolean ourPhlocPresentOnClasspath;
private final FhirContext myContext;
private volatile List<IValidator> myValidators = new ArrayList<IValidator>();
/**
* Constructor (this should not be called directly, but rather {@link FhirContext#newValidator()} should be called to obtain an instance of {@link FhirValidator})
@ -73,17 +78,17 @@ public class FhirValidator {
}
private void addOrRemoveValidator(boolean theValidateAgainstStandardSchema, Class<? extends IValidator> type, IValidator instance) {
private void addOrRemoveValidator(boolean theValidateAgainstStandardSchema, Class<? extends IValidator> type, IValidator theInstance) {
if (theValidateAgainstStandardSchema) {
boolean found = haveValidatorOfType(type);
if (!found) {
myValidators.add(instance);
registerValidator(theInstance);
}
} else {
for (Iterator<IValidator> iter = myValidators.iterator(); iter.hasNext();) {
IValidator next = iter.next();
if (next.getClass().equals(type)) {
iter.remove();
unregisterValidator(next);
}
}
}
@ -102,32 +107,69 @@ public class FhirValidator {
/**
* Should the validator validate the resource against the base schema (the schema provided with the FHIR distribution itself)
*/
public boolean isValidateAgainstStandardSchema() {
public synchronized boolean isValidateAgainstStandardSchema() {
return haveValidatorOfType(SchemaBaseValidator.class);
}
/**
* Should the validator validate the resource against the base schema (the schema provided with the FHIR distribution itself)
*/
public boolean isValidateAgainstStandardSchematron() {
public synchronized boolean isValidateAgainstStandardSchematron() {
return haveValidatorOfType(SchematronBaseValidator.class);
}
/**
* Should the validator validate the resource against the base schema (the schema provided with the FHIR distribution itself)
* Add a new validator module to this validator. You may register as many modules as you like at any time.
*
* @param theValidator
* The validator module. Must not be null.
*/
public void setValidateAgainstStandardSchema(boolean theValidateAgainstStandardSchema) {
public synchronized void registerValidator(IValidator theValidator) {
Validate.notNull(theValidator, "theValidator must not be null");
ArrayList<IValidator> newValidators = new ArrayList<IValidator>(myValidators.size() + 1);
newValidators.addAll(myValidators);
newValidators.add(theValidator);
myValidators = newValidators;
}
/**
* Should the validator validate the resource against the base schema (the schema provided with the FHIR distribution itself)
*
* @return Returns a referens to <code>this<code> for method chaining
*/
public synchronized FhirValidator setValidateAgainstStandardSchema(boolean theValidateAgainstStandardSchema) {
addOrRemoveValidator(theValidateAgainstStandardSchema, SchemaBaseValidator.class, new SchemaBaseValidator(myContext));
return this;
}
/**
* Should the validator validate the resource against the base schematron (the schematron provided with the FHIR distribution itself)
*
* @return
* @return Returns a referens to <code>this<code> for method chaining
*/
public void setValidateAgainstStandardSchematron(boolean theValidateAgainstStandardSchematron) {
public synchronized FhirValidator setValidateAgainstStandardSchematron(boolean theValidateAgainstStandardSchematron) {
if (theValidateAgainstStandardSchematron && !ourPhlocPresentOnClasspath) {
throw new IllegalArgumentException(myContext.getLocalizer().getMessage(I18N_KEY_NO_PHLOC_ERROR));
}
addOrRemoveValidator(theValidateAgainstStandardSchematron, SchematronBaseValidator.class, new SchematronBaseValidator(myContext));
return this;
}
/**
* Removes a validator module from this validator. You may register as many modules as you like, and remove them at any time.
*
* @param theValidator
* The validator module. Must not be null.
*/
public synchronized void unregisterValidator(IValidator theValidator) {
Validate.notNull(theValidator, "theValidator must not be null");
ArrayList<IValidator> newValidators = new ArrayList<IValidator>(myValidators.size() + 1);
newValidators.addAll(myValidators);
newValidators.remove(theValidator);
myValidators = newValidators;
}
/**
@ -212,4 +254,25 @@ public class FhirValidator {
return ctx.toResult();
}
/**
* Validates a resource instance returning a {@link ca.uhn.fhir.validation.ValidationResult} which contains the results.
*
* @param theResource
* the resource to validate
* @return the results of validation
* @since 1.1
*/
public ValidationResult validateWithResult(String theResource) {
Validate.notNull(theResource, "theResource must not be null");
IValidationContext<IBaseResource> ctx = ValidationContext.forText(myContext, theResource);
for (IValidator next : myValidators) {
next.validateResource(ctx);
}
return ctx.toResult();
}
}

View File

@ -33,8 +33,6 @@ interface IValidationContext<T> {
EncodingEnum getResourceAsStringEncoding();
String getResourceName();
void addValidationMessage(SingleValidationMessage theMessage);
ValidationResult toResult();

View File

@ -161,7 +161,7 @@ class SchemaBaseValidator implements IValidator {
private void addIssue(SAXParseException theException, ResultSeverityEnum theSeverity) {
SingleValidationMessage message = new SingleValidationMessage();
message.setLocationRow(theException.getLineNumber());
message.setLocationLine(theException.getLineNumber());
message.setLocationCol(theException.getColumnNumber());
message.setMessage(theException.getLocalizedMessage());
message.setSeverity(theSeverity);

View File

@ -34,6 +34,7 @@ import org.oclc.purl.dsdl.svrl.SchematronOutputType;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.BundleEntry;
import ca.uhn.fhir.rest.server.EncodingEnum;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import com.phloc.commons.error.IResourceError;
@ -55,7 +56,13 @@ public class SchematronBaseValidator implements IValidator {
public void validateResource(IValidationContext<IBaseResource> theCtx) {
ISchematronResource sch = getSchematron(theCtx);
StreamSource source = new StreamSource(new StringReader(theCtx.getResourceAsString()));
String resourceAsString;
if (theCtx.getResourceAsStringEncoding() == EncodingEnum.XML) {
resourceAsString = theCtx.getResourceAsString();
} else {
resourceAsString = theCtx.getFhirContext().newXmlParser().encodeResourceToString(theCtx.getResource());
}
StreamSource source = new StreamSource(new StringReader(resourceAsString));
SchematronOutputType results = SchematronHelper.applySchematron(sch, source);
if (results == null) {
@ -90,7 +97,7 @@ public class SchematronBaseValidator implements IValidator {
SingleValidationMessage message = new SingleValidationMessage();
message.setMessage(details);
message.setLocationRow(next.getLocation().getLineNumber());
message.setLocationLine(next.getLocation().getLineNumber());
message.setLocationCol(next.getLocation().getColumnNumber());
message.setLocationString(next.getLocation().getAsString());
message.setSeverity(severity);

View File

@ -28,7 +28,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
public class SingleValidationMessage {
private Integer myLocationCol;
private Integer myLocationRow;
private Integer myLocationLine;
private String myLocationString;
private String myMessage;
private ResultSeverityEnum mySeverity;
@ -47,7 +47,7 @@ public class SingleValidationMessage {
SingleValidationMessage other = (SingleValidationMessage) obj;
EqualsBuilder b = new EqualsBuilder();
b.append(myLocationCol, other.myLocationCol);
b.append(myLocationRow, other.myLocationRow);
b.append(myLocationLine, other.myLocationLine);
b.append(myLocationString, other.myLocationString);
b.append(myMessage, other.myMessage);
b.append(mySeverity, other.mySeverity);
@ -58,8 +58,8 @@ public class SingleValidationMessage {
return myLocationCol;
}
public Integer getLocationRow() {
return myLocationRow;
public Integer getLocationLine() {
return myLocationLine;
}
public String getLocationString() {
@ -89,8 +89,8 @@ public class SingleValidationMessage {
myLocationCol = theLocationCol;
}
public void setLocationRow(Integer theLocationRow) {
myLocationRow = theLocationRow;
public void setLocationLine(Integer theLocationLine) {
myLocationLine = theLocationLine;
}
public void setLocationString(String theLocationString) {
@ -108,9 +108,9 @@ public class SingleValidationMessage {
@Override
public String toString() {
ToStringBuilder b = new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE);
if (myLocationCol != null || myLocationRow != null) {
if (myLocationCol != null || myLocationLine != null) {
b.append("myLocationCol", myLocationCol);
b.append("myLocationRow", myLocationRow);
b.append("myLocationRow", myLocationLine);
}
if (myLocationString != null) {
b.append("myLocationString", myLocationString);

View File

@ -20,32 +20,27 @@ package ca.uhn.fhir.validation;
* #L%
*/
import java.util.ArrayList;
import java.util.List;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.thymeleaf.util.Validate;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.rest.method.MethodUtil;
import ca.uhn.fhir.rest.server.EncodingEnum;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
class ValidationContext<T> implements IValidationContext<T> {
class ValidationContext<T> extends BaseValidationContext<T> implements IValidationContext<T> {
private final IEncoder myEncoder;
private final FhirContext myFhirContext;
private List<SingleValidationMessage> myMessages = new ArrayList<SingleValidationMessage>();
private final T myResource;
private String myResourceAsString;
private final EncodingEnum myResourceAsStringEncoding;
private final String myResourceName;
private ValidationContext(FhirContext theContext, T theResource, String theResourceName, IEncoder theEncoder) {
myFhirContext = theContext;
private ValidationContext(FhirContext theContext, T theResource, IEncoder theEncoder) {
super(theContext);
myResource = theResource;
myEncoder = theEncoder;
myResourceName = theResourceName;
if (theEncoder != null) {
myResourceAsStringEncoding = theEncoder.getEncoding();
} else {
@ -53,17 +48,6 @@ class ValidationContext<T> implements IValidationContext<T> {
}
}
@Override
public void addValidationMessage(SingleValidationMessage theMessage) {
Validate.notNull(theMessage, "theMessage must not be null");
myMessages.add(theMessage);
}
@Override
public FhirContext getFhirContext() {
return myFhirContext;
}
@Override
public T getResource() {
return myResource;
@ -82,19 +66,8 @@ class ValidationContext<T> implements IValidationContext<T> {
return myResourceAsStringEncoding;
}
@Override
public String getResourceName() {
return myResourceName;
}
@Override
public ValidationResult toResult() {
return new ValidationResult(myFhirContext, myMessages);
}
public static IValidationContext<Bundle> forBundle(final FhirContext theContext, final Bundle theBundle) {
String resourceName = "Bundle";
return new ValidationContext<Bundle>(theContext, theBundle, resourceName, new IEncoder() {
return new ValidationContext<Bundle>(theContext, theBundle, new IEncoder() {
@Override
public String encode() {
return theContext.newXmlParser().encodeBundleToString(theBundle);
@ -108,8 +81,7 @@ class ValidationContext<T> implements IValidationContext<T> {
}
public static <T extends IBaseResource> IValidationContext<T> forResource(final FhirContext theContext, final T theResource) {
String resourceName = theContext.getResourceDefinition(theResource).getName();
return new ValidationContext<T>(theContext, theResource, resourceName, new IEncoder() {
return new ValidationContext<T>(theContext, theResource, new IEncoder() {
@Override
public String encode() {
return theContext.newXmlParser().encodeResourceToString(theResource);
@ -150,11 +122,6 @@ class ValidationContext<T> implements IValidationContext<T> {
return EncodingEnum.XML;
}
@Override
public String getResourceName() {
return theContext.getFhirContext().getResourceDefinition(theResource).getName();
}
@Override
public ValidationResult toResult() {
return theContext.toResult();
@ -168,4 +135,39 @@ class ValidationContext<T> implements IValidationContext<T> {
EncodingEnum getEncoding();
}
public static IValidationContext<IBaseResource> forText(final FhirContext theContext, final String theResourceBody) {
Validate.notNull(theContext, "theContext can not be null");
Validate.notEmpty(theResourceBody, "theResourceBody can not be null or empty");
return new BaseValidationContext<IBaseResource>(theContext) {
private EncodingEnum myEncoding;
private IBaseResource myParsed;
@Override
public IBaseResource getResource() {
if (myParsed == null) {
myParsed = getResourceAsStringEncoding().newParser(getFhirContext()).parseResource(getResourceAsString());
}
return myParsed;
}
@Override
public String getResourceAsString() {
return theResourceBody;
}
@Override
public EncodingEnum getResourceAsStringEncoding() {
if (myEncoding == null) {
myEncoding = MethodUtil.detectEncodingNoDefault(theResourceBody);
if (myEncoding == null) {
throw new InvalidRequestException(theContext.getLocalizer().getMessage(ValidationContext.class, "unableToDetermineEncoding"));
}
}
return myEncoding;
}
};
}
}

View File

@ -96,8 +96,8 @@ public class ValidationResult {
String location;
if (isNotBlank(next.getLocationString())) {
location = next.getLocationString();
} else if (next.getLocationRow() != null || next.getLocationCol() != null) {
location = "Line[" + next.getLocationRow() + "] Col[" + next.getLocationCol() + "]";
} else if (next.getLocationLine() != null || next.getLocationCol() != null) {
location = "Line[" + next.getLocationLine() + "] Col[" + next.getLocationCol() + "]";
} else {
location = null;
}

View File

@ -30,6 +30,7 @@ ca.uhn.fhir.parser.ParserState.wrongResourceTypeFound=Incorrect resource type fo
ca.uhn.fhir.rest.server.RestfulServer.getPagesNonHttpGet=Requests for _getpages must use HTTP GET
ca.uhn.fhir.validation.ValidationContext.unableToDetermineEncoding=Unable to determine encoding (e.g. XML / JSON) on validation input. Is this a valid FHIR resource body?
ca.uhn.fhir.validation.FhirValidator.noPhlocWarningOnStartup=Phloc-schematron library not found on classpath, will not attempt to perform schematron validation
ca.uhn.fhir.validation.FhirValidator.noPhlocError=Phloc-schematron library not found on classpath, can not enable perform schematron validation

View File

@ -9,9 +9,9 @@
-->
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>1.1</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
<artifactId>hapi-deployable-pom</artifactId>
<version>1.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
<artifactId>hapi-fhir-cobertura</artifactId>
@ -23,27 +23,27 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -18,17 +18,17 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -31,7 +31,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
@ -42,19 +42,19 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-hl7org-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<optional>true</optional>
</dependency>
@ -391,7 +391,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<executions>
<execution>
<id>build_dstu1</id>
@ -422,12 +422,12 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>

View File

@ -12,13 +12,13 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>ca.uhn.hapi.example</groupId>
<artifactId>hapi-fhir-jpaserver-example</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<packaging>war</packaging>
<name>HAPI FHIR JPA Server - Example</name>
@ -39,19 +39,19 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<!-- At least one "structures" JAR must also be included -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<!--
@ -61,14 +61,14 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<!-- This dependency is used for the "FHIR Tester" web app overlay -->
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<type>war</type>
<scope>provided</scope>
</dependency>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -18,22 +18,22 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-structures-dstu2</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-testpage-overlay</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<type>war</type>
<scope>provided</scope>
</dependency>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
@ -189,7 +189,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<executions>
<execution>
<goals>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>
@ -177,7 +177,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<executions>
<execution>
<goals>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>
@ -18,7 +18,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-base</artifactId>
<version>1.1</version>
<version>1.2-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -68,6 +68,7 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
private Bundle myBundle;
private FhirContext myContext;
private String myBase;
public Dstu2Hl7OrgBundleFactory(FhirContext theContext) {
myContext = theContext;
@ -180,10 +181,8 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
myBundle.addLink().setRelation("self").setUrl(theCompleteUrl);
}
if (isBlank(myBundle.getBase()) && isNotBlank(theServerBase)) {
myBundle.setBase(theServerBase);
}
myBase = theServerBase;
if (myBundle.getTypeElement().isEmpty() && theBundleType != null) {
myBundle.getTypeElement().setValueAsString(theBundleType.getCode());
}
@ -307,14 +306,14 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
nextEntry.setResource((Resource) next);
if (next.getIdElement().isEmpty()) {
nextEntry.getTransaction().setMethod(HTTPVerb.POST);
nextEntry.getRequest().setMethod(HTTPVerb.POST);
} else {
nextEntry.getTransaction().setMethod(HTTPVerb.PUT);
nextEntry.getRequest().setMethod(HTTPVerb.PUT);
if (next.getIdElement().isAbsolute()) {
nextEntry.getTransaction().setUrl(next.getIdElement().getValue());
nextEntry.getRequest().setUrl(next.getIdElement().getValue());
} else {
String resourceType = myContext.getResourceDefinition(next).getName();
nextEntry.getTransaction().setUrl(new IdType(theServerBase, resourceType, next.getIdElement().getIdPart(), next.getIdElement().getVersionIdPart()).getValue());
nextEntry.getRequest().setUrl(new IdType(theServerBase, resourceType, next.getIdElement().getIdPart(), next.getIdElement().getVersionIdPart()).getValue());
}
}
}
@ -383,7 +382,11 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
} while (references.isEmpty() == false);
myBundle.addEntry().setResource((Resource) next);
BundleEntryComponent entry = myBundle.addEntry().setResource((Resource) next);
IdType nextId = (IdType) next.getIdElement();
if (isNotBlank(myBase) && isNotBlank(nextId.getResourceType())) {
entry.setFullUrlElement(nextId.withServerBase(myBase, nextId.getResourceType()));
}
}
@ -406,8 +409,8 @@ public class Dstu2Hl7OrgBundleFactory implements IVersionSpecificBundleFactory {
for (BundleEntryComponent next : myBundle.getEntry()) {
if (next.getResource() != null) {
retVal.add(next.getResource());
} else if (next.getTransactionResponse().getLocationElement().isEmpty() == false) {
IdType id = new IdType(next.getTransactionResponse().getLocation());
} else if (next.getResponse().getLocationElement().isEmpty() == false) {
IdType id = new IdType(next.getResponse().getLocation());
String resourceType = id.getResourceType();
if (isNotBlank(resourceType)) {
IBaseResource res = (IBaseResource) myContext.getResourceDefinition(resourceType).newInstance();

View File

@ -1,7 +1,10 @@
package ca.uhn.fhir.validation;
import static org.apache.commons.lang3.StringUtils.isBlank;
import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@ -15,30 +18,32 @@ import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.utils.WorkerContext;
import org.hl7.fhir.instance.validation.ValidationMessage;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.rest.server.EncodingEnum;
import ca.uhn.fhir.rest.server.exceptions.InternalErrorException;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
public class FhirInstanceValidator implements IValidator {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(FhirInstanceValidator.class);
private DocumentBuilderFactory myDocBuilderFactory;
FhirInstanceValidator() {
public FhirInstanceValidator() {
myDocBuilderFactory = DocumentBuilderFactory.newInstance();
myDocBuilderFactory.setNamespaceAware(true);
}
List<ValidationMessage> validate(FhirContext theCtx, String theInput, EncodingEnum theEncoding, String theResourceName) {
List<ValidationMessage> validate(FhirContext theCtx, String theInput, EncodingEnum theEncoding) {
WorkerContext workerContext = new WorkerContext();
org.hl7.fhir.instance.validation.InstanceValidator v;
try {
@ -47,14 +52,7 @@ public class FhirInstanceValidator implements IValidator {
throw new ConfigurationException(e);
}
String profileCpName = "/org/hl7/fhir/instance/model/profile/" + theResourceName.toLowerCase() + ".profile.xml";
String profileText;
try {
profileText = IOUtils.toString(FhirInstanceValidator.class.getResourceAsStream(profileCpName), "UTF-8");
} catch (IOException e1) {
throw new ConfigurationException("Failed to load profile from classpath: " + profileCpName, e1);
}
StructureDefinition profile = theCtx.newXmlParser().parseResource(StructureDefinition.class, profileText);
List<ValidationMessage> messages = new ArrayList<ValidationMessage>();
if (theEncoding == EncodingEnum.XML) {
Document document;
@ -69,31 +67,86 @@ public class FhirInstanceValidator implements IValidator {
m.setMessage("Failed to parse input, it does not appear to be valid XML:" + e2.getMessage());
return Collections.singletonList(m);
}
try {
List<ValidationMessage> results = v.validate(document, profile);
return results;
} catch (Exception e) {
throw new InternalErrorException("Unexpected failure while validating resource", e);
String resourceName = determineResourceName(document);
StructureDefinition profile = loadProfileOrReturnNull(messages, theCtx, resourceName);
if (profile != null) {
try {
v.validate(messages, document, profile);
} catch (Exception e) {
throw new InternalErrorException("Unexpected failure while validating resource", e);
}
}
} else if (theEncoding == EncodingEnum.JSON) {
Gson gson = new GsonBuilder().create();
JsonObject json = gson.fromJson(theInput, JsonObject.class);
try {
return v.validate(json, profile);
} catch (Exception e) {
throw new InternalErrorException("Unexpected failure while validating resource", e);
String resourceName = json.get("resourceType").getAsString();
StructureDefinition profile = loadProfileOrReturnNull(messages, theCtx, resourceName);
if (profile != null) {
try {
v.validate(messages, json, profile);
} catch (Exception e) {
throw new InternalErrorException("Unexpected failure while validating resource", e);
}
}
} else {
throw new IllegalArgumentException("Unknown encoding: " + theEncoding);
}
return messages;
}
private StructureDefinition loadProfileOrReturnNull(List<ValidationMessage> theMessages, FhirContext theCtx, String theResourceName) {
if (isBlank(theResourceName)) {
theMessages.add(new ValidationMessage().setLevel(IssueSeverity.FATAL).setMessage("Could not determine resource type from request. Content appears invalid."));
return null;
}
String profileCpName = "/org/hl7/fhir/instance/model/profile/" + theResourceName.toLowerCase() + ".profile.xml";
String profileText;
try {
profileText = IOUtils.toString(FhirInstanceValidator.class.getResourceAsStream(profileCpName), "UTF-8");
} catch (IOException e1) {
theMessages.add(new ValidationMessage().setLevel(IssueSeverity.FATAL).setMessage("No profile found for resource type " + theResourceName));
return null;
}
StructureDefinition profile = theCtx.newXmlParser().parseResource(StructureDefinition.class, profileText);
return profile;
}
private String determineResourceName(Document theDocument) {
Element root = null;
NodeList list = theDocument.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
if (list.item(i) instanceof Element) {
root = (Element) list.item(i);
break;
}
}
root = theDocument.getDocumentElement();
return root.getLocalName();
}
@Override
public void validateResource(IValidationContext<IBaseResource> theCtx) {
String resourceName = theCtx.getResourceName();
String resourceBody = theCtx.getResourceAsString();
validate(theCtx.getFhirContext(), resourceBody, theCtx.getResourceAsStringEncoding(), resourceName);
List<ValidationMessage> messages = validate(theCtx.getFhirContext(), theCtx.getResourceAsString(), theCtx.getResourceAsStringEncoding());
for (ValidationMessage riMessage : messages) {
SingleValidationMessage hapiMessage = new SingleValidationMessage();
if (riMessage.getCol() != -1) {
hapiMessage.setLocationCol(riMessage.getCol());
}
if (riMessage.getLine() != -1) {
hapiMessage.setLocationLine(riMessage.getLine());
}
hapiMessage.setLocationString(riMessage.getLocation());
hapiMessage.setMessage(riMessage.getMessage());
if (riMessage.getLevel() != null) {
hapiMessage.setSeverity(ResultSeverityEnum.fromCode(riMessage.getLevel().toCode()));
}
theCtx.addValidationMessage(hapiMessage);
}
}
@Override

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.annotations.Block;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;
@ -461,6 +461,106 @@ public class Conformance extends DomainResource implements IBaseConformance {
}
}
public enum TransactionMode {
/**
* Neither Batch or Transaction supported
*/
NOTSUPPORTED,
/**
* Batches supported
*/
BATCH,
/**
* Transactions Supported
*/
TRANSACTION,
/**
* Both Batches and Transactions Supported
*/
BOTH,
/**
* added to help the parsers
*/
NULL;
public static TransactionMode fromCode(String codeString) throws Exception {
if (codeString == null || "".equals(codeString))
return null;
if ("not-supported".equals(codeString))
return NOTSUPPORTED;
if ("batch".equals(codeString))
return BATCH;
if ("transaction".equals(codeString))
return TRANSACTION;
if ("both".equals(codeString))
return BOTH;
throw new Exception("Unknown TransactionMode code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case NOTSUPPORTED: return "not-supported";
case BATCH: return "batch";
case TRANSACTION: return "transaction";
case BOTH: return "both";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case NOTSUPPORTED: return "http://hl7.org/fhir/transaction-mode";
case BATCH: return "http://hl7.org/fhir/transaction-mode";
case TRANSACTION: return "http://hl7.org/fhir/transaction-mode";
case BOTH: return "http://hl7.org/fhir/transaction-mode";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case NOTSUPPORTED: return "Neither Batch or Transaction supported";
case BATCH: return "Batches supported";
case TRANSACTION: return "Transactions Supported";
case BOTH: return "Both Batches and Transactions Supported";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case NOTSUPPORTED: return "None";
case BATCH: return "Batches supported";
case TRANSACTION: return "Transactions Supported";
case BOTH: return "Batches & Transactions";
default: return "?";
}
}
}
public static class TransactionModeEnumFactory implements EnumFactory<TransactionMode> {
public TransactionMode fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("not-supported".equals(codeString))
return TransactionMode.NOTSUPPORTED;
if ("batch".equals(codeString))
return TransactionMode.BATCH;
if ("transaction".equals(codeString))
return TransactionMode.TRANSACTION;
if ("both".equals(codeString))
return TransactionMode.BOTH;
throw new IllegalArgumentException("Unknown TransactionMode code '"+codeString+"'");
}
public String toCode(TransactionMode code) {
if (code == TransactionMode.NOTSUPPORTED)
return "not-supported";
if (code == TransactionMode.BATCH)
return "batch";
if (code == TransactionMode.TRANSACTION)
return "transaction";
if (code == TransactionMode.BOTH)
return "both";
return "?";
}
}
public enum MessageSignificanceCategory {
/**
* The message represents/requests a change that should not be processed more than once. E.g. Making a booking for an appointment
@ -1283,28 +1383,35 @@ public class Conformance extends DomainResource implements IBaseConformance {
@Description(shortDefinition="What operations are supported?", formalDefinition="A specification of restful operations supported by the system." )
protected List<SystemInteractionComponent> interaction;
/**
* A code that indicates how transactions are supported.
*/
@Child(name = "transactionMode", type = {CodeType.class}, order=6, min=0, max=1)
@Description(shortDefinition="not-supported | batch | transaction | both", formalDefinition="A code that indicates how transactions are supported." )
protected Enumeration<TransactionMode> transactionMode;
/**
* Definition of an operation or a named query and with its parameters and their meaning and type.
*/
@Child(name = "operation", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED)
@Child(name = "operation", type = {}, order=7, min=0, max=Child.MAX_UNLIMITED)
@Description(shortDefinition="Definition of an operation or a custom query", formalDefinition="Definition of an operation or a named query and with its parameters and their meaning and type." )
protected List<ConformanceRestOperationComponent> operation;
/**
* A list of absolute URIs that identify profiles that this server implements for accepting documents in the mailbox. If this list is empty, then documents are not accepted. The base specification has the profile identifier "http://hl7.org/fhir/documents/mailbox". Other specifications can declare their own identifier for this purpose.
*/
@Child(name = "documentMailbox", type = {UriType.class}, order=7, min=0, max=Child.MAX_UNLIMITED)
@Child(name = "documentMailbox", type = {UriType.class}, order=8, min=0, max=Child.MAX_UNLIMITED)
@Description(shortDefinition="How documents are accepted in /Mailbox", formalDefinition="A list of absolute URIs that identify profiles that this server implements for accepting documents in the mailbox. If this list is empty, then documents are not accepted. The base specification has the profile identifier 'http://hl7.org/fhir/documents/mailbox'. Other specifications can declare their own identifier for this purpose." )
protected List<UriType> documentMailbox;
/**
* An absolute URI which is a reference to the definition of a compartment hosted by the system.
*/
@Child(name = "compartment", type = {UriType.class}, order=8, min=0, max=Child.MAX_UNLIMITED)
@Child(name = "compartment", type = {UriType.class}, order=9, min=0, max=Child.MAX_UNLIMITED)
@Description(shortDefinition="Compartments served/used by system", formalDefinition="An absolute URI which is a reference to the definition of a compartment hosted by the system." )
protected List<UriType> compartment;
private static final long serialVersionUID = -535980615L;
private static final long serialVersionUID = 471286912L;
/*
* Constructor
@ -1519,6 +1626,55 @@ public class Conformance extends DomainResource implements IBaseConformance {
return this;
}
/**
* @return {@link #transactionMode} (A code that indicates how transactions are supported.). This is the underlying object with id, value and extensions. The accessor "getTransactionMode" gives direct access to the value
*/
public Enumeration<TransactionMode> getTransactionModeElement() {
if (this.transactionMode == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ConformanceRestComponent.transactionMode");
else if (Configuration.doAutoCreate())
this.transactionMode = new Enumeration<TransactionMode>(new TransactionModeEnumFactory()); // bb
return this.transactionMode;
}
public boolean hasTransactionModeElement() {
return this.transactionMode != null && !this.transactionMode.isEmpty();
}
public boolean hasTransactionMode() {
return this.transactionMode != null && !this.transactionMode.isEmpty();
}
/**
* @param value {@link #transactionMode} (A code that indicates how transactions are supported.). This is the underlying object with id, value and extensions. The accessor "getTransactionMode" gives direct access to the value
*/
public ConformanceRestComponent setTransactionModeElement(Enumeration<TransactionMode> value) {
this.transactionMode = value;
return this;
}
/**
* @return A code that indicates how transactions are supported.
*/
public TransactionMode getTransactionMode() {
return this.transactionMode == null ? null : this.transactionMode.getValue();
}
/**
* @param value A code that indicates how transactions are supported.
*/
public ConformanceRestComponent setTransactionMode(TransactionMode value) {
if (value == null)
this.transactionMode = null;
else {
if (this.transactionMode == null)
this.transactionMode = new Enumeration<TransactionMode>(new TransactionModeEnumFactory());
this.transactionMode.setValue(value);
}
return this;
}
/**
* @return {@link #operation} (Definition of an operation or a named query and with its parameters and their meaning and type.)
*/
@ -1674,6 +1830,7 @@ public class Conformance extends DomainResource implements IBaseConformance {
childrenList.add(new Property("security", "", "Information about security implementation from an interface perspective - what a client needs to know.", 0, java.lang.Integer.MAX_VALUE, security));
childrenList.add(new Property("resource", "", "A specification of the restful capabilities of the solution for a specific resource type.", 0, java.lang.Integer.MAX_VALUE, resource));
childrenList.add(new Property("interaction", "", "A specification of restful operations supported by the system.", 0, java.lang.Integer.MAX_VALUE, interaction));
childrenList.add(new Property("transactionMode", "code", "A code that indicates how transactions are supported.", 0, java.lang.Integer.MAX_VALUE, transactionMode));
childrenList.add(new Property("operation", "", "Definition of an operation or a named query and with its parameters and their meaning and type.", 0, java.lang.Integer.MAX_VALUE, operation));
childrenList.add(new Property("documentMailbox", "uri", "A list of absolute URIs that identify profiles that this server implements for accepting documents in the mailbox. If this list is empty, then documents are not accepted. The base specification has the profile identifier 'http://hl7.org/fhir/documents/mailbox'. Other specifications can declare their own identifier for this purpose.", 0, java.lang.Integer.MAX_VALUE, documentMailbox));
childrenList.add(new Property("compartment", "uri", "An absolute URI which is a reference to the definition of a compartment hosted by the system.", 0, java.lang.Integer.MAX_VALUE, compartment));
@ -1695,6 +1852,7 @@ public class Conformance extends DomainResource implements IBaseConformance {
for (SystemInteractionComponent i : interaction)
dst.interaction.add(i.copy());
};
dst.transactionMode = transactionMode == null ? null : transactionMode.copy();
if (operation != null) {
dst.operation = new ArrayList<ConformanceRestOperationComponent>();
for (ConformanceRestOperationComponent i : operation)
@ -1721,9 +1879,9 @@ public class Conformance extends DomainResource implements IBaseConformance {
return false;
ConformanceRestComponent o = (ConformanceRestComponent) other;
return compareDeep(mode, o.mode, true) && compareDeep(documentation, o.documentation, true) && compareDeep(security, o.security, true)
&& compareDeep(resource, o.resource, true) && compareDeep(interaction, o.interaction, true) && compareDeep(operation, o.operation, true)
&& compareDeep(documentMailbox, o.documentMailbox, true) && compareDeep(compartment, o.compartment, true)
;
&& compareDeep(resource, o.resource, true) && compareDeep(interaction, o.interaction, true) && compareDeep(transactionMode, o.transactionMode, true)
&& compareDeep(operation, o.operation, true) && compareDeep(documentMailbox, o.documentMailbox, true)
&& compareDeep(compartment, o.compartment, true);
}
@Override
@ -1733,15 +1891,17 @@ public class Conformance extends DomainResource implements IBaseConformance {
if (!(other instanceof ConformanceRestComponent))
return false;
ConformanceRestComponent o = (ConformanceRestComponent) other;
return compareValues(mode, o.mode, true) && compareValues(documentation, o.documentation, true) && compareValues(documentMailbox, o.documentMailbox, true)
&& compareValues(compartment, o.compartment, true);
return compareValues(mode, o.mode, true) && compareValues(documentation, o.documentation, true) && compareValues(transactionMode, o.transactionMode, true)
&& compareValues(documentMailbox, o.documentMailbox, true) && compareValues(compartment, o.compartment, true)
;
}
public boolean isEmpty() {
return super.isEmpty() && (mode == null || mode.isEmpty()) && (documentation == null || documentation.isEmpty())
&& (security == null || security.isEmpty()) && (resource == null || resource.isEmpty()) && (interaction == null || interaction.isEmpty())
&& (operation == null || operation.isEmpty()) && (documentMailbox == null || documentMailbox.isEmpty())
&& (compartment == null || compartment.isEmpty());
&& (transactionMode == null || transactionMode.isEmpty()) && (operation == null || operation.isEmpty())
&& (documentMailbox == null || documentMailbox.isEmpty()) && (compartment == null || compartment.isEmpty())
;
}
}

View File

@ -29,12 +29,12 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
public class Constants {
public final static String VERSION = "0.5.0";
public final static String REVISION = "5780";
public final static String DATE = "Wed Jul 08 17:35:37 EDT 2015";
public final static String REVISION = "5843";
public final static String DATE = "Tue Jul 14 17:35:58 EDT 2015";
}

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.annotations.Block;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.annotations.Block;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import org.hl7.fhir.instance.model.annotations.DatatypeDef;
import org.hl7.fhir.instance.model.annotations.Block;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;
@ -1223,35 +1223,28 @@ public class ElementDefinition extends Type implements ICompositeType {
@Block()
public static class ElementDefinitionBindingComponent extends Element implements IBaseDatatypeElement {
/**
* A descriptive name for this - can be useful for generating implementation artifacts.
*/
@Child(name = "name", type = {StringType.class}, order=1, min=0, max=1)
@Description(shortDefinition="Descriptive Name", formalDefinition="A descriptive name for this - can be useful for generating implementation artifacts." )
protected StringType name;
/**
* Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.
*/
@Child(name = "strength", type = {CodeType.class}, order=2, min=1, max=1)
@Child(name = "strength", type = {CodeType.class}, order=1, min=1, max=1)
@Description(shortDefinition="required | extensible | preferred | example", formalDefinition="Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances." )
protected Enumeration<BindingStrength> strength;
/**
* Describes the intended use of this particular set of codes.
*/
@Child(name = "description", type = {StringType.class}, order=3, min=0, max=1)
@Child(name = "description", type = {StringType.class}, order=2, min=0, max=1)
@Description(shortDefinition="Human explanation of the value set", formalDefinition="Describes the intended use of this particular set of codes." )
protected StringType description;
/**
* Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.
*/
@Child(name = "valueSet", type = {UriType.class, ValueSet.class}, order=4, min=0, max=1)
@Child(name = "valueSet", type = {UriType.class, ValueSet.class}, order=3, min=0, max=1)
@Description(shortDefinition="Source of value set", formalDefinition="Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used." )
protected Type valueSet;
private static final long serialVersionUID = 325485202L;
private static final long serialVersionUID = 1355538460L;
/*
* Constructor
@ -1268,55 +1261,6 @@ public class ElementDefinition extends Type implements ICompositeType {
this.strength = strength;
}
/**
* @return {@link #name} (A descriptive name for this - can be useful for generating implementation artifacts.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
*/
public StringType getNameElement() {
if (this.name == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ElementDefinitionBindingComponent.name");
else if (Configuration.doAutoCreate())
this.name = new StringType(); // bb
return this.name;
}
public boolean hasNameElement() {
return this.name != null && !this.name.isEmpty();
}
public boolean hasName() {
return this.name != null && !this.name.isEmpty();
}
/**
* @param value {@link #name} (A descriptive name for this - can be useful for generating implementation artifacts.). This is the underlying object with id, value and extensions. The accessor "getName" gives direct access to the value
*/
public ElementDefinitionBindingComponent setNameElement(StringType value) {
this.name = value;
return this;
}
/**
* @return A descriptive name for this - can be useful for generating implementation artifacts.
*/
public String getName() {
return this.name == null ? null : this.name.getValue();
}
/**
* @param value A descriptive name for this - can be useful for generating implementation artifacts.
*/
public ElementDefinitionBindingComponent setName(String value) {
if (Utilities.noString(value))
this.name = null;
else {
if (this.name == null)
this.name = new StringType();
this.name.setValue(value);
}
return this;
}
/**
* @return {@link #strength} (Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.). This is the underlying object with id, value and extensions. The accessor "getStrength" gives direct access to the value
*/
@ -1458,7 +1402,6 @@ public class ElementDefinition extends Type implements ICompositeType {
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("name", "string", "A descriptive name for this - can be useful for generating implementation artifacts.", 0, java.lang.Integer.MAX_VALUE, name));
childrenList.add(new Property("strength", "code", "Indicates the degree of conformance expectations associated with this binding - that is, the degree to which the provided value set must be adhered to in the instances.", 0, java.lang.Integer.MAX_VALUE, strength));
childrenList.add(new Property("description", "string", "Describes the intended use of this particular set of codes.", 0, java.lang.Integer.MAX_VALUE, description));
childrenList.add(new Property("valueSet[x]", "uri|Reference(ValueSet)", "Points to the value set or external definition (e.g. implicit value set) that identifies the set of codes to be used.", 0, java.lang.Integer.MAX_VALUE, valueSet));
@ -1467,7 +1410,6 @@ public class ElementDefinition extends Type implements ICompositeType {
public ElementDefinitionBindingComponent copy() {
ElementDefinitionBindingComponent dst = new ElementDefinitionBindingComponent();
copyValues(dst);
dst.name = name == null ? null : name.copy();
dst.strength = strength == null ? null : strength.copy();
dst.description = description == null ? null : description.copy();
dst.valueSet = valueSet == null ? null : valueSet.copy();
@ -1481,7 +1423,7 @@ public class ElementDefinition extends Type implements ICompositeType {
if (!(other instanceof ElementDefinitionBindingComponent))
return false;
ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other;
return compareDeep(name, o.name, true) && compareDeep(strength, o.strength, true) && compareDeep(description, o.description, true)
return compareDeep(strength, o.strength, true) && compareDeep(description, o.description, true)
&& compareDeep(valueSet, o.valueSet, true);
}
@ -1492,14 +1434,13 @@ public class ElementDefinition extends Type implements ICompositeType {
if (!(other instanceof ElementDefinitionBindingComponent))
return false;
ElementDefinitionBindingComponent o = (ElementDefinitionBindingComponent) other;
return compareValues(name, o.name, true) && compareValues(strength, o.strength, true) && compareValues(description, o.description, true)
return compareValues(strength, o.strength, true) && compareValues(description, o.description, true)
;
}
public boolean isEmpty() {
return super.isEmpty() && (name == null || name.isEmpty()) && (strength == null || strength.isEmpty())
&& (description == null || description.isEmpty()) && (valueSet == null || valueSet.isEmpty())
;
return super.isEmpty() && (strength == null || strength.isEmpty()) && (description == null || description.isEmpty())
&& (valueSet == null || valueSet.isEmpty());
}
}
@ -1774,7 +1715,7 @@ public class ElementDefinition extends Type implements ICompositeType {
/**
* A concise definition that is shown in the generated XML format that summarizes profiles (used throughout the specification).
*/
@Child(name = "short_", type = {StringType.class}, order=6, min=0, max=1)
@Child(name = "short", type = {StringType.class}, order=6, min=0, max=1)
@Description(shortDefinition="Concise definition for xml presentation", formalDefinition="A concise definition that is shown in the generated XML format that summarizes profiles (used throughout the specification)." )
protected StringType short_;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import org.hl7.fhir.instance.model.api.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;
@ -146,792 +146,6 @@ public class ImagingStudy extends DomainResource {
}
}
public enum Modality {
/**
* null
*/
AR,
/**
* null
*/
AU,
/**
* null
*/
BDUS,
/**
* null
*/
BI,
/**
* null
*/
BMD,
/**
* null
*/
CR,
/**
* null
*/
CT,
/**
* null
*/
DG,
/**
* null
*/
DX,
/**
* null
*/
ECG,
/**
* null
*/
EPS,
/**
* null
*/
ES,
/**
* null
*/
GM,
/**
* null
*/
HC,
/**
* null
*/
HD,
/**
* null
*/
IO,
/**
* null
*/
IVOCT,
/**
* null
*/
IVUS,
/**
* null
*/
KER,
/**
* null
*/
KO,
/**
* null
*/
LEN,
/**
* null
*/
LS,
/**
* null
*/
MG,
/**
* null
*/
MR,
/**
* null
*/
NM,
/**
* null
*/
OAM,
/**
* null
*/
OCT,
/**
* null
*/
OP,
/**
* null
*/
OPM,
/**
* null
*/
OPT,
/**
* null
*/
OPV,
/**
* null
*/
OT,
/**
* null
*/
PR,
/**
* null
*/
PT,
/**
* null
*/
PX,
/**
* null
*/
REG,
/**
* null
*/
RF,
/**
* null
*/
RG,
/**
* null
*/
RTDOSE,
/**
* null
*/
RTIMAGE,
/**
* null
*/
RTPLAN,
/**
* null
*/
RTRECORD,
/**
* null
*/
RTSTRUCT,
/**
* null
*/
SEG,
/**
* null
*/
SM,
/**
* null
*/
SMR,
/**
* null
*/
SR,
/**
* null
*/
SRF,
/**
* null
*/
TG,
/**
* null
*/
US,
/**
* null
*/
VA,
/**
* null
*/
XA,
/**
* null
*/
XC,
/**
* added to help the parsers
*/
NULL;
public static Modality fromCode(String codeString) throws Exception {
if (codeString == null || "".equals(codeString))
return null;
if ("AR".equals(codeString))
return AR;
if ("AU".equals(codeString))
return AU;
if ("BDUS".equals(codeString))
return BDUS;
if ("BI".equals(codeString))
return BI;
if ("BMD".equals(codeString))
return BMD;
if ("CR".equals(codeString))
return CR;
if ("CT".equals(codeString))
return CT;
if ("DG".equals(codeString))
return DG;
if ("DX".equals(codeString))
return DX;
if ("ECG".equals(codeString))
return ECG;
if ("EPS".equals(codeString))
return EPS;
if ("ES".equals(codeString))
return ES;
if ("GM".equals(codeString))
return GM;
if ("HC".equals(codeString))
return HC;
if ("HD".equals(codeString))
return HD;
if ("IO".equals(codeString))
return IO;
if ("IVOCT".equals(codeString))
return IVOCT;
if ("IVUS".equals(codeString))
return IVUS;
if ("KER".equals(codeString))
return KER;
if ("KO".equals(codeString))
return KO;
if ("LEN".equals(codeString))
return LEN;
if ("LS".equals(codeString))
return LS;
if ("MG".equals(codeString))
return MG;
if ("MR".equals(codeString))
return MR;
if ("NM".equals(codeString))
return NM;
if ("OAM".equals(codeString))
return OAM;
if ("OCT".equals(codeString))
return OCT;
if ("OP".equals(codeString))
return OP;
if ("OPM".equals(codeString))
return OPM;
if ("OPT".equals(codeString))
return OPT;
if ("OPV".equals(codeString))
return OPV;
if ("OT".equals(codeString))
return OT;
if ("PR".equals(codeString))
return PR;
if ("PT".equals(codeString))
return PT;
if ("PX".equals(codeString))
return PX;
if ("REG".equals(codeString))
return REG;
if ("RF".equals(codeString))
return RF;
if ("RG".equals(codeString))
return RG;
if ("RTDOSE".equals(codeString))
return RTDOSE;
if ("RTIMAGE".equals(codeString))
return RTIMAGE;
if ("RTPLAN".equals(codeString))
return RTPLAN;
if ("RTRECORD".equals(codeString))
return RTRECORD;
if ("RTSTRUCT".equals(codeString))
return RTSTRUCT;
if ("SEG".equals(codeString))
return SEG;
if ("SM".equals(codeString))
return SM;
if ("SMR".equals(codeString))
return SMR;
if ("SR".equals(codeString))
return SR;
if ("SRF".equals(codeString))
return SRF;
if ("TG".equals(codeString))
return TG;
if ("US".equals(codeString))
return US;
if ("VA".equals(codeString))
return VA;
if ("XA".equals(codeString))
return XA;
if ("XC".equals(codeString))
return XC;
throw new Exception("Unknown Modality code '"+codeString+"'");
}
public String toCode() {
switch (this) {
case AR: return "AR";
case AU: return "AU";
case BDUS: return "BDUS";
case BI: return "BI";
case BMD: return "BMD";
case CR: return "CR";
case CT: return "CT";
case DG: return "DG";
case DX: return "DX";
case ECG: return "ECG";
case EPS: return "EPS";
case ES: return "ES";
case GM: return "GM";
case HC: return "HC";
case HD: return "HD";
case IO: return "IO";
case IVOCT: return "IVOCT";
case IVUS: return "IVUS";
case KER: return "KER";
case KO: return "KO";
case LEN: return "LEN";
case LS: return "LS";
case MG: return "MG";
case MR: return "MR";
case NM: return "NM";
case OAM: return "OAM";
case OCT: return "OCT";
case OP: return "OP";
case OPM: return "OPM";
case OPT: return "OPT";
case OPV: return "OPV";
case OT: return "OT";
case PR: return "PR";
case PT: return "PT";
case PX: return "PX";
case REG: return "REG";
case RF: return "RF";
case RG: return "RG";
case RTDOSE: return "RTDOSE";
case RTIMAGE: return "RTIMAGE";
case RTPLAN: return "RTPLAN";
case RTRECORD: return "RTRECORD";
case RTSTRUCT: return "RTSTRUCT";
case SEG: return "SEG";
case SM: return "SM";
case SMR: return "SMR";
case SR: return "SR";
case SRF: return "SRF";
case TG: return "TG";
case US: return "US";
case VA: return "VA";
case XA: return "XA";
case XC: return "XC";
default: return "?";
}
}
public String getSystem() {
switch (this) {
case AR: return "http://nema.org/dicom/dicm";
case AU: return "http://nema.org/dicom/dicm";
case BDUS: return "http://nema.org/dicom/dicm";
case BI: return "http://nema.org/dicom/dicm";
case BMD: return "http://nema.org/dicom/dicm";
case CR: return "http://nema.org/dicom/dicm";
case CT: return "http://nema.org/dicom/dicm";
case DG: return "http://nema.org/dicom/dicm";
case DX: return "http://nema.org/dicom/dicm";
case ECG: return "http://nema.org/dicom/dicm";
case EPS: return "http://nema.org/dicom/dicm";
case ES: return "http://nema.org/dicom/dicm";
case GM: return "http://nema.org/dicom/dicm";
case HC: return "http://nema.org/dicom/dicm";
case HD: return "http://nema.org/dicom/dicm";
case IO: return "http://nema.org/dicom/dicm";
case IVOCT: return "http://nema.org/dicom/dicm";
case IVUS: return "http://nema.org/dicom/dicm";
case KER: return "http://nema.org/dicom/dicm";
case KO: return "http://nema.org/dicom/dicm";
case LEN: return "http://nema.org/dicom/dicm";
case LS: return "http://nema.org/dicom/dicm";
case MG: return "http://nema.org/dicom/dicm";
case MR: return "http://nema.org/dicom/dicm";
case NM: return "http://nema.org/dicom/dicm";
case OAM: return "http://nema.org/dicom/dicm";
case OCT: return "http://nema.org/dicom/dicm";
case OP: return "http://nema.org/dicom/dicm";
case OPM: return "http://nema.org/dicom/dicm";
case OPT: return "http://nema.org/dicom/dicm";
case OPV: return "http://nema.org/dicom/dicm";
case OT: return "http://nema.org/dicom/dicm";
case PR: return "http://nema.org/dicom/dicm";
case PT: return "http://nema.org/dicom/dicm";
case PX: return "http://nema.org/dicom/dicm";
case REG: return "http://nema.org/dicom/dicm";
case RF: return "http://nema.org/dicom/dicm";
case RG: return "http://nema.org/dicom/dicm";
case RTDOSE: return "http://nema.org/dicom/dicm";
case RTIMAGE: return "http://nema.org/dicom/dicm";
case RTPLAN: return "http://nema.org/dicom/dicm";
case RTRECORD: return "http://nema.org/dicom/dicm";
case RTSTRUCT: return "http://nema.org/dicom/dicm";
case SEG: return "http://nema.org/dicom/dicm";
case SM: return "http://nema.org/dicom/dicm";
case SMR: return "http://nema.org/dicom/dicm";
case SR: return "http://nema.org/dicom/dicm";
case SRF: return "http://nema.org/dicom/dicm";
case TG: return "http://nema.org/dicom/dicm";
case US: return "http://nema.org/dicom/dicm";
case VA: return "http://nema.org/dicom/dicm";
case XA: return "http://nema.org/dicom/dicm";
case XC: return "http://nema.org/dicom/dicm";
default: return "?";
}
}
public String getDefinition() {
switch (this) {
case AR: return "";
case AU: return "";
case BDUS: return "";
case BI: return "";
case BMD: return "";
case CR: return "";
case CT: return "";
case DG: return "";
case DX: return "";
case ECG: return "";
case EPS: return "";
case ES: return "";
case GM: return "";
case HC: return "";
case HD: return "";
case IO: return "";
case IVOCT: return "";
case IVUS: return "";
case KER: return "";
case KO: return "";
case LEN: return "";
case LS: return "";
case MG: return "";
case MR: return "";
case NM: return "";
case OAM: return "";
case OCT: return "";
case OP: return "";
case OPM: return "";
case OPT: return "";
case OPV: return "";
case OT: return "";
case PR: return "";
case PT: return "";
case PX: return "";
case REG: return "";
case RF: return "";
case RG: return "";
case RTDOSE: return "";
case RTIMAGE: return "";
case RTPLAN: return "";
case RTRECORD: return "";
case RTSTRUCT: return "";
case SEG: return "";
case SM: return "";
case SMR: return "";
case SR: return "";
case SRF: return "";
case TG: return "";
case US: return "";
case VA: return "";
case XA: return "";
case XC: return "";
default: return "?";
}
}
public String getDisplay() {
switch (this) {
case AR: return "AR";
case AU: return "AU";
case BDUS: return "BDUS";
case BI: return "BI";
case BMD: return "BMD";
case CR: return "CR";
case CT: return "CT";
case DG: return "DG";
case DX: return "DX";
case ECG: return "ECG";
case EPS: return "EPS";
case ES: return "ES";
case GM: return "GM";
case HC: return "HC";
case HD: return "HD";
case IO: return "IO";
case IVOCT: return "IVOCT";
case IVUS: return "IVUS";
case KER: return "KER";
case KO: return "KO";
case LEN: return "LEN";
case LS: return "LS";
case MG: return "MG";
case MR: return "MR";
case NM: return "NM";
case OAM: return "OAM";
case OCT: return "OCT";
case OP: return "OP";
case OPM: return "OPM";
case OPT: return "OPT";
case OPV: return "OPV";
case OT: return "OT";
case PR: return "PR";
case PT: return "PT";
case PX: return "PX";
case REG: return "REG";
case RF: return "RF";
case RG: return "RG";
case RTDOSE: return "RTDOSE";
case RTIMAGE: return "RTIMAGE";
case RTPLAN: return "RTPLAN";
case RTRECORD: return "RTRECORD";
case RTSTRUCT: return "RTSTRUCT";
case SEG: return "SEG";
case SM: return "SM";
case SMR: return "SMR";
case SR: return "SR";
case SRF: return "SRF";
case TG: return "TG";
case US: return "US";
case VA: return "VA";
case XA: return "XA";
case XC: return "XC";
default: return "?";
}
}
}
public static class ModalityEnumFactory implements EnumFactory<Modality> {
public Modality fromCode(String codeString) throws IllegalArgumentException {
if (codeString == null || "".equals(codeString))
if (codeString == null || "".equals(codeString))
return null;
if ("AR".equals(codeString))
return Modality.AR;
if ("AU".equals(codeString))
return Modality.AU;
if ("BDUS".equals(codeString))
return Modality.BDUS;
if ("BI".equals(codeString))
return Modality.BI;
if ("BMD".equals(codeString))
return Modality.BMD;
if ("CR".equals(codeString))
return Modality.CR;
if ("CT".equals(codeString))
return Modality.CT;
if ("DG".equals(codeString))
return Modality.DG;
if ("DX".equals(codeString))
return Modality.DX;
if ("ECG".equals(codeString))
return Modality.ECG;
if ("EPS".equals(codeString))
return Modality.EPS;
if ("ES".equals(codeString))
return Modality.ES;
if ("GM".equals(codeString))
return Modality.GM;
if ("HC".equals(codeString))
return Modality.HC;
if ("HD".equals(codeString))
return Modality.HD;
if ("IO".equals(codeString))
return Modality.IO;
if ("IVOCT".equals(codeString))
return Modality.IVOCT;
if ("IVUS".equals(codeString))
return Modality.IVUS;
if ("KER".equals(codeString))
return Modality.KER;
if ("KO".equals(codeString))
return Modality.KO;
if ("LEN".equals(codeString))
return Modality.LEN;
if ("LS".equals(codeString))
return Modality.LS;
if ("MG".equals(codeString))
return Modality.MG;
if ("MR".equals(codeString))
return Modality.MR;
if ("NM".equals(codeString))
return Modality.NM;
if ("OAM".equals(codeString))
return Modality.OAM;
if ("OCT".equals(codeString))
return Modality.OCT;
if ("OP".equals(codeString))
return Modality.OP;
if ("OPM".equals(codeString))
return Modality.OPM;
if ("OPT".equals(codeString))
return Modality.OPT;
if ("OPV".equals(codeString))
return Modality.OPV;
if ("OT".equals(codeString))
return Modality.OT;
if ("PR".equals(codeString))
return Modality.PR;
if ("PT".equals(codeString))
return Modality.PT;
if ("PX".equals(codeString))
return Modality.PX;
if ("REG".equals(codeString))
return Modality.REG;
if ("RF".equals(codeString))
return Modality.RF;
if ("RG".equals(codeString))
return Modality.RG;
if ("RTDOSE".equals(codeString))
return Modality.RTDOSE;
if ("RTIMAGE".equals(codeString))
return Modality.RTIMAGE;
if ("RTPLAN".equals(codeString))
return Modality.RTPLAN;
if ("RTRECORD".equals(codeString))
return Modality.RTRECORD;
if ("RTSTRUCT".equals(codeString))
return Modality.RTSTRUCT;
if ("SEG".equals(codeString))
return Modality.SEG;
if ("SM".equals(codeString))
return Modality.SM;
if ("SMR".equals(codeString))
return Modality.SMR;
if ("SR".equals(codeString))
return Modality.SR;
if ("SRF".equals(codeString))
return Modality.SRF;
if ("TG".equals(codeString))
return Modality.TG;
if ("US".equals(codeString))
return Modality.US;
if ("VA".equals(codeString))
return Modality.VA;
if ("XA".equals(codeString))
return Modality.XA;
if ("XC".equals(codeString))
return Modality.XC;
throw new IllegalArgumentException("Unknown Modality code '"+codeString+"'");
}
public String toCode(Modality code) {
if (code == Modality.AR)
return "AR";
if (code == Modality.AU)
return "AU";
if (code == Modality.BDUS)
return "BDUS";
if (code == Modality.BI)
return "BI";
if (code == Modality.BMD)
return "BMD";
if (code == Modality.CR)
return "CR";
if (code == Modality.CT)
return "CT";
if (code == Modality.DG)
return "DG";
if (code == Modality.DX)
return "DX";
if (code == Modality.ECG)
return "ECG";
if (code == Modality.EPS)
return "EPS";
if (code == Modality.ES)
return "ES";
if (code == Modality.GM)
return "GM";
if (code == Modality.HC)
return "HC";
if (code == Modality.HD)
return "HD";
if (code == Modality.IO)
return "IO";
if (code == Modality.IVOCT)
return "IVOCT";
if (code == Modality.IVUS)
return "IVUS";
if (code == Modality.KER)
return "KER";
if (code == Modality.KO)
return "KO";
if (code == Modality.LEN)
return "LEN";
if (code == Modality.LS)
return "LS";
if (code == Modality.MG)
return "MG";
if (code == Modality.MR)
return "MR";
if (code == Modality.NM)
return "NM";
if (code == Modality.OAM)
return "OAM";
if (code == Modality.OCT)
return "OCT";
if (code == Modality.OP)
return "OP";
if (code == Modality.OPM)
return "OPM";
if (code == Modality.OPT)
return "OPT";
if (code == Modality.OPV)
return "OPV";
if (code == Modality.OT)
return "OT";
if (code == Modality.PR)
return "PR";
if (code == Modality.PT)
return "PT";
if (code == Modality.PX)
return "PX";
if (code == Modality.REG)
return "REG";
if (code == Modality.RF)
return "RF";
if (code == Modality.RG)
return "RG";
if (code == Modality.RTDOSE)
return "RTDOSE";
if (code == Modality.RTIMAGE)
return "RTIMAGE";
if (code == Modality.RTPLAN)
return "RTPLAN";
if (code == Modality.RTRECORD)
return "RTRECORD";
if (code == Modality.RTSTRUCT)
return "RTSTRUCT";
if (code == Modality.SEG)
return "SEG";
if (code == Modality.SM)
return "SM";
if (code == Modality.SMR)
return "SMR";
if (code == Modality.SR)
return "SR";
if (code == Modality.SRF)
return "SRF";
if (code == Modality.TG)
return "TG";
if (code == Modality.US)
return "US";
if (code == Modality.VA)
return "VA";
if (code == Modality.XA)
return "XA";
if (code == Modality.XC)
return "XC";
return "?";
}
}
@Block()
public static class ImagingStudySeriesComponent extends BackboneElement implements IBaseBackboneElement {
/**
@ -944,9 +158,9 @@ public class ImagingStudy extends DomainResource {
/**
* The modality of this series sequence.
*/
@Child(name = "modality", type = {CodeType.class}, order=2, min=1, max=1)
@Child(name = "modality", type = {Coding.class}, order=2, min=1, max=1)
@Description(shortDefinition="The modality of the instances in the series (0008,0060)", formalDefinition="The modality of this series sequence." )
protected Enumeration<Modality> modality;
protected Coding modality;
/**
* Formal identifier for this series.
@ -1011,7 +225,7 @@ public class ImagingStudy extends DomainResource {
@Description(shortDefinition="A single instance taken from a patient (image or other)", formalDefinition="A single SOP Instance within the series, e.g., an image, or presentation state." )
protected List<ImagingStudySeriesInstanceComponent> instance;
private static final long serialVersionUID = 1186612269L;
private static final long serialVersionUID = -873161275L;
/*
* Constructor
@ -1023,7 +237,7 @@ public class ImagingStudy extends DomainResource {
/*
* Constructor
*/
public ImagingStudySeriesComponent(Enumeration<Modality> modality, OidType uid, UnsignedIntType numberOfInstances) {
public ImagingStudySeriesComponent(Coding modality, OidType uid, UnsignedIntType numberOfInstances) {
super();
this.modality = modality;
this.uid = uid;
@ -1076,50 +290,29 @@ public class ImagingStudy extends DomainResource {
}
/**
* @return {@link #modality} (The modality of this series sequence.). This is the underlying object with id, value and extensions. The accessor "getModality" gives direct access to the value
* @return {@link #modality} (The modality of this series sequence.)
*/
public Enumeration<Modality> getModalityElement() {
public Coding getModality() {
if (this.modality == null)
if (Configuration.errorOnAutoCreate())
throw new Error("Attempt to auto-create ImagingStudySeriesComponent.modality");
else if (Configuration.doAutoCreate())
this.modality = new Enumeration<Modality>(new ModalityEnumFactory()); // bb
this.modality = new Coding(); // cc
return this.modality;
}
public boolean hasModalityElement() {
return this.modality != null && !this.modality.isEmpty();
}
public boolean hasModality() {
return this.modality != null && !this.modality.isEmpty();
}
/**
* @param value {@link #modality} (The modality of this series sequence.). This is the underlying object with id, value and extensions. The accessor "getModality" gives direct access to the value
* @param value {@link #modality} (The modality of this series sequence.)
*/
public ImagingStudySeriesComponent setModalityElement(Enumeration<Modality> value) {
public ImagingStudySeriesComponent setModality(Coding value) {
this.modality = value;
return this;
}
/**
* @return The modality of this series sequence.
*/
public Modality getModality() {
return this.modality == null ? null : this.modality.getValue();
}
/**
* @param value The modality of this series sequence.
*/
public ImagingStudySeriesComponent setModality(Modality value) {
if (this.modality == null)
this.modality = new Enumeration<Modality>(new ModalityEnumFactory());
this.modality.setValue(value);
return this;
}
/**
* @return {@link #uid} (Formal identifier for this series.). This is the underlying object with id, value and extensions. The accessor "getUid" gives direct access to the value
*/
@ -1497,7 +690,7 @@ public class ImagingStudy extends DomainResource {
protected void listChildren(List<Property> childrenList) {
super.listChildren(childrenList);
childrenList.add(new Property("number", "unsignedInt", "The Numeric identifier of this series in the study.", 0, java.lang.Integer.MAX_VALUE, number));
childrenList.add(new Property("modality", "code", "The modality of this series sequence.", 0, java.lang.Integer.MAX_VALUE, modality));
childrenList.add(new Property("modality", "Coding", "The modality of this series sequence.", 0, java.lang.Integer.MAX_VALUE, modality));
childrenList.add(new Property("uid", "oid", "Formal identifier for this series.", 0, java.lang.Integer.MAX_VALUE, uid));
childrenList.add(new Property("description", "string", "A description of the series.", 0, java.lang.Integer.MAX_VALUE, description));
childrenList.add(new Property("numberOfInstances", "unsignedInt", "Number of SOP Instances in Series.", 0, java.lang.Integer.MAX_VALUE, numberOfInstances));
@ -1551,10 +744,9 @@ public class ImagingStudy extends DomainResource {
if (!(other instanceof ImagingStudySeriesComponent))
return false;
ImagingStudySeriesComponent o = (ImagingStudySeriesComponent) other;
return compareValues(number, o.number, true) && compareValues(modality, o.modality, true) && compareValues(uid, o.uid, true)
&& compareValues(description, o.description, true) && compareValues(numberOfInstances, o.numberOfInstances, true)
&& compareValues(availability, o.availability, true) && compareValues(url, o.url, true) && compareValues(dateTime, o.dateTime, true)
;
return compareValues(number, o.number, true) && compareValues(uid, o.uid, true) && compareValues(description, o.description, true)
&& compareValues(numberOfInstances, o.numberOfInstances, true) && compareValues(availability, o.availability, true)
&& compareValues(url, o.url, true) && compareValues(dateTime, o.dateTime, true);
}
public boolean isEmpty() {

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;
@ -1413,14 +1413,14 @@ public class ImplementationGuide extends DomainResource {
/**
* A logical set of resources that is a section in the implementation Guide.
*/
@Child(name = "package_", type = {}, order=14, min=1, max=Child.MAX_UNLIMITED)
@Child(name = "package", type = {}, order=14, min=1, max=Child.MAX_UNLIMITED)
@Description(shortDefinition="A section in the IG", formalDefinition="A logical set of resources that is a section in the implementation Guide." )
protected List<ImplementationGuidePackageComponent> package_;
/**
* A default profile that applies to a particular resource type. Whenever a resource type is referenced in any structure definition (explicitly, or by inheritance from the base specification), and no explicit profile is applied, then this default profile applies.
*/
@Child(name = "default_", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED)
@Child(name = "default", type = {}, order=15, min=0, max=Child.MAX_UNLIMITED)
@Description(shortDefinition="Applies when no explicit profile applied", formalDefinition="A default profile that applies to a particular resource type. Whenever a resource type is referenced in any structure definition (explicitly, or by inheritance from the base specification), and no explicit profile is applied, then this default profile applies." )
protected List<ImplementationGuideDefaultComponent> default_;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;
@ -527,14 +527,14 @@ public class List_ extends DomainResource {
protected Resource subjectTarget;
/**
* The entity responsible for deciding what the contents of the list were.
* The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.
*/
@Child(name = "source", type = {Practitioner.class, Patient.class, Device.class}, order=4, min=0, max=1)
@Description(shortDefinition="Who and/or what defined the list contents", formalDefinition="The entity responsible for deciding what the contents of the list were." )
@Description(shortDefinition="Who and/or what defined the list contents (aka Author)", formalDefinition="The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list." )
protected Reference source;
/**
* The actual object that is the target of the reference (The entity responsible for deciding what the contents of the list were.)
* The actual object that is the target of the reference (The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.)
*/
protected Resource sourceTarget;
@ -770,7 +770,7 @@ public class List_ extends DomainResource {
}
/**
* @return {@link #source} (The entity responsible for deciding what the contents of the list were.)
* @return {@link #source} (The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.)
*/
public Reference getSource() {
if (this.source == null)
@ -786,7 +786,7 @@ public class List_ extends DomainResource {
}
/**
* @param value {@link #source} (The entity responsible for deciding what the contents of the list were.)
* @param value {@link #source} (The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.)
*/
public List_ setSource(Reference value) {
this.source = value;
@ -794,14 +794,14 @@ public class List_ extends DomainResource {
}
/**
* @return {@link #source} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The entity responsible for deciding what the contents of the list were.)
* @return {@link #source} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.)
*/
public Resource getSourceTarget() {
return this.sourceTarget;
}
/**
* @param value {@link #source} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The entity responsible for deciding what the contents of the list were.)
* @param value {@link #source} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.)
*/
public List_ setSourceTarget(Resource value) {
this.sourceTarget = value;
@ -1134,7 +1134,7 @@ public class List_ extends DomainResource {
childrenList.add(new Property("title", "string", "A label for the list assigned by the author.", 0, java.lang.Integer.MAX_VALUE, title));
childrenList.add(new Property("code", "CodeableConcept", "This code defines the purpose of the list - why it was created.", 0, java.lang.Integer.MAX_VALUE, code));
childrenList.add(new Property("subject", "Reference(Patient|Group|Device|Location)", "The common subject (or patient) of the resources that are in the list, if there is one.", 0, java.lang.Integer.MAX_VALUE, subject));
childrenList.add(new Property("source", "Reference(Practitioner|Patient|Device)", "The entity responsible for deciding what the contents of the list were.", 0, java.lang.Integer.MAX_VALUE, source));
childrenList.add(new Property("source", "Reference(Practitioner|Patient|Device)", "The entity responsible for deciding what the contents of the list were. Where the list was created by a human, this is the same as the author of the list.", 0, java.lang.Integer.MAX_VALUE, source));
childrenList.add(new Property("encounter", "Reference(Encounter)", "The encounter that is the context in which this list was created.", 0, java.lang.Integer.MAX_VALUE, encounter));
childrenList.add(new Property("status", "code", "Indicates the current state of this list.", 0, java.lang.Integer.MAX_VALUE, status));
childrenList.add(new Property("date", "dateTime", "The date that the list was prepared.", 0, java.lang.Integer.MAX_VALUE, date));
@ -1228,7 +1228,7 @@ public class List_ extends DomainResource {
public static final String SP_SUBJECT = "subject";
@SearchParamDefinition(name="patient", path="List.subject", description="If all resources have the same subject", type="reference" )
public static final String SP_PATIENT = "patient";
@SearchParamDefinition(name="source", path="List.source", description="Who and/or what defined the list contents", type="reference" )
@SearchParamDefinition(name="source", path="List.source", description="Who and/or what defined the list contents (aka Author)", type="reference" )
public static final String SP_SOURCE = "source";
@SearchParamDefinition(name="encounter", path="List.encounter", description="Context in which list created", type="reference" )
public static final String SP_ENCOUNTER = "encounter";

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

View File

@ -29,7 +29,7 @@ package org.hl7.fhir.instance.model;
*/
// Generated on Wed, Jul 8, 2015 17:35-0400 for FHIR v0.5.0
// Generated on Tue, Jul 14, 2015 17:35-0400 for FHIR v0.5.0
import java.util.*;

Some files were not shown because too many files have changed in this diff Show More