Search in sources :

Example 11 with AuditEvent

use of org.hl7.fhir.r4.model.AuditEvent in project org.hl7.fhir.core by hapifhir.

the class RdfParser method composeAuditEventAuditEventSourceComponent.

protected void composeAuditEventAuditEventSourceComponent(Complex parent, String parentType, String name, AuditEvent.AuditEventSourceComponent element, int index) {
    if (element == null)
        return;
    Complex t;
    if (Utilities.noString(parentType))
        t = parent;
    else {
        t = parent.predicate("fhir:" + parentType + '.' + name);
    }
    composeBackboneElement(t, "source", name, element, index);
    if (element.hasSiteElement())
        composeString(t, "AuditEvent", "site", element.getSiteElement(), -1);
    if (element.hasObserver())
        composeReference(t, "AuditEvent", "observer", element.getObserver(), -1);
    for (int i = 0; i < element.getType().size(); i++) composeCoding(t, "AuditEvent", "type", element.getType().get(i), i);
}
Also used : Complex(org.hl7.fhir.r4.utils.formats.Turtle.Complex)

Example 12 with AuditEvent

use of org.hl7.fhir.r4.model.AuditEvent in project org.hl7.fhir.core by hapifhir.

the class TurtleTests method test_auditevent_example_disclosure.

