use of com.evolveum.midpoint.gui.api.component.AssignmentPopup in project midpoint by Evolveum.
the class AbstractAssignmentTypePanel method newAssignmentClickPerformed.
protected void newAssignmentClickPerformed(AjaxRequestTarget target) {
AssignmentPopup popupPanel = new AssignmentPopup(getPageBase().getMainPopupBodyId(), createAssignmentPopupModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, List<AssignmentType> newAssignmentsList) {
super.addPerformed(target, newAssignmentsList);
addSelectedAssignmentsPerformed(target, newAssignmentsList);
}
@Override
protected List<ObjectTypes> getObjectTypesList() {
return AbstractAssignmentTypePanel.this.getObjectTypesList();
}
@Override
protected ObjectFilter getSubtypeFilter() {
return AbstractAssignmentTypePanel.this.getSubtypeFilter();
}
@Override
protected boolean isEntitlementAssignment() {
return AbstractAssignmentTypePanel.this.isEntitlementAssignment();
}
@Override
protected PrismContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
return AbstractAssignmentTypePanel.this.getContainerModel().getObject();
}
@Override
protected <F extends AssignmentHolderType> PrismObject<F> getFocusObject() {
return AbstractAssignmentTypePanel.this.getFocusObject();
}
};
popupPanel.setOutputMarkupId(true);
popupPanel.setOutputMarkupPlaceholderTag(true);
getPageBase().showMainPopup(popupPanel, target);
}
use of com.evolveum.midpoint.gui.api.component.AssignmentPopup in project midpoint by Evolveum.
the class AssignmentHolderOperationalButtonsPanel method changeArchetypeButtonClicked.
private void changeArchetypeButtonClicked(AjaxRequestTarget target) {
AssignmentPopup changeArchetypePopup = new AssignmentPopup(getPageBase().getMainPopupBodyId(), Model.of(new AssignmentPopupDto(null))) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, List<AssignmentType> newAssignmentsList) {
addArchetypePerformed(target, newAssignmentsList);
}
@Override
protected List<ITab> createAssignmentTabs(AssignmentObjectRelation assignmentObjectRelation) {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(getPageBase().createStringResource("ObjectTypes.ARCHETYPE"), new VisibleBehaviour(() -> true)) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new FocusTypeAssignmentPopupTabPanel<ArchetypeType>(panelId, ObjectTypes.ARCHETYPE, null) {
private static final long serialVersionUID = 1L;
@Override
protected PrismContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
PrismContainerWrapper<AssignmentType> assignmentsWrapper = null;
try {
assignmentsWrapper = AssignmentHolderOperationalButtonsPanel.this.getModelObject().findContainer(FocusType.F_ASSIGNMENT);
} catch (SchemaException e) {
LOGGER.error("Cannot find assignment wrapper: {}", e.getMessage());
}
return assignmentsWrapper;
}
@Override
protected List<QName> getSupportedRelations() {
return Collections.singletonList(SchemaConstants.ORG_DEFAULT);
}
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<ArchetypeType>> rowModel) {
target.add(getObjectListPanel());
tabLabelPanelUpdate(target);
}
@Override
protected IModel<Boolean> getObjectSelectCheckBoxEnableModel(IModel<SelectableBean<ArchetypeType>> rowModel) {
if (rowModel == null) {
return Model.of(false);
}
List selectedObjects = getSelectedObjectsList();
return Model.of(selectedObjects == null || selectedObjects.size() == 0 || (rowModel.getObject() != null && rowModel.getObject().isSelected()));
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.ARCHETYPE;
}
@Override
protected ObjectQuery addFilterToContentQuery() {
ObjectQuery query = super.addFilterToContentQuery();
if (query == null) {
query = getPrismContext().queryFactory().createQuery();
}
List<String> archetypeOidsList = getArchetypeOidsListToAssign();
ObjectFilter filter = getPrismContext().queryFor(ArchetypeType.class).id(archetypeOidsList.toArray(new String[0])).buildFilter();
query.addFilter(filter);
return query;
}
};
}
});
return tabs;
}
@Override
protected IModel<String> getWarningMessageModel() {
return createStringResource("PageAdminObjectDetails.button.changeArchetype.warningMessage");
}
};
changeArchetypePopup.setOutputMarkupPlaceholderTag(true);
getPageBase().showMainPopup(changeArchetypePopup, target);
}
use of com.evolveum.midpoint.gui.api.component.AssignmentPopup in project midpoint by Evolveum.
the class PageAdminObjectDetails method changeArchetypeButtonClicked.
private void changeArchetypeButtonClicked(AjaxRequestTarget target) {
AssignmentPopup changeArchetypePopup = new AssignmentPopup(getMainPopupBodyId(), null) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, List<AssignmentType> newAssignmentsList) {
OperationResult result = new OperationResult(OPERATION_EXECUTE_ARCHETYPE_CHANGES);
if (newAssignmentsList.size() > 1) {
result.recordWarning(getString("PageAdminObjectDetails.change.archetype.more.than.one.selected"));
showResult(result);
target.add(PageAdminObjectDetails.this.getFeedbackPanel());
return;
}
AssignmentType oldArchetypAssignment = getOldArchetypeAssignment(result);
if (oldArchetypAssignment == null) {
showResult(result);
target.add(PageAdminObjectDetails.this.getFeedbackPanel());
return;
}
try {
ObjectDelta<O> delta = getPrismContext().deltaFor(getCompileTimeClass()).item(AssignmentHolderType.F_ASSIGNMENT).delete(oldArchetypAssignment.clone()).asObjectDelta(getObjectWrapper().getOid());
delta.addModificationAddContainer(AssignmentHolderType.F_ASSIGNMENT, newAssignmentsList.iterator().next());
Task task = createSimpleTask(OPERATION_EXECUTE_ARCHETYPE_CHANGES);
getModelService().executeChanges(MiscUtil.createCollection(delta), null, task, result);
} catch (Exception e) {
LOGGER.error("Cannot find assignment wrapper: {}", e.getMessage(), e);
result.recordFatalError(getString("PageAdminObjectDetails.change.archetype.failed", e.getMessage()), e);
}
result.computeStatusIfUnknown();
showResult(result);
target.add(PageAdminObjectDetails.this.getFeedbackPanel());
refresh(target);
}
@Override
protected List<ITab> createAssignmentTabs(AssignmentObjectRelation assignmentObjectRelation) {
List<ITab> tabs = new ArrayList<>();
tabs.add(new PanelTab(getPageBase().createStringResource("ObjectTypes.ARCHETYPE"), new VisibleBehaviour(() -> true)) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new FocusTypeAssignmentPopupTabPanel<ArchetypeType>(panelId, ObjectTypes.ARCHETYPE, null) {
private static final long serialVersionUID = 1L;
@Override
protected PrismContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
PrismContainerWrapper<AssignmentType> assignmentsWrapper = null;
try {
assignmentsWrapper = getObjectWrapper().findContainer(FocusType.F_ASSIGNMENT);
} catch (SchemaException e) {
LOGGER.error("Cannot find assignment wrapper: {}", e.getMessage());
}
return assignmentsWrapper;
}
@Override
protected List<QName> getSupportedRelations() {
return Collections.singletonList(SchemaConstants.ORG_DEFAULT);
}
@Override
protected void onSelectionPerformed(AjaxRequestTarget target, IModel<SelectableBean<ArchetypeType>> rowModel) {
target.add(getObjectListPanel());
tabLabelPanelUpdate(target);
}
@Override
protected IModel<Boolean> getObjectSelectCheckBoxEnableModel(IModel<SelectableBean<ArchetypeType>> rowModel) {
if (rowModel == null) {
return Model.of(false);
}
List selectedObjects = getSelectedObjectsList();
return Model.of(selectedObjects == null || selectedObjects.size() == 0 || (rowModel.getObject() != null && rowModel.getObject().isSelected()));
}
@Override
protected ObjectTypes getObjectType() {
return ObjectTypes.ARCHETYPE;
}
@Override
protected ObjectQuery addFilterToContentQuery() {
ObjectQuery query = super.addFilterToContentQuery();
if (query == null) {
query = getPrismContext().queryFactory().createQuery();
}
List<String> archetypeOidsList = getArchetypeOidsListToAssign();
ObjectFilter filter = getPrismContext().queryFor(ArchetypeType.class).id(archetypeOidsList.toArray(new String[0])).buildFilter();
query.addFilter(filter);
return query;
}
};
}
});
return tabs;
}
@Override
protected IModel<String> getWarningMessageModel() {
return createStringResource("PageAdminObjectDetails.button.changeArchetype.warningMessage");
}
};
changeArchetypePopup.setOutputMarkupPlaceholderTag(true);
showMainPopup(changeArchetypePopup, target);
}
use of com.evolveum.midpoint.gui.api.component.AssignmentPopup in project midpoint by Evolveum.
the class AssignmentPanel method newAssignmentClickPerformed.
protected void newAssignmentClickPerformed(AjaxRequestTarget target) {
AssignmentPopup popupPanel = new AssignmentPopup(getPageBase().getMainPopupBodyId(), createAssignmentPopupModel()) {
private static final long serialVersionUID = 1L;
@Override
protected void addPerformed(AjaxRequestTarget target, List<AssignmentType> newAssignmentsList) {
super.addPerformed(target, newAssignmentsList);
addSelectedAssignmentsPerformed(target, newAssignmentsList);
}
@Override
protected List<ObjectTypes> getObjectTypesList() {
return AssignmentPanel.this.getObjectTypesList();
}
@Override
protected ObjectFilter getSubtypeFilter() {
return AssignmentPanel.this.getSubtypeFilter();
}
@Override
protected boolean isEntitlementAssignment() {
return AssignmentPanel.this.isEntitlementAssignment();
}
@Override
protected PrismContainerWrapper<AssignmentType> getAssignmentWrapperModel() {
return AssignmentPanel.this.getModelObject();
}
@Override
protected <F extends AssignmentHolderType> PrismObject<F> getFocusObject() {
return getMultivalueContainerListPanel().getFocusObject();
}
};
popupPanel.setOutputMarkupId(true);
popupPanel.setOutputMarkupPlaceholderTag(true);
getPageBase().showMainPopup(popupPanel, target);
}
Aggregations