use of org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent in project org.hl7.fhir.core by hapifhir.
the class DataElement method setProperty.
@Override
public void setProperty(String name, Base value) throws FHIRException {
if (name.equals("url"))
// UriType
this.url = castToUri(value);
else if (name.equals("identifier"))
this.getIdentifier().add(castToIdentifier(value));
else if (name.equals("version"))
// StringType
this.version = castToString(value);
else if (name.equals("name"))
// StringType
this.name = castToString(value);
else if (name.equals("status"))
// Enumeration<ConformanceResourceStatus>
this.status = new ConformanceResourceStatusEnumFactory().fromType(value);
else if (name.equals("experimental"))
// BooleanType
this.experimental = castToBoolean(value);
else if (name.equals("publisher"))
// StringType
this.publisher = castToString(value);
else if (name.equals("contact"))
this.getContact().add((DataElementContactComponent) value);
else if (name.equals("date"))
// DateTimeType
this.date = castToDateTime(value);
else if (name.equals("useContext"))
this.getUseContext().add(castToCodeableConcept(value));
else if (name.equals("copyright"))
// StringType
this.copyright = castToString(value);
else if (name.equals("stringency"))
// Enumeration<DataElementStringency>
this.stringency = new DataElementStringencyEnumFactory().fromType(value);
else if (name.equals("mapping"))
this.getMapping().add((DataElementMappingComponent) value);
else if (name.equals("element"))
this.getElement().add(castToElementDefinition(value));
else
super.setProperty(name, value);
}
use of org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent in project org.hl7.fhir.core by hapifhir.
the class ResourceUtilities method showDECHeader.
private static DataElement showDECHeader(StringBuilder b, Bundle bundle) {
DataElement meta = new DataElement();
DataElement prototype = (DataElement) bundle.getEntry().get(0).getResource();
meta.setPublisher(prototype.getPublisher());
meta.getContact().addAll(prototype.getContact());
meta.setStatus(prototype.getStatus());
meta.setDate(prototype.getDate());
meta.addElement().getType().addAll(prototype.getElement().get(0).getType());
for (BundleEntryComponent e : bundle.getEntry()) {
DataElement de = (DataElement) e.getResource();
if (!Base.compareDeep(de.getPublisherElement(), meta.getPublisherElement(), false))
meta.setPublisherElement(null);
if (!Base.compareDeep(de.getContact(), meta.getContact(), false))
meta.getContact().clear();
if (!Base.compareDeep(de.getStatusElement(), meta.getStatusElement(), false))
meta.setStatusElement(null);
if (!Base.compareDeep(de.getDateElement(), meta.getDateElement(), false))
meta.setDateElement(null);
if (!Base.compareDeep(de.getElement().get(0).getType(), meta.getElement().get(0).getType(), false))
meta.getElement().get(0).getType().clear();
}
if (meta.hasPublisher() || meta.hasContact() || meta.hasStatus() || meta.hasDate()) /* || meta.hasType() */
{
b.append("<table class=\"grid\">\r\n");
if (meta.hasPublisher())
b.append("<tr><td>Publisher:</td><td>" + meta.getPublisher() + "</td></tr>\r\n");
if (meta.hasContact()) {
b.append("<tr><td>Contacts:</td><td>");
boolean firsti = true;
for (DataElementContactComponent c : meta.getContact()) {
if (firsti)
firsti = false;
else
b.append("<br/>");
if (c.hasName())
b.append(Utilities.escapeXml(c.getName()) + ": ");
boolean first = true;
for (ContactPoint cp : c.getTelecom()) {
if (first)
first = false;
else
b.append(", ");
renderContactPoint(b, cp);
}
}
b.append("</td></tr>\r\n");
}
if (meta.hasStatus())
b.append("<tr><td>Status:</td><td>" + meta.getStatus().toString() + "</td></tr>\r\n");
if (meta.hasDate())
b.append("<tr><td>Date:</td><td>" + meta.getDateElement().asStringValue() + "</td></tr>\r\n");
if (meta.getElement().get(0).hasType())
b.append("<tr><td>Type:</td><td>" + renderType(meta.getElement().get(0).getType()) + "</td></tr>\r\n");
b.append("</table>\r\n");
}
return meta;
}
use of org.hl7.fhir.dstu2.model.DataElement.DataElementContactComponent in project org.hl7.fhir.core by hapifhir.
the class ResourceUtilities method showDECHeader.
private static DataElement showDECHeader(StringBuilder b, Bundle bundle) {
DataElement meta = new DataElement();
DataElement prototype = (DataElement) bundle.getEntry().get(0).getResource();
meta.setPublisher(prototype.getPublisher());
meta.getContact().addAll(prototype.getContact());
meta.setStatus(prototype.getStatus());
meta.setDate(prototype.getDate());
meta.addElement().getType().addAll(prototype.getElement().get(0).getType());
for (BundleEntryComponent e : bundle.getEntry()) {
DataElement de = (DataElement) e.getResource();
if (!Base.compareDeep(de.getPublisherElement(), meta.getPublisherElement(), false))
meta.setPublisherElement(null);
if (!Base.compareDeep(de.getContact(), meta.getContact(), false))
meta.getContact().clear();
if (!Base.compareDeep(de.getStatusElement(), meta.getStatusElement(), false))
meta.setStatusElement(null);
if (!Base.compareDeep(de.getDateElement(), meta.getDateElement(), false))
meta.setDateElement(null);
if (!Base.compareDeep(de.getElement().get(0).getType(), meta.getElement().get(0).getType(), false))
meta.getElement().get(0).getType().clear();
}
if (meta.hasPublisher() || meta.hasContact() || meta.hasStatus() || meta.hasDate()) /* || meta.hasType() */
{
b.append("<table class=\"grid\">\r\n");
if (meta.hasPublisher())
b.append("<tr><td>Publisher:</td><td>" + meta.getPublisher() + "</td></tr>\r\n");
if (meta.hasContact()) {
b.append("<tr><td>Contacts:</td><td>");
boolean firsti = true;
for (DataElementContactComponent c : meta.getContact()) {
if (firsti)
firsti = false;
else
b.append("<br/>");
if (c.hasName())
b.append(Utilities.escapeXml(c.getName()) + ": ");
boolean first = true;
for (ContactPoint cp : c.getTelecom()) {
if (first)
first = false;
else
b.append(", ");
renderContactPoint(b, cp);
}
}
b.append("</td></tr>\r\n");
}
if (meta.hasStatus())
b.append("<tr><td>Status:</td><td>" + meta.getStatus().toString() + "</td></tr>\r\n");
if (meta.hasDate())
b.append("<tr><td>Date:</td><td>" + meta.getDateElement().asStringValue() + "</td></tr>\r\n");
if (meta.getElement().get(0).hasType())
b.append("<tr><td>Type:</td><td>" + renderType(meta.getElement().get(0).getType()) + "</td></tr>\r\n");
b.append("</table>\r\n");
}
return meta;
}
Aggregations