Search in sources :

Example 1 with PrismContainerValueWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.

the class CaseWorkItemsPanel method workItemActionPerformed.

private void workItemActionPerformed(IModel<PrismContainerValueWrapper<CaseWorkItemType>> rowModel, boolean approved, AjaxRequestTarget target) {
    List<PrismContainerValueWrapper<CaseWorkItemType>> selectedWorkItems = new ArrayList<>();
    if (rowModel == null) {
        ContainerableListPanel<CaseWorkItemType, PrismContainerValueWrapper<CaseWorkItemType>> tablePanel = getContainerableListPanel();
        selectedWorkItems.addAll(tablePanel.getSelectedObjects());
    } else {
        selectedWorkItems.addAll(Collections.singletonList(rowModel.getObject()));
    }
    if (selectedWorkItems.size() == 0) {
        warn(getString("CaseWorkItemsPanel.noWorkItemIsSelected"));
        target.add(getPageBase().getFeedbackPanel());
        return;
    }
    Task task = CaseWorkItemsPanel.this.getPageBase().createSimpleTask(OPERATION_LOAD_POWER_DONOR_OBJECT);
    OperationResult result = new OperationResult(OPERATION_LOAD_POWER_DONOR_OBJECT);
    final PrismObject<UserType> powerDonor = StringUtils.isNotEmpty(getPowerDonorOidParameterValue()) ? WebModelServiceUtils.loadObject(UserType.class, getPowerDonorOidParameterValue(), CaseWorkItemsPanel.this.getPageBase(), task, result) : null;
    OperationResult completeWorkItemResult = new OperationResult(OPERATION_COMPLETE_WORK_ITEM);
    selectedWorkItems.forEach(workItemToReject -> {
        WebComponentUtil.workItemApproveActionPerformed(target, workItemToReject.getRealValue(), null, powerDonor, approved, completeWorkItemResult, CaseWorkItemsPanel.this.getPageBase());
    });
    WebComponentUtil.clearProviderCache(getContainerableListPanel().getTable().getDataTable().getDataProvider());
    target.add(getPageBase().getFeedbackPanel());
    target.add(getContainerableListPanel());
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ArrayList(java.util.ArrayList) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)

Example 2 with PrismContainerValueWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.

the class CaseWorkItemsPanel method createRowActions.

protected List<InlineMenuItem> createRowActions() {
    List<InlineMenuItem> menu = new ArrayList<>();
    menu.add(new ButtonInlineMenuItem(createStringResource("pageWorkItem.button.reject")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>() {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    workItemActionPerformed(getRowModel(), false, target);
                }
            };
        }

        @Override
        public IModel<Boolean> getEnabled() {
            IModel<PrismContainerValueWrapper<CaseWorkItemType>> rowModel = ((ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>) getAction()).getRowModel();
            if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getRealValue() != null) {
                CaseWorkItemType workItem = rowModel.getObject().getRealValue();
                return Model.of(!CaseTypeUtil.isClosed(CaseTypeUtil.getCase(workItem)));
            } else {
                return super.getEnabled();
            }
        }

        @Override
        public IModel<String> getConfirmationMessageModel() {
            return createStringResource("CaseWorkItemsPanel.confirmWorkItemsRejectAction");
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_ICON_NO_OBJECTS);
        }

        @Override
        public IModel<Boolean> getVisible() {
            IModel<PrismContainerValueWrapper<CaseWorkItemType>> rowModel = ((ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>) getAction()).getRowModel();
            if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getRealValue() != null) {
                CaseWorkItemType workItem = rowModel.getObject().getRealValue();
                return Model.of(!CaseTypeUtil.isCorrelationCase(CaseTypeUtil.getCase(workItem)));
            } else {
                return super.getVisible();
            }
        }
    });
    menu.add(new ButtonInlineMenuItem(createStringResource("pageWorkItem.button.approve")) {

        private static final long serialVersionUID = 1L;

        @Override
        public InlineMenuItemAction initAction() {
            return new ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>() {

                @Override
                public void onClick(AjaxRequestTarget target) {
                    workItemActionPerformed(getRowModel(), true, target);
                }
            };
        }

        @Override
        public CompositedIconBuilder getIconCompositedBuilder() {
            return getDefaultCompositedIconBuilder(GuiStyleConstants.CLASS_ICON_ACTIVATION_ACTIVE);
        }

        @Override
        public IModel<Boolean> getEnabled() {
            IModel<PrismContainerValueWrapper<CaseWorkItemType>> rowModel = ((ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>) getAction()).getRowModel();
            if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getRealValue() != null) {
                CaseWorkItemType workItem = rowModel.getObject().getRealValue();
                return Model.of(!CaseTypeUtil.isClosed(CaseTypeUtil.getCase(workItem)));
            } else {
                return super.getEnabled();
            }
        }

        @Override
        public IModel<String> getConfirmationMessageModel() {
            return createStringResource("CaseWorkItemsPanel.confirmWorkItemsApproveAction");
        }

        @Override
        public IModel<Boolean> getVisible() {
            IModel<PrismContainerValueWrapper<CaseWorkItemType>> rowModel = ((ColumnMenuAction<PrismContainerValueWrapper<CaseWorkItemType>>) getAction()).getRowModel();
            if (rowModel != null && rowModel.getObject() != null && rowModel.getObject().getRealValue() != null) {
                CaseWorkItemType workItem = rowModel.getObject().getRealValue();
                return Model.of(!CaseTypeUtil.isCorrelationCase(CaseTypeUtil.getCase(workItem)));
            } else {
                return super.getVisible();
            }
        }
    });
    return menu;
}
Also used : IModel(org.apache.wicket.model.IModel) ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) InlineMenuItemAction(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction) CompositedIconBuilder(com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper) ButtonInlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)

