org.hl7.fhir.r4.model.Resource Java Examples

The following examples show how to use org.hl7.fhir.r4.model.Resource. 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: ToolsHelper.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public void executeRoundTrip(String[] args) throws IOException, FHIRException {
	FileInputStream in;
	File source = new CSFile(args[1]);
	File dest = new CSFile(args[2]);
	if (args.length >= 4) {
		Utilities.copyFile(args[1], args[3]);
	}

	if (!source.exists())        
		throw new FHIRException("Source File \""+source.getAbsolutePath()+"\" not found");
	in = new CSFileInputStream(source);
	XmlParser p = new XmlParser();
	JsonParser parser = new JsonParser();
	JsonParser pj = parser;
	Resource rf = p.parse(in);
	ByteArrayOutputStream json = new ByteArrayOutputStream();
	parser.setOutputStyle(OutputStyle.PRETTY);
	parser.compose(json, rf);
	json.close();
	TextFile.stringToFile(new String(json.toByteArray()), Utilities.changeFileExt(dest.getAbsolutePath(), ".json"));
	rf = pj.parse(new ByteArrayInputStream(json.toByteArray()));
	FileOutputStream s = new FileOutputStream(dest);
	new XmlParser().compose(s, rf, true);
	s.close();
}
 
Example #2
Source File: MeasureOperationsProvider.java    From cqf-ruler with Apache License 2.0 6 votes vote down vote up
private void resolveReferences(Resource resource, Parameters parameters, Map<String, Resource> resourceMap) {
    List<IBase> values;
    for (BaseRuntimeChildDefinition child : this.measureResourceProvider.getContext().getResourceDefinition(resource).getChildren()) {
        values = child.getAccessor().getValues(resource);
        if (values == null || values.isEmpty()) {
            continue;
        }

        else if (values.get(0) instanceof Reference
                && ((Reference) values.get(0)).getReferenceElement().hasResourceType()
                && ((Reference) values.get(0)).getReferenceElement().hasIdPart()) {
            Resource fetchedResource = (Resource) registry
                    .getResourceDao(((Reference) values.get(0)).getReferenceElement().getResourceType())
                    .read(new IdType(((Reference) values.get(0)).getReferenceElement().getIdPart()));

            if (!resourceMap.containsKey(fetchedResource.getIdElement().getValue())) {
                parameters.addParameter(new Parameters.ParametersParameterComponent().setName("resource")
                        .setResource(fetchedResource));

                resourceMap.put(fetchedResource.getIdElement().getValue(), fetchedResource);
            }
        }
    }
}
 
