use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException in project midpoint by Evolveum.
the class ReportWebService method processReport.
@Override
public ObjectListType processReport(String query, RemoteReportParametersType parameters, SelectorQualifiedGetOptionsType options) {
try {
Map<QName, Object> parametersMap = getParamsMap(parameters);
ObjectQuery q = reportService.parseQuery(query, parametersMap);
Collection<PrismObject<? extends ObjectType>> resultList = reportService.searchObjects(q, MiscSchemaUtil.optionsTypeToOptions(options));
return createObjectListType(resultList);
} catch (SchemaException | ObjectNotFoundException | SecurityViolationException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
// TODO Auto-generated catch block
throw new Fault(e);
}
}
use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException in project midpoint by Evolveum.
the class ReportWebService method evaluateScript.
@Override
public ObjectListType evaluateScript(String script, RemoteReportParametersType parameters) {
try {
Map<QName, Object> params = getParamsMap(parameters);
Collection resultList = reportService.evaluateScript(script, params);
return createObjectListType(resultList);
} catch (SchemaException | ExpressionEvaluationException | ObjectNotFoundException e) {
// TODO Auto-generated catch block
throw new Fault(e);
}
}
use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException in project midpoint by Evolveum.
the class MidPointQueryExecutor method createDatasource.
@Override
public JRDataSource createDatasource() throws JRException {
try {
if (query == null && script == null) {
throw new JRException("Neither query, nor script defined in the report.");
}
if (query != null) {
Collection<PrismObject<? extends ObjectType>> results;
results = searchObjects(query, SelectorOptions.createCollection(GetOperationOptions.createRaw()));
return createDataSourceFromObjects(results);
} else {
if (script.contains("AuditEventRecord")) {
Collection<AuditEventRecord> audtiEventRecords = searchAuditRecords(script, getPromptingParameters());
Collection<AuditEventRecordType> auditEventRecordsType = new ArrayList<>();
for (AuditEventRecord aer : audtiEventRecords) {
AuditEventRecordType aerType = aer.createAuditEventRecordType(true);
auditEventRecordsType.add(aerType);
}
return new JRBeanCollectionDataSource(auditEventRecordsType);
} else {
Collection<PrismContainerValue<? extends Containerable>> results;
results = evaluateScript(script, getParameters());
return createDataSourceFromContainerValues(results);
}
}
} catch (SchemaException | ObjectNotFoundException | SecurityViolationException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
// TODO Auto-generated catch block
throw new JRException(e);
}
}
use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException in project midpoint by Evolveum.
the class ReportServiceImpl method searchObjects.
@Override
public Collection<PrismObject<? extends ObjectType>> searchObjects(ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options) throws SchemaException, ObjectNotFoundException, SecurityViolationException, CommunicationException, ConfigurationException, ExpressionEvaluationException {
if (!(query.getFilter() instanceof TypeFilter)) {
throw new IllegalArgumentException("Query must contain type filter.");
}
TypeFilter typeFilter = (TypeFilter) query.getFilter();
QName type = typeFilter.getType();
Class clazz = prismContext.getSchemaRegistry().determineCompileTimeClass(type);
if (clazz == null) {
clazz = prismContext.getSchemaRegistry().findObjectDefinitionByType(type).getCompileTimeClass();
}
ObjectQuery queryForSearch = ObjectQuery.createObjectQuery(typeFilter.getFilter());
Task task = taskManager.createTaskInstance(ReportService.class.getName() + ".searchObjects()");
OperationResult parentResult = task.getResult();
// options.add(new
// SelectorOptions(GetOperationOptions.createResolveNames()));
GetOperationOptions getOptions = GetOperationOptions.createResolveNames();
getOptions.setRaw(Boolean.TRUE);
options = SelectorOptions.createCollection(getOptions);
List<PrismObject<? extends ObjectType>> results;
try {
results = model.searchObjects(clazz, queryForSearch, options, task, parentResult);
return results;
} catch (SchemaException | ObjectNotFoundException | SecurityViolationException | CommunicationException | ConfigurationException | ExpressionEvaluationException e) {
// TODO Auto-generated catch block
throw e;
}
}
use of com.evolveum.midpoint.util.exception.ExpressionEvaluationException in project midpoint by Evolveum.
the class ProvisioningServiceImpl method executeScript.
/* (non-Javadoc)
* @see com.evolveum.midpoint.provisioning.api.ProvisioningService#executeScript(java.lang.Class, java.lang.String, com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningScriptType, com.evolveum.midpoint.task.api.Task, com.evolveum.midpoint.schema.result.OperationResult)
*/
@Override
public <T extends ObjectType> void executeScript(String resourceOid, ProvisioningScriptType script, Task task, OperationResult parentResult) throws ObjectNotFoundException, SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ObjectAlreadyExistsException, ExpressionEvaluationException {
Validate.notNull(resourceOid, "Oid of object for script execution must not be null.");
Validate.notNull(parentResult, "Operation result must not be null.");
OperationResult result = parentResult.createSubresult(ProvisioningService.class.getName() + ".executeScript");
result.addParam("oid", resourceOid);
result.addParam("script", script);
result.addContext(OperationResult.CONTEXT_IMPLEMENTATION_CLASS, ProvisioningServiceImpl.class);
try {
resourceManager.executeScript(resourceOid, script, task, result);
} catch (CommunicationException | SchemaException | ConfigurationException | SecurityViolationException | ExpressionEvaluationException | RuntimeException | Error e) {
ProvisioningUtil.recordFatalError(LOGGER, result, null, e);
throw e;
}
result.computeStatus();
result.cleanupResult();
}
Aggregations