Example 3 with PrismContainerValueWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.

the class ObjectPolicyConfigurationTabPanel method initBasicColumns.

private List<IColumn<PrismContainerValueWrapper<ObjectPolicyConfigurationType>, String>> initBasicColumns() {
    List<IColumn<PrismContainerValueWrapper<ObjectPolicyConfigurationType>, String>> columns = new ArrayList<>();
    columns.add(new CheckBoxHeaderColumn<>());
    columns.add(new PrismPropertyWrapperColumn<ObjectPolicyConfigurationType, QName>(getModel(), ObjectPolicyConfigurationType.F_TYPE, ColumnType.LINK, getPageBase()) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onClick(AjaxRequestTarget target, IModel<PrismContainerValueWrapper<ObjectPolicyConfigurationType>> rowModel) {
            getMultivalueContainerListPanel().itemDetailsPerformed(target, rowModel);
        }

        @Override
        public String getCssClass() {
            return " col-lg-1 col-md-2 ";
        }
    });
    columns.add(new PrismPropertyWrapperColumn(getModel(), ObjectPolicyConfigurationType.F_SUBTYPE, ColumnType.VALUE, getPageBase()) {

        @Override
        public String getCssClass() {
            return " col-md-2 ";
        }
    });
    columns.add(new PrismReferenceWrapperColumn(getModel(), ObjectPolicyConfigurationType.F_OBJECT_TEMPLATE_REF, ColumnType.VALUE, getPageBase()));
    columns.add(new PrismReferenceWrapperColumn(getModel(), ItemPath.create(ObjectPolicyConfigurationType.F_APPLICABLE_POLICIES, ApplicablePoliciesType.F_POLICY_GROUP_REF), ColumnType.VALUE, getPageBase()));
    columns.add(new PrismContainerWrapperColumn<ObjectPolicyConfigurationType>(getModel(), ItemPath.create(ObjectPolicyConfigurationType.F_LIFECYCLE_STATE_MODEL, LifecycleStateModelType.F_STATE), getPageBase()) {

        @Override
        public String getCssClass() {
            return " col-md-2 ";
        }
    });
    List<InlineMenuItem> menuActionsList = getMultivalueContainerListPanel().getDefaultMenuActions();
    columns.add(new InlineMenuButtonColumn(menuActionsList, getPageBase()) {

        @Override
        public String getCssClass() {
            return " col-md-1 ";
        }
    });
    return columns;
}
Also used : PrismPropertyWrapperColumn(com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn) QName(javax.xml.namespace.QName) InlineMenuButtonColumn(com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn) ArrayList(java.util.ArrayList) AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper) PrismReferenceWrapperColumn(com.evolveum.midpoint.gui.impl.component.data.column.PrismReferenceWrapperColumn)

