org.hl7.fhir.instance.model.api.IIdType Java Examples
The following examples show how to use
org.hl7.fhir.instance.model.api.IIdType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IdType.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@Override public IIdType setParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart) { if (isNotBlank(theVersionIdPart)) { Validate.notBlank(theResourceType, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated"); Validate.notBlank(theIdPart, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated"); } if (isNotBlank(theBaseUrl) && isNotBlank(theIdPart)) { Validate.notBlank(theResourceType, "If theBaseUrl is populated and theIdPart is populated, theResourceType must be populated"); } setValue(null); myBaseUrl = theBaseUrl; myResourceType = theResourceType; myUnqualifiedId = theIdPart; myUnqualifiedVersionId = StringUtils.defaultIfBlank(theVersionIdPart, null); myHaveComponentParts = true; return this; }
Example #2
Source File: IdType.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
@Override public IIdType setParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart) { if (isNotBlank(theVersionIdPart)) { Validate.notBlank(theResourceType, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated"); Validate.notBlank(theIdPart, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated"); } if (isNotBlank(theBaseUrl) && isNotBlank(theIdPart)) { Validate.notBlank(theResourceType, "If theBaseUrl is populated and theIdPart is populated, theResourceType must be populated"); } setValue(null); myBaseUrl = theBaseUrl; myResourceType = theResourceType; myUnqualifiedId = theIdPart; myUnqualifiedVersionId = StringUtils.defaultIfBlank(theVersionIdPart, null); myHaveComponentParts = true; return this; }
Example #3
Source File: IdType.java From org.hl7.fhir.core with Apache License 2.0 | 6 votes |
public IIdType setParts(String theBaseUrl, String theResourceType, String theIdPart, String theVersionIdPart) { if (isNotBlank(theVersionIdPart)) { Validate.notBlank(theResourceType, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated"); Validate.notBlank(theIdPart, "If theVersionIdPart is populated, theResourceType and theIdPart must be populated"); } if (isNotBlank(theBaseUrl) && isNotBlank(theIdPart)) { Validate.notBlank(theResourceType, "If theBaseUrl is populated and theIdPart is populated, theResourceType must be populated"); } setValue(null); myBaseUrl = theBaseUrl; myResourceType = theResourceType; myUnqualifiedId = theIdPart; myUnqualifiedVersionId = StringUtils.defaultIfBlank(theVersionIdPart, null); myHaveComponentParts = true; return this; }
Example #4
Source File: BaseReference.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public BaseReference(IIdType theReference) { if (theReference != null) { setReference(theReference.getValue()); } else { setReference(null); } }
Example #5
Source File: Reference.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * Convenience setter which sets the reference to the complete {@link IIdType#getValue() value} of the given * reference. * * @param theReference The reference, or <code>null</code> * @return * @return Returns a reference to this */ public Reference setReferenceElement(IIdType theReference) { if (theReference != null) { setReference(theReference.getValue()); } else { setReference(null); } return this; }
Example #6
Source File: BaseResource.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * @param value The logical id of the resource, as used in the url for the resoure. Once assigned, this value never changes. */ public BaseResource setId(IIdType value) { if (value == null) { setIdElement((IdType)null); } else if (value instanceof IdType) { setIdElement((IdType) value); } else { setIdElement(new IdType(value.getValue())); } return this; }
Example #7
Source File: BaseResource.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * @param value The logical id of the resource, as used in the url for the resoure. Once assigned, this value never changes. */ public BaseResource setId(IIdType value) { if (value == null) { setIdElement((IdType)null); } else if (value instanceof IdType) { setIdElement((IdType) value); } else { setIdElement(new IdType(value.getValue())); } return this; }
Example #8
Source File: Reference.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * Convenience setter which sets the reference to the complete {@link IIdType#getValue() value} of the given * reference. * * @param theReference The reference, or <code>null</code> * @return * @return Returns a reference to this */ public Reference setReferenceElement(IIdType theReference) { if (theReference != null) { setReference(theReference.getValue()); } else { setReference(null); } return this; }
Example #9
Source File: BaseReference.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public BaseReference(IIdType theReference) { if (theReference != null) { setReference(theReference.getValue()); } else { setReference(null); } }
Example #10
Source File: IdType.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * Retrieves the ID from the given resource instance */ public static IdType of(IBaseResource theResouce) { if (theResouce == null) { throw new NullPointerException("theResource can not be null"); } else { IIdType retVal = theResouce.getIdElement(); if (retVal == null) { return null; } else if (retVal instanceof IdType) { return (IdType) retVal; } else { return new IdType(retVal.getValue()); } } }
Example #11
Source File: BaseResource.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * @param value The logical id of the resource, as used in the url for the resoure. Once assigned, this value never changes. */ public BaseResource setId(IIdType value) { if (value == null) { setIdElement((IdType)null); } else if (value instanceof IdType) { setIdElement((IdType) value); } else { setIdElement(new IdType(value.getValue())); } return this; }
Example #12
Source File: IdType.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * Retrieves the ID from the given resource instance */ public static IdType of(IBaseResource theResouce) { if (theResouce == null) { throw new NullPointerException("theResource can not be null"); } else { IIdType retVal = theResouce.getIdElement(); if (retVal == null) { return null; } else if (retVal instanceof IdType) { return (IdType) retVal; } else { return new IdType(retVal.getValue()); } } }
Example #13
Source File: BaseReference.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public BaseReference(IIdType theReference) { if (theReference != null) { setReference(theReference.getValue()); } else { setReference(null); } }
Example #14
Source File: BaseResource.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * @param value The logical id of the resource, as used in the url for the resoure. Once assigned, this value never changes. */ public BaseResource setId(IIdType value) { if (value == null) { setIdElement((IdType)null); } else if (value instanceof IdType) { setIdElement((IdType) value); } else { setIdElement(new IdType(value.getValue())); } return this; }
Example #15
Source File: ExampleServerDstu3IT.java From hapi-fhir-jpaserver-starter with Apache License 2.0 | 5 votes |
@Test public void testCreateAndRead() { ourLog.info("Base URL is: " + HapiProperties.getServerAddress()); String methodName = "testCreateResourceConditional"; Patient pt = new Patient(); pt.addName().setFamily(methodName); IIdType id = ourClient.create().resource(pt).execute().getId(); Patient pt2 = ourClient.read().resource(Patient.class).withId(id).execute(); assertEquals(methodName, pt2.getName().get(0).getFamily()); }
Example #16
Source File: ExampleServerR4IT.java From hapi-fhir-jpaserver-starter with Apache License 2.0 | 5 votes |
@Test public void testCreateAndRead() { ourLog.info("Base URL is: " + HapiProperties.getServerAddress()); String methodName = "testCreateResourceConditional"; Patient pt = new Patient(); pt.addName().setFamily(methodName); IIdType id = ourClient.create().resource(pt).execute().getId(); Patient pt2 = ourClient.read().resource(Patient.class).withId(id).execute(); assertEquals(methodName, pt2.getName().get(0).getFamily()); }
Example #17
Source File: BaseResource.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * @param value The logical id of the resource, as used in the url for the resoure. Once assigned, this value never changes. */ public BaseResource setId(IIdType value) { if (value == null) { setIdElement((IdType)null); } else if (value instanceof IdType) { setIdElement((IdType) value); } else { setIdElement(new IdType(value.getValue())); } return this; }
Example #18
Source File: IdType.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * Retrieves the ID from the given resource instance */ public static IdType of(IBaseResource theResouce) { if (theResouce == null) { throw new NullPointerException("theResource can not be null"); } else { IIdType retVal = theResouce.getIdElement(); if (retVal == null) { return null; } else if (retVal instanceof IdType) { return (IdType) retVal; } else { return new IdType(retVal.getValue()); } } }
Example #19
Source File: TestApplicationHints.java From fhirstarters with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void step3_create_patient() { // Create a patient Patient newPatient = new Patient(); // Populate the patient with fake information newPatient .addName() .setFamily("DevDays2015") .addGiven("John") .addGiven("Q"); newPatient .addIdentifier() .setSystem("http://acme.org/mrn") .setValue("1234567"); newPatient.setGender(Enumerations.AdministrativeGender.MALE); newPatient.setBirthDateElement(new DateType("2015-11-18")); // Create a client FhirContext ctx = FhirContext.forDstu3(); IGenericClient client = ctx.newRestfulGenericClient("http://fhirtest.uhn.ca/baseDstu3"); // Create the resource on the server MethodOutcome outcome = client .create() .resource(newPatient) .execute(); // Log the ID that the server assigned IIdType id = outcome.getId(); System.out.println("Created patient, got ID: " + id); }
Example #20
Source File: BaseReference.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
public BaseReference(IIdType theReference) { if (theReference != null) { setReference(theReference.getValue()); } else { setReference(null); } }
Example #21
Source File: Reference.java From org.hl7.fhir.core with Apache License 2.0 | 5 votes |
/** * Convenience setter which sets the reference to the complete {@link IIdType#getValue() value} of the given * reference. * * @param theReference The reference, or <code>null</code> * @return * @return Returns a reference to this */ public Reference setReferenceElement(IIdType theReference) { if (theReference != null) { setReference(theReference.getValue()); } else { setReference(null); } return this; }
Example #22
Source File: ExampleServerR5IT.java From hapi-fhir-jpaserver-starter with Apache License 2.0 | 5 votes |
@Test public void testCreateAndRead() { ourLog.info("Base URL is: " + HapiProperties.getServerAddress()); String methodName = "testCreateResourceConditional"; Patient pt = new Patient(); pt.addName().setFamily(methodName); IIdType id = ourClient.create().resource(pt).execute().getId(); Patient pt2 = ourClient.read().resource(Patient.class).withId(id).execute(); assertEquals(methodName, pt2.getName().get(0).getFamily()); }
Example #23
Source File: ExampleServerDstu2IT.java From hapi-fhir-jpaserver-starter with Apache License 2.0 | 5 votes |
@Test public void testCreateAndRead() { ourLog.info("Base URL is: " + HapiProperties.getServerAddress()); String methodName = "testCreateResourceConditional"; Patient pt = new Patient(); pt.addName().addFamily(methodName); IIdType id = ourClient.create().resource(pt).execute().getId(); Patient pt2 = ourClient.read().resource(Patient.class).withId(id).execute(); assertEquals(methodName, pt2.getName().get(0).getFamily().get(0).getValue()); }
Example #24
Source File: JsonParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
protected void composeStringCore(String name, IIdType value, boolean inArray) throws IOException { composeStringCore(name, new StringType(value.getValue()), inArray); }
Example #25
Source File: BaseReference.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
@Override public IIdType getReferenceElement() { return new IdType(getReference()); }
Example #26
Source File: XmlParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
protected void composeString(String name, IIdType value) throws IOException { composeString(name, new StringType(value.getValue())); }
Example #27
Source File: JsonParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
protected void composeStringCore(String name, IIdType value, boolean inArray) throws IOException { composeStringCore(name, new StringType(value.getValue()), inArray); }
Example #28
Source File: JsonParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
protected void composeStringExtras(String name, IIdType value, boolean inArray) throws IOException { composeStringExtras(name, new StringType(value.getValue()), inArray); }
Example #29
Source File: ExampleServerR5IT.java From hapi-fhir-jpaserver-starter with Apache License 2.0 | 4 votes |
@Test public void testWebsocketSubscription() throws Exception { /* * Create topic */ SubscriptionTopic topic = new SubscriptionTopic(); topic.getResourceTrigger().getQueryCriteria().setCurrent("Observation?status=final"); /* * Create subscription */ Subscription subscription = new Subscription(); subscription.getTopic().setResource(topic); subscription.setReason("Monitor new neonatal function (note, age will be determined by the monitor)"); subscription.setStatus(Enumerations.SubscriptionState.REQUESTED); subscription.getChannelType() .setSystem("http://terminology.hl7.org/CodeSystem/subscription-channel-type") .setCode("websocket"); subscription.setContentType("application/json"); MethodOutcome methodOutcome = ourClient.create().resource(subscription).execute(); IIdType mySubscriptionId = methodOutcome.getId(); // Wait for the subscription to be activated waitForSize(1, () -> ourClient.search().forResource(Subscription.class).where(Subscription.STATUS.exactly().code("active")).cacheControl(new CacheControlDirective().setNoCache(true)).returnBundle(Bundle.class).execute().getEntry().size()); /* * Attach websocket */ WebSocketClient myWebSocketClient = new WebSocketClient(); SocketImplementation mySocketImplementation = new SocketImplementation(mySubscriptionId.getIdPart(), EncodingEnum.JSON); myWebSocketClient.start(); URI echoUri = new URI("ws://localhost:" + ourPort + "/hapi-fhir-jpaserver/websocket"); ClientUpgradeRequest request = new ClientUpgradeRequest(); ourLog.info("Connecting to : {}", echoUri); Future<Session> connection = myWebSocketClient.connect(mySocketImplementation, echoUri, request); Session session = connection.get(2, TimeUnit.SECONDS); ourLog.info("Connected to WS: {}", session.isOpen()); /* * Create a matching resource */ Observation obs = new Observation(); obs.setStatus(Enumerations.ObservationStatus.FINAL); ourClient.create().resource(obs).execute(); // Give some time for the subscription to deliver Thread.sleep(2000); /* * Ensure that we receive a ping on the websocket */ waitForSize(1, () -> mySocketImplementation.myPingCount); /* * Clean up */ ourClient.delete().resourceById(mySubscriptionId).execute(); }
Example #30
Source File: JsonParserBase.java From org.hl7.fhir.core with Apache License 2.0 | 4 votes |
protected void parseElementProperties(JsonObject theAsJsonObject, IIdType theReferenceElement) throws FHIRFormatError, IOException { parseElementProperties(theAsJsonObject, (Element)theReferenceElement); }