Search in sources :

Example 86 with ExpressionEvaluationException

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);
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) QName(javax.xml.namespace.QName) Fault(org.apache.cxf.interceptor.Fault) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) PrismObject(com.evolveum.midpoint.prism.PrismObject) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) PrismObject(com.evolveum.midpoint.prism.PrismObject)

Example 87 with ExpressionEvaluationException

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);
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) QName(javax.xml.namespace.QName) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) Collection(java.util.Collection) PrismObject(com.evolveum.midpoint.prism.PrismObject) Fault(org.apache.cxf.interceptor.Fault)

Example 88 with ExpressionEvaluationException

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);
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) PrismContainerValue(com.evolveum.midpoint.prism.PrismContainerValue) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) JRException(net.sf.jasperreports.engine.JRException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) ArrayList(java.util.ArrayList) JRBeanCollectionDataSource(net.sf.jasperreports.engine.data.JRBeanCollectionDataSource) PrismObject(com.evolveum.midpoint.prism.PrismObject) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) AuditEventRecordType(com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException) Containerable(com.evolveum.midpoint.prism.Containerable) AuditEventRecord(com.evolveum.midpoint.audit.api.AuditEventRecord)

Example 89 with ExpressionEvaluationException

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;
    }
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Task(com.evolveum.midpoint.task.api.Task) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) QName(javax.xml.namespace.QName) TypeFilter(com.evolveum.midpoint.prism.query.TypeFilter) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) PrismObject(com.evolveum.midpoint.prism.PrismObject) ObjectType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType) GetOperationOptions(com.evolveum.midpoint.schema.GetOperationOptions) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException)

Example 90 with ExpressionEvaluationException

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();
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ExpressionEvaluationException(com.evolveum.midpoint.util.exception.ExpressionEvaluationException) CommunicationException(com.evolveum.midpoint.util.exception.CommunicationException) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Aggregations

ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)120 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)93 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)92 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)71 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)71 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)69 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)59 Task (com.evolveum.midpoint.task.api.Task)35 SystemException (com.evolveum.midpoint.util.exception.SystemException)32 PrismObject (com.evolveum.midpoint.prism.PrismObject)29 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)28 PolicyViolationException (com.evolveum.midpoint.util.exception.PolicyViolationException)26 QName (javax.xml.namespace.QName)23 ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)21 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)21 ArrayList (java.util.ArrayList)19 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)17 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)13 Collection (java.util.Collection)13 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)12