Search in sources :

Example 1 with ResourceConfigurationDto

use of com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method initLayout.

protected void initLayout(IModel model, PageBase parentPage) {
    PrismObject<ResourceType> resourceObject = (PrismObject<ResourceType>) model.getObject();
    ResourceType resource = resourceObject.asObjectable();
    add(createLastAvailabilityStatusInfo(resource));
    add(createSourceTargetInfo(resource));
    add(createSchemaStatusInfo(resource));
    CapabilitiesPanel capabilities = new CapabilitiesPanel(PANEL_CAPABILITIES, capabilitiesModel);
    add(capabilities);
    List<ResourceConfigurationDto> resourceConfigList = createResourceConfigList(resource);
    ListDataProvider<ResourceConfigurationDto> resourceConfigProvider = new ListDataProvider<ResourceConfigurationDto>(ResourceDetailsTabPanel.this, new ListModel<ResourceConfigurationDto>(resourceConfigList));
    List<ColumnTypeDto<String>> columns = Arrays.asList(new ColumnTypeDto<String>("ShadowType.kind", "objectTypeDefinition.kind", ShadowType.F_KIND.getLocalPart()), new ColumnTypeDto<String>("ShadowType.objectClass", "objectTypeDefinition.objectClass.localPart", ShadowType.F_OBJECT_CLASS.getLocalPart()), new ColumnTypeDto<String>("ShadowType.intent", "objectTypeDefinition.intent", ShadowType.F_INTENT.getLocalPart()), new ColumnTypeDto<String>("ResourceType.isSync", "sync", null));
    List<IColumn<SelectableBean<ResourceType>, String>> tableColumns = ColumnUtils.createColumns(columns);
    PropertyColumn tasksColumn = new PropertyColumn(PageBase.createStringResourceStatic(this, "ResourceType.tasks"), "definedTasks") {

        @Override
        public void populateItem(Item item, String componentId, final IModel rowModel) {
            ResourceConfigurationDto conf = (ResourceConfigurationDto) rowModel.getObject();
            RepeatingView repeater = new RepeatingView(componentId);
            for (final TaskType task : conf.getDefinedTasks()) {
                repeater.add(new LinkPanel(repeater.newChildId(), new Model<String>(task.getName().getOrig())) {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        ResourceDetailsTabPanel.this.taskDetailsPerformed(target, task.getOid());
                    }
                });
            }
            item.add(repeater);
        }
    };
    tableColumns.add(tasksColumn);
    BoxedTablePanel<ResourceConfigurationDto> resourceConfig = new BoxedTablePanel("resourceConfig", resourceConfigProvider, tableColumns);
    resourceConfig.setAdditionalBoxCssClasses("box-success");
    add(resourceConfig);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) ResourceConfigurationDto(com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto) ColumnTypeDto(com.evolveum.midpoint.web.component.data.column.ColumnTypeDto) LinkPanel(com.evolveum.midpoint.web.component.data.column.LinkPanel) PrismObject(com.evolveum.midpoint.prism.PrismObject) Item(org.apache.wicket.markup.repeater.Item) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) IModel(org.apache.wicket.model.IModel) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) IModel(org.apache.wicket.model.IModel) ListModel(org.apache.wicket.model.util.ListModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel)

Example 2 with ResourceConfigurationDto

use of com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method createResourceConfigList.