@Test
public void test_auditevent_example_disclosure() throws FileNotFoundException, IOException, Exception {
    System.out.println("auditevent-example-disclosure.ttl");
    new Turtle().parse(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\auditevent-example-disclosure.ttl"));
}
Also used : Turtle(org.hl7.fhir.dstu3.utils.formats.Turtle) Test(org.junit.jupiter.api.Test)

Example 13 with AuditEvent

use of org.hl7.fhir.r4.model.AuditEvent in project SORMAS-Project by hzi-braunschweig.

the class AuditLoggerEjb method logApplicationLifecycle.

private void logApplicationLifecycle(Coding subtype, String outcomeDesc) {
    AuditEvent applicationStartAudit = new AuditEvent();
    applicationStartAudit.setType(new Coding(VALUESET_AUDIT_EVENT_TYPE_HTML, "110100", "Application Activity"));
    applicationStartAudit.setSubtype(Collections.singletonList(subtype));
    applicationStartAudit.setAction(AuditEvent.AuditEventAction.E);
    applicationStartAudit.setRecorded(Calendar.getInstance(TimeZone.getDefault()).getTime());
    // success
    applicationStartAudit.setOutcome(AuditEvent.AuditEventOutcome._0);
    applicationStartAudit.setOutcomeDesc(outcomeDesc);
    AuditEvent.AuditEventAgentComponent agent = new AuditEvent.AuditEventAgentComponent();
    CodeableConcept codeableConcept = new CodeableConcept();
    codeableConcept.addCoding(new Coding("https://www.hl7.org/fhir/valueset-participation-role-type.html", "110151", "Application Launcher"));
    agent.setType(codeableConcept);
    agent.setName("SYSTEM");
    applicationStartAudit.addAgent(agent);
    AuditEvent.AuditEventSourceComponent source = new AuditEvent.AuditEventSourceComponent();
    source.setSite(auditSourceSite);
    // Application Server
    AuditSourceType auditSourceType = AuditSourceType._4;
    source.addType(new Coding(auditSourceType.getSystem(), auditSourceType.toCode(), auditSourceType.getDisplay()));
    applicationStartAudit.setSource(source);
    AuditEvent.AuditEventEntityComponent entity = new AuditEvent.AuditEventEntityComponent();
    entity.setWhat(new Reference("StartupShutdownService"));
    // System Object
    AuditEntityType entityType = AuditEntityType._2;
    entity.setType(new Coding(entityType.getSystem(), entityType.toCode(), entityType.getDisplay()));
    applicationStartAudit.addEntity(entity);
    accept(applicationStartAudit);
}
Also used : AuditSourceType(org.hl7.fhir.r4.model.codesystems.AuditSourceType) AuditEntityType(org.hl7.fhir.r4.model.codesystems.AuditEntityType) Coding(org.hl7.fhir.r4.model.Coding) Reference(org.hl7.fhir.r4.model.Reference) AuditEvent(org.hl7.fhir.r4.model.AuditEvent) CodeableConcept(org.hl7.fhir.r4.model.CodeableConcept)

Example 14 with AuditEvent

use of org.hl7.fhir.r4.model.AuditEvent in project SORMAS-Project by hzi-braunschweig.

the class AuditLoggerEjb method logFailedRestLogin.

@Override
public void logFailedRestLogin(String caller, String method, String pathInfo) {
    AuditEvent restLoginFail = new AuditEvent();
    restLoginFail.setType(USER_AUTHENTICATION_CODING);
    restLoginFail.addSubtype(LOGIN_CODING);
    restLoginFail.setAction(AuditEvent.AuditEventAction.E);
    restLoginFail.setRecorded(Calendar.getInstance(TimeZone.getDefault()).getTime());
    restLoginFail.setOutcome(AuditEvent.AuditEventOutcome._4);
    restLoginFail.setOutcomeDesc("Authentication failed");
    AuditEvent.AuditEventAgentComponent agent = new AuditEvent.AuditEventAgentComponent();
    agent.setName(caller);
    restLoginFail.addAgent(agent);
    AuditEvent.AuditEventSourceComponent source = new AuditEvent.AuditEventSourceComponent();
    source.setSite(String.format("%s - REST MultiAuthenticationMechanism", auditSourceSite));
    restLoginFail.setSource(source);
    AuditEvent.AuditEventEntityComponent entity = new AuditEvent.AuditEventEntityComponent();
    entity.setWhat(new Reference(String.format("%s %s", method, pathInfo)));
    restLoginFail.addEntity(entity);
    accept(restLoginFail);
}
Also used : Reference(org.hl7.fhir.r4.model.Reference) AuditEvent(org.hl7.fhir.r4.model.AuditEvent)

Example 15 with AuditEvent

use of org.hl7.fhir.r4.model.AuditEvent in project SORMAS-Project by hzi-braunschweig.

the class AuditLoggerEjb method logLabMessageError.

private void logLabMessageError(String messageUuid, Coding type, Reference what, String outcome, String error, Date start, Date end, String authAlias) {
    AuditEvent logLabMessage = new AuditEvent();
    logLabMessage.setType(type);
    logLabMessage.setAction(AuditEvent.AuditEventAction.E);
    makePeriod(start, end, logLabMessage);
    logLabMessage.setRecorded(Calendar.getInstance(TimeZone.getDefault()).getTime());
    logLabMessage.setOutcome(AuditEvent.AuditEventOutcome._8);
    logLabMessage.setOutcomeDesc(outcome);
    logLabMessage.addAgent(getAuditEventAgentComponentWithAuthAlias(authAlias));
    AuditEvent.AuditEventSourceComponent source = new AuditEvent.AuditEventSourceComponent();
    source.setSite(String.format("%s - DEMIS", auditSourceSite));
    logLabMessage.setSource(source);
    AuditEvent.AuditEventEntityComponent entity = new AuditEvent.AuditEventEntityComponent();
    entity.setWhat(what);
    AuditEvent.AuditEventEntityDetailComponent uuid = new AuditEvent.AuditEventEntityDetailComponent(new StringType("messageUuid"), new StringType(messageUuid));
    entity.addDetail(uuid);
    AuditEvent.AuditEventEntityDetailComponent errorMessage = new AuditEvent.AuditEventEntityDetailComponent(new StringType("errorMessage"), new StringType(error));
    entity.addDetail(errorMessage);
    logLabMessage.addEntity(entity);
    accept(logLabMessage);
}
Also used : StringType(org.hl7.fhir.r4.model.StringType) AuditEvent(org.hl7.fhir.r4.model.AuditEvent)

Aggregations

AuditEvent (org.hl7.fhir.r4.model.AuditEvent)10 Complex (org.hl7.fhir.dstu2016may.formats.RdfGenerator.Complex)6 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)6 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)6 Reference (org.hl7.fhir.r4.model.Reference)5 Coding (org.hl7.fhir.r4.model.Coding)4 AuditSourceType (org.hl7.fhir.r4.model.codesystems.AuditSourceType)3 Test (org.junit.jupiter.api.Test)3 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)2 Date (java.util.Date)2 Turtle (org.hl7.fhir.dstu3.utils.formats.Turtle)2 CodeableConcept (org.hl7.fhir.r4.model.CodeableConcept)2 StringType (org.hl7.fhir.r4.model.StringType)2 RequestDetails (ca.uhn.fhir.rest.api.server.RequestDetails)1 ArrayList (java.util.ArrayList)1 AuditEvent (org.hl7.fhir.dstu3.model.AuditEvent)1 Bundle (org.hl7.fhir.r4.model.Bundle)1 Identifier (org.hl7.fhir.r4.model.Identifier)1 InstantType (org.hl7.fhir.r4.model.InstantType)1 Period (org.hl7.fhir.r4.model.Period)1