Example 4 with PrismContainerValueWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.

the class AbstractAssignmentTypePanel method createAssignmentProvider.

private AssignmentListProvider createAssignmentProvider(IModel<Search<AssignmentType>> searchModel, IModel<List<PrismContainerValueWrapper<AssignmentType>>> assignments) {
    AssignmentListProvider assignmentListProvider = new AssignmentListProvider(AbstractAssignmentTypePanel.this, searchModel, assignments) {

        @Override
        protected PageStorage getPageStorage() {
            return AbstractAssignmentTypePanel.this.getPageStorage();
        }

        @Override
        protected List<PrismContainerValueWrapper<AssignmentType>> postFilter(List<PrismContainerValueWrapper<AssignmentType>> assignmentList) {
            return customPostSearch(assignmentList);
        }

        @Override
        protected ObjectQuery getCustomizeContentQuery() {
            return AbstractAssignmentTypePanel.this.getCustomizeQuery();
        }
    };
    assignmentListProvider.setCompiledObjectCollectionView(getObjectCollectionView());
    return assignmentListProvider;
}
Also used : List(java.util.List) ArrayList(java.util.ArrayList) AssignmentListProvider(com.evolveum.midpoint.web.component.util.AssignmentListProvider) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)

Example 5 with PrismContainerValueWrapper

use of com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper in project midpoint by Evolveum.

the class GenericAbstractRoleAssignmentPanel method customPostSearch.

@Override
protected List<PrismContainerValueWrapper<AssignmentType>> customPostSearch(List<PrismContainerValueWrapper<AssignmentType>> assignments) {
    if (assignments == null) {
        return null;
    }
    List<PrismContainerValueWrapper<AssignmentType>> resultList = new ArrayList<>();
    Task task = getPageBase().createSimpleTask("load assignment targets");
    Iterator<PrismContainerValueWrapper<AssignmentType>> assignmentIterator = assignments.iterator();
    while (assignmentIterator.hasNext()) {
        PrismContainerValueWrapper<AssignmentType> ass = assignmentIterator.next();
        AssignmentType assignment = ass.getRealValue();
        if (assignment == null || assignment.getTargetRef() == null) {
            continue;
        }
        if (QNameUtil.match(assignment.getTargetRef().getType(), OrgType.COMPLEX_TYPE)) {
            PrismObject<OrgType> org = WebModelServiceUtils.loadObject(assignment.getTargetRef(), getPageBase(), task, task.getResult());
            if (org != null) {
                if (FocusTypeUtil.determineSubTypes(org).contains("access")) {
                    resultList.add(ass);
                }
            }
        }
    }
    return resultList;
}
Also used : Task(com.evolveum.midpoint.task.api.Task) ArrayList(java.util.ArrayList) PrismContainerValueWrapper(com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)

Aggregations

PrismContainerValueWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper)25 ArrayList (java.util.ArrayList)16 InlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)11 IModel (org.apache.wicket.model.IModel)10 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)9 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)8 InlineMenuButtonColumn (com.evolveum.midpoint.web.component.data.column.InlineMenuButtonColumn)7 ButtonInlineMenuItem (com.evolveum.midpoint.web.component.menu.cog.ButtonInlineMenuItem)7 ListItem (org.apache.wicket.markup.html.list.ListItem)7 Label (org.apache.wicket.markup.html.basic.Label)6 PrismContainerWrapper (com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper)5 CompositedIconBuilder (com.evolveum.midpoint.gui.impl.component.icon.CompositedIconBuilder)5 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)5 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)5 InlineMenuItemAction (com.evolveum.midpoint.web.component.menu.cog.InlineMenuItemAction)5 List (java.util.List)5 PrismPropertyWrapperColumn (com.evolveum.midpoint.gui.impl.component.data.column.PrismPropertyWrapperColumn)4 Task (com.evolveum.midpoint.task.api.Task)4 UserProfileStorage (com.evolveum.midpoint.web.session.UserProfileStorage)4 QName (javax.xml.namespace.QName)4