当前位置: 首页>>代码示例>>Java>>正文


Java IGenericClient类代码示例

本文整理汇总了Java中ca.uhn.fhir.rest.client.IGenericClient的典型用法代码示例。如果您正苦于以下问题:Java IGenericClient类的具体用法?Java IGenericClient怎么用?Java IGenericClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IGenericClient类属于ca.uhn.fhir.rest.client包,在下文中一共展示了IGenericClient类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: deleteServerResources

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
private static void deleteServerResources(IGenericClient client, Iterable<Object> resources, String dataType){
	for(Object obj : resources){
		IBaseResource resource = (IBaseResource) obj;
		try{
			//delete existing
			client.delete()
				.resourceConditionalByType(resource.getClass())
				.where(new TokenClientParam("identifier").exactly()
					.systemAndCode("http://mcm.usciitg-prep.org", resource.getIdElement().getIdPart()))
				.execute();
			System.out.println(dataType + ":" + resource.getIdElement().getValue() + " deleted ID:" + resource.getIdElement().getIdPart());
		}catch(Exception e){
			System.out.println(dataType + ":" + resource.getIdElement().getValue() + " deleted: failure" + " ID:" + resource.getIdElement().getIdPart());
		}			
	}
}
 
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:17,代码来源:UsciitgFhirDataProviderHL7IT.java