private List<ResourceConfigurationDto> createResourceConfigList(ResourceType resource) {
    OperationResult result = new OperationResult(OPERATION_SEARCH_TASKS_FOR_RESOURCE);
    List<PrismObject<TaskType>> tasks = WebModelServiceUtils.searchObjects(TaskType.class, getPageBase().getPrismContext().queryFor(TaskType.class).item(TaskType.F_OBJECT_REF).ref(resource.getOid()).and().item(TaskType.F_PARENT).isNull().build(), result, getPageBase());
    List<ResourceConfigurationDto> configs = new ArrayList<>();
    if (resource.getSchemaHandling() == null) {
        return configs;
    }
    List<ResourceObjectTypeDefinitionType> objectTypes = resource.getSchemaHandling().getObjectType();
    if (objectTypes == null) {
        return configs;
    }
    try {
        for (ResourceObjectTypeDefinitionType objectType : objectTypes) {
            ObjectSynchronizationType objectSynchronization = null;
            if (resource.getSynchronization() != null && resource.getSynchronization().getObjectSynchronization() != null) {
                objectSynchronization = getSynchronizationFor(objectType, resource.getSynchronization().getObjectSynchronization(), resource.asPrismObject());
            }
            List<TaskType> syncTask = new ArrayList<>();
            if (objectSynchronization != null) {
                syncTask = getTaskFor(tasks, objectSynchronization, resource.asPrismObject());
            }
            ResourceConfigurationDto resourceConfig = new ResourceConfigurationDto(objectType, objectSynchronization != null, syncTask);
            configs.add(resourceConfig);
        }
    } catch (SchemaException ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Could not determine resource configuration", ex);
    }
    return configs;
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceConfigurationDto(com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto)

Example 3 with ResourceConfigurationDto

use of com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method initLayout.

protected void initLayout() {
    PrismObject<ResourceType> resourceObject = getModelObject();
    ResourceType resource = resourceObject.asObjectable();
    add(createLastAvailabilityStatusInfo(resource));
    add(createSourceTargetInfo(resource));
    add(createSchemaStatusInfo(resource));
    CapabilitiesPanel capabilities = new CapabilitiesPanel(PANEL_CAPABILITIES, capabilitiesModel);
    add(capabilities);
    List<ResourceConfigurationDto> resourceConfigList = createResourceConfigList(resource);
    ListDataProvider<ResourceConfigurationDto> resourceConfigProvider = new ListDataProvider<>(ResourceDetailsTabPanel.this, new ListModel<>(resourceConfigList));
    List<IColumn<SelectableBeanImpl<ResourceType>, String>> tableColumns = new ArrayList<>();
    tableColumns.add(ColumnUtils.createPropertyColumn(new ColumnTypeDto<>("ShadowType.kind", "objectTypeDefinition.kind", ShadowType.F_KIND.getLocalPart())));
    tableColumns.add(new PropertyColumn<>(createStringResource("ShadowType.objectClass"), "objectTypeDefinition.objectClass") {

        @Override
        public IModel<?> getDataModel(IModel<SelectableBeanImpl<ResourceType>> rowModel) {
            IModel<QName> model = (IModel<QName>) super.getDataModel(rowModel);
            if (model.getObject() != null) {
                return () -> model.getObject().getLocalPart();
            }
            return model;
        }
    });
    List<ColumnTypeDto<String>> columns = Arrays.asList(new ColumnTypeDto<>("ShadowType.intent", "objectTypeDefinition.intent", ShadowType.F_INTENT.getLocalPart()), new ColumnTypeDto<>("ResourceType.isSync", "sync", null));
    tableColumns.addAll(ColumnUtils.createColumns(columns));
    PropertyColumn tasksColumn = new PropertyColumn(PageBase.createStringResourceStatic(this, "ResourceType.tasks"), "definedTasks") {

        @Override
        public void populateItem(Item item, String componentId, final IModel rowModel) {
            ResourceConfigurationDto conf = (ResourceConfigurationDto) rowModel.getObject();
            RepeatingView repeater = new RepeatingView(componentId);
            for (final TaskType task : conf.getDefinedTasks()) {
                repeater.add(new AjaxLinkPanel(repeater.newChildId(), new Model<>(task.getName().getOrig())) {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        ResourceDetailsTabPanel.this.taskDetailsPerformed(target, task.getOid());
                    }
                });
            }
            item.add(repeater);
        }
    };
    tableColumns.add(tasksColumn);
    BoxedTablePanel<ResourceConfigurationDto> resourceConfig = new BoxedTablePanel("resourceConfig", resourceConfigProvider, tableColumns);
    resourceConfig.setAdditionalBoxCssClasses("box-success");
    add(resourceConfig);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) ResourceConfigurationDto(com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto) ColumnTypeDto(com.evolveum.midpoint.web.component.data.column.ColumnTypeDto) Item(org.apache.wicket.markup.repeater.Item) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) IModel(org.apache.wicket.model.IModel) QName(javax.xml.namespace.QName) AjaxLinkPanel(com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) IModel(org.apache.wicket.model.IModel) ListModel(org.apache.wicket.model.util.ListModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel)

