Search in sources :

Example 1 with ConfigureTaskConfirmationPanel

use of com.evolveum.midpoint.web.component.dialog.ConfigureTaskConfirmationPanel in project midpoint by Evolveum.

the class AbstractRoleMemberPanel method recomputeMembersPerformed.

protected void recomputeMembersPerformed(AjaxRequestTarget target) {
    StringResourceModel confirmModel;
    if (getSearchBoxConfiguration().isSearchScope(SearchBoxScopeType.SUBTREE)) {
        confirmModel = createStringResource("abstractRoleMemberPanel.recomputeAllSubtreeMembersConfirmationLabel");
    } else {
        confirmModel = getMemberTable().getSelectedObjectsCount() > 0 ? createStringResource("abstractRoleMemberPanel.recomputeSelectedMembersConfirmationLabel") : createStringResource("abstractRoleMemberPanel.recomputeAllMembersConfirmationLabel");
    }
    ConfigureTaskConfirmationPanel dialog = new ConfigureTaskConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(), confirmModel) {

        private static final long serialVersionUID = 1L;

        @Override
        protected PrismObject<TaskType> getTask(AjaxRequestTarget target) {
            Task task = MemberOperationsHelper.createRecomputeMembersTask(getModelObject(), getQueryScope(), getActionQuery(getQueryScope(), getRelationsForRecomputeTask()), target, getPageBase());
            if (task == null) {
                return null;
            }
            PrismObject<TaskType> recomputeTask = task.getRawTaskObjectClone();
            TaskType recomputeTaskType = recomputeTask.asObjectable();
            recomputeTaskType.getAssignment().add(ObjectTypeUtil.createAssignmentTo(SystemObjectsType.ARCHETYPE_RECOMPUTATION_TASK.value(), ObjectTypes.ARCHETYPE, getPrismContext()));
            return recomputeTask;
        }

        @Override
        public StringResourceModel getTitle() {
            return createStringResource("pageUsers.message.confirmActionPopupTitle");
        }

        @Override
        public void yesPerformed(AjaxRequestTarget target) {
            MemberOperationsHelper.createAndSubmitRecomputeMembersTask(getModelObject(), getQueryScope(), getActionQuery(getQueryScope(), getRelationsForRecomputeTask()), target, getPageBase());
        }
    };
    ((PageBase) getPage()).showMainPopup(dialog, target);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Task(com.evolveum.midpoint.task.api.Task) ConfigureTaskConfirmationPanel(com.evolveum.midpoint.web.component.dialog.ConfigureTaskConfirmationPanel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 2 with ConfigureTaskConfirmationPanel

use of com.evolveum.midpoint.web.component.dialog.ConfigureTaskConfirmationPanel in project midpoint by Evolveum.

the class AbstractRoleMemberPanel method recomputeMembersPerformed.

protected void recomputeMembersPerformed(AjaxRequestTarget target) {
    StringResourceModel confirmModel;
    if (getSearchBoxConfiguration().isSearchScope(SearchBoxScopeType.SUBTREE)) {
        confirmModel = createStringResource("abstractRoleMemberPanel.recomputeAllSubtreeMembersConfirmationLabel");
    } else {
        confirmModel = getMemberTable().getSelectedObjectsCount() > 0 ? createStringResource("abstractRoleMemberPanel.recomputeSelectedMembersConfirmationLabel") : createStringResource("abstractRoleMemberPanel.recomputeAllMembersConfirmationLabel");
    }
    ConfigureTaskConfirmationPanel dialog = new ConfigureTaskConfirmationPanel(((PageBase) getPage()).getMainPopupBodyId(), confirmModel) {

        private static final long serialVersionUID = 1L;

        @Override
        protected PrismObject<TaskType> getTask(AjaxRequestTarget target) {
            Task task = MemberOperationsHelperOld.createRecomputeMembersTask(getModelObject(), getPageBase(), getQueryScope(), getActionQuery(getQueryScope(), getRelationsForRecomputeTask()), target);
            if (task == null) {
                return null;
            }
            PrismObject<TaskType> recomputeTask = task.getRawTaskObjectClone();
            TaskType recomputeTaskType = recomputeTask.asObjectable();
            recomputeTaskType.getAssignment().add(ObjectTypeUtil.createAssignmentTo(SystemObjectsType.ARCHETYPE_RECOMPUTATION_TASK.value(), ObjectTypes.ARCHETYPE, getPrismContext()));
            return recomputeTask;
        }

        @Override
        public StringResourceModel getTitle() {
            return createStringResource("pageUsers.message.confirmActionPopupTitle");
        }

        @Override
        public void yesPerformed(AjaxRequestTarget target) {
            MemberOperationsHelperOld.recomputeMembersPerformed(getModelObject(), getPageBase(), getQueryScope(), getActionQuery(getQueryScope(), getRelationsForRecomputeTask()), target);
        }
    };
    ((PageBase) getPage()).showMainPopup(dialog, target);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) Task(com.evolveum.midpoint.task.api.Task) ConfigureTaskConfirmationPanel(com.evolveum.midpoint.web.component.dialog.ConfigureTaskConfirmationPanel) PageBase(com.evolveum.midpoint.gui.api.page.PageBase) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Aggregations

PageBase (com.evolveum.midpoint.gui.api.page.PageBase)2 Task (com.evolveum.midpoint.task.api.Task)2 ConfigureTaskConfirmationPanel (com.evolveum.midpoint.web.component.dialog.ConfigureTaskConfirmationPanel)2 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)2 StringResourceModel (org.apache.wicket.model.StringResourceModel)2