Example #3
Source File: FHIRToolingClient.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public ConceptMap initializeClosure(String name) {
  Parameters params = new Parameters();
  params.addParameter().setName("name").setValue(new StringType(name));
  List<Header> headers = null;
  ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(null, "closure", new HashMap<String, String>()),
      utils.getResourceAsByteArray(params, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
  result.addErrorStatus(410);//gone
  result.addErrorStatus(404);//unknown
  result.addErrorStatus(405);
  result.addErrorStatus(422);//Unprocessable Entity
  result.addSuccessStatus(200);
  result.addSuccessStatus(201);
  if(result.isUnsuccessfulRequest()) {
    throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
  }
  return (ConceptMap) result.getPayload();
}
 
Example #4
Source File: FHIRToolingClient.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public ValueSet expandValueset(ValueSet source, Parameters expParams) {
  List<Header> headers = null;
  Parameters p = expParams == null ? new Parameters() : expParams.copy();
  p.addParameter().setName("valueSet").setResource(source);
  ResourceRequest<Resource> result = utils.issuePostRequest(resourceAddress.resolveOperationUri(ValueSet.class, "expand"), 
      utils.getResourceAsByteArray(p, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat(), headers);
  result.addErrorStatus(410);//gone
  result.addErrorStatus(404);//unknown
  result.addErrorStatus(405);
  result.addErrorStatus(422);//Unprocessable Entity
  result.addSuccessStatus(200);
  result.addSuccessStatus(201);
  if(result.isUnsuccessfulRequest()) {
    throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
  }
  return (ValueSet) result.getPayload();
}
 
Example #5
Source File: FHIRToolingClient.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("unchecked")

public <T extends Resource> OperationOutcome validate(Class<T> resourceClass, T resource, String id) {
	ResourceRequest<T> result = null;
	try {
		result = utils.issuePostRequest(resourceAddress.resolveValidateUri(resourceClass, id), utils.getResourceAsByteArray(resource, false, isJson(getPreferredResourceFormat())), getPreferredResourceFormat());
		result.addErrorStatus(400);//gone
		result.addErrorStatus(422);//Unprocessable Entity
		result.addSuccessStatus(200);//OK
		if(result.isUnsuccessfulRequest()) {
			throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
		}
	} catch(Exception e) {
		handleException("An error has occurred while trying to validate this resource", e);
	}
	return (OperationOutcome)result.getPayload();
}
 
Example #6
Source File: FHIRToolingClient.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public <T extends Resource> T getCanonical(Class<T> resourceClass, String canonicalURL) {
  ResourceRequest<T> result = null;
  try {
    result = utils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndCanonical(resourceClass, canonicalURL), getPreferredResourceFormat());
    result.addErrorStatus(410);//gone
    result.addErrorStatus(404);//unknown
    result.addErrorStatus(405);//unknown
    result.addSuccessStatus(200);//Only one for now
    if(result.isUnsuccessfulRequest()) {
      throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
    }
  } catch (Exception e) {
    handleException("An error has occurred while trying to read this version of the resource", e);
  }
  Bundle bnd = (Bundle) result.getPayload();
  if (bnd.getEntry().size() == 0)
    throw new EFhirClientException("No matching resource found for canonical URL '"+canonicalURL+"'");
  if (bnd.getEntry().size() > 1)
    throw new EFhirClientException("Multiple matching resources found for canonical URL '"+canonicalURL+"'");
  return (T) bnd.getEntry().get(0).getResource();
}
 
Example #7
Source File: FHIRToolingClient.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public <T extends Resource> T vread(Class<T> resourceClass, String id, String version) {
	ResourceRequest<T> result = null;
	try {
		result = utils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndIdAndVersion(resourceClass, id, version), getPreferredResourceFormat());
		result.addErrorStatus(410);//gone
		result.addErrorStatus(404);//unknown
		result.addErrorStatus(405);//unknown
		result.addSuccessStatus(200);//Only one for now
		if(result.isUnsuccessfulRequest()) {
			throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
		}
	} catch (Exception e) {
		handleException("An error has occurred while trying to read this version of the resource", e);
	}
	return result.getPayload();
}
 
Example #8
Source File: FhirR4.java    From synthea with Apache License 2.0 6 votes vote down vote up
/**
 * Helper function to create an Entry for the given Resource within the given Bundle. Sets the
 * resourceID to a random UUID, sets the entry's fullURL to that resourceID, and adds the entry to
 * the bundle.
 *
 * @param bundle   The Bundle to add the Entry to
 * @param resource Resource the new Entry should contain
 * @param resourceID The Resource ID to assign
 * @return the created Entry
 */
private static BundleEntryComponent newEntry(Bundle bundle, Resource resource,
    String resourceID) {
  BundleEntryComponent entry = bundle.addEntry();

  resource.setId(resourceID);
  entry.setFullUrl(getUrlPrefix(resource.fhirType()) + resourceID);
  entry.setResource(resource);

  if (TRANSACTION_BUNDLE) {
    BundleEntryRequestComponent request = entry.getRequest();
    request.setMethod(HTTPVerb.POST);
    request.setUrl(resource.getResourceType().name());
    entry.setRequest(request);
  }

  return entry;
}
 
Example #9
Source File: GraphQLEngineTests.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
@Override
public ReferenceResolution lookup(Object appInfo, IBaseResource context, IBaseReference reference) throws FHIRException {
  try {
    if (reference.getReferenceElement().isLocal()) {
      if (!(context instanceof DomainResource))
        return null;
      for (Resource r : ((DomainResource) context).getContained()) {
        if (('#' + r.getId()).equals(reference.getReferenceElement().getValue())) {
          return new ReferenceResolution(context, r);
        }
      }
    } else {
      String[] parts = reference.getReferenceElement().getValue().split("/");
      String filename = TestingUtilities.resourceNameToFile(parts[0].toLowerCase() + '-' + parts[1].toLowerCase() + ".xml");
      if (new File(filename).exists())
        return new ReferenceResolution(null, new XmlParser().parse(new FileInputStream(filename)));
    }
    return null;
  } catch (Exception e) {
    throw new FHIRException(e);
  }
}
 
