Search in sources :

Example 1 with DebugConfDialogDto

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

the class PageDebugList method deleteSelectedConfirmed.

private void deleteSelectedConfirmed(AjaxRequestTarget target, List<DebugObjectItem> items) {
    DebugConfDialogDto dto = confDialogModel.getObject();
    OperationResult result = new OperationResult(OPERATION_DELETE_OBJECTS);
    for (DebugObjectItem bean : items) {
        WebModelServiceUtils.deleteObject(dto.getType(), bean.getOid(), ModelExecuteOptions.createRaw(), result, this);
    }
    result.computeStatusIfUnknown();
    RepositoryObjectDataProvider provider = getTableDataProvider();
    provider.clearCache();
    showResult(result);
    target.add((Component) getListTable());
    target.add(getFeedbackPanel());
}
Also used : RepositoryObjectDataProvider(com.evolveum.midpoint.web.component.data.RepositoryObjectDataProvider) DebugConfDialogDto(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugConfDialogDto) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DebugObjectItem(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugObjectItem)

Example 2 with DebugConfDialogDto

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

the class PageDebugList method deleteSelected.

private void deleteSelected(AjaxRequestTarget target, DebugObjectItem item) {
    List<DebugObjectItem> selected = getSelectedData(target, item);
    if (selected.isEmpty()) {
        return;
    }
    DebugSearchDto searchDto = searchModel.getObject();
    DebugConfDialogDto dto = new DebugConfDialogDto(DebugConfDialogDto.Operation.DELETE_SELECTED, selected, searchDto.getType().getClassDefinition());
    confDialogModel.setObject(dto);
    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) DebugObjectItem(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugObjectItem)

Example 3 with DebugConfDialogDto

use of com.evolveum.midpoint.web.page.admin.configuration.dto.DebugConfDialogDto 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 4 with DebugConfDialogDto

use of com.evolveum.midpoint.web.page.admin.configuration.dto.DebugConfDialogDto 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)

Example 5 with DebugConfDialogDto

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

the class PageDebugList method getDeleteConfirmationPanel.

private Popupable getDeleteConfirmationPanel() {
    return new ConfirmationPanel(getMainPopupBodyId(), createDeleteConfirmString()) {

        private static final long serialVersionUID = 1L;

        @Override
        public void yesPerformed(AjaxRequestTarget target) {
            ModalWindow modalWindow = findParent(ModalWindow.class);
            if (modalWindow != null) {
                modalWindow.close(target);
                DebugConfDialogDto dto = confDialogModel.getObject();
                switch(dto.getOperation()) {
                    case DELETE_ALL_TYPE:
                        deleteAllTypeConfirmed(target);
                        break;
                    case DELETE_SELECTED:
                        deleteSelectedConfirmed(target, dto.getObjects());
                        break;
                    case DELETE_RESOURCE_SHADOWS:
                        deleteAllShadowsOnResourceConfirmed(target);
                        break;
                }
            }
        }

        @Override
        public boolean getLabelEscapeModelStrings() {
            return false;
        }
    };
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DebugConfDialogDto(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugConfDialogDto) ModalWindow(org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow)

Aggregations

DebugConfDialogDto (com.evolveum.midpoint.web.page.admin.configuration.dto.DebugConfDialogDto)6 DebugSearchDto (com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto)4 DebugObjectItem (com.evolveum.midpoint.web.page.admin.configuration.dto.DebugObjectItem)3 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 RepositoryObjectDataProvider (com.evolveum.midpoint.web.component.data.RepositoryObjectDataProvider)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 ModalWindow (org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow)1 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)1