Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into feature/simulations
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Jan 19, 2023
2 parents b3cd9e5 + fe8057f commit 68b4093
Show file tree
Hide file tree
Showing 65 changed files with 1,884 additions and 473 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,9 @@ public Collection<VirtualContainersSpecificationType> getVirtualContainers() {

protected void collectVirtualContainers(@NotNull Collection<? extends ContainerPanelConfigurationType> panelConfigs, Collection<VirtualContainersSpecificationType> virtualContainers) {
for (ContainerPanelConfigurationType panelConfig : panelConfigs) {
if(isIgnoredWizardPanel(panelConfig)) {
continue;
}
if (objectStatus == null || panelConfig.getApplicableForOperation() == null
|| (ItemStatus.NOT_CHANGED.equals(objectStatus)
&& OperationTypeType.MODIFY.equals(panelConfig.getApplicableForOperation()))
Expand All @@ -243,6 +246,10 @@ protected void collectVirtualContainers(@NotNull Collection<? extends ContainerP
}
}

protected boolean isIgnoredWizardPanel(ContainerPanelConfigurationType panelConfig) {
return false;
}

public VirtualContainersSpecificationType findVirtualContainerConfiguration(ItemPath path) {
for (VirtualContainersSpecificationType virtualContainer : getVirtualContainers()) {
if (virtualContainer.getPath() != null && path.equivalent(virtualContainer.getPath().getItemPath())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3616,19 +3616,15 @@ public static Collection<QName> loadResourceObjectClassValues(ResourceType resou
public static List<ResourceAssociationDefinition> getRefinedAssociationDefinition(ConstructionType construction, PageBase pageBase) {
List<ResourceAssociationDefinition> associationDefinitions = new ArrayList<>();

PrismContext prismContext = pageBase.getPrismContext();
if (construction == null) {
return associationDefinitions;
}
PrismObject<ResourceType> resource = WebComponentUtil.getConstructionResource(construction, "load resource", pageBase);
if (resource == null) {
return associationDefinitions;
}

ObjectQuery query = prismContext.queryFactory().createQuery();
try {
ResourceSchema schema = ResourceSchemaFactory.getCompleteSchema(resource);
ResourceObjectDefinition oc = schema.findDefinitionForConstruction(construction);
ResourceObjectDefinition oc = getResourceObjectDefinition(construction, pageBase);
if (oc == null) {
LOGGER.debug("Association for {} not supported by resource {}", construction, resource);
return null;
Expand All @@ -3645,6 +3641,22 @@ public static List<ResourceAssociationDefinition> getRefinedAssociationDefinitio
return associationDefinitions;
}

public static ResourceObjectDefinition getResourceObjectDefinition(ConstructionType construction, PageBase pageBase) throws CommonException {

PrismContext prismContext = pageBase.getPrismContext();
if (construction == null) {
return null;
}
PrismObject<ResourceType> resource = WebComponentUtil.getConstructionResource(construction, "load resource", pageBase);
if (resource == null) {
return null;
}

ResourceSchema schema = ResourceSchemaFactory.getCompleteSchema(resource);
ResourceObjectDefinition oc = schema.findDefinitionForConstruction(construction);
return oc;
}

public static List<ResourceAssociationDefinition> getRefinedAssociationDefinition(ResourceType resource, ShadowKindType kind, String intent) {
List<ResourceAssociationDefinition> associationDefinitions = new ArrayList<>();

Expand Down Expand Up @@ -5474,12 +5486,12 @@ public static AdminLTESkin getMidPointSkin() {
return AdminLTESkin.create(skin);
}

public static void createToastForUpdateObject(AjaxRequestTarget target, Component panel, QName type) {
createToastForResource("AbstractWizardPanel.updateObject", ResourceType.COMPLEX_TYPE, target);
public static void createToastForUpdateObject(AjaxRequestTarget target, QName type) {
createToastForResource("AbstractWizardPanel.updateObject", type, target);
}

public static void createToastForCreateObject(AjaxRequestTarget target, Component panel, QName type) {
createToastForResource("AbstractWizardPanel.createObject", ResourceType.COMPLEX_TYPE, target);
public static void createToastForCreateObject(AjaxRequestTarget target, QName type) {
createToastForResource("AbstractWizardPanel.createObject", type, target);
}

private static void createToastForResource(String key, QName type, AjaxRequestTarget target) {
Expand All @@ -5494,6 +5506,10 @@ private static void createToastForResource(String key, QName type, AjaxRequestTa
.show(target);
}

public static <O extends ObjectType> String getLabelForType(Class<O> type, boolean startsWithUppercase) {
return translateMessage(ObjectTypeUtil.createTypeDisplayInformation(type.getSimpleName(), startsWithUppercase));
}

public static String translateMessage(LocalizableMessage msg) {
if (msg == null) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,8 @@ private boolean isMenuItemVisible(ContainerPanelConfigurationType config) {
return true;
}



return WebComponentUtil.getElementVisibility(config.getVisibility()) && isVisibleForAddApply(config);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</span>
<div class="d-inline-flex">
<wicket:container wicket:id="selectedItemContainer">
<div class="btn-sm btn-primary d-flex" style="cursor: auto;">
<div class="btn-sm btn-primary d-flex mr-2" style="cursor: auto;">
<div wicket:id="selectedItem"/>
<a wicket:id="deselectButton">
<i class="fa fa-xmark ml-2 text-white"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.evolveum.midpoint.web.component.AjaxButton;
import com.evolveum.midpoint.web.component.data.SelectableBeanObjectDataProvider;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.web.session.UserProfileStorage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;

Expand All @@ -20,7 +21,7 @@

public abstract class MultiSelectTileTablePanel<E extends Serializable, O extends ObjectType> extends SingleSelectTileTablePanel<O> {

private static final String ID_SELECTED_ITEMS_CONTAINER = "selectedItemsContainer";
protected static final String ID_SELECTED_ITEMS_CONTAINER = "selectedItemsContainer";
private static final String ID_SELECTED_ITEM_CONTAINER = "selectedItemContainer";
private static final String ID_SELECTED_ITEM = "selectedItem";
private static final String ID_DESELECT_BUTTON = "deselectButton";
Expand All @@ -40,6 +41,7 @@ protected void onInitialize() {
private void initLayout(){
WebMarkupContainer selectedItemsContainer = new WebMarkupContainer(ID_SELECTED_ITEMS_CONTAINER);
selectedItemsContainer.setOutputMarkupId(true);
selectedItemsContainer.add(new VisibleBehaviour(() -> isSelectedItemsPanelVisible()));
add(selectedItemsContainer);

ListView<E> selectedContainer = new ListView<>(
Expand All @@ -65,10 +67,18 @@ public void onClick(AjaxRequestTarget target) {
selectedItemsContainer.add(selectedContainer);
}

protected boolean isSelectedItemsPanelVisible() {
return true;
}

@Override
public void refresh(AjaxRequestTarget target) {
super.refresh(target);
target.add(get(ID_SELECTED_ITEMS_CONTAINER));
target.add(getSelectedItemPanel());
}

protected Component getSelectedItemPanel() {
return get(ID_SELECTED_ITEMS_CONTAINER);
}

protected abstract void deselectItem(E entry);
Expand All @@ -92,7 +102,7 @@ protected void onClick(AjaxRequestTarget target) {
getModelObject().getValue().setSelected(getModelObject().isSelected());

processSelectOrDeselectItem(getModelObject());
target.add(MultiSelectTileTablePanel.this.get(ID_SELECTED_ITEMS_CONTAINER));
target.add(getSelectedItemPanel());
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,13 @@ protected IModel<Search<? extends ObjectType>> createSearchModel() {
return new LoadableModel<>(false) {
@Override
protected Search<O> load() {
return SearchFactory.createSearch(createSearchConfigWrapper(getType()), getPageBase());
return SearchFactory.createSearch(createSearchConfigWrapper(getType()), false, getPageBase());
}
};
}

protected SearchConfigurationWrapper<O> createSearchConfigWrapper(Class<O> type) {
return new SearchConfigurationWrapper<>(type, getPageBase());
return SearchFactory.createDefaultSearchBoxConfigurationWrapper(type, getPageBase());
}

protected Class<O> getType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ protected void updateFeedbackPanels(AjaxRequestTarget target) {
(component, objectIVisit) -> ((VerticalFormPrismPropertyValuePanel<?>) component).updateFeedbackPanel(target));
}

private VerticalFormPanel getVerticalForm() {
protected VerticalFormPanel getVerticalForm() {
return (VerticalFormPanel) get(ID_FORM);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public IModel<PrismContainerValueWrapper<C>> getValueModel() {
return helper.getValueModel();
}

protected OperationResult onSaveResourcePerformed(AjaxRequestTarget target) {
return helper.onSaveResourcePerformed(target);
protected OperationResult onSavePerformed(AjaxRequestTarget target) {
return helper.onSaveObjectPerformed(target);
}

protected boolean isSavedAfterWizard() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import com.evolveum.midpoint.gui.impl.component.tile.TilePanel;
import com.evolveum.midpoint.gui.impl.page.admin.assignmentholder.AssignmentHolderDetailsModel;

import com.evolveum.midpoint.gui.impl.page.admin.role.component.wizard.ApplicationRoleWizardPreviewPanel;
import com.evolveum.midpoint.prism.PrismContext;
import com.evolveum.midpoint.schema.util.ObjectTypeUtil;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerValueWrapper;
import com.evolveum.midpoint.gui.impl.page.admin.resource.ResourceDetailsModel;
import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.schema.result.OperationResult;

Expand Down Expand Up @@ -50,7 +49,7 @@ public boolean isSavedAfterWizard() {
return true;
}

public OperationResult onSaveResourcePerformed(AjaxRequestTarget target) {
public OperationResult onSaveObjectPerformed(AjaxRequestTarget target) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.task.api.Task;

import com.evolveum.midpoint.util.QNameUtil;
import com.evolveum.midpoint.util.exception.ConfigurationException;

import org.apache.wicket.model.IModel;
Expand Down Expand Up @@ -75,7 +76,7 @@ public Collection<ItemName> loadChoices() {
@Override
public <IW extends ItemWrapper<?, ?>> boolean match(IW wrapper) {
ItemPath wrapperPath = wrapper.getPath().removeIds();
return isAssignmentAttributeOrAssociation(wrapperPath) || isInducementAttributeOrAssociation(wrapperPath);
return isAssignmentAttributeOrAssociation(wrapperPath) || isInducementAttributeOrAssociation(wrapper);
}

private boolean isAssignmentAttributeOrAssociation(ItemPath wrapperPath) {
Expand All @@ -85,11 +86,21 @@ private boolean isAssignmentAttributeOrAssociation(ItemPath wrapperPath) {
return assignmentAttributePath.equivalent(wrapperPath) || assignmentAssociationPath.equivalent(wrapperPath);
}

private boolean isInducementAttributeOrAssociation(ItemPath wrapperPath) {
private <IW extends ItemWrapper<?, ?>> boolean isInducementAttributeOrAssociation(IW wrapper) {
ItemPath wrapperPath = wrapper.getPath().removeIds();
ItemPath inducementAttributePath = ItemPath.create(AbstractRoleType.F_INDUCEMENT, AssignmentType.F_CONSTRUCTION, ConstructionType.F_ATTRIBUTE, ResourceAttributeDefinitionType.F_REF);
ItemPath inducementAssociationPath = ItemPath.create(AbstractRoleType.F_INDUCEMENT, AssignmentType.F_CONSTRUCTION, ConstructionType.F_ASSOCIATION, ResourceAttributeDefinitionType.F_REF);

return inducementAttributePath.equivalent(wrapperPath) || inducementAssociationPath.equivalent(wrapperPath);
return inducementAttributePath.equivalent(wrapperPath) || inducementAssociationPath.equivalent(wrapperPath) || isVirtualPropertyOfMapping(wrapper);
}

private <IW extends ItemWrapper<?, ?>> boolean isVirtualPropertyOfMapping(IW wrapper) {
return QNameUtil.match(wrapper.getItemName(), ResourceAttributeDefinitionType.F_REF)
&& wrapper.getParent().getPath().namedSegmentsOnly().equivalent(ItemPath.create(
AbstractRoleType.F_INDUCEMENT,
AssignmentType.F_CONSTRUCTION,
ConstructionType.F_ATTRIBUTE,
ResourceAttributeDefinitionType.F_OUTBOUND));
}

private List<ItemName> getChoicesList(PrismPropertyPanelContext<ItemPathType> ctx) {
Expand All @@ -101,17 +112,19 @@ private List<ItemName> getChoicesList(PrismPropertyPanelContext<ItemPathType> ct
}

//attribute value
if (wrapper.getParent() == null) {
PrismContainerValueWrapper<ResourceAttributeDefinitionType> attributeValueWrapper =
wrapper.getParentContainerValue(ResourceAttributeDefinitionType.class);
if (attributeValueWrapper == null) {
return Collections.emptyList();
}

//attribute
ItemWrapper<?, ?> attributeWrapper = wrapper.getParent().getParent();
ItemWrapper<?, ?> attributeWrapper = attributeValueWrapper.getParent();
if (attributeWrapper == null) {
return Collections.emptyList();
}

PrismContainerValueWrapper<?> itemWrapper = attributeWrapper.getParent();
PrismContainerValueWrapper<ConstructionType> itemWrapper = wrapper.getParentContainerValue(ConstructionType.class);

if (itemWrapper == null) {
return Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

package com.evolveum.midpoint.gui.impl.page.admin;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import org.apache.poi.ss.formula.functions.T;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.markup.html.form.validation.IFormValidator;
Expand Down Expand Up @@ -88,15 +88,15 @@ private void visitWrapper(ItemWrapper iw, List<ItemWrapper> iws) {
}

private void validateItemWrapperWithFormValidator(Form form, ItemWrapper iw, PrismValueWrapper value) {
Validatable<T> validatable = new Validatable<>() {
Validatable<Serializable> validatable = new Validatable<>() {

@Override
public T getValue() {
public Serializable getValue() {
return value.getNewValue().getRealValue();
}

@Override
public IModel<T> getModel() {
public IModel<Serializable> getModel() {
return () -> getValue();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ protected String getTilesHeaderCssClasses() {
protected IModel<Search<? extends ObjectType>> createSearchModel() {
return (IModel) searchModel;
}

@Override
protected boolean isSelectedItemsPanelVisible() {
return false;
}
};
memberContainer.add(tilesTable);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ protected boolean isReadonly() {
};
}

protected Boolean getReadonlyOverride() {
return readonlyOverride;
}

@Override
public ProgressPanel startAndGetProgressPanel(AjaxRequestTarget target, OperationResult result) {
LOGGER.trace("startProcessing called, making main panel invisible");
Expand Down

0 comments on commit 68b4093

Please sign in to comment.