示例2: deleteDiagnosticReportBySpecimen

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deleteDiagnosticReportBySpecimen(FhirContext oContext,List<String> listIdSpecimenToDelete, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete()
                .resourceConditionalByType("DiagnosticReport")
                //.where(DiagnosticReport.SPECIMEN.hasId(idSpecimenToDelete))
                .where(DiagnosticReport.SPECIMEN.hasAnyOfIds(listIdSpecimenToDelete))
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:24,代码来源:FhirResourceValidator.java

示例3: deleteObservationBySpecimen

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deleteObservationBySpecimen(FhirContext oContext,List<String> listIdSpecimenToDelete, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete()
                .resourceConditionalByType("Observation")
                //.where(DiagnosticReport.SPECIMEN.hasId(idSpecimenToDelete))
                .where(Observation.SPECIMEN.hasAnyOfIds(listIdSpecimenToDelete))
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:24,代码来源:FhirResourceValidator.java

示例4: deleteDiagnosticOrderBySpecimen

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deleteDiagnosticOrderBySpecimen(FhirContext oContext,List<String> listIdSpecimenToDelete, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete()
                .resourceConditionalByType("DiagnosticOrder")
                //.where(DiagnosticReport.SPECIMEN.hasId(idSpecimenToDelete))
                .where(DiagnosticOrder.SPECIMEN.hasAnyOfIds(listIdSpecimenToDelete))
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:24,代码来源:FhirResourceValidator.java

示例5: deletePractitioner

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deletePractitioner(FhirContext oContext,List<IdDt> listIdsPractitioner, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        for(IdDt idToDelete:listIdsPractitioner)
        {

            IBaseOperationOutcome resp=client.delete()
                    .resourceById(idToDelete)
                    .execute();
            if(resp!=null)
            {
                OperationOutcome outcome = (OperationOutcome) resp;
                System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
            }
        }


    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:27,代码来源:FhirResourceValidator.java

示例6: deleteSpecimen

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deleteSpecimen(FhirContext oContext,List<IdDt> listIdsSpecimen, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        for(IdDt idToDelete:listIdsSpecimen)
        {

            IBaseOperationOutcome resp=client.delete()
                    .resourceById(idToDelete)
                    .execute();
            if(resp!=null)
            {
                OperationOutcome outcome = (OperationOutcome) resp;
                System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
            }
        }


    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:27,代码来源:FhirResourceValidator.java

示例7: getListConditionTrackedForPatient

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static List<Condition> getListConditionTrackedForPatient(FhirContext oContext,String patientId,String serverUrl,String logFileName)
{
    List<Condition> listOfAssociatedCondition=new ArrayList<>();
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        Bundle oBundle=client.search()
                .forResource(Condition.class)
                .where(new StringClientParam("patient").matches().value(patientId))
                .returnBundle(ca.uhn.fhir.model.dstu2.resource.Bundle.class)
                .execute();
        for(Entry oEntry:oBundle.getEntry())
        {
            listOfAssociatedCondition.add((Condition)oEntry.getResource());
        }
    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
    return listOfAssociatedCondition;
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:24,代码来源:FhirResourceValidator.java

示例8: deleteBundle

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void deleteBundle(FhirContext oContext, IdDt idBundle, String serverUrl, String logFileName)
{
    try
    {
        IGenericClient client=oContext.newRestfulGenericClient(serverUrl);
        IBaseOperationOutcome resp=client.delete().resourceById(idBundle)
                .execute();
        if(resp!=null)
        {
            OperationOutcome outcome = (OperationOutcome) resp;
            System.out.println(outcome.getIssueFirstRep().getDetailsElement().getValue());
        }

    }
    catch (Exception exc)
    {
        FhirMediatorUtilities.writeInLogFile(logFileName,
                exc.getMessage(),"Error");
    }
}
 
开发者ID:gerard-bisama,项目名称:DHIS2-fhir-lab-app,代码行数:21,代码来源:FhirResourceValidator.java

示例9: testFindConsent

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
/**
 * Test method for
 * {@link org.iexhub.services.JaxRsConsentRestProvider\#find(@IdParam final
 * IdDt id)}.
 */
@Test
public void testFindConsent() {

	try {
		Logger logger = LoggerFactory.getLogger(ConsentDstu3Test.class);
		LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
		loggingInterceptor.setLogRequestSummary(true);
		loggingInterceptor.setLogRequestBody(true);
		loggingInterceptor.setLogger(logger);

		IGenericClient client = ctxt.newRestfulGenericClient(serverBaseUrl);
		client.registerInterceptor(loggingInterceptor); // Required only for
														// logging
		Consent retVal = client.read(Consent.class,
				/*iExHubDomainOid + "." + consentId*/ /*"2.25.1469220780502"*/ "2.25.1471531116858");
		
		assertTrue("Error - unexpected return value for testFindConsent", retVal != null);
	} catch (Exception e) {
		fail(e.getMessage());
	}
}
 
开发者ID:bhits,项目名称:iexhub,代码行数:27,代码来源:ConsentDstu3Test.java

示例10: createProxy

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
public void createProxy() {
   // START SNIPPET: proxy
   FhirContext ctx = new FhirContext();

   // Set connections to access the network via the HTTP proxy at
   // example.com : 8888
   ctx.getRestfulClientFactory().setProxy("example.com", 8888);

   // If the proxy requires authentication, use the following as well
   ctx.getRestfulClientFactory().setProxyCredentials("theUsername", "thePassword");
   
   // Create the client
   IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
   // END SNIPPET: proxy
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:17,代码来源:ClientExamples.java

示例11: createSecurity

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
public void createSecurity() {
   // START SNIPPET: security
   // Create a context and get the client factory so it can be configured
   FhirContext ctx = new FhirContext();
   IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();

   // Create an HTTP basic auth interceptor
   String username = "foobar";
   String password = "boobear";
   BasicAuthInterceptor authInterceptor = new BasicAuthInterceptor(username, password);

   // Register the interceptor with your client (either style)
   IPatientClient annotationClient = ctx.newRestfulClient(IPatientClient.class, "http://localhost:9999/fhir");
   annotationClient.registerInterceptor(authInterceptor);

   IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
   annotationClient.registerInterceptor(authInterceptor);
   // END SNIPPET: security
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:21,代码来源:ClientExamples.java

示例12: createCookie

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
public void createCookie() {
   // START SNIPPET: cookie
   // Create a context and get the client factory so it can be configured
   FhirContext ctx = new FhirContext();
   IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();

   // Create a cookie interceptor. This cookie will have the name "mycookie" and
   // the value "Chips Ahoy"
   CookieInterceptor interceptor = new CookieInterceptor("mycookie=Chips Ahoy");

   // Register the interceptor with your client (either style)
   IPatientClient annotationClient = ctx.newRestfulClient(IPatientClient.class, "http://localhost:9999/fhir");
   annotationClient.registerInterceptor(interceptor);

   IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
   annotationClient.registerInterceptor(interceptor);
   // END SNIPPET: cookie
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:20,代码来源:ClientExamples.java

示例13: createSecurityBearer

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
public void createSecurityBearer() {
   // START SNIPPET: securityBearer
   // Create a context and get the client factory so it can be configured
   FhirContext ctx = new FhirContext();
   IRestfulClientFactory clientFactory = ctx.getRestfulClientFactory();

   // In reality the token would have come from an authorization server 
   String token = "3w03fj.r3r3t"; 
   
   BearerTokenAuthInterceptor authInterceptor = new BearerTokenAuthInterceptor(token);

   // Register the interceptor with your client (either style)
   IPatientClient annotationClient = ctx.newRestfulClient(IPatientClient.class, "http://localhost:9999/fhir");
   annotationClient.registerInterceptor(authInterceptor);

   IGenericClient genericClient = ctx.newRestfulGenericClient("http://localhost:9999/fhir");
   annotationClient.registerInterceptor(authInterceptor);
   // END SNIPPET: securityBearer
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:21,代码来源:ClientExamples.java

示例14: simpleExample

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
public static void simpleExample() {
   // START SNIPPET: simple
   // We're connecting to a DSTU1 compliant server in this example
   FhirContext ctx = FhirContext.forDstu1();
   String serverBase = "http://fhirtest.uhn.ca/baseDstu1";
   
   IGenericClient client = ctx.newRestfulGenericClient(serverBase);

   // Perform a search
   Bundle results = client
         .search()
         .forResource(Patient.class)
         .where(Patient.FAMILY.matches().value("duck"))
         .execute();

   System.out.println("Found " + results.size() + " patients named 'duck'");
   // END SNIPPET: simple
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:19,代码来源:GenericClientExample.java

示例15: operationHttpGet

import ca.uhn.fhir.rest.client.IGenericClient; //导入依赖的package包/类
@SuppressWarnings("unused")
private static void operationHttpGet() {
   // START SNIPPET: operationHttpGet
   // Create a client to talk to the HeathIntersections server
   FhirContext ctx = FhirContext.forDstu2();
   IGenericClient client = ctx.newRestfulGenericClient("http://fhir-dev.healthintersections.com.au/open");
   client.registerInterceptor(new LoggingInterceptor(true));
   
   // Create the input parameters to pass to the server
   Parameters inParams = new Parameters();
   inParams.addParameter().setName("start").setValue(new DateDt("2001-01-01"));
   inParams.addParameter().setName("end").setValue(new DateDt("2015-03-01"));
   
   // Invoke $everything on "Patient/1"
   Parameters outParams = client
      .operation()
      .onInstance(new IdDt("Patient", "1"))
      .named("$everything")
      .withParameters(inParams)
      .useHttpGet() // Use HTTP GET instead of POST
      .execute();
   // END SNIPPET: operationHttpGet
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:24,代码来源:GenericClientExample.java


注:本文中的ca.uhn.fhir.rest.client.IGenericClient类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。