Java源码示例:org.hl7.fhir.instance.model.api.IIdType
示例1
@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;
}
示例2
@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;
}
示例3
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;
}
示例4
/**
* 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;
}
示例5
public BaseReference(IIdType theReference) {
if (theReference != null) {
setReference(theReference.getValue());
} else {
setReference(null);
}
}
示例6
/**
* 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());
}
}
}
示例7
/**
* @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;
}
示例8
public BaseReference(IIdType theReference) {
if (theReference != null) {
setReference(theReference.getValue());
} else {
setReference(null);
}
}
示例9
/**
* 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());
}
}
}
示例10
/**
* @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;
}
示例11
/**
* @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;
}
示例12
/**
* 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;
}
示例13
public BaseReference(IIdType theReference) {
if (theReference != null) {
setReference(theReference.getValue());
} else {
setReference(null);
}
}
示例14
/**
* @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;
}
示例15
/**
* 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;
}
示例16
public BaseReference(IIdType theReference) {
if (theReference != null) {
setReference(theReference.getValue());
} else {
setReference(null);
}
}
示例17
/**
* 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());
}
}
}
示例18
/**
* @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;
}
示例19
@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());
}
示例20
@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());
}
示例21
@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());
}
示例22
@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());
}
示例23
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);
}
示例24
protected void composeString(String name, IIdType value) throws IOException {
composeString(name, new StringType(value.getValue()));
}
示例25
protected void composeStringCore(String name, IIdType value, boolean inArray) throws IOException {
composeStringCore(name, new StringType(value.getValue()), inArray);
}
示例26
protected void composeStringExtras(String name, IIdType value, boolean inArray) throws IOException {
composeStringExtras(name, new StringType(value.getValue()), inArray);
}
示例27
protected void parseElementProperties(JsonObject theAsJsonObject, IIdType theReferenceElement) throws FHIRFormatError, IOException {
parseElementProperties(theAsJsonObject, (Element)theReferenceElement);
}
示例28
@Override
public IIdType getReferenceElement() {
return new IdType(getReference());
}
示例29
protected void composeString(String name, IIdType value) throws IOException {
composeString(name, new StringType(value.getValue()));
}
示例30
protected void composeStringCore(String name, IIdType value, boolean inArray) throws IOException {
composeStringCore(name, new StringType(value.getValue()), inArray);
}