本文整理汇总了Java中org.hl7.fhir.dstu3.model.OperationOutcome类的典型用法代码示例。如果您正苦于以下问题:Java OperationOutcome类的具体用法?Java OperationOutcome怎么用?Java OperationOutcome使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OperationOutcome类属于org.hl7.fhir.dstu3.model包,在下文中一共展示了OperationOutcome类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildOperationOutcomeException
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
public static BaseServerResponseException buildOperationOutcomeException(BaseServerResponseException exception, OperationOutcome.IssueSeverity code, OperationOutcome.IssueType issueType) {
CodeableConcept codeableConcept = new CodeableConcept()
.setText(exception.getMessage());
OperationOutcome operationOutcome = new OperationOutcome();
operationOutcome.addIssue()
.setSeverity(OperationOutcome.IssueSeverity.ERROR)
.setCode(issueType)
.setDetails(codeableConcept);
// operationOutcome.getMeta()
// .addProfile(SystemURL.SD_GPC_OPERATIONOUTCOME);
exception.setOperationOutcome(operationOutcome);
return exception;
}
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:19,代码来源:OperationOutcomeFactory.java
示例2: main
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
public static void main(String[] args) {
String input = "<Encounter xmlns=\"http://hl7.org/fhir\"></Encounter>";
// Create a new validator
FhirContext ctx = FhirContext.forDstu3();
FhirValidator validator = ctx.newValidator();
// Did we succeed?
ValidationResult result = validator.validateWithResult(input);
System.out.println("Success: " + result.isSuccessful());
// What was the result
OperationOutcome outcome = (OperationOutcome) result.toOperationOutcome();
IParser parser = ctx.newXmlParser().setPrettyPrint(true);
System.out.println(parser.encodeResourceToString(outcome));
}
示例3: main
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
public static void main(String[] args) {
// Create an incomplete encounter (status is required)
Encounter enc = new Encounter();
enc.addIdentifier().setSystem("http://acme.org/encNums").setValue("12345");
// Create a new validator
FhirContext ctx = FhirContext.forDstu3();
FhirValidator validator = ctx.newValidator();
// Did we succeed?
ValidationResult result = validator.validateWithResult(enc);
System.out.println("Success: " + result.isSuccessful());
// What was the result
OperationOutcome outcome = (OperationOutcome) result.toOperationOutcome();
IParser parser = ctx.newXmlParser().setPrettyPrint(true);
System.out.println(parser.encodeResourceToString(outcome));
}
示例4: loadCache
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
private void loadCache() throws FHIRFormatError, IOException {
File[] files = new File(cacheFolder).listFiles();
for (File f : files) {
if (f.getName().endsWith(".xml")) {
final FileInputStream is = new FileInputStream(f);
try {
Resource r = context.newXmlParser().setOutputStyle(OutputStyle.PRETTY).parse(is);
if (r instanceof OperationOutcome) {
OperationOutcome oo = (OperationOutcome) r;
expansions.put(ToolingExtensions.getExtension(oo,VS_ID_EXT).getValue().toString(),
new ValueSetExpansionOutcome(new XhtmlComposer(XhtmlComposer.XML).composePlainText(oo.getText().getDiv()), TerminologyServiceErrorClass.UNKNOWN));
} else {
ValueSet vs = (ValueSet) r;
expansions.put(vs.getUrl(), new ValueSetExpansionOutcome(vs));
}
} finally {
IOUtils.closeQuietly(is);
}
}
}
}
示例5: testAddHeadersNotFound
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
@Test
public void testAddHeadersNotFound() throws Exception {
OperationOutcome operationOutcome = new OperationOutcome();
operationOutcome.addIssue().setCode(IssueType.BUSINESSRULE);
ourException = new ResourceNotFoundException("SOME MESSAGE");
ourException.addResponseHeader("X-Foo", "BAR BAR");
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient");
CloseableHttpResponse status = ourClient.execute(httpGet);
try {
String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(status.getStatusLine().toString());
ourLog.info(responseContent);
assertEquals(404, status.getStatusLine().getStatusCode());
assertEquals("BAR BAR", status.getFirstHeader("X-Foo").getValue());
assertThat(status.getFirstHeader("X-Powered-By").getValue(), containsString("HAPI FHIR"));
} finally {
IOUtils.closeQuietly(status.getEntity().getContent());
}
}
示例6: testAuthorize
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
@Test
public void testAuthorize() throws Exception {
OperationOutcome operationOutcome = new OperationOutcome();
operationOutcome.addIssue().setCode(IssueType.BUSINESSRULE);
ourException = new AuthenticationException().addAuthenticateHeaderForRealm("REALM");
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient");
CloseableHttpResponse status = ourClient.execute(httpGet);
try {
String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(status.getStatusLine().toString());
ourLog.info(responseContent);
assertEquals(401, status.getStatusLine().getStatusCode());
assertEquals("Basic realm=\"REALM\"", status.getFirstHeader("WWW-Authenticate").getValue());
} finally {
IOUtils.closeQuietly(status.getEntity().getContent());
}
}
示例7: testCreateReturnsOperationOutcome
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
@Test
public void testCreateReturnsOperationOutcome() throws Exception {
ourReturnOo = new OperationOutcome().addIssue(new OperationOutcomeIssueComponent().setDiagnostics("DIAG"));
HttpPost httpPost = new HttpPost("http://localhost:" + ourPort + "/Patient");
httpPost.setEntity(new StringEntity("{\"resourceType\":\"Patient\", \"status\":\"active\"}", ContentType.parse("application/fhir+json; charset=utf-8")));
HttpResponse status = ourClient.execute(httpPost);
String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
IOUtils.closeQuietly(status.getEntity().getContent());
ourLog.info("Response was:\n{}", responseContent);
assertEquals(201, status.getStatusLine().getStatusCode());
assertThat(responseContent, containsString("DIAG"));
}
示例8: testSearch
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
@Test
public void testSearch() throws Exception {
OperationOutcome operationOutcome = new OperationOutcome();
operationOutcome.addIssue().setCode(IssueType.BUSINESSRULE);
ourException = new UnclassifiedServerFailureException(477, "SOME MESSAGE", operationOutcome);
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient");
CloseableHttpResponse status = ourClient.execute(httpGet);
try {
String responseContent = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
ourLog.info(status.getStatusLine().toString());
ourLog.info(responseContent);
assertEquals(477, status.getStatusLine().getStatusCode());
//assertEquals("SOME MESSAGE", status.getStatusLine().getReasonPhrase());
assertThat(responseContent, stringContainsInOrder("business-rule"));
} finally {
IOUtils.closeQuietly(status.getEntity().getContent());
}
}
示例9: update
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
@Update
public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam DocumentReference documentReference, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) {
MethodOutcome method = new MethodOutcome();
method.setCreated(true);
OperationOutcome opOutcome = new OperationOutcome();
method.setOperationOutcome(opOutcome);
DocumentReference newDocumentReference = documentReferenceDao.create(ctx,documentReference, theId, theConditional);
method.setId(newDocumentReference.getIdElement());
method.setResource(newDocumentReference);
return method;
}
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:15,代码来源:DocumentReferenceProvider.java
示例10: create
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
@Create
public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam DocumentReference documentReference) {
MethodOutcome method = new MethodOutcome();
method.setCreated(true);
OperationOutcome opOutcome = new OperationOutcome();
method.setOperationOutcome(opOutcome);
DocumentReference newDocumentReference = documentReferenceDao.create(ctx,documentReference, null,null);
method.setId(newDocumentReference.getIdElement());
method.setResource(newDocumentReference);
return method;
}
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:15,代码来源:DocumentReferenceProvider.java
示例11: get
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
@Read()
public DocumentReference get(@IdParam IdType documentReferenceId) {
DocumentReference documentReference = documentReferenceDao.read(ctx,documentReferenceId);
if ( documentReference == null) {
throw OperationOutcomeFactory.buildOperationOutcomeException(
new ResourceNotFoundException("No DocumentReference/ " + documentReferenceId.getIdPart()),
OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.NOTFOUND);
}
return documentReference;
}
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:14,代码来源:DocumentReferenceProvider.java
示例12: if
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
@Read
public PractitionerRole getPractitionerRole
(@IdParam IdType internalId) {
PractitionerRole practitionerRole = practitionerRoleDao.read(ctx, internalId);
if ( practitionerRole == null) {
throw OperationOutcomeFactory.buildOperationOutcomeException(
new ResourceNotFoundException("No PractitionerRole/" + internalId.getIdPart()),
OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.NOTFOUND);
}
return practitionerRole;
}
开发者ID:nhsconnect,项目名称:careconnect-reference-implementation,代码行数:14,代码来源:PractitionerRoleProvider.java
示例13: update
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
@Update
public MethodOutcome update(HttpServletRequest theRequest, @ResourceParam Composition composition, @IdParam IdType theId, @ConditionalUrlParam String theConditional, RequestDetails theRequestDetails) {
MethodOutcome method = new MethodOutcome();
method.setCreated(true);
OperationOutcome opOutcome = new OperationOutcome();
method.setOperationOutcome(opOutcome);
Composition newComposition = compositionDao.create(ctx,composition, theId, theConditional);
method.setId(newComposition.getIdElement());
method.setResource(newComposition);
return method;
}
示例14: create
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
@Create
public MethodOutcome create(HttpServletRequest theRequest, @ResourceParam Composition composition) {
MethodOutcome method = new MethodOutcome();
method.setCreated(true);
OperationOutcome opOutcome = new OperationOutcome();
method.setOperationOutcome(opOutcome);
Composition newComposition = compositionDao.create(ctx,composition, null,null);
method.setId(newComposition.getIdElement());
method.setResource(newComposition);
return method;
}
示例15: get
import org.hl7.fhir.dstu3.model.OperationOutcome; //导入依赖的package包/类
@Read()
public Composition get(@IdParam IdType compositionId) {
Composition composition = compositionDao.read(ctx,compositionId);
if ( composition == null) {
throw OperationOutcomeFactory.buildOperationOutcomeException(
new ResourceNotFoundException("No Composition/ " + compositionId.getIdPart()),
OperationOutcome.IssueSeverity.ERROR, OperationOutcome.IssueType.NOTFOUND);
}
return composition;
}