Search in sources :

Example 1 with DebugObjectItem

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

the class PageDebugList method exportSelected.

private void exportSelected(AjaxRequestTarget target, DebugObjectItem item) {
    List<DebugObjectItem> selected = getSelectedData(target, item);
    if (selected.isEmpty()) {
        return;
    }
    List<String> oids = new ArrayList<>();
    for (DebugObjectItem dItem : selected) {
        oids.add(dItem.getOid());
    }
    ObjectFilter filter = InOidFilter.createInOid(oids);
    DebugSearchDto searchDto = searchModel.getObject();
    initDownload(target, searchDto.getType().getClassDefinition(), ObjectQuery.createObjectQuery(filter));
}
Also used : ArrayList(java.util.ArrayList) DebugSearchDto(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto) ObjectFilter(com.evolveum.midpoint.prism.query.ObjectFilter) DebugObjectItem(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugObjectItem)

Example 2 with DebugObjectItem

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

the class PageDebugList method initColumns.

private List<IColumn> initColumns(final Class<? extends ObjectType> type) {
    List<IColumn> columns = new ArrayList<>();
    IColumn column = new CheckBoxHeaderColumn<ObjectType>();
    columns.add(column);
    column = new LinkColumn<DebugObjectItem>(createStringResource("pageDebugList.name"), DebugObjectItem.F_NAME, DebugObjectItem.F_NAME) {

        @Override
        public void populateItem(Item<ICellPopulator<DebugObjectItem>> cellItem, String componentId, final IModel<DebugObjectItem> rowModel) {
            TwoValueLinkPanel panel = new TwoValueLinkPanel(componentId, new AbstractReadOnlyModel<String>() {

                @Override
                public String getObject() {
                    DebugObjectItem object = rowModel.getObject();
                    if (object == null) {
                        return null;
                    }
                    StringBuilder sb = new StringBuilder();
                    sb.append(object.getName());
                    if (object.getStatus() != null && object.getStatus() != OperationResultStatusType.SUCCESS && object.getStatus() != OperationResultStatusType.HANDLED_ERROR) {
                        sb.append(" (");
                        sb.append(object.getStatus());
                        sb.append(")");
                    }
                    return sb.toString();
                }
            }, new PropertyModel<String>(rowModel, DebugObjectItem.F_OID)) {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    DebugObjectItem object = rowModel.getObject();
                    objectEditPerformed(target, object.getOid(), type);
                }

                @Override
                public boolean isEnabled() {
                    return rowModel.getObject().getOid() != null;
                }
            };
            cellItem.add(panel);
            cellItem.add(new AttributeModifier("class", "col-md-3"));
        }
    };
    columns.add(column);
    columns.add(new PropertyColumn(createStringResource("pageDebugList.description"), DebugObjectItem.F_DESCRIPTION));
    if (ShadowType.class.isAssignableFrom(type)) {
        columns.add(new PropertyColumn(createStringResource("pageDebugList.resourceName"), DebugObjectItem.F_RESOURCE_NAME));
        columns.add(new PropertyColumn(createStringResource("pageDebugList.resourceType"), DebugObjectItem.F_RESOURCE_TYPE));
    }
    column = new AbstractColumn<DebugObjectItem, String>(new Model(), null) {

        @Override
        public String getCssClass() {
            return "debug-list-buttons";
        }

        @Override
        public void populateItem(Item<ICellPopulator<DebugObjectItem>> cellItem, String componentId, IModel<DebugObjectItem> rowModel) {
            cellItem.add(new DebugButtonPanel<DebugObjectItem>(componentId, rowModel) {

                @Override
                public void deletePerformed(AjaxRequestTarget target, IModel<DebugObjectItem> model) {
                    deleteSelected(target, model.getObject());
                }

                @Override
                public void exportPerformed(AjaxRequestTarget target, IModel<DebugObjectItem> model) {
                    exportSelected(target, model.getObject());
                }
            });
        }
    };
    columns.add(column);
    column = new InlineMenuHeaderColumn<InlineMenuable>(initInlineMenu()) {

        @Override
        public void populateItem(Item<ICellPopulator<InlineMenuable>> cellItem, String componentId, IModel<InlineMenuable> rowModel) {
            // we don't need row inline menu
            cellItem.add(new Label(componentId));
        }
    };
    columns.add(column);
    return columns;
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) Label(org.apache.wicket.markup.html.basic.Label) DebugObjectItem(com.evolveum.midpoint.web.page.admin.configuration.dto.DebugObjectItem) TwoValueLinkPanel(com.evolveum.midpoint.web.component.data.column.TwoValueLinkPanel) CheckBoxHeaderColumn(com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn) IModel(org.apache.wicket.model.IModel) PropertyModel(org.apache.wicket.model.PropertyModel) AttributeModifier(org.apache.wicket.AttributeModifier) InlineMenuable(com.evolveum.midpoint.web.component.data.column.InlineMenuable) ICellPopulator(org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) 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) DebugButtonPanel(com.evolveum.midpoint.web.page.admin.configuration.component.DebugButtonPanel)

Example 3 with DebugObjectItem

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

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

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

Aggregations

DebugObjectItem (com.evolveum.midpoint.web.page.admin.configuration.dto.DebugObjectItem)6 DebugConfDialogDto (com.evolveum.midpoint.web.page.admin.configuration.dto.DebugConfDialogDto)3 DebugSearchDto (com.evolveum.midpoint.web.page.admin.configuration.dto.DebugSearchDto)3 ArrayList (java.util.ArrayList)2 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PrismReference (com.evolveum.midpoint.prism.PrismReference)1 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 ObjectFilter (com.evolveum.midpoint.prism.query.ObjectFilter)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 RepositoryObjectDataProvider (com.evolveum.midpoint.web.component.data.RepositoryObjectDataProvider)1 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)1 InlineMenuable (com.evolveum.midpoint.web.component.data.column.InlineMenuable)1 TwoValueLinkPanel (com.evolveum.midpoint.web.component.data.column.TwoValueLinkPanel)1 DebugButtonPanel (com.evolveum.midpoint.web.page.admin.configuration.component.DebugButtonPanel)1 AttributeModifier (org.apache.wicket.AttributeModifier)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 ICellPopulator (org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator)1 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)1