Search in sources :

Example 91 with SchemaException

use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.

the class CertDefinitionDto method updateScopeDefinition.

public void updateScopeDefinition(PrismContext prismContext) {
    AccessCertificationAssignmentReviewScopeType scopeTypeObj = null;
    if (definitionScopeDto != null) {
        scopeTypeObj = new AccessCertificationAssignmentReviewScopeType(prismContext);
        scopeTypeObj.setName(definitionScopeDto.getName());
        scopeTypeObj.setDescription(definitionScopeDto.getDescription());
        scopeTypeObj.setObjectType(definitionScopeDto.getObjectType() != null ? new QName(definitionScopeDto.getObjectType().name()) : null);
        SearchFilterType parsedSearchFilter = definitionScopeDto.getParsedSearchFilter(prismContext);
        if (parsedSearchFilter != null) {
            // check if everything is OK
            try {
                QueryConvertor.parseFilterPreliminarily(parsedSearchFilter.getFilterClauseXNode(), prismContext);
            } catch (SchemaException e) {
                throw new SystemException("Couldn't parse search filter: " + e.getMessage(), e);
            }
        }
        scopeTypeObj.setSearchFilter(parsedSearchFilter);
        scopeTypeObj.setIncludeAssignments(definitionScopeDto.isIncludeAssignments());
        scopeTypeObj.setIncludeInducements(definitionScopeDto.isIncludeInducements());
        scopeTypeObj.setIncludeResources(definitionScopeDto.isIncludeResources());
        scopeTypeObj.setIncludeRoles(definitionScopeDto.isIncludeRoles());
        scopeTypeObj.setIncludeOrgs(definitionScopeDto.isIncludeOrgs());
        scopeTypeObj.setIncludeServices(definitionScopeDto.isIncludeServices());
        scopeTypeObj.setIncludeUsers(definitionScopeDto.isIncludeUsers());
        scopeTypeObj.setEnabledItemsOnly(definitionScopeDto.isEnabledItemsOnly());
        scopeTypeObj.setItemSelectionExpression(definitionScopeDto.getItemSelectionExpression());
        scopeTypeObj.getRelation().addAll(definitionScopeDto.getRelationList());
    }
    definition.setScopeDefinition(scopeTypeObj);
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SearchFilterType(com.evolveum.prism.xml.ns._public.query_3.SearchFilterType) SystemException(com.evolveum.midpoint.util.exception.SystemException) QName(javax.xml.namespace.QName)

Example 92 with SchemaException

use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.

the class DefinitionScopeDto method getParsedSearchFilter.

public SearchFilterType getParsedSearchFilter(PrismContext context) {
    if (searchFilterText == null || searchFilterText.isEmpty()) {
        return null;
    }
    SearchFilterType rv = new SearchFilterType();
    RootXNode filterClauseNode;
    try {
        filterClauseNode = (RootXNode) context.parserFor(searchFilterText).xml().parseToXNode();
    } catch (SchemaException e) {
        throw new SystemException("Cannot parse search filter " + searchFilterText + ": " + e.getMessage(), e);
    }
    rv.setFilterClauseXNode(filterClauseNode);
    return rv;
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) SearchFilterType(com.evolveum.prism.xml.ns._public.query_3.SearchFilterType) SystemException(com.evolveum.midpoint.util.exception.SystemException) RootXNode(com.evolveum.midpoint.prism.xnode.RootXNode)

Example 93 with SchemaException

use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.

the class PageAccounts method showShadowResult.

private void showShadowResult(AjaxRequestTarget target, IModel<SelectableBean> rowModel) {
    OperationResultType result = getResult(rowModel);
    String xml;
    ModalWindow aceDialog = (ModalWindow) get(createComponentPath(ID_RESULT_DIALOG));
    AceEditorDialog aceEditor = (AceEditorDialog) aceDialog.get(aceDialog.getContentId());
    try {
        xml = getPrismContext().xmlSerializer().serializeRealValue(result, ShadowType.F_RESULT);
        aceEditor.updateModel(new Model<String>(xml));
    } catch (SchemaException e) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't parse result", e);
        aceEditor.updateModel(new Model<String>("Unable to show result. For more information see logs."));
    }
    aceDialog.show(target);
    target.add(getFeedbackPanel());
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) AceEditorDialog(com.evolveum.midpoint.web.page.admin.configuration.component.AceEditorDialog) OperationResultType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType) IModel(org.apache.wicket.model.IModel) Model(org.apache.wicket.model.Model) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) PropertyModel(org.apache.wicket.model.PropertyModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ModalWindow(org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow)

Example 94 with SchemaException

use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.

the class PageAbout method testRepositoryCheckOrgClosurePerformed.

private void testRepositoryCheckOrgClosurePerformed(AjaxRequestTarget target) {
    OperationResult result = new OperationResult(OPERATION_TEST_REPOSITORY_CHECK_ORG_CLOSURE);
    try {
        Task task = createSimpleTask(OPERATION_TEST_REPOSITORY_CHECK_ORG_CLOSURE);
        getModelDiagnosticService().repositoryTestOrgClosureConsistency(task, true, result);
    } catch (SchemaException | SecurityViolationException e) {
        result.recordFatalError(e);
    } finally {
        result.computeStatusIfUnknown();
    }
    showResult(result);
    target.add(getFeedbackPanel());
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Task(com.evolveum.midpoint.task.api.Task) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 95 with SchemaException

use of com.evolveum.midpoint.util.exception.SchemaException in project midpoint by Evolveum.

the class PageAbout method reindexRepositoryObjectsPerformed.

private void reindexRepositoryObjectsPerformed(AjaxRequestTarget target) {
    OperationResult result = new OperationResult(OPERATION_SUBMIT_REINDEX);
    try {
        TaskManager taskManager = getTaskManager();
        Task task = taskManager.createTaskInstance();
        MidPointPrincipal user = SecurityUtils.getPrincipalUser();
        if (user == null) {
            throw new RestartResponseException(PageLogin.class);
        } else {
            task.setOwner(user.getUser().asPrismObject());
        }
        getSecurityEnforcer().authorize(AuthorizationConstants.AUTZ_ALL_URL, null, null, null, null, null, result);
        task.setChannel(SchemaConstants.CHANNEL_GUI_USER_URI);
        task.setHandlerUri(ModelPublicConstants.REINDEX_TASK_HANDLER_URI);
        task.setName("Reindex repository objects");
        taskManager.switchToBackground(task, result);
        result.setBackgroundTaskOid(task.getOid());
    } catch (SecurityViolationException | SchemaException | RuntimeException e) {
        result.recordFatalError(e);
    } finally {
        result.computeStatusIfUnknown();
    }
    showResult(result);
    target.add(getFeedbackPanel());
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) Task(com.evolveum.midpoint.task.api.Task) TaskManager(com.evolveum.midpoint.task.api.TaskManager) SecurityViolationException(com.evolveum.midpoint.util.exception.SecurityViolationException) RestartResponseException(org.apache.wicket.RestartResponseException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) MidPointPrincipal(com.evolveum.midpoint.security.api.MidPointPrincipal)

Aggregations

SchemaException (com.evolveum.midpoint.util.exception.SchemaException)576 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)235 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)214 QName (javax.xml.namespace.QName)132 SystemException (com.evolveum.midpoint.util.exception.SystemException)113 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)100 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)100 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)92 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)89 Task (com.evolveum.midpoint.task.api.Task)87 PrismObject (com.evolveum.midpoint.prism.PrismObject)86 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)69 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)68 ArrayList (java.util.ArrayList)67 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)59 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)49 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)47 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)46 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)34 Test (org.testng.annotations.Test)34