Search in sources :

Example 31 with ResourceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.

the class PageAdminResources method loadResource.

protected PrismObject<ResourceType> loadResource(Collection<SelectorOptions<GetOperationOptions>> options) {
    OperationResult result = new OperationResult(OPERATION_LOAD_RESOURCE);
    PrismObject<ResourceType> resource = null;
    try {
        Task task = createSimpleTask(OPERATION_LOAD_RESOURCE);
        LOGGER.trace("getObject(resource) oid={}, options={}", getResourceOid(), options);
        resource = getModelService().getObject(ResourceType.class, getResourceOid(), options, task, result);
        result.recomputeStatus();
        if (LOGGER.isTraceEnabled()) {
            LOGGER.trace("getObject(resource) result\n:{}", result.debugDump());
        }
    } catch (Exception ex) {
        LoggingUtils.logUnexpectedException(LOGGER, "Couldn't get resource", ex);
        result.recordFatalError("Couldn't get resource, reason: " + ex.getMessage(), ex);
    }
    if (!WebComponentUtil.isSuccessOrHandledError(result)) {
        if (resource != null) {
            showResult(result);
        } else {
            getSession().error(getString("pageAdminResources.message.cantLoadResource"));
            throw new RestartResponseException(PageResources.class);
        }
    }
    return resource;
}
Also used : Task(com.evolveum.midpoint.task.api.Task) RestartResponseException(org.apache.wicket.RestartResponseException) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) RestartResponseException(org.apache.wicket.RestartResponseException)

Example 32 with ResourceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.

the class PageAdminResources method deleteSyncTokenPerformed.

protected void deleteSyncTokenPerformed(AjaxRequestTarget target, ResourceType resourceType) {
    //        ResourceDto dto = model.getObject();
    String resourceOid = resourceType.getOid();
    String handlerUri = "http://midpoint.evolveum.com/xml/ns/public/model/synchronization/task/live-sync/handler-3";
    ObjectReferenceType resourceRef = new ObjectReferenceType();
    resourceRef.setOid(resourceOid);
    PrismObject<TaskType> oldTask;
    OperationResult result = new OperationResult(OPERATION_DELETE_SYNC_TOKEN);
    ObjectQuery query = QueryBuilder.queryFor(TaskType.class, getPrismContext()).item(TaskType.F_OBJECT_REF).ref(resourceOid).and().item(TaskType.F_HANDLER_URI).eq(handlerUri).build();
    List<PrismObject<TaskType>> taskList = WebModelServiceUtils.searchObjects(TaskType.class, query, result, this);
    if (taskList.size() != 1) {
        error(getString("pageResource.message.invalidTaskSearch"));
    } else {
        oldTask = taskList.get(0);
        saveTask(oldTask, result);
    }
    result.recomputeStatus();
    showResult(result);
    target.add(getFeedbackPanel());
}
Also used : PrismObject(com.evolveum.midpoint.prism.PrismObject) ObjectReferenceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType) TaskType(com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult)

Example 33 with ResourceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.

the class PageAccount method createPageTitleModel.

@Override
protected IModel<String> createPageTitleModel() {
    return new LoadableModel<String>(false) {

        @Override
        protected String load() {
            PrismObject<ShadowType> account = accountModel.getObject().getObject();
            String accName = WebComponentUtil.getName(account);
            ResourceType resource = account.asObjectable().getResource();
            String name = WebComponentUtil.getName(resource);
            return createStringResourceStatic(PageAccount.this, "PageAccount.title", accName, name).getString();
        }
    };
}
Also used : ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)

Example 34 with ResourceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.

the class PageResources method editAsXmlPerformed.

private void editAsXmlPerformed(ResourceType resourceType) {
    PageParameters parameters = new PageParameters();
    parameters.add(PageDebugView.PARAM_OBJECT_ID, resourceType.getOid());
    parameters.add(PageDebugView.PARAM_OBJECT_TYPE, ResourceType.class.getSimpleName());
    navigateToNext(PageDebugView.class, parameters);
}
Also used : ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters)

Example 35 with ResourceType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType in project midpoint by Evolveum.

the class PageResources method createRowMenuItems.