Example 4 with ResourceConfigurationDto

use of com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method initLayout.

protected void initLayout() {
    // PrismObject<ResourceType> resourceObject = getObjectWrapper().getObject();
    // ResourceType resource = resourceObject.asObjectable();
    add(createLastAvailabilityStatusInfo());
    add(createSourceTargetInfo());
    add(createSchemaStatusInfo());
    CapabilitiesPanel capabilities = new CapabilitiesPanel(PANEL_CAPABILITIES, capabilitiesModel);
    add(capabilities);
    ListDataProvider<ResourceConfigurationDto> resourceConfigProvider = new ListDataProvider<>(ResourceDetailsTabPanel.this, createResourceConfigListModel());
    List<IColumn<SelectableBeanImpl<ResourceType>, String>> tableColumns = new ArrayList<>();
    tableColumns.add(ColumnUtils.createPropertyColumn(new ColumnTypeDto<>("ShadowType.kind", "objectTypeDefinition.kind", ShadowType.F_KIND.getLocalPart())));
    tableColumns.add(new PropertyColumn<>(createStringResource("ShadowType.objectClass"), "objectTypeDefinition.objectClass") {

        @Override
        public IModel<?> getDataModel(IModel<SelectableBeanImpl<ResourceType>> rowModel) {
            IModel<QName> model = (IModel<QName>) super.getDataModel(rowModel);
            if (model.getObject() != null) {
                return () -> model.getObject().getLocalPart();
            }
            return model;
        }
    });
    List<ColumnTypeDto<String>> columns = Arrays.asList(new ColumnTypeDto<>("ShadowType.intent", "objectTypeDefinition.intent", ShadowType.F_INTENT.getLocalPart()), new ColumnTypeDto<>("ResourceType.isSync", "sync", null));
    tableColumns.addAll(ColumnUtils.createColumns(columns));
    PropertyColumn tasksColumn = new PropertyColumn(PageBase.createStringResourceStatic(this, "ResourceType.tasks"), "definedTasks") {

        @Override
        public void populateItem(Item item, String componentId, final IModel rowModel) {
            ResourceConfigurationDto conf = (ResourceConfigurationDto) rowModel.getObject();
            RepeatingView repeater = new RepeatingView(componentId);
            for (final TaskType task : conf.getDefinedTasks()) {
                repeater.add(new AjaxLinkPanel(repeater.newChildId(), new Model<>(task.getName().getOrig())) {

                    @Override
                    public void onClick(AjaxRequestTarget target) {
                        ResourceDetailsTabPanel.this.taskDetailsPerformed(target, task.getOid());
                    }
                });
            }
            item.add(repeater);
        }
    };
    tableColumns.add(tasksColumn);
    BoxedTablePanel<ResourceConfigurationDto> resourceConfig = new BoxedTablePanel("resourceConfig", resourceConfigProvider, tableColumns);
    resourceConfig.setAdditionalBoxCssClasses("box-success");
    add(resourceConfig);
}
Also used : ListDataProvider(com.evolveum.midpoint.web.component.util.ListDataProvider) SelectableBeanImpl(com.evolveum.midpoint.web.component.util.SelectableBeanImpl) PropertyColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn) ArrayList(java.util.ArrayList) RepeatingView(org.apache.wicket.markup.repeater.RepeatingView) ResourceConfigurationDto(com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto) ColumnTypeDto(com.evolveum.midpoint.web.component.data.column.ColumnTypeDto) Item(org.apache.wicket.markup.repeater.Item) BoxedTablePanel(com.evolveum.midpoint.web.component.data.BoxedTablePanel) IModel(org.apache.wicket.model.IModel) QName(javax.xml.namespace.QName) AjaxLinkPanel(com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel) CapabilitiesPanel(com.evolveum.midpoint.web.page.admin.resources.CapabilitiesPanel) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) IModel(org.apache.wicket.model.IModel) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel) Model(org.apache.wicket.model.Model) ResourceDetailsModel(com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel)