Example #10
Source File: ResourceRoundTripTests.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Test
@Disabled
public void test() throws FileNotFoundException, IOException, FHIRException, EOperationOutcome, UcumException {
  Resource res = new XmlParser().parse(new FileInputStream(TestingUtilities.resourceNameToFile("unicode.xml")));
  new NarrativeGenerator("", "", TestingUtilities.context()).generate((DomainResource) res, null);
  new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilities.resourceNameToFile("gen", "unicode.out.xml")), res);
}
 
Example #11
Source File: XmlParserBase.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * Compose a resource to a stream, possibly using pretty presentation for a human reader (used in the spec, for example, but not normally in production)
 * @ 
 */
@Override
public void compose(OutputStream stream, Resource resource)  throws IOException {
	XMLWriter writer = new XMLWriter(stream, "UTF-8", version == XmlVersion.V1_1);
	writer.setPretty(style == OutputStyle.PRETTY);
	writer.start();
	compose(writer, resource, writer.isPretty());
	writer.end();
}
 
Example #12
Source File: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private static void renderConceptMaps(StringBuilder b, StructureMap map) {
  for (Resource r : map.getContained()) {
    if (r instanceof ConceptMap) {
      produceConceptMap(b, (ConceptMap) r);
    }
  }
}
 
Example #13
Source File: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public boolean conformsToProfile(Object appContext, Base item, String url) throws FHIRException {
  IResourceValidator val = worker.newValidator();
  List<ValidationMessage> valerrors = new ArrayList<ValidationMessage>();
  if (item instanceof Resource) {
    val.validate(appContext, valerrors, (Resource) item, url);
    boolean ok = true;
    for (ValidationMessage v : valerrors)
      ok = ok && v.getLevel().isError();
    return ok;
  }
  throw new NotImplementedException("Not done yet (FFHIRPathHostServices.conformsToProfile), when item is element");
}
 
Example #14
Source File: MeasureOperationsProvider.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
@Operation(name = "$submit-data", idempotent = true, type = Measure.class)
public Resource submitData(RequestDetails details, @IdParam IdType theId,
        @OperationParam(name = "measure-report", min = 1, max = 1, type = MeasureReport.class) MeasureReport report,
        @OperationParam(name = "resource") List<IAnyResource> resources) {
    Bundle transactionBundle = new Bundle().setType(Bundle.BundleType.TRANSACTION);

    /*
     * TODO - resource validation using $data-requirements operation (params are the
     * provided id and the measurement period from the MeasureReport)
     * 
     * TODO - profile validation ... not sure how that would work ... (get
     * StructureDefinition from URL or must it be stored in Ruler?)
     */

    transactionBundle.addEntry(createTransactionEntry(report));

    for (IAnyResource resource : resources) {
        Resource res = (Resource) resource;
        if (res instanceof Bundle) {
            for (Bundle.BundleEntryComponent entry : createTransactionBundle((Bundle) res).getEntry()) {
                transactionBundle.addEntry(entry);
            }
        } else {
            // Build transaction bundle
            transactionBundle.addEntry(createTransactionEntry(res));
        }
    }

    return (Resource) this.registry.getSystemDao().transaction(details, transactionBundle);
}
 
Example #15
Source File: MeasureOperationsProvider.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
private Bundle.BundleEntryComponent createTransactionEntry(Resource resource) {
    Bundle.BundleEntryComponent transactionEntry = new Bundle.BundleEntryComponent().setResource(resource);
    if (resource.hasId()) {
        transactionEntry.setRequest(
                new Bundle.BundleEntryRequestComponent().setMethod(Bundle.HTTPVerb.PUT).setUrl(resource.getId()));
    } else {
        transactionEntry.setRequest(new Bundle.BundleEntryRequestComponent().setMethod(Bundle.HTTPVerb.POST)
                .setUrl(resource.fhirType()));
    }
    return transactionEntry;
}
 
Example #16
Source File: XmlParserBase.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * Compose a resource to a stream, possibly using pretty presentation for a human reader, and maybe a different choice in the xhtml narrative (used in the spec in one place, but should not be used in production)
 * @ 
 */
public void compose(OutputStream stream, Resource resource, boolean htmlPretty)  throws IOException {
	XMLWriter writer = new XMLWriter(stream, "UTF-8", version == XmlVersion.V1_1);
	writer.setPretty(style == OutputStyle.PRETTY);
	writer.start();
	compose(writer, resource, htmlPretty);
	writer.end();
}
 
