use of com.evolveum.midpoint.gui.api.component.AssignmentPopupDto 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);
}
Aggregations