private List<InlineMenuItem> createRowMenuItems(boolean isHeader) {
    List<InlineMenuItem> menuItems = new ArrayList<>();
    menuItems.add(new InlineMenuItem(createStringResource("PageResources.inlineMenuItem.test"), new Model<Boolean>(false), new Model<Boolean>(false), false, new ColumnMenuAction<SelectableBean<ResourceType>>() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            SelectableBean<ResourceType> rowDto = getRowModel().getObject();
            testResourcePerformed(target, rowDto.getValue());
        }
    }, isHeader ? InlineMenuItem.RESOURCE_INLINE_MENU_ITEM_ID.HEADER_TEST_CONNECTION.getMenuItemId() : InlineMenuItem.RESOURCE_INLINE_MENU_ITEM_ID.TEST_CONNECTION.getMenuItemId(), GuiStyleConstants.CLASS_TEST_CONNECTION_MENU_ITEM, DoubleButtonColumn.BUTTON_COLOR_CLASS.INFO.toString()));
    menuItems.add(new InlineMenuItem(createStringResource("PageBase.button.delete"), new Model<Boolean>(true), new Model<Boolean>(true), false, new ColumnMenuAction<SelectableBean<ResourceType>>() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            if (getRowModel() == null) {
                deleteResourcePerformed(target, null);
            } else {
                SelectableBean<ResourceType> rowDto = getRowModel().getObject();
                deleteResourcePerformed(target, rowDto.getValue());
            }
        }
    }, isHeader ? InlineMenuItem.RESOURCE_INLINE_MENU_ITEM_ID.HEADER_DELETE.getMenuItemId() : InlineMenuItem.RESOURCE_INLINE_MENU_ITEM_ID.DELETE_RESOURCE.getMenuItemId(), GuiStyleConstants.CLASS_DELETE_MENU_ITEM, DoubleButtonColumn.BUTTON_COLOR_CLASS.DANGER.toString()));
    menuItems.add(new InlineMenuItem(createStringResource("pageResources.inlineMenuItem.deleteSyncToken"), isHeader ? new Model<Boolean>(false) : new Model<Boolean>(true), isHeader ? new Model<Boolean>(false) : new Model<Boolean>(true), false, new ColumnMenuAction<SelectableBean<ResourceType>>() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            SelectableBean<ResourceType> rowDto = getRowModel().getObject();
            deleteResourceSyncTokenPerformed(target, rowDto.getValue());
        }
    }));
    menuItems.add(new InlineMenuItem(createStringResource("pageResources.inlineMenuItem.editResource"), isHeader ? new Model<Boolean>(false) : new Model<Boolean>(true), isHeader ? new Model<Boolean>(false) : new Model<Boolean>(true), false, new ColumnMenuAction<SelectableBean<ResourceType>>() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            SelectableBean<ResourceType> rowDto = getRowModel().getObject();
            editResourcePerformed(rowDto.getValue());
        }
    }));
    menuItems.add(new InlineMenuItem(createStringResource("pageResources.button.editAsXml"), new Model<Boolean>(false), new Model<Boolean>(false), false, new ColumnMenuAction<SelectableBean<ResourceType>>() {

        @Override
        public void onClick(AjaxRequestTarget target) {
            SelectableBean<ResourceType> rowDto = getRowModel().getObject();
            editAsXmlPerformed(rowDto.getValue());
        }
    }, InlineMenuItem.RESOURCE_INLINE_MENU_ITEM_ID.EDIT_XML.getMenuItemId(), GuiStyleConstants.CLASS_EDIT_MENU_ITEM, DoubleButtonColumn.BUTTON_COLOR_CLASS.INFO.toString()));
    return menuItems;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) ArrayList(java.util.ArrayList) IModel(org.apache.wicket.model.IModel) AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) Model(org.apache.wicket.model.Model) LoadableModel(com.evolveum.midpoint.gui.api.model.LoadableModel) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ResourceType(com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType) ColumnMenuAction(com.evolveum.midpoint.web.component.data.column.ColumnMenuAction)

Aggregations

ResourceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceType)252 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)199 Test (org.testng.annotations.Test)165 Task (com.evolveum.midpoint.task.api.Task)115 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)58 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)54 PrismObject (com.evolveum.midpoint.prism.PrismObject)50 QName (javax.xml.namespace.QName)45 ArrayList (java.util.ArrayList)37 Element (org.w3c.dom.Element)34 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)33 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)30 ConnectorType (com.evolveum.midpoint.xml.ns._public.common.common_3.ConnectorType)28 ObjectType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType)27 RefinedResourceSchema (com.evolveum.midpoint.common.refinery.RefinedResourceSchema)26 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)26 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)25 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)24 SelectorOptions (com.evolveum.midpoint.schema.SelectorOptions)23 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)23