Search in sources :

Example 6 with DebugSearchDto

use of com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto in project midpoint by Evolveum.

the class PageDebugList method deleteAllTypeConfirmed.

private void deleteAllTypeConfirmed(AjaxRequestTarget target) {
    DebugSearchDto dto = searchModel.getObject();
    LOGGER.debug("Deleting all of type {}", dto.getType());
    OperationResult result = new OperationResult(OPERATION_DELETE_OBJECTS);
    String taskOid = null;
    try {
        ObjectQuery query = null;
        if (ObjectTypes.USER.equals(dto.getType())) {
            query = createDeleteAllUsersQuery();
        }
        QName type = dto.getType().getTypeQName();
        taskOid = deleteObjectsAsync(type, query, true, "Delete all of type " + type.getLocalPart(), result);
        info(getString("pageDebugList.messsage.deleteAllOfType", dto.getType()));
    } catch (Exception ex) {
        result.recomputeStatus();
        result.recordFatalError("Couldn't delete objects of type " + dto.getType(), ex);
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't delete objects of type " + dto.getType(), ex);
    }
    showResult(result);
    if (taskOid != null) {
        PageParameters parameters = new PageParameters();
        parameters.add(OnePageParameterEncoder.PARAMETER, taskOid);
        navigateToNext(PageTaskEdit.class, parameters);
    } else {
        navigateToNext(PageTasks.class);
    }
    target.add(getFeedbackPanel());
}
Also used : QName(javax.xml.namespace.QName) DebugSearchDto(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ObjectAlreadyExistsException(com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException) ObjectNotFoundException(com.evolveum.midpoint.util.exception.ObjectNotFoundException)

Example 7 with DebugSearchDto

use of com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto in project midpoint by Evolveum.

the class PageDebugList method initInlineMenu.

private List<InlineMenuItem> initInlineMenu() {
    List<InlineMenuItem> headerMenuItems = new ArrayList<>();
    headerMenuItems.add(new InlineMenuItem(createStringResource("pageDebugList.menu.exportSelected"), true, new HeaderMenuAction(this) {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            exportSelected(target, null);
        }
    }));
    headerMenuItems.add(new InlineMenuItem(createStringResource("pageDebugList.menu.exportAllSelectedType"), true, new HeaderMenuAction(this) {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            exportAllType(target);
        }
    }));
    headerMenuItems.add(new InlineMenuItem(createStringResource("pageDebugList.menu.exportShadowsOnResource"), new Model(true), new AbstractReadOnlyModel<Boolean>() {

        @Override
        public Boolean getObject() {
            DebugSearchDto dto = searchModel.getObject();
            return ObjectTypes.SHADOW.equals(dto.getType());
        }
    }, false, new HeaderMenuAction(this) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            exportAllShadowsOnResource(target);
        }
    }));
    headerMenuItems.add(new InlineMenuItem(createStringResource("pageDebugList.menu.exportAll"), true, new HeaderMenuAction(this) {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            exportAll(target);
        }
    }));
    headerMenuItems.add(new InlineMenuItem());
    headerMenuItems.add(new InlineMenuItem(createStringResource("pageDebugList.menu.deleteSelected"), true, new HeaderMenuAction(this) {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            deleteSelected(target, null);
        }
    }));
    headerMenuItems.add(new InlineMenuItem(createStringResource("pageDebugList.menu.deleteAllType"), true, new HeaderMenuAction(this) {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            deleteAllType(target);
        }
    }));
    headerMenuItems.add(new InlineMenuItem(createStringResource("pageDebugList.menu.deleteShadowsOnResource"), new Model(true), new AbstractReadOnlyModel<Boolean>() {

        @Override
        public Boolean getObject() {
            DebugSearchDto dto = searchModel.getObject();
            return ObjectTypes.SHADOW.equals(dto.getType());
        }
    }, false, new HeaderMenuAction(this) {

        @Override
        public void onClick(AjaxRequestTarget target) {
            deleteAllShadowsOnResource(target);
        }
    }));
    headerMenuItems.add(new InlineMenuItem());
    headerMenuItems.add(new InlineMenuItem(createStringResource("pageDebugList.menu.deleteAllIdentities"), true, new HeaderMenuAction(this) {

        @Override
        public void onSubmit(AjaxRequestTarget target, Form<?> form) {
            deleteAllIdentities(target);
        }
    }));
    return headerMenuItems;
}
Also used : HeaderMenuAction(com.evolveum.midpoint.web.page.admin.configuration.component.HeaderMenuAction) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Form(org.apache.wicket.markup.html.form.Form) ArrayList(java.util.ArrayList) 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) DebugSearchDto(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 8 with DebugSearchDto

use of com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto in project midpoint by Evolveum.

the class PageDebugList method createDeleteConfirmString.

private IModel<String> createDeleteConfirmString() {
    return new AbstractReadOnlyModel<String>() {

        @Override
        public String getObject() {
            DebugConfDialogDto dto = confDialogModel.getObject();
            switch(dto.getOperation()) {
                case DELETE_ALL_TYPE:
                    String key = ObjectTypeGuiDescriptor.getDescriptor(dto.getType()).getLocalizationKey();
                    String type = createStringResource(key).getString();
                    return createStringResource("pageDebugList.message.deleteAllType", type).getString();
                case DELETE_SELECTED:
                    List<DebugObjectItem> selectedList = dto.getObjects();
                    if (selectedList.size() > 1) {
                        return createStringResource("pageDebugList.message.deleteSelectedConfirm", selectedList.size()).getString();
                    }
                    DebugObjectItem selectedItem = selectedList.get(0);
                    return createStringResource("pageDebugList.message.deleteObjectConfirm", selectedItem.getName()).getString();
                case DELETE_RESOURCE_SHADOWS:
                    DebugSearchDto search = searchModel.getObject();
                    return createStringResource("pageDebugList.messsage.deleteAllResourceShadows", search.getResource().getName()).getString();
            }
            return "";
        }
    };
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) DebugConfDialogDto(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugConfDialogDto) DebugSearchDto(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto) DebugObjectItem(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugObjectItem)

Example 9 with DebugSearchDto

use of com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto in project midpoint by Evolveum.

the class PageDebugList method exportAllShadowsOnResource.

private void exportAllShadowsOnResource(AjaxRequestTarget target) {
    DebugSearchDto dto = searchModel.getObject();
    if (dto.getResource() == null) {
        error(getString("pageDebugList.message.resourceNotSelected"));
        target.add(getFeedbackPanel());
        return;
    }
    ObjectQuery objectQuery = QueryBuilder.queryFor(ShadowType.class, getPrismContext()).item(ShadowType.F_RESOURCE_REF).ref(dto.getResource().getOid()).build();
    initDownload(target, dto.getType().getClassDefinition(), objectQuery);
}
Also used : DebugSearchDto(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto) ObjectQuery(com.evolveum.midpoint.prism.query.ObjectQuery)

Example 10 with DebugSearchDto

use of com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto in project midpoint by Evolveum.

the class PageDebugList method deleteAllShadowsOnResource.

private void deleteAllShadowsOnResource(AjaxRequestTarget target) {
    DebugSearchDto dto = searchModel.getObject();
    if (dto.getResource() == null) {
        error(getString("pageDebugList.message.resourceNotSelected"));
        target.add(getFeedbackPanel());
        return;
    }
    LOGGER.debug("Displaying delete all shadows on resource {} confirmation dialog", dto.getResource().getName());
    DebugConfDialogDto dialogDto = new DebugConfDialogDto(DebugConfDialogDto.Operation.DELETE_RESOURCE_SHADOWS, null, null);
    confDialogModel.setObject(dialogDto);
    showMainPopup(getDeleteConfirmationPanel(), target);
}
Also used : DebugConfDialogDto(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugConfDialogDto) DebugSearchDto(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto)

Aggregations

DebugSearchDto (com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto)14 ObjectQuery (com.evolveum.midpoint.prism.query.ObjectQuery)6 DebugConfDialogDto (com.evolveum.midpoint.web.page.admin.configuration.dto.DebugConfDialogDto)4 DebugObjectItem (com.evolveum.midpoint.web.page.admin.configuration.dto.DebugObjectItem)3 ArrayList (java.util.ArrayList)3 ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 ObjectAlreadyExistsException (com.evolveum.midpoint.util.exception.ObjectAlreadyExistsException)2 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 RepositoryObjectDataProvider (com.evolveum.midpoint.web.component.data.RepositoryObjectDataProvider)2 ConfigurationStorage (com.evolveum.midpoint.web.session.ConfigurationStorage)2 QName (javax.xml.namespace.QName)2 Form (org.apache.wicket.markup.html.form.Form)2 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)2 PageParameters (org.apache.wicket.request.mapper.parameter.PageParameters)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 ObjectPaging (com.evolveum.midpoint.prism.query.ObjectPaging)1 ObjectTypes (com.evolveum.midpoint.schema.constants.ObjectTypes)1 Table (com.evolveum.midpoint.web.component.data.Table)1