Example #17
Source File: ObjectConverter.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public Element convert(Resource ig) throws IOException, FHIRException {
  if (ig == null)
    return null;
  ByteArrayOutputStream bs = new ByteArrayOutputStream();
  org.hl7.fhir.r4.formats.JsonParser jp = new org.hl7.fhir.r4.formats.JsonParser();
  jp.compose(bs, ig);
  ByteArrayInputStream bi = new ByteArrayInputStream(bs.toByteArray());
  return new JsonParser(context).parse(bi);
}
 
Example #18
Source File: XmlParserBase.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
protected Resource parseResourceContained(XmlPullParser xpp) throws IOException, FHIRFormatError, XmlPullParserException  {
	next(xpp);
	int eventType = nextNoWhitespace(xpp);
	if (eventType == XmlPullParser.START_TAG) { 
		Resource r = (Resource) parseResource(xpp);
		nextNoWhitespace(xpp);
		next(xpp);
		return r;
	} else {
		unknownContent(xpp);
		return null;
	}
}
 
Example #19
Source File: ObjectConverter.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public Resource convert(Element element) throws FHIRException {
    ByteArrayOutputStream bo = new ByteArrayOutputStream();
    try {
      new JsonParser(context).compose(element, bo, OutputStyle.NORMAL, null);
//      TextFile.bytesToFile(bo.toByteArray(), "c:\\temp\\json.json");
      return new org.hl7.fhir.r4.formats.JsonParser().parse(bo.toByteArray());
    } catch (IOException e) {
      // won't happen
      throw new FHIRException(e);
    }
    
  }
 
Example #20
Source File: LiquidEngine.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public void evaluate(StringBuilder b, Resource resource, LiquidEngineContext ctxt) throws FHIRException {
  if (compiled == null)
    compiled = engine.parse(condition);
  boolean ok = engine.evaluateToBoolean(ctxt, resource, resource, resource, compiled); 
  List<LiquidNode> list = ok ? thenBody : elseBody;
  for (LiquidNode n : list) {
    n.evaluate(b, resource, ctxt);
  }
}
 
Example #21
Source File: LiquidEngine.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public void evaluate(StringBuilder b, Resource resource, LiquidEngineContext ctxt) throws FHIRException {
  if (compiled == null)
    compiled = engine.parse(condition);
  List<Base> list = engine.evaluate(ctxt, resource, resource, resource, compiled);
  LiquidEngineContext lctxt = new LiquidEngineContext(ctxt);
  for (Base o : list) {
    lctxt.vars.put(varName, o);
    for (LiquidNode n : body) {
      n.evaluate(b, resource, lctxt);
    }
  }
}
 
Example #22
Source File: LiquidEngine.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public void evaluate(StringBuilder b, Resource resource, LiquidEngineContext ctxt) throws FHIRException {
  String src = includeResolver.fetchInclude(LiquidEngine.this, page);
  LiquidParser parser = new LiquidParser(src);
  LiquidDocument doc = parser.parse(page);
  LiquidEngineContext nctxt =  new LiquidEngineContext(ctxt.externalContext);
  Tuple incl = new Tuple();
  nctxt.vars.put("include", incl);
  for (String s : params.keySet()) {
    incl.addProperty(s, engine.evaluate(ctxt, resource, resource, resource, params.get(s)));
  }
  for (LiquidNode n : doc.body) {
    n.evaluate(b, resource, nctxt);
  }
}
 
Example #23
Source File: GraphQLEngineTests.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public Resource lookup(Object appInfo, String type, String id) throws FHIRException {
  try {
    String filename = TestingUtilities.resourceNameToFile(type.toLowerCase() + '-' + id.toLowerCase() + ".xml");
    if (new File(filename).exists())
      return new XmlParser().parse(new FileInputStream(filename));
    else
      return null;
  } catch (Exception e) {
    throw new FHIRException(e);
  }
}
 
Example #24
Source File: ResourceAddress.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public <T extends Resource> String nameForClass(Class<T> resourceClass) {
  if (resourceClass == null)
    return null;
	String res = resourceClass.getSimpleName();
	if (res.equals("List_"))
		return "List";
	else
		return res;
}
 
Example #25
Source File: ResourceUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static Resource getById(Bundle feed, ResourceType type, String reference) {
  for (BundleEntryComponent item : feed.getEntry()) {
    if (item.getResource().getId().equals(reference) && item.getResource().getResourceType() == type)
      return item.getResource();
  }
  return null;
}
 
