/** * Add a new tag instance * * @param theScheme * The tag scheme * @param theTerm * The tag term * @param theLabel * The tag label * @return Returns the newly created tag instance. Note that the tag is added to the list by this method, so you * generally do not need to interact directly with the added tag. */ public Tag addTag(String theScheme, String theTerm, String theLabel) { Tag retVal = new Tag(theScheme, theTerm, theLabel); add(retVal); myOrderedTags = null; return retVal; }
public String toHeaderValue() { StringBuilder b = new StringBuilder(); b.append(this.getTerm()); if (isNotBlank(this.getLabel())) { b.append("; label=\"").append(this.getLabel()).append('"'); } if (isNotBlank(this.getScheme())) { b.append("; scheme=\"").append(this.getScheme()).append('"'); } return b.toString(); }
@Override public boolean isEmpty() { for (Tag next : myTagSet) { if (next.isEmpty() == false) { return false; } } return true; }
@Override public String getSystem() { return getScheme(); }
@Override public String getCode() { return getTerm(); }
@Override public String getDisplay() { return getLabel(); }
@Override public IBaseCoding setDisplay(String theLabel) { setLabel(theLabel); return this; }
beginArray(theEventWriter, "tag"); for (Tag tag : tags) { if (tag.isEmpty()) { continue; writeOptionalTagWithTextNode(theEventWriter, "system", tag.getScheme()); writeOptionalTagWithTextNode(theEventWriter, "code", tag.getTerm()); writeOptionalTagWithTextNode(theEventWriter, "display", tag.getLabel()); theEventWriter.endObject();
@SuppressWarnings("unused") public void getResourceTags() { // START SNIPPET: getResourceTags IGenericClient client = FhirContext.forDstu2().newRestfulGenericClient("http://fhir.healthintersections.com.au/open"); Patient p = client.read(Patient.class, "1"); // Retrieve the list of tags from the resource metadata TagList tags = ResourceMetadataKeyEnum.TAG_LIST.get(p); // tags may be null if no tags were read in if (tags == null) { System.out.println("No tags!"); } else { // You may iterate over all the tags for (Tag next : tags) { System.out.println(next.getScheme() + " - " + next.getTerm()); } // You may also get a list of tags matching a given scheme List<Tag> someTags = tags.getTagsWithScheme("http://hl7.org/fhir/tag"); // Or a specific tag (by scheme and term) Tag specificTag = tags.getTag("http://hl7.org/fhir/tag", "http://foo"); } // END SNIPPET: getResourceTags }
public List<Tag> getTagsWithScheme(String theScheme) { ArrayList<Tag> retVal = new ArrayList<Tag>(); for (Tag next : this) { if (theScheme.equals(next.getScheme())) { retVal.add(next); } } return retVal; }
@Override public String getCode() { return getTerm(); }
@Override public String getDisplay() { return getLabel(); }
@Override public IBaseCoding setDisplay(String theLabel) { setLabel(theLabel); return this; }
/** * Add a new tag instance * * @param theScheme * The tag scheme (the system) * @param theTerm * The tag term (the code) * @return Returns the newly created tag instance. Note that the tag is added to the list by this method, so you * generally do not need to interact directly with the added tag. */ public Tag addTag(String theScheme, String theTerm) { Tag retVal = new Tag(theScheme, theTerm); add(retVal); myOrderedTags = null; return retVal; }
@Override public String getSystem() { return getScheme(); }