use of com.evolveum.midpoint.xml.ns._public.report.report_3.EvaluateAuditScriptResponseType in project midpoint by Evolveum.
the class ReportWebServiceRaw method invokeAllowingFaults.
public DOMSource invokeAllowingFaults(DOMSource request) throws FaultMessage {
Node rootNode = request.getNode();
Element rootElement;
if (rootNode instanceof Document) {
rootElement = ((Document) rootNode).getDocumentElement();
} else if (rootNode instanceof Element) {
rootElement = (Element) rootNode;
} else {
// throw ws.createIllegalArgumentFault("Unexpected DOM node type: " + rootNode);
throw new FaultMessage("Unexpected DOM node type: " + rootNode);
}
Object requestObject;
try {
requestObject = prismContext.parserFor(rootElement).parseRealValue();
} catch (SchemaException e) {
throw new FaultMessage("Couldn't parse SOAP request body because of schema exception: " + e.getMessage());
// throw ws.createIllegalArgumentFault("Couldn't parse SOAP request body because of schema exception: " + e.getMessage());
}
Node response;
Holder<OperationResultType> operationResultTypeHolder = new Holder<>();
SerializationContext ctx = new SerializationContext(SerializationOptions.createSerializeReferenceNames());
try {
if (requestObject instanceof EvaluateScriptType) {
EvaluateScriptType s = (EvaluateScriptType) requestObject;
ObjectListType olt = reportService.evaluateScript(s.getScript(), s.getParameters());
EvaluateScriptResponseType sr = new EvaluateScriptResponseType();
sr.setObjectList(olt);
response = prismContext.domSerializer().context(ctx).serializeAnyData(sr, ReportPort.EVALUATE_SCRIPT_RESPONSE);
} else if (requestObject instanceof EvaluateAuditScriptType) {
EvaluateAuditScriptType s = (EvaluateAuditScriptType) requestObject;
AuditEventRecordListType olt = reportService.evaluateAuditScript(s.getScript(), s.getParameters());
EvaluateAuditScriptResponseType sr = new EvaluateAuditScriptResponseType();
sr.setObjectList(olt);
response = prismContext.domSerializer().context(ctx).serializeAnyData(sr, ReportPort.EVALUATE_AUDIT_SCRIPT_RESPONSE);
} else if (requestObject instanceof ProcessReportType) {
ProcessReportType p = (ProcessReportType) requestObject;
ObjectListType olt = reportService.processReport(p.getQuery(), p.getParameters(), p.getOptions());
ProcessReportResponseType pr = new ProcessReportResponseType();
pr.setObjectList(olt);
response = prismContext.domSerializer().context(ctx).serializeAnyData(pr, ReportPort.PROCESS_REPORT_RESPONSE);
} else {
throw new FaultMessage("Unsupported request type: " + requestObject);
}
} catch (SchemaException e) {
throwFault(e, operationResultTypeHolder.value);
// not reached
return null;
}
return new DOMSource(response);
}
Aggregations