Example #26
Source File: MeasureOperationsProvider.java    From cqf-ruler with Apache License 2.0 5 votes vote down vote up
@Operation(name = "$collect-data", idempotent = true, type = Measure.class)
public Parameters collectData(@IdParam IdType theId, @RequiredParam(name = "periodStart") String periodStart,
        @RequiredParam(name = "periodEnd") String periodEnd, @OptionalParam(name = "patient") String patientRef,
        @OptionalParam(name = "practitioner") String practitionerRef,
        @OptionalParam(name = "lastReceivedOn") String lastReceivedOn) throws FHIRException {
    // TODO: Spec says that the periods are not required, but I am not sure what to
    // do when they aren't supplied so I made them required
    MeasureReport report = evaluateMeasure(theId, periodStart, periodEnd, null, null, patientRef, null,
            practitionerRef, lastReceivedOn, null, null, null);
    report.setGroup(null);

    Parameters parameters = new Parameters();

    parameters.addParameter(
            new Parameters.ParametersParameterComponent().setName("measurereport").setResource(report));

    if (report.hasContained()) {
        for (Resource contained : report.getContained()) {
            if (contained instanceof Bundle) {
                addEvaluatedResourcesToParameters((Bundle) contained, parameters);
            }
        }
    }

    // TODO: need a way to resolve referenced resources within the evaluated
    // resources
    // Should be able to use _include search with * wildcard, but HAPI doesn't
    // support that

    return parameters;
}
 
Example #27
Source File: ClientUtils.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
/**
 * @param resourceFormat
 * @param options
 * @return
 */
protected <T extends Resource> ResourceRequest<T> issueResourceRequest(String resourceFormat, HttpUriRequest request, byte[] payload, List<Header> headers) {
  configureFhirRequest(request, resourceFormat, headers);
  HttpResponse response = null;
  if(request instanceof HttpEntityEnclosingRequest && payload != null) {
    response = sendPayload((HttpEntityEnclosingRequestBase)request, payload, proxy);
  } else if (request instanceof HttpEntityEnclosingRequest && payload == null){
    throw new EFhirClientException("PUT and POST requests require a non-null payload");
  } else {
    response = sendRequest(request);
  }
  T resource = unmarshalReference(response, resourceFormat);
  return new ResourceRequest<T>(resource, response.getStatusLine().getStatusCode(), getLocationHeader(response));
}
 
Example #28
Source File: ClientUtils.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public Bundle issuePostFeedRequest(URI resourceUri, Map<String, String> parameters, String resourceName, Resource resource, String resourceFormat) throws IOException {
  HttpPost httppost = new HttpPost(resourceUri);
  String boundary = "----WebKitFormBoundarykbMUo6H8QaUnYtRy";
  httppost.addHeader("Content-Type", "multipart/form-data; boundary="+boundary);
  httppost.addHeader("Accept", resourceFormat);
  configureFhirRequest(httppost, null);
  HttpResponse response = sendPayload(httppost, encodeFormSubmission(parameters, resourceName, resource, boundary));
  return unmarshalFeed(response, resourceFormat);
}
 
Example #29
Source File: FHIRToolingClient.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public <T extends Resource> T read(Class<T> resourceClass, String id) {//TODO Change this to AddressableResource
	ResourceRequest<T> result = null;
	try {
		result = utils.issueGetResourceRequest(resourceAddress.resolveGetUriFromResourceClassAndId(resourceClass, id), getPreferredResourceFormat());
		result.addErrorStatus(410);//gone
		result.addErrorStatus(404);//unknown
		result.addSuccessStatus(200);//Only one for now
		if(result.isUnsuccessfulRequest()) {
			throw new EFhirClientException("Server returned error code " + result.getHttpStatus(), (OperationOutcome)result.getPayload());
		}
	} catch (Exception e) {
		handleException("An error has occurred while trying to read this resource", e);
	}
	return result.getPayload();
}
 
Example #30
Source File: SnapShotGenerationTests.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
@Override
public boolean conformsToProfile(Object appContext, Base item, String url) throws FHIRException {
  IResourceValidator val = TestingUtilities.context().newValidator();
  List<ValidationMessage> valerrors = new ArrayList<ValidationMessage>();
  if (item instanceof Resource) {
    val.validate(appContext, valerrors, (Resource) item, url);
    boolean ok = true;
    for (ValidationMessage v : valerrors)
      ok = ok && v.getLevel().isError();
    return ok;
  }
  throw new NotImplementedException("Not done yet (IGPublisherHostServices.SnapShotGenerationTestsContext), when item is element");
}