added more auditors for new resource types, updates existing auditors to include subject

This commit is contained in:
lmds1 2014-11-19 15:48:12 -05:00
parent df2011388c
commit bf65cb974b
6 changed files with 200 additions and 1 deletions

View File

@ -0,0 +1,65 @@
package ca.uhn.fhir.rest.server.audit;
import java.util.HashMap;
import java.util.Map;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
import ca.uhn.fhir.model.dstu.resource.AdverseReaction;
import ca.uhn.fhir.model.dstu.valueset.SecurityEventObjectSensitivityEnum;
import ca.uhn.fhir.model.dstu.valueset.SecurityEventObjectTypeEnum;
public class AdverseReactionAuditor implements IResourceAuditor<AdverseReaction> {
private AdverseReaction myResource = null;
@Override
public AdverseReaction getResource() {
return myResource;
}
@Override
public void setResource(AdverseReaction resource) {
myResource = resource;
}
@Override
public boolean isAuditable() {
return myResource != null;
}
@Override
public String getName() {
if(myResource == null) return null;
return "AdverseReaction:" + myResource.getIdentifierFirstRep().getValue();
}
@Override
public BaseIdentifierDt getIdentifier() {
if(myResource == null) return null;
return myResource.getIdentifierFirstRep();
}
@Override
public SecurityEventObjectTypeEnum getType() {
return SecurityEventObjectTypeEnum.OTHER;
}
@Override
public String getDescription() {
return null;
}
@Override
public Map<String, String> getDetail() {
Map<String, String> details = new HashMap<String, String>();
details.put("subject", myResource.getSubject().getReference().getValue());
details.put("version", myResource.getId().getVersionIdPart());
return details;
}
@Override
public SecurityEventObjectSensitivityEnum getSensitivity() {
return null;
}
}

View File

@ -78,6 +78,7 @@ public class DiagnosticReportAuditor implements IResourceAuditor<DiagnosticRepor
Map<String, String> details = new HashMap<String, String>();
details.put("dateIssued", myDiagnosticReport.getIssued().getValueAsString());
details.put("version", myDiagnosticReport.getId().getVersionIdPart());
details.put("subject", myDiagnosticReport.getSubject().getReference().getValue());
return details;
}

View File

@ -91,6 +91,7 @@ public class EncounterAuditor implements IResourceAuditor<Encounter> {
details.put("service", myEncounter.getServiceProvider().getDisplay().getValue());
details.put("type", myEncounter.getTypeFirstRep().getText().getValue());
details.put("status", myEncounter.getStatus().getValueAsString());
details.put("subject", myEncounter.getSubject().getReference().getValue());
return details;
}

View File

@ -81,7 +81,7 @@ public class MedicationPrescriptionAuditor implements IResourceAuditor<Medicatio
@Override
public Map<String, String> getDetail() {
return null; //no additional details required for audit?
return null; //no additional details required for audit
}
@Override

View File

@ -0,0 +1,66 @@
package ca.uhn.fhir.rest.server.audit;
import java.util.HashMap;
import java.util.Map;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
import ca.uhn.fhir.model.dstu.resource.Observation;
import ca.uhn.fhir.model.dstu.valueset.SecurityEventObjectSensitivityEnum;
import ca.uhn.fhir.model.dstu.valueset.SecurityEventObjectTypeEnum;
public class ObservationAuditor implements IResourceAuditor<Observation> {
private Observation myResource = null;
@Override
public Observation getResource() {
return myResource;
}
@Override
public void setResource(Observation resource) {
myResource = resource;
}
@Override
public boolean isAuditable() {
return myResource != null;
}
@Override
public String getName() {
if(myResource == null) return null;
return "Observation:" + myResource.getName().getCodingFirstRep().getCode().getValue();
}
@Override
public BaseIdentifierDt getIdentifier() {
return myResource.getIdentifier();
}
@Override
public SecurityEventObjectTypeEnum getType() {
return SecurityEventObjectTypeEnum.OTHER;
}
@Override
public String getDescription() {
return null;
}
@Override
public Map<String, String> getDetail() {
if(myResource == null) return null;
Map<String, String> details = new HashMap<String, String>();
details.put("dateIssued", myResource.getIssued().getValueAsString());
details.put("version", myResource.getId().getVersionIdPart());
details.put("subject", myResource.getSubject().getReference().getValue());
return details;
}
@Override
public SecurityEventObjectSensitivityEnum getSensitivity() {
return null;
}
}

View File

@ -0,0 +1,66 @@
package ca.uhn.fhir.rest.server.audit;
import java.util.HashMap;
import java.util.Map;
import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
import ca.uhn.fhir.model.dstu.composite.IdentifierDt;
import ca.uhn.fhir.model.dstu.resource.Procedure;
import ca.uhn.fhir.model.dstu.valueset.SecurityEventObjectSensitivityEnum;
import ca.uhn.fhir.model.dstu.valueset.SecurityEventObjectTypeEnum;
public class ProcedureAuditor implements IResourceAuditor<Procedure> {
private Procedure myResource = null;
@Override
public Procedure getResource() {
return myResource;
}
@Override
public void setResource(Procedure resource) {
myResource = resource;
}
@Override
public boolean isAuditable() {
return myResource != null;
}
@Override
public String getName() {
if(myResource == null) return null;
return "Procedure:" + myResource.getId().getIdPart();
}
@Override
public BaseIdentifierDt getIdentifier() {
if(myResource == null) return null;
return new IdentifierDt(myResource.getId().getResourceType(), myResource.getId().getIdPart());
}
@Override
public SecurityEventObjectTypeEnum getType() {
return SecurityEventObjectTypeEnum.OTHER;
}
@Override
public String getDescription() {
return null;
}
@Override
public Map<String, String> getDetail() {
if(myResource == null) return null;
Map<String, String> details = new HashMap<String, String>();
details.put("subject", myResource.getSubject().getReference().getValue());
return details;
}
@Override
public SecurityEventObjectSensitivityEnum getSensitivity() {
return null;
}
}