protected TagList getMetaTagsForEncoding(IResource theIResource) { TagList tags = ResourceMetadataKeyEnum.TAG_LIST.get(theIResource); if (shouldAddSubsettedTag()) { tags = new TagList(tags); tags.add(new Tag(getSubsettedCodeSystem(), Constants.TAG_SUBSETTED_CODE, subsetDescription())); } return tags; }
@Search public List<Patient> getAllPatients() { ArrayList<Patient> retVal = new ArrayList<Patient>(); // Create a patient to return Patient patient = new Patient(); patient.setId("Patient/123"); patient.addName().addFamily("Smith").addGiven("John"); // Create a tag list and add it to the resource TagList tags = new TagList(); ResourceMetadataKeyEnum.TAG_LIST.put(patient, tags); // Add some tags to the list tags.addTag(Tag.HL7_ORG_FHIR_TAG, "http://foo/tag1.html", "Some tag"); tags.addTag(Tag.HL7_ORG_FHIR_TAG, "http://foo/tag2.html", "Another tag"); return retVal; } // END SNIPPET: serverMethod
@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 }
TagList tagList = new TagList(); List<IBaseCoding> securityLabels = new ArrayList<>(); List<IdDt> profiles = new ArrayList<>(); break; case TAG: tagList.add(new Tag(next.getTag().getSystem(), next.getTag().getCode(), next.getTag().getDisplay())); break; if (tagList.size() > 0) { ResourceMetadataKeyEnum.TAG_LIST.put(res, tagList);
/** * Copy constructor */ public TagList(TagList theTags) { if (theTags != null) { for (Tag next : theTags) { add(next); } } }
/** * @deprecated Tags wil become immutable in a future release of HAPI, so {@link #addTag(String, String, String)} * should be used instead */ @Deprecated public Tag addTag() { myOrderedTags = null; return addTag(null, null, null); }
@Override public String toString() { StringBuilder b = new StringBuilder(); b.append("TagList[").append(size()).append(" tag(s)]"); for (Tag next : this) { b.append("\n * ").append(next.toString()); } return b.toString(); }
TagList tagList = new TagList(); List<IBaseCoding> securityLabels = new ArrayList<>(); List<IdDt> profiles = new ArrayList<>(); break; case TAG: tagList.add(new Tag(next.getTag().getSystem(), next.getTag().getCode(), next.getTag().getDisplay())); break; if (tagList.size() > 0) { ResourceMetadataKeyEnum.TAG_LIST.put(res, tagList);
/** * 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; }
/** * @deprecated Tags wil become immutable in a future release of HAPI, so {@link #addTag(String, String, String)} * should be used instead */ @Deprecated public Tag addTag() { myOrderedTags = null; return addTag(null, null, null); }
@Override public String toString() { StringBuilder b = new StringBuilder(); b.append("TagList[").append(size()).append(" tag(s)]"); for (Tag next : this) { b.append("\n * ").append(next.toString()); } return b.toString(); }
IFhirResourceDao<? extends IBaseResource> dao = getDao(theResourceType); BaseHasResource entity = dao.readEntity(theResourceId); TagList retVal = new TagList(); for (BaseTag next : entity.getTags()) { retVal.add(next.getTag().toTag()); findMatchingTagIds(resourceName, theResourceId, tagIds, ResourceHistoryTag.class); if (tagIds.isEmpty()) { return new TagList(); q.setMaxResults(getConfig().getHardTagListLimit()); TagList retVal = new TagList(); for (TagDefinition next : q.getResultList()) { retVal.add(next.toTag());
/** * 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; }
/** * Copy constructor */ public TagList(TagList theTags) { if (theTags != null) { for (Tag next : theTags) { add(next); } } }
/** * 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; }