Example 5 with ResourceConfigurationDto

use of com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto in project midpoint by Evolveum.

the class ResourceDetailsTabPanel method createResourceConfigListModel.

private ReadOnlyModel<List<ResourceConfigurationDto>> createResourceConfigListModel() {
    return new ReadOnlyModel<>(() -> {
        ResourceType resource = getObjectDetailsModels().getObjectType();
        OperationResult result = new OperationResult(OPERATION_SEARCH_TASKS_FOR_RESOURCE);
        List<PrismObject<TaskType>> tasks = WebModelServiceUtils.searchObjects(TaskType.class, getPageBase().getPrismContext().queryFor(TaskType.class).item(TaskType.F_OBJECT_REF).ref(resource.getOid()).and().item(TaskType.F_PARENT).isNull().build(), result, getPageBase());
        List<ResourceConfigurationDto> configs = new ArrayList<>();
        if (resource.getSchemaHandling() == null) {
            return configs;
        }
        List<ResourceObjectTypeDefinitionType> objectTypes = resource.getSchemaHandling().getObjectType();
        if (objectTypes == null) {
            return configs;
        }
        try {
            for (ResourceObjectTypeDefinitionType objectType : objectTypes) {
                ObjectSynchronizationType objectSynchronization = null;
                if (resource.getSynchronization() != null && resource.getSynchronization().getObjectSynchronization() != null) {
                    objectSynchronization = getSynchronizationFor(objectType, resource.getSynchronization().getObjectSynchronization(), resource.asPrismObject());
                }
                List<TaskType> syncTask = new ArrayList<>();
                if (objectSynchronization != null) {
                    syncTask = getTaskFor(tasks, objectSynchronization, resource.asPrismObject());
                }
                ResourceConfigurationDto resourceConfig = new ResourceConfigurationDto(objectType, objectSynchronization != null, syncTask);
                configs.add(resourceConfig);
            }
        } catch (SchemaException ex) {
            LoggingUtils.logUnexpectedException(LOGGER, "Could not determine resource configuration", ex);
        }
        return configs;
    });
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceConfigurationDto(com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto) PrismObject(com.evolveum.midpoint.prism.PrismObject) ReadOnlyModel(com.evolveum.midpoint.gui.api.model.ReadOnlyModel)

Aggregations

ResourceConfigurationDto (com.evolveum.midpoint.web.page.admin.resources.dto.ResourceConfigurationDto)5 ArrayList (java.util.ArrayList)4 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)3 PrismObject (com.evolveum.midpoint.prism.PrismObject)3 BoxedTablePanel (com.evolveum.midpoint.web.component.data.BoxedTablePanel)3 ColumnTypeDto (com.evolveum.midpoint.web.component.data.column.ColumnTypeDto)3 ListDataProvider (com.evolveum.midpoint.web.component.util.ListDataProvider)3 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)3 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)3 PropertyColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn)3 Item (org.apache.wicket.markup.repeater.Item)3 RepeatingView (org.apache.wicket.markup.repeater.RepeatingView)3 IModel (org.apache.wicket.model.IModel)3 Model (org.apache.wicket.model.Model)3 ReadOnlyModel (com.evolveum.midpoint.gui.api.model.ReadOnlyModel)2 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)2 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)2 AjaxLinkPanel (com.evolveum.midpoint.web.component.data.column.AjaxLinkPanel)2 SelectableBeanImpl (com.evolveum.midpoint.web.component.util.SelectableBeanImpl)2 QName (javax.xml.namespace.QName)2