Services working now

This commit is contained in:
jamesagnew 2014-03-04 18:25:52 -05:00
parent 5828f49029
commit 3d281217da
54 changed files with 293 additions and 498 deletions

View File

@ -82,5 +82,6 @@
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="var" path="M2_REPO/org/mockito/mockito-all/1.9.5/mockito-all-1.9.5.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/hapi-fhir-structures-dstu"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -36,9 +36,7 @@ import ca.uhn.fhir.model.api.annotation.Choice;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
import ca.uhn.fhir.model.api.annotation.Extension;
import ca.uhn.fhir.model.api.annotation.Narrative;
import ca.uhn.fhir.model.api.annotation.ResourceDef;
import ca.uhn.fhir.model.dstu.composite.NarrativeDt;
import ca.uhn.fhir.model.primitive.BoundCodeDt;
import ca.uhn.fhir.model.primitive.CodeDt;
import ca.uhn.fhir.model.primitive.DateDt;
@ -71,7 +69,6 @@ class ModelScanner {
}
private void init(Set<Class<? extends IElement>> toScan) {
toScan.add(NarrativeDt.class);
toScan.add(DateDt.class);
toScan.add(CodeDt.class);
@ -264,18 +261,6 @@ class ModelScanner {
for (Field next : theClass.getDeclaredFields()) {
Narrative hasNarrative = next.getAnnotation(Narrative.class);
if (hasNarrative != null) {
RuntimeChildNarrativeDefinition def;
try {
def = new RuntimeChildNarrativeDefinition(next, hasNarrative.name());
} catch (Exception e) {
throw new ConfigurationException("Failed to find narrative field", e);
}
theDefinition.addChild(def);
continue;
}
Child element = next.getAnnotation(Child.class);
if (element == null) {
ourLog.debug("Ignoring non-type field '" + next.getName() + "' on target type: " + theClass);

View File

@ -1,13 +0,0 @@
package ca.uhn.fhir.context;
import java.lang.reflect.Field;
import ca.uhn.fhir.model.dstu.composite.NarrativeDt;
public class RuntimeChildNarrativeDefinition extends BaseRuntimeChildDatatypeDefinition {
public RuntimeChildNarrativeDefinition(Field theField, String theElementName) {
super(theField, theElementName, 1, 1, NarrativeDt.class);
}
}

View File

@ -1,14 +0,0 @@
package ca.uhn.fhir.model.api.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(value= {ElementType.FIELD})
public @interface Narrative {
String name();
}

View File

@ -1,9 +0,0 @@
package ca.uhn.fhir.model.enm;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
@CodeTableDef(name="body-site", tableId=62, restrictedToSnomedIsA= {91723000})
public enum BodySiteEnum implements ICodeEnum {
}

View File

@ -1,25 +0,0 @@
package ca.uhn.fhir.model.enm;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.EnumeratedCodeValue;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
@CodeTableDef(name="identifier-use", tableId=13)
public enum IdentifierUseEnum implements ICodeEnum {
@EnumeratedCodeValue("usual")
@Description("the identifier recommended for display and use in real-world interactions.")
USUAL,
@EnumeratedCodeValue("official")
@Description("the identifier considered to be most trusted for the identification of this item.")
OFFICIAL,
@EnumeratedCodeValue("temp")
@Description("A temporary identifier.")
TEMP,
@EnumeratedCodeValue("secondary")
@Description("An identifier that was assigned in secondary use - it serves to identify the object in a relative context, but cannot be consistently assigned to the same object again in a different context.")
SECONDARY
}

View File

@ -1,26 +0,0 @@
package ca.uhn.fhir.model.enm;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.EnumeratedCodeValue;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
@CodeTableDef(tableId = 28, name = "narrative-status")
public enum NarrativeStatusEnum implements ICodeEnum {
@EnumeratedCodeValue(value = "generated")
@Description("The contents of the narrative are entirely generated from the structured data in the resource.")
GENERATED,
@EnumeratedCodeValue(value = "extensions")
@Description("The contents of the narrative are entirely generated from the structured data in the resource and some of the content is generated from extensions.")
EXTENSIONS,
@EnumeratedCodeValue(value = "additional")
@Description("The contents of the narrative contain additional information not found in the structured data.")
ADDITIONAL,
@EnumeratedCodeValue(value = "empty")
@Description("the contents of the narrative are some equivalent of \"No human-readable text provided for this resource\".")
EMPTY
}

View File

@ -1,9 +0,0 @@
package ca.uhn.fhir.model.enm;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
@CodeTableDef(name="observation-codes", tableId=115)
public enum ObservationCodesEnum implements ICodeEnum {
}

View File

@ -1,126 +0,0 @@
package ca.uhn.fhir.model.enm;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.EnumeratedCodeValue;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
@CodeTableDef(tableId = 117, name = "observation-interpretation")
public enum ObservationInterpretationEnum implements ICodeEnum {
@EnumeratedCodeValue(value = "<", system = "http://hl7.org/fhir/v2/0078")
@Description("Below absolute low-off instrument scale")
BELOW_ABSOLUTE_LOW,
@EnumeratedCodeValue(value = ">", system = "http://hl7.org/fhir/v2/0078")
@Description("Above absolute high-off instrument scale")
ABOVE_ABSOLUTE_HIGH,
@EnumeratedCodeValue(value = "A", system = "http://hl7.org/fhir/v2/0078")
@Description("Abnormal (applies to non-numeric results)")
A,
@EnumeratedCodeValue(value = "AA", system = "http://hl7.org/fhir/v2/0078")
@Description("Very abnormal (applies to non-numeric units, analogous to panic limits for numeric units)")
AA,
@EnumeratedCodeValue(value = "AC", system = "http://hl7.org/fhir/v2/0078")
@Description("Anti-complementary substances present")
AC,
@EnumeratedCodeValue(value = "B", system = "http://hl7.org/fhir/v2/0078")
@Description("Better-use when direction not relevant")
B,
@EnumeratedCodeValue(value = "D", system = "http://hl7.org/fhir/v2/0078")
@Description("Significant change down")
D,
@EnumeratedCodeValue(value = "DET", system = "http://hl7.org/fhir/v2/0078")
@Description("Detected")
DET,
@EnumeratedCodeValue(value = "H", system = "http://hl7.org/fhir/v2/0078")
@Description("Above high normal")
H,
@EnumeratedCodeValue(value = "HH", system = "http://hl7.org/fhir/v2/0078")
@Description("Above upper panic limits")
HH,
@EnumeratedCodeValue(value = "I", system = "http://hl7.org/fhir/v2/0078")
@Description("Intermediate. Indicates for microbiology susceptibilities only.")
I,
@EnumeratedCodeValue(value = "IND", system = "http://hl7.org/fhir/v2/0078")
@Description("Indeterminate")
IND,
@EnumeratedCodeValue(value = "L", system = "http://hl7.org/fhir/v2/0078")
@Description("Below low normal")
L,
@EnumeratedCodeValue(value = "LL", system = "http://hl7.org/fhir/v2/0078")
@Description("Below lower panic limits")
LL, @EnumeratedCodeValue(value = "MS", system = "http://hl7.org/fhir/v2/0078")
@Description("Moderately susceptible. Indicates for microbiology susceptibilities only.")
MS,
@EnumeratedCodeValue(value = "N", system = "http://hl7.org/fhir/v2/0078")
@Description("Normal (applies to non-numeric results)")
N,
@EnumeratedCodeValue(value = "ND", system = "http://hl7.org/fhir/v2/0078")
@Description("Not Detected")
ND,
@EnumeratedCodeValue(value = "NEG", system = "http://hl7.org/fhir/v2/0078")
@Description("Negative")
NEG, @EnumeratedCodeValue(value = "NR", system = "http://hl7.org/fhir/v2/0078")
@Description("Non-reactive")
NR,
@EnumeratedCodeValue(value = "POS", system = "http://hl7.org/fhir/v2/0078")
@Description("Positive")
POS,
@EnumeratedCodeValue(value = "QCF", system = "http://hl7.org/fhir/v2/0078")
@Description("Quality Control Failure")
QCF,
@EnumeratedCodeValue(value = "R", system = "http://hl7.org/fhir/v2/0078")
@Description("Resistant. Indicates for microbiology susceptibilities only.")
R,
@EnumeratedCodeValue(value = "RR", system = "http://hl7.org/fhir/v2/0078")
@Description("Reactive")
RR,
@EnumeratedCodeValue(value = "S", system = "http://hl7.org/fhir/v2/0078")
@Description("Susceptible. Indicates for microbiology susceptibilities only.")
S,
@EnumeratedCodeValue(value = "TOX", system = "http://hl7.org/fhir/v2/0078")
@Description("Cytotoxic substance present")
TOX,
@EnumeratedCodeValue(value = "U", system = "http://hl7.org/fhir/v2/0078")
@Description("Significant change up")
U,
@EnumeratedCodeValue(value = "VS", system = "http://hl7.org/fhir/v2/0078")
@Description("Very susceptible. Indicates for microbiology susceptibilities only.")
VS,
@EnumeratedCodeValue(value = "W", system = "http://hl7.org/fhir/v2/0078")
@Description("Worse-use when direction not relevant")
W,
@EnumeratedCodeValue(value = "WR", system = "http://hl7.org/fhir/v2/0078")
@Description("Weakly reactive")
WR,
@EnumeratedCodeValue(value = "null", system = "http://hl7.org/fhir/v2/0078")
@Description("No range defined, or normal ranges don't apply")
NULL
}

View File

@ -1,10 +0,0 @@
package ca.uhn.fhir.model.enm;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
@CodeTableDef(tableId=114, name="observation-method")
public enum ObservationMethodEnum implements ICodeEnum {
}

View File

@ -1,38 +0,0 @@
package ca.uhn.fhir.model.enm;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.EnumeratedCodeValue;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
@CodeTableDef(tableId = 371, name = "observation-relationshiptype")
public enum ObservationRelationshipTypeEnum implements ICodeEnum {
@EnumeratedCodeValue("has-component")
@Description("The target observation is a component of this observation (e.g. Systolic and Diastolic Blood Pressure).")
HAS_COMPONENT,
@EnumeratedCodeValue("has-member")
@Description("This observation is a group observation (e.g. a battery, a panel of tests, a set of vital sign measurements) that includes the target as a member of the group.")
HAS_MEMBER,
@EnumeratedCodeValue("derived-from")
@Description("The target observation is part of the information from which this observation value is derived (e.g. calculated anion gap, Apgar score).")
DERIVED_FROM,
@EnumeratedCodeValue("sequel-to")
@Description("This observation follows the target observation (e.g. timed tests such as Glucose Tolerance Test).")
SEQUEL_TO,
@EnumeratedCodeValue("replaces")
@Description("This observation replaces a previous observation (i.e. a revised value). The target observation is now obsolete.")
REPLACES,
@EnumeratedCodeValue("qualified-by")
@Description("The value of the target observation qualifies (refines) the semantics of the source observation (e.g. a lipaemia measure target from a plasma measure).")
QUALIFIED_BY,
@EnumeratedCodeValue("interfered-by")
@Description("The value of the target observation interferes (degardes quality, or prevents valid observation) with the semantics of the source observation (e.g. a hemolysis measure target from a plasma potassium measure which has no value).")
INTERFERED_BY
}

View File

@ -1,39 +0,0 @@
package ca.uhn.fhir.model.enm;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.EnumeratedCodeValue;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
@CodeTableDef(tableId=118, name="observation-reliability")
public enum ObservationReliabilityEnum implements ICodeEnum {
@Description("The result has no reliability concerns.")
@EnumeratedCodeValue("ok")
OK,
@Description("An early estimate of value; measurement is still occurring.")
@EnumeratedCodeValue("ongoing")
ONGOING,
@Description("An early estimate of value; processing is still occurring.")
@EnumeratedCodeValue("early")
EARLY,
@Description("The observation value should be treated with care.")
@EnumeratedCodeValue("questionable")
QUESTIONABLE,
@Description("The result has been generated while calibration is occurring.")
@EnumeratedCodeValue("calibrating")
CALIBRATING,
@Description("The observation could not be completed because of an error.")
@EnumeratedCodeValue("error")
ERROR,
@Description("No observation value was available.")
@EnumeratedCodeValue("unknown")
UNKNOWN
}

View File

@ -1,36 +0,0 @@
package ca.uhn.fhir.model.enm;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.EnumeratedCodeValue;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
@CodeTableDef(tableId=7, name="observation-status")
public enum ObservationStatusEnum implements ICodeEnum {
@Description("The existence of the observation is registered, but there is no result yet available")
@EnumeratedCodeValue("registered")
REGISTERED,
@Description("This is an initial or interim observation: data may be incomplete or unverified")
@EnumeratedCodeValue("interim")
INTERIM,
@Description("The observation is complete and verified by an authorised person")
@EnumeratedCodeValue("final")
FINAL,
@Description("The observation has been modified subsequent to being Final, and is complete and verified by an authorised person")
@EnumeratedCodeValue("amended")
AMENDED,
@Description("The observation is unavailable because the measurement was not started or not completed (also sometimes called \"aborted\")")
@EnumeratedCodeValue("cancelled")
CANCELLED,
@Description("The observation has been withdrawn following previous Final release")
@EnumeratedCodeValue("withdrawn")
WITHDRAWN
}

View File

@ -1,27 +0,0 @@
package ca.uhn.fhir.model.enm;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.EnumeratedCodeValue;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
@CodeTableDef(tableId=14, name="quantity-comparator")
public enum QuantityComparatorEnum implements ICodeEnum {
@EnumeratedCodeValue("<")
@Description("The actual value is less than the given value.")
LESSTHAN,
@EnumeratedCodeValue("<=")
@Description("The actual value is less than or equal to the given value.")
LESSTHAN_OR_EQUAL,
@EnumeratedCodeValue(">=")
@Description("The actual value is greater than or equal to the given value.")
GREATERTHAN_OR_EQUAL,
@EnumeratedCodeValue(">")
@Description("The actual value is greater than the given value.")
GREATERTHAN;
}

View File

@ -1,55 +0,0 @@
package ca.uhn.fhir.model.enm;
import ca.uhn.fhir.model.api.ICodeEnum;
import ca.uhn.fhir.model.api.annotation.CodeTableDef;
import ca.uhn.fhir.model.api.annotation.Description;
import ca.uhn.fhir.model.api.annotation.EnumeratedCodeValue;
@CodeTableDef(tableId = 119, name = "referencerange-meaning")
public enum ReferenceRangeMeaningEnum implements ICodeEnum {
@EnumeratedCodeValue(value = "normal", system = "http://hl7.org/fhir/referencerange-meaning")
@Description("Normal Range")
NORMAL,
@EnumeratedCodeValue(value = "recommended", system = "http://hl7.org/fhir/referencerange-meaning")
@Description("Recommended Range")
RECOMMENDED,
@EnumeratedCodeValue(value = "treatment", system = "http://hl7.org/fhir/referencerange-meaning")
@Description("Treatment Range")
TREATMENT,
@EnumeratedCodeValue(value = "therapeutic", system = "http://hl7.org/fhir/referencerange-meaning")
@Description("Therapeutic Desired Level")
THERAPEUTIC,
@EnumeratedCodeValue(value = "pre", system = "http://hl7.org/fhir/referencerange-meaning")
@Description("Pre Therapeutic Desired Level")
PRE,
@EnumeratedCodeValue(value = "post", system = "http://hl7.org/fhir/referencerange-meaning")
@Description("Post Therapeutic Desired Level")
POST,
@EnumeratedCodeValue(value = "pre-puberty", system = "http://hl7.org/fhir/referencerange-meaning")
@Description("Pre-Puberty")
PRE_PUBERTY,
@EnumeratedCodeValue(value = "follicular", system = "http://hl7.org/fhir/referencerange-meaning")
@Description("Follicular Stage")
FOLLICULAR,
@EnumeratedCodeValue(value = "midcycle", system = "http://hl7.org/fhir/referencerange-meaning")
@Description("MidCycle")
MIDCYCLE,
@EnumeratedCodeValue(value = "luteal", system = "http://hl7.org/fhir/referencerange-meaning")
@Description("Luteal")
LUTEAL,
@EnumeratedCodeValue(value = "postmenopausal", system = "http://hl7.org/fhir/referencerange-meaning")
@Description("Post-Menopause")
POSTMENOPAUSAL
}

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
public class Constants {

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
public enum EncodingUtil {

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
import ca.uhn.fhir.model.api.IResource;

View File

@ -1,8 +1,8 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
import ca.uhn.fhir.context.ConfigurationException;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.ws.exceptions.InternalErrorException;
import ca.uhn.fhir.server.exceptions.InternalErrorException;
/**
* Created by dsotnikov on 2/25/2014.

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
import java.util.ArrayList;
import java.util.List;

View File

@ -1,9 +1,9 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.ws.exceptions.InternalErrorException;
import ca.uhn.fhir.ws.exceptions.InvalidRequestException;
import ca.uhn.fhir.ws.exceptions.MethodNotFoundException;
import ca.uhn.fhir.server.exceptions.InternalErrorException;
import ca.uhn.fhir.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.server.exceptions.MethodNotFoundException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
import java.io.File;
import java.io.IOException;
@ -26,14 +26,14 @@ import ca.uhn.fhir.model.api.Bundle;
import ca.uhn.fhir.model.api.BundleEntry;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.parser.XmlParser;
import ca.uhn.fhir.ws.exceptions.AbstractResponseException;
import ca.uhn.fhir.ws.exceptions.InternalErrorException;
import ca.uhn.fhir.ws.exceptions.MethodNotFoundException;
import ca.uhn.fhir.ws.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.ws.operations.DELETE;
import ca.uhn.fhir.ws.operations.GET;
import ca.uhn.fhir.ws.operations.POST;
import ca.uhn.fhir.ws.operations.PUT;
import ca.uhn.fhir.server.exceptions.AbstractResponseException;
import ca.uhn.fhir.server.exceptions.InternalErrorException;
import ca.uhn.fhir.server.exceptions.MethodNotFoundException;
import ca.uhn.fhir.server.exceptions.ResourceNotFoundException;
import ca.uhn.fhir.server.operations.DELETE;
import ca.uhn.fhir.server.operations.GET;
import ca.uhn.fhir.server.operations.POST;
import ca.uhn.fhir.server.operations.PUT;
public abstract class RestfulServer extends HttpServlet {

View File

@ -1,7 +1,7 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
import ca.uhn.fhir.ws.parameters.Optional;
import ca.uhn.fhir.ws.parameters.Required;
import ca.uhn.fhir.server.parameters.Optional;
import ca.uhn.fhir.server.parameters.Required;
import java.io.UnsupportedEncodingException;
import java.lang.annotation.Annotation;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.exceptions;
package ca.uhn.fhir.server.exceptions;
public abstract class AbstractResponseException extends Exception {

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.exceptions;
package ca.uhn.fhir.server.exceptions;
import javax.servlet.ServletException;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.exceptions;
package ca.uhn.fhir.server.exceptions;
public class InternalErrorException extends AbstractResponseException {

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.exceptions;
package ca.uhn.fhir.server.exceptions;
public class InvalidRequestException extends AbstractResponseException {

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.exceptions;
package ca.uhn.fhir.server.exceptions;
/**
* Created by dsotnikov on 2/27/2014.

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.exceptions;
package ca.uhn.fhir.server.exceptions;
public class ResourceNotFoundException extends AbstractResponseException {

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.operations;
package ca.uhn.fhir.server.operations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.operations;
package ca.uhn.fhir.server.operations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.operations;
package ca.uhn.fhir.server.operations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.operations;
package ca.uhn.fhir.server.operations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.parameters;
package ca.uhn.fhir.server.parameters;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws.parameters;
package ca.uhn.fhir.server.parameters;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
import java.util.HashMap;
import java.util.Map;
@ -9,8 +9,9 @@ import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.dstu.resource.Patient;
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
import ca.uhn.fhir.model.primitive.UriDt;
import ca.uhn.fhir.ws.operations.GET;
import ca.uhn.fhir.ws.parameters.Required;
import ca.uhn.fhir.server.IResourceProvider;
import ca.uhn.fhir.server.operations.GET;
import ca.uhn.fhir.server.parameters.Required;
/**
* Created by dsotnikov on 2/25/2014.

View File

@ -1,8 +1,11 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
import java.util.Arrays;
import java.util.Collection;
import ca.uhn.fhir.server.IResourceProvider;
import ca.uhn.fhir.server.RestfulServer;
public class DummyRestfulServer extends RestfulServer {
private static final long serialVersionUID = 1L;

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
import static org.junit.Assert.*;
@ -91,7 +91,7 @@ public class ResfulServerTest {
HttpResponse status = ourClient.execute(httpGet);
String responseContent = IOUtils.toString(status.getEntity().getContent());
ourLog.debug("Response was:\n{}", responseContent);
ourLog.info("Response was:\n{}", responseContent);
assertEquals(200, status.getStatusLine().getStatusCode());
Patient patient = (Patient) ourCtx.newXmlParser().parseResource(responseContent);

View File

@ -1,4 +1,4 @@
package ca.uhn.fhir.ws;
package ca.uhn.fhir.server;
import static org.junit.Assert.*;
@ -9,6 +9,9 @@ import java.util.Set;
import org.junit.Test;
import ca.uhn.fhir.server.Parameter;
import ca.uhn.fhir.server.ResourceMethod;
public class ResourceMethodTest {
@Test

View File

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="target/generated-sources/tinder" including="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar" sourcepath="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar" sourcepath="M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-base/1.0-SNAPSHOT/hapi-fhir-base-1.0-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar" sourcepath="M2_REPO/com/google/code/gson/gson/2.2.4/gson-2.2.4-sources.jar">
<attributes>
<attribute value="jar:file:/home/t3903uhn/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/org/codehaus/woodstox/woodstox-core-asl/4.2.0/woodstox-core-asl-4.2.0.jar" sourcepath="M2_REPO/org/codehaus/woodstox/woodstox-core-asl/4.2.0/woodstox-core-asl-4.2.0-sources.jar">
<attributes>
<attribute value="jar:file:/home/t3903uhn/.m2/repository/org/codehaus/woodstox/woodstox-core-asl/4.2.0/woodstox-core-asl-4.2.0-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/org/codehaus/woodstox/stax2-api/3.1.1/stax2-api-3.1.1.jar" sourcepath="M2_REPO/org/codehaus/woodstox/stax2-api/3.1.1/stax2-api-3.1.1-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1.jar" sourcepath="M2_REPO/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1-sources.jar">
<attributes>
<attribute value="jar:file:/home/t3903uhn/.m2/repository/org/apache/commons/commons-lang3/3.2.1/commons-lang3-3.2.1-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/commons-codec/commons-codec/1.9/commons-codec-1.9.jar" sourcepath="M2_REPO/commons-codec/commons-codec/1.9/commons-codec-1.9-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6.jar" sourcepath="M2_REPO/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6-sources.jar">
<attributes>
<attribute value="jar:file:/home/t3903uhn/.m2/repository/org/slf4j/slf4j-api/1.7.6/slf4j-api-1.7.6-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpclient/4.2.3/httpclient-4.2.3.jar" sourcepath="M2_REPO/org/apache/httpcomponents/httpclient/4.2.3/httpclient-4.2.3-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/httpcomponents/httpcore/4.2.2/httpcore-4.2.2.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar" sourcepath="M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-sources.jar">
<attributes>
<attribute value="jar:file:/home/t3903uhn/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1-javadoc.jar!/" name="javadoc_location"/>
</attributes>
</classpathentry>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.17/log4j-1.2.17.jar"/>
</classpath>

4
hapi-fhir-structures-dstu/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
/bin
/target
*.log
*.log*

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>hapi-fhir-structures-dstu</name>
<comment>NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,5 @@
#Tue Mar 04 18:10:08 EST 2014
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.compliance=1.7

View File

@ -10,7 +10,7 @@
</parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-test</artifactId>
<artifactId>hapi-fhir-structures-dstu</artifactId>
<packaging>jar</packaging>
<name>HAPI FHIR Structures - DSTU (FHIR 0.80)</name>
@ -39,16 +39,34 @@
<configuration>
<package>ca.uhn.fhir.model.dstu</package>
<baseResourceNames>
<baseResourceName>patient</baseResourceName>
<baseResourceName>valueset</baseResourceName>
<baseResourceName>organization</baseResourceName>
<baseResourceName>device</baseResourceName>
<baseResourceName>group</baseResourceName>
<baseResourceName>location</baseResourceName>
<baseResourceName>medication</baseResourceName>
<baseResourceName>observation</baseResourceName>
<baseResourceName>organization</baseResourceName>
<baseResourceName>patient</baseResourceName>
<baseResourceName>practitioner</baseResourceName>
<baseResourceName>profile</baseResourceName>
<baseResourceName>specimen</baseResourceName>
<baseResourceName>substance</baseResourceName>
<baseResourceName>valueset</baseResourceName>
</baseResourceNames>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${maven_javadoc_plugin_version}</version>
<configuration>
</configuration>
</plugin>
</plugins>
</reporting>
</project>

View File

@ -99,6 +99,24 @@
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<configuration>
<!-- see http://jira.codehaus.org/browse/MNG-5346 -->
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version> <configuration> <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration> <executions> <execution> <id>mojo-descriptor</id> <goals>

View File

@ -145,6 +145,7 @@ public abstract class BaseStructureParser {
ctx.put("children", theResource.getChildren());
ctx.put("resourceBlockChildren", theResource.getResourceBlockChildren());
ctx.put("childExtensionTypes", ObjectUtils.defaultIfNull(myExtensions, new ArrayList<Extension>()));
ctx.put("searchParams", (theResource.getSearchParameters()));
VelocityEngine v = new VelocityEngine();
v.setProperty("resource.loader", "cp");

View File

@ -16,6 +16,7 @@ import ca.uhn.fhir.tinder.model.Child;
import ca.uhn.fhir.tinder.model.Resource;
import ca.uhn.fhir.tinder.model.ResourceBlock;
import ca.uhn.fhir.tinder.model.ResourceBlockCopy;
import ca.uhn.fhir.tinder.model.SearchParameter;
import ca.uhn.fhir.tinder.util.XMLUtils;
public abstract class BaseStructureSpreadsheetParser extends BaseStructureParser {
@ -44,9 +45,12 @@ public abstract class BaseStructureSpreadsheetParser extends BaseStructureParser
parseFirstRow(defRow);
Element resourceRow = (Element) rows.item(1);
Resource resource = new Resource();
addResource(resource);
parseParameters(file, resource);
parseBasicElements(resourceRow, resource);
Map<String, BaseElement> elements = new HashMap<String, BaseElement>();
@ -100,6 +104,57 @@ public abstract class BaseStructureSpreadsheetParser extends BaseStructureParser
}
private void parseParameters(Document theFile, Resource theResource) {
NodeList sheets = theFile.getElementsByTagName("Worksheet");
for (int i = 0; i < sheets.getLength(); i++) {
Element sheet = (Element) sheets.item(i);
String name = sheet.getAttributeNS("urn:schemas-microsoft-com:office:spreadsheet", "Name");
if ("Search".equals(name)) {
NodeList tableList = sheet.getElementsByTagName("Table");
Element table = (Element) tableList.item(0);
NodeList rows = table.getElementsByTagName("Row");
Element defRow = (Element) rows.item(0);
int colName = 0;
int colDesc = 0;
int colType = 0;
int colPath = 0;
for (int j = 0; j < 20; j++) {
String nextName = cellValue(defRow, j);
if (nextName == null) {
continue;
}
nextName = nextName.toLowerCase().trim().replace(".", "");
if ("name".equals(nextName)) {
colName = j;
} else if ("description".equals(nextName)) {
colDesc = j;
} else if ("type".equals(nextName)) {
colType = j;
} else if ("path".equals(nextName)) {
colPath = j;
}
}
for (int j = 1; j < rows.getLength(); j++) {
Element nextRow = (Element) rows.item(j);
SearchParameter sp = new SearchParameter();
sp.setName(cellValue(nextRow, colName));
sp.setDescription(cellValue(nextRow, colDesc));
sp.setType(cellValue(nextRow, colType));
sp.setPath(cellValue(nextRow, colPath));
if (StringUtils.isNotBlank(sp.getName())) {
theResource.getSearchParameters().add(sp);
}
}
}
}
}
protected abstract Collection<InputStream> getInputStreams();
private void parseFirstRow(Element theDefRow) {

View File

@ -1,8 +1,10 @@
package ca.uhn.fhir.tinder;
import java.io.File;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.apache.maven.plugin.MojoFailureException;
@ -31,9 +33,10 @@ public class ResourceGeneratorUsingSpreadsheet extends BaseStructureSpreadsheetP
public static void main(String[] args) throws Exception {
// ResourceSpreadsheetParser p = new ResourceSpreadsheetParser();
// p.setAllDatatypes(new ArrayList<String>());
// p.setDirectory("src/test/resources/res");
ResourceGeneratorUsingSpreadsheet p = new ResourceGeneratorUsingSpreadsheet();
p.setBaseResourceNames(Collections.singletonList("patient"));
p.parse();
p.writeAll(new File("tmp"), "ca.test");
//
// // TODO: this needs to be properly populated
// p.getAllDatatypes().add("String");

View File

@ -1,8 +1,6 @@
package ca.uhn.fhir.tinder;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;
import org.apache.commons.lang3.StringUtils;

View File

@ -1,11 +1,23 @@
package ca.uhn.fhir.tinder.model;
import java.util.ArrayList;
import java.util.List;
public class Resource extends BaseElement {
private List<SearchParameter> mySearchParameters;
@Override
public String getTypeSuffix() {
return "";
}
public List<SearchParameter> getSearchParameters() {
if (mySearchParameters==null) {
mySearchParameters=new ArrayList<SearchParameter>();
}
return mySearchParameters;
}
}

View File

@ -0,0 +1,48 @@
package ca.uhn.fhir.tinder.model;
import org.apache.commons.lang3.StringUtils;
public class SearchParameter {
private String myDescription;
private String myName;
private String myPath;
private String myType;
public String getDescription() {
return StringUtils.defaultString(myDescription);
}
public String getConstantName() {
return "SP_" + myName.toUpperCase().replace("-[X]", "_X").replace('-', '_').replace("!", "");
}
public String getName() {
return myName;
}
public String getPath() {
return StringUtils.defaultString(myPath);
}
public String getType() {
return StringUtils.defaultString(myType);
}
public void setDescription(String theDescription) {
myDescription = theDescription;
}
public void setName(String theName) {
myName = theName;
}
public void setPath(String thePath) {
myPath = thePath;
}
public void setType(String theType) {
myType = theType;
}
}

View File

@ -36,9 +36,9 @@ public class ${className}Dt extends BaseElement implements ICompositeDatatype {
#########################
#if ( ${className} == "Identifier" )
/**
* Returns true if <code>this</code> identifier has the same {@link IdentifierDt#getValue() value}
* and {@link IdentifierDt#getSystem() system} (as compared by simple equals comparison).
* Does not compare other values (e.g. {@link IdentifierDt#getUse() use}) or any extensions.
* Returns true if <code>this</code> identifier has the same {@link IdentifierDt#[[#]]#getValue() value}
* and {@link IdentifierDt#[[#]]#getSystem() system} (as compared by simple equals comparison).
* Does not compare other values (e.g. {@link IdentifierDt#[[#]]#getUse() use}) or any extensions.
*/
public boolean matchesSystemAndValue(IdentifierDt theIdentifier) {
if (theIdentifier == null) {
@ -52,7 +52,7 @@ public class ${className}Dt extends BaseElement implements ICompositeDatatype {
* format is used in HTTP queries as a parameter format.
*
* @see See FHIR specification
* <a href="http://www.hl7.org/implement/standards/fhir/search.html#ptypes">2.2.2 Search Parameter Types</a>
* <a href="http://www.hl7.org/implement/standards/fhir/search.html#[[#]]#ptypes">2.2.2 Search Parameter Types</a>
* for information on the <b>token</b> format
*/
public void setValueAsQueryToken(String theParameter) {

View File

@ -26,6 +26,19 @@ import ${packageBase}.valueset.*;
@ResourceDef(name="${className}")
public class ${className} extends BaseResource implements IResource {
#foreach ( $param in $searchParams )
/**
* Search parameter constant for <b>${param.name}</b>
* <p>
* Description: <b>${param.description}</b><br/>
* Type: <b>${param.type}</b><br/>
* Path: <b>${param.path}</b><br/>
* </p>
*/
public static final String $param.constantName = "${param.name}";
#end
#childExtensionFields( $childExtensionTypes )
#childVars( $children )
#childAccessors( $children )

View File

@ -24,11 +24,12 @@
<module>hapi-fhir-base</module>
<module>hapi-tinder-plugin</module>
<module>hapi-tinder-test</module>
<module>hapi-fhir-structures-dstu</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven_javadoc_plugin_version>2.9.1</maven_javadoc_plugin_version>
<slf4j_version>1.6.6</slf4j_version>
</properties>