More work on new bundle type
This commit is contained in:
parent
dbc2d374d4
commit
7e1f9cfdbf
|
@ -26,6 +26,7 @@ import ca.uhn.fhir.model.api.BaseIdentifiableElement;
|
|||
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||
import ca.uhn.fhir.model.api.IQueryParameterType;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
import ca.uhn.fhir.rest.param.ParameterUtil;
|
||||
|
||||
|
@ -54,6 +55,20 @@ public abstract class BaseCodingDt extends BaseIdentifiableElement implements IC
|
|||
*/
|
||||
public abstract UriDt getSystemElement();
|
||||
|
||||
/**
|
||||
* Gets the value(s) for <b>display</b> (Representation defined by the system).
|
||||
* creating it if it does
|
||||
* not exist. Will not return <code>null</code>.
|
||||
*
|
||||
* <p>
|
||||
* <b>Definition:</b>
|
||||
* A representation of the meaning of the code in the system, following the rules of the system.
|
||||
* </p>
|
||||
*/
|
||||
public abstract StringDt getDisplayElement();
|
||||
|
||||
public abstract BaseCodingDt setDisplay( String theString);
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
|
@ -51,7 +51,7 @@ import ca.uhn.fhir.util.UrlUtil;
|
|||
* </p>
|
||||
*/
|
||||
@DatatypeDef(name = "id")
|
||||
public class IdDt implements IPrimitiveDatatype<String> {
|
||||
public class IdDt extends UriDt implements IPrimitiveDatatype<String> {
|
||||
|
||||
private String myBaseUrl;
|
||||
private boolean myHaveComponentParts;
|
||||
|
|
|
@ -28,10 +28,9 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import ca.uhn.fhir.model.api.BasePrimitive;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
import ca.uhn.fhir.model.api.annotation.SimpleSetter;
|
||||
import ca.uhn.fhir.parser.DataFormatException;
|
||||
|
||||
@DatatypeDef(name = "uri")
|
||||
public class UriDt extends BasePrimitive<URI> {
|
||||
public class UriDt extends BasePrimitive<String> {
|
||||
|
||||
/**
|
||||
* Creates a new UriDt instance which uses the given OID as the content (and prepends "urn:oid:" to the OID string
|
||||
|
@ -67,8 +66,8 @@ public class UriDt extends BasePrimitive<URI> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected String encode(URI theValue) {
|
||||
return getValue().toASCIIString();
|
||||
protected String encode(String theValue) {
|
||||
return theValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -88,8 +87,8 @@ public class UriDt extends BasePrimitive<URI> {
|
|||
return false;
|
||||
}
|
||||
|
||||
URI normalize = normalize(getValue());
|
||||
URI normalize2 = normalize(other.getValue());
|
||||
String normalize = normalize(getValue());
|
||||
String normalize2 = normalize(other.getValue());
|
||||
return normalize.equals(normalize2);
|
||||
}
|
||||
|
||||
|
@ -107,17 +106,23 @@ public class UriDt extends BasePrimitive<URI> {
|
|||
final int prime = 31;
|
||||
int result = 1;
|
||||
|
||||
URI normalize = normalize(getValue());
|
||||
String normalize = normalize(getValue());
|
||||
result = prime * result + ((normalize == null) ? 0 : normalize.hashCode());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private URI normalize(URI theValue) {
|
||||
private String normalize(String theValue) {
|
||||
if (theValue == null) {
|
||||
return null;
|
||||
}
|
||||
URI retVal = (theValue.normalize());
|
||||
URI retVal;
|
||||
try {
|
||||
retVal = new URI(theValue).normalize();
|
||||
} catch (URISyntaxException e1) {
|
||||
ourLog.debug("Failed to normalize URL '{}', message was: {}", theValue, e1.toString());
|
||||
return theValue;
|
||||
}
|
||||
String urlString = retVal.toString();
|
||||
if (urlString.endsWith("/") && urlString.length() > 1) {
|
||||
try {
|
||||
|
@ -126,16 +131,12 @@ public class UriDt extends BasePrimitive<URI> {
|
|||
ourLog.debug("Failed to normalize URL '{}', message was: {}", urlString, e.toString());
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
return retVal.toASCIIString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected URI parse(String theValue) {
|
||||
try {
|
||||
return new URI(theValue);
|
||||
} catch (URISyntaxException e) {
|
||||
throw new DataFormatException("Unable to parse URI value", e);
|
||||
}
|
||||
protected String parse(String theValue) {
|
||||
return theValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -237,10 +237,10 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
return new LoadPageInternal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IBaseResource> T read(final Class<T> theType, IdDt theId) {
|
||||
return doReadOrVRead(theType, theId, false, null, null);
|
||||
}
|
||||
// @Override
|
||||
// public <T extends IBaseResource> T read(final Class<T> theType, IdDt theId) {
|
||||
// return doReadOrVRead(theType, theId, false, null, null);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public <T extends IBaseResource> T read(Class<T> theType, String theId) {
|
||||
|
@ -248,8 +248,9 @@ public class GenericClient extends BaseClient implements IGenericClient {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <T extends IResource> T read(final Class<T> theType, UriDt theUrl) {
|
||||
return read(theType, new IdDt(theUrl));
|
||||
public <T extends IBaseResource> T read(final Class<T> theType, UriDt theUrl) {
|
||||
IdDt id = theUrl instanceof IdDt ? ((IdDt)theUrl) : new IdDt(theUrl);
|
||||
return doReadOrVRead(theType, id, false, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -151,23 +151,23 @@ public interface IGenericClient {
|
|||
*/
|
||||
IRead read();
|
||||
|
||||
/**
|
||||
* Implementation of the "instance read" method. This method will only ever do a "read" for the latest version of a
|
||||
* given resource instance, even if the ID passed in contains a version. If you wish to request a specific version
|
||||
* of a resource (the "vread" operation), use {@link #vread(Class, IdDt)} instead.
|
||||
* <p>
|
||||
* Note that if an absolute resource ID is passed in (i.e. a URL containing a protocol and host as well as the
|
||||
* resource type and ID) the server base for the client will be ignored, and the URL passed in will be queried.
|
||||
* </p>
|
||||
*
|
||||
* @param theType
|
||||
* The type of resource to load
|
||||
* @param theId
|
||||
* The ID to load, including the resource ID and the resource version ID. Valid values include
|
||||
* "Patient/123/_history/222", or "http://example.com/fhir/Patient/123/_history/222"
|
||||
* @return The resource
|
||||
*/
|
||||
<T extends IBaseResource> T read(Class<T> theType, IdDt theId);
|
||||
// /**
|
||||
// * Implementation of the "instance read" method. This method will only ever do a "read" for the latest version of a
|
||||
// * given resource instance, even if the ID passed in contains a version. If you wish to request a specific version
|
||||
// * of a resource (the "vread" operation), use {@link #vread(Class, IdDt)} instead.
|
||||
// * <p>
|
||||
// * Note that if an absolute resource ID is passed in (i.e. a URL containing a protocol and host as well as the
|
||||
// * resource type and ID) the server base for the client will be ignored, and the URL passed in will be queried.
|
||||
// * </p>
|
||||
// *
|
||||
// * @param theType
|
||||
// * The type of resource to load
|
||||
// * @param theId
|
||||
// * The ID to load, including the resource ID and the resource version ID. Valid values include
|
||||
// * "Patient/123/_history/222", or "http://example.com/fhir/Patient/123/_history/222"
|
||||
// * @return The resource
|
||||
// */
|
||||
// <T extends IBaseResource> T read(Class<T> theType, IdDt theId);
|
||||
|
||||
/**
|
||||
* Implementation of the "instance read" method.
|
||||
|
@ -189,7 +189,7 @@ public interface IGenericClient {
|
|||
* The absolute URL, e.g. "http://example.com/fhir/Patient/123"
|
||||
* @return The returned resource from the server
|
||||
*/
|
||||
<T extends IResource> T read(Class<T> theType, UriDt theUrl);
|
||||
<T extends IBaseResource> T read(Class<T> theType, UriDt theUrl);
|
||||
|
||||
/**
|
||||
* Perform the "read" operation (retrieve the latest version of a resource instance by ID) using an absolute URL.
|
||||
|
|
|
@ -83,7 +83,7 @@ public abstract class BaseMethodBinding<T> implements IClientResponseHandler<T>
|
|||
myMethod = theMethod;
|
||||
myContext = theContext;
|
||||
myProvider = theProvider;
|
||||
myParameters = MethodUtil.getResourceParameters(theMethod, theProvider);
|
||||
myParameters = MethodUtil.getResourceParameters(theContext, theMethod, theProvider);
|
||||
}
|
||||
|
||||
public List<Class<?>> getAllowableParamAnnotations() {
|
||||
|
|
|
@ -496,7 +496,7 @@ public class MethodUtil {
|
|||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<IParameter> getResourceParameters(Method theMethod, Object theProvider) {
|
||||
public static List<IParameter> getResourceParameters(FhirContext theContext, Method theMethod, Object theProvider) {
|
||||
List<IParameter> parameters = new ArrayList<IParameter>();
|
||||
|
||||
Class<?>[] parameterTypes = theMethod.getParameterTypes();
|
||||
|
@ -590,7 +590,7 @@ public class MethodUtil {
|
|||
} else if (nextAnnotation instanceof Sort) {
|
||||
param = new SortParameter();
|
||||
} else if (nextAnnotation instanceof TransactionParam) {
|
||||
param = new TransactionParamBinder();
|
||||
param = new TransactionParamBinder(theContext);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -21,13 +21,17 @@ package ca.uhn.fhir.rest.method;
|
|||
*/
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hl7.fhir.instance.model.IBaseResource;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.RuntimeResourceDefinition;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.BundleEntry;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
|
@ -38,13 +42,16 @@ import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
|||
class TransactionParamBinder implements IParameter {
|
||||
|
||||
private boolean myParamIsBundle;
|
||||
private FhirContext myContext;
|
||||
private boolean myParamIsResource;
|
||||
|
||||
public TransactionParamBinder() {
|
||||
public TransactionParamBinder(FhirContext theContext) {
|
||||
myContext = theContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translateClientArgumentIntoQueryArgument(FhirContext theContext, Object theSourceClientArgument, Map<String, List<String>> theTargetQueryArguments) throws InternalErrorException {
|
||||
// TODO Auto-generated method stub
|
||||
// nothing
|
||||
|
||||
}
|
||||
|
||||
|
@ -73,20 +80,31 @@ class TransactionParamBinder implements IParameter {
|
|||
if (theParameterType.equals(Bundle.class)) {
|
||||
myParamIsBundle=true;
|
||||
if (theInnerCollectionType!=null) {
|
||||
throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + TransactionParam.class.getName() + " but is not of type List<" + IResource.class.getCanonicalName()
|
||||
+ "> or Bundle");
|
||||
throw new ConfigurationException(createParameterTypeError(theMethod));
|
||||
}
|
||||
} else if (Modifier.isInterface(theParameterType.getModifiers()) == false && IBaseResource.class.isAssignableFrom(theParameterType)) {
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<? extends IBaseResource> parameterType = (Class<? extends IBaseResource>) theParameterType;
|
||||
RuntimeResourceDefinition def = myContext.getResourceDefinition(parameterType);
|
||||
if ("Bundle".equals(def.getName())) {
|
||||
myParamIsResource = true;
|
||||
} else {
|
||||
throw new ConfigurationException(createParameterTypeError(theMethod));
|
||||
}
|
||||
} else {
|
||||
myParamIsBundle=false;
|
||||
if (theInnerCollectionType.equals(List.class) == false) {
|
||||
throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + TransactionParam.class.getName() + " but is not of type List<" + IResource.class.getCanonicalName()
|
||||
+ "> or Bundle");
|
||||
throw new ConfigurationException(createParameterTypeError(theMethod));
|
||||
}
|
||||
if (theParameterType.equals(IResource.class) == false) {
|
||||
throw new ConfigurationException("Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + TransactionParam.class.getName() + " but is not of type List<" + IResource.class.getCanonicalName()
|
||||
+ "> or Bundle");
|
||||
throw new ConfigurationException(createParameterTypeError(theMethod));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String createParameterTypeError(Method theMethod) {
|
||||
return "Method '" + theMethod.getName() + "' in type '" + theMethod.getDeclaringClass().getCanonicalName() + "' is annotated with @" + TransactionParam.class.getName() + " but is not of type List<" + IResource.class.getCanonicalName()
|
||||
+ "> or Bundle";
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -361,6 +361,11 @@ public class InternalCodingDt
|
|||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public StringDt getDisplayElement() {
|
||||
return getDisplay();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@ package ca.uhn.fhir.rest.server;
|
|||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
@ -23,11 +21,10 @@ import org.junit.Test;
|
|||
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle.Entry;
|
||||
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.HTTPVerbEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.InstantDt;
|
||||
import ca.uhn.fhir.rest.annotation.Transaction;
|
||||
|
@ -39,6 +36,11 @@ import ca.uhn.fhir.util.PortUtil;
|
|||
*/
|
||||
public class TransactionWithBundleResourceParamTest {
|
||||
|
||||
@Test
|
||||
public void testIt() {
|
||||
|
||||
}
|
||||
|
||||
// private static CloseableHttpClient ourClient;
|
||||
// private static FhirContext ourCtx = new FhirContext();
|
||||
// private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(TransactionWithBundleResourceParamTest.class);
|
||||
|
@ -47,8 +49,6 @@ public class TransactionWithBundleResourceParamTest {
|
|||
//
|
||||
// private static Server ourServer;
|
||||
//
|
||||
//
|
||||
//
|
||||
// @Before
|
||||
// public void before() {
|
||||
// ourReturnOperationOutcome = false;
|
||||
|
@ -72,8 +72,8 @@ public class TransactionWithBundleResourceParamTest {
|
|||
// entry.setResource(p2);
|
||||
//
|
||||
// Entry deletedEntry = b.addEntry();
|
||||
// deletedEntry.getTransaction().getMethodElement().setDeletedResourceId(new IdDt("Patient/3"));
|
||||
// deletedEntry.setDeleted(nowInstant);
|
||||
// deletedEntry.getTransaction().setMethod(HTTPVerbEnum.DELETE);
|
||||
// deletedEntry.getTransaction().setUrl("http://base.com/Patient/123");
|
||||
//
|
||||
// String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(b);
|
||||
// ourLog.info(bundleString);
|
||||
|
@ -82,31 +82,25 @@ public class TransactionWithBundleResourceParamTest {
|
|||
// httpPost.addHeader("Accept", Constants.CT_ATOM_XML + "; pretty=true");
|
||||
// httpPost.setEntity(new StringEntity(bundleString, ContentType.create(Constants.CT_ATOM_XML, "UTF-8")));
|
||||
// HttpResponse status = ourClient.execute(httpPost);
|
||||
// String responseContent = IOUtils.toString(status.getEntity().getContent()); IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
// String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
// IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
//
|
||||
// assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
//
|
||||
// ourLog.info(responseContent);
|
||||
//
|
||||
// Bundle bundle = ourCtx.newXmlParser().parseResource(Bundle.class, responseContent);
|
||||
// assertEquals(3, bundle.size());
|
||||
// assertEquals(3, bundle.getEntry().size());
|
||||
//
|
||||
// BundleEntry entry0 = bundle.getEntries().get(0);
|
||||
// Entry entry0 = bundle.getEntry().get(0);
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getResource().getId().getValue());
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getLinkSelf().getValue());
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/1", entry0.getLinkAlternate().getValue());
|
||||
//
|
||||
// BundleEntry entry1 = bundle.getEntries().get(1);
|
||||
// Entry entry1 = bundle.getEntry().get(1);
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getResource().getId().getValue());
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getLinkSelf().getValue());
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/2", entry1.getLinkAlternate().getValue());
|
||||
//
|
||||
// BundleEntry entry2 = bundle.getEntries().get(2);
|
||||
// Entry entry2 = bundle.getEntry().get(2);
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getResource().getId().getValue());
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getLinkSelf().getValue());
|
||||
// assertEquals(nowInstant.getValueAsString(), entry2.getDeletedAt().getValueAsString());
|
||||
//}
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Test
|
||||
// public void testTransactionWithOperationOutcome() throws Exception {
|
||||
|
@ -117,7 +111,7 @@ public class TransactionWithBundleResourceParamTest {
|
|||
//
|
||||
// Patient p1 = new Patient();
|
||||
// p1.addName().addFamily("Family1");
|
||||
// BundleEntry entry = b.addEntry();
|
||||
// Entry entry = b.addEntry();
|
||||
// p1.getId().setValue("1");
|
||||
// entry.setResource(p1);
|
||||
//
|
||||
|
@ -127,44 +121,38 @@ public class TransactionWithBundleResourceParamTest {
|
|||
// p2.getId().setValue("2");
|
||||
// entry.setResource(p2);
|
||||
//
|
||||
// BundleEntry deletedEntry = b.addEntry();
|
||||
// deletedEntry.setDeletedResourceId(new IdDt("Patient/3"));
|
||||
// deletedEntry.setDeleted(nowInstant);
|
||||
// Entry deletedEntry = b.addEntry();
|
||||
// deletedEntry.getTransaction().setMethod(HTTPVerbEnum.DELETE);
|
||||
// deletedEntry.getTransaction().setUrl(new IdDt("Patient/3"));
|
||||
//
|
||||
// String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
|
||||
// String bundleString = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(b);
|
||||
// ourLog.info(bundleString);
|
||||
//
|
||||
// HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/");
|
||||
// httpPost.addHeader("Accept", Constants.CT_ATOM_XML + "; pretty=true");
|
||||
// httpPost.setEntity(new StringEntity(bundleString, ContentType.create(Constants.CT_ATOM_XML, "UTF-8")));
|
||||
// HttpResponse status = ourClient.execute(httpPost);
|
||||
// String responseContent = IOUtils.toString(status.getEntity().getContent()); IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
// String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
// IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
//
|
||||
// assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
//
|
||||
// ourLog.info(responseContent);
|
||||
//
|
||||
// Bundle bundle = new FhirContext().newXmlParser().parseBundle(responseContent);
|
||||
// assertEquals(4, bundle.size());
|
||||
// Bundle bundle = new FhirContext().newXmlParser().parseResource(Bundle.class, responseContent);
|
||||
// assertEquals(4, bundle.getEntry().size());
|
||||
//
|
||||
// assertEquals(OperationOutcome.class, bundle.getEntries().get(0).getResource().getClass());
|
||||
// assertEquals("OperationOutcome (no ID)", bundle.getEntries().get(0).getTitle().getValue());
|
||||
// assertEquals(OperationOutcome.class, bundle.getEntry().get(0).getResource().getClass());
|
||||
//
|
||||
// BundleEntry entry0 = bundle.getEntries().get(1);
|
||||
// Entry entry0 = bundle.getEntry().get(1);
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getResource().getId().getValue());
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/81/_history/91", entry0.getLinkSelf().getValue());
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/1", entry0.getLinkAlternate().getValue());
|
||||
//
|
||||
// BundleEntry entry1 = bundle.getEntries().get(2);
|
||||
// Entry entry1 = bundle.getEntry().get(2);
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getResource().getId().getValue());
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/82/_history/92", entry1.getLinkSelf().getValue());
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/2", entry1.getLinkAlternate().getValue());
|
||||
//
|
||||
// BundleEntry entry2 = bundle.getEntries().get(3);
|
||||
// Entry entry2 = bundle.getEntry().get(3);
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getResource().getId().getValue());
|
||||
// assertEquals("http://localhost:" + ourPort + "/Patient/3/_history/93", entry2.getLinkSelf().getValue());
|
||||
// assertEquals(nowInstant.getValueAsString(), entry2.getDeletedAt().getValueAsString());
|
||||
//}
|
||||
// }
|
||||
//
|
||||
// @AfterClass
|
||||
// public static void afterClass() throws Exception {
|
||||
|
@ -197,43 +185,35 @@ public class TransactionWithBundleResourceParamTest {
|
|||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Created by dsotnikov on 2/25/2014.
|
||||
// */
|
||||
// public static class DummyProvider {
|
||||
// public static class DummyProvider {
|
||||
//
|
||||
// @Transaction
|
||||
// public List<IResource> transaction(@TransactionParam Bundle theResources) {
|
||||
// int index=1;
|
||||
// for (IResource next : theResources.toListOfResources()) {
|
||||
// String newId = "8"+Integer.toString(index);
|
||||
// if (next.getResourceMetadata().containsKey(ResourceMetadataKeyEnum.DELETED_AT)) {
|
||||
// newId = next.getId().getIdPart();
|
||||
// }
|
||||
// next.setId(new IdDt("Patient", newId, "9"+Integer.toString(index)));
|
||||
// index++;
|
||||
// }
|
||||
// public Bundle transaction(@TransactionParam Bundle theResources) {
|
||||
// Bundle retVal = new Bundle();
|
||||
//
|
||||
// List<IResource> retVal = theResources.toListOfResources();
|
||||
// if (ourReturnOperationOutcome) {
|
||||
// retVal = new ArrayList<IResource>();
|
||||
// OperationOutcome oo = new OperationOutcome();
|
||||
// oo.addIssue().setDetails("AAAAA");
|
||||
// retVal.add(oo);
|
||||
// retVal.addAll(theResources.toListOfResources());
|
||||
// retVal.addEntry().setResource(oo);
|
||||
// }
|
||||
//
|
||||
// int index = 1;
|
||||
// for (Entry nextEntry : theResources.getEntry()) {
|
||||
// String newId = "8" + Integer.toString(index);
|
||||
// if (nextEntry.getTransaction().getMethodElement().getValueAsEnum() == HTTPVerbEnum.DELETE) {
|
||||
// newId = new IdDt(nextEntry.getTransaction().getUrlElement()).getIdPart();
|
||||
// }
|
||||
// IdDt newIdDt = (new IdDt("Patient", newId, "9" + Integer.toString(index)));
|
||||
// retVal.addEntry().getTransactionResponse().setLocation(newIdDt.getValue());
|
||||
// index++;
|
||||
// }
|
||||
//
|
||||
// return retVal;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// }
|
||||
|
||||
@Test
|
||||
public void testId() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,36 +16,16 @@
|
|||
|
||||
package ca.uhn.fhir.model.dstu.composite;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import java.util.*;
|
||||
import ca.uhn.fhir.model.api.*;
|
||||
import ca.uhn.fhir.model.primitive.*;
|
||||
import ca.uhn.fhir.model.api.annotation.*;
|
||||
import ca.uhn.fhir.model.base.composite.*;
|
||||
import java.util.List;
|
||||
|
||||
import ca.uhn.fhir.model.dstu.valueset.AddressUseEnum;
|
||||
import ca.uhn.fhir.model.dstu.composite.CodingDt;
|
||||
import ca.uhn.fhir.model.dstu.valueset.ContactSystemEnum;
|
||||
import ca.uhn.fhir.model.dstu.valueset.ContactUseEnum;
|
||||
import ca.uhn.fhir.model.dstu.valueset.EventTimingEnum;
|
||||
import ca.uhn.fhir.model.dstu.valueset.IdentifierUseEnum;
|
||||
import ca.uhn.fhir.model.dstu.valueset.NameUseEnum;
|
||||
import ca.uhn.fhir.model.dstu.resource.Organization;
|
||||
import ca.uhn.fhir.model.dstu.composite.PeriodDt;
|
||||
import ca.uhn.fhir.model.dstu.valueset.QuantityCompararatorEnum;
|
||||
import ca.uhn.fhir.model.dstu.composite.QuantityDt;
|
||||
import ca.uhn.fhir.model.api.TemporalPrecisionEnum;
|
||||
import ca.uhn.fhir.model.dstu.valueset.UnitsOfTimeEnum;
|
||||
import ca.uhn.fhir.model.dstu.resource.ValueSet;
|
||||
import ca.uhn.fhir.model.dstu.composite.ResourceReferenceDt;
|
||||
import ca.uhn.fhir.model.primitive.Base64BinaryDt;
|
||||
import ca.uhn.fhir.model.api.ICompositeDatatype;
|
||||
import ca.uhn.fhir.model.api.IElement;
|
||||
import ca.uhn.fhir.model.api.annotation.Child;
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
import ca.uhn.fhir.model.api.annotation.Description;
|
||||
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
|
||||
import ca.uhn.fhir.model.primitive.BooleanDt;
|
||||
import ca.uhn.fhir.model.primitive.BoundCodeDt;
|
||||
import ca.uhn.fhir.model.primitive.CodeDt;
|
||||
import ca.uhn.fhir.model.primitive.DateTimeDt;
|
||||
import ca.uhn.fhir.model.primitive.DecimalDt;
|
||||
import ca.uhn.fhir.model.primitive.IntegerDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.model.primitive.UriDt;
|
||||
|
||||
|
|
Loading…
Reference in New Issue