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());
}
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;
}
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;
}
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;
}
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;
}
Aggregations