Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Mar 21, 2023
2 parents e4a2c55 + 3480d4d commit 578040b
Show file tree
Hide file tree
Showing 21 changed files with 334 additions and 162 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
/*
* Copyright (c) 2010-2022 Evolveum
* Copyright (C) 2022-2023 Evolveum and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.gui.api.page;

import org.apache.commons.lang3.StringUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</wicket:enclosure>
<div wicket:id="infoContainer" class="d-flex">
<span class="text-info" wicket:id="infoLabel"/>
<span class="btn btn-tool mt-0">
<span class="btn btn-tool mt-0 p-0">
<i class="p-1" wicket:id="infoIcon"/>
</span>
<div class="ml-auto">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/
package com.evolveum.midpoint.gui.impl.page.admin.resource.component.wizard.objectType;

import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismContainerWrapper;

import com.evolveum.midpoint.gui.api.prism.wrapper.PrismValueWrapper;
Expand Down Expand Up @@ -35,6 +36,7 @@
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectTypeDefinitionType;

import org.apache.wicket.model.Model;
import org.jetbrains.annotations.NotNull;

/**
Expand Down Expand Up @@ -78,19 +80,18 @@ protected void onBeforeRender() {

@Override
protected void onNewValue(IModel<PrismContainerWrapper<ResourceObjectTypeDefinitionType>> containerModel, AjaxRequestTarget target) {
IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> model = () -> {
PrismContainerWrapper<ResourceObjectTypeDefinitionType> container = containerModel.getObject();
PrismContainerValue<ResourceObjectTypeDefinitionType> value = container.getItem().createNewValue();
try {
PrismContainerValueWrapper newWrapper = WebPrismUtil.createNewValueWrapper(
container, value, getPageBase(), getObjectDetailsModels().createWrapperContext());
container.getValues().add(newWrapper);
return newWrapper;
} catch (SchemaException e) {
LOGGER.error("Couldn't create new value for container " + container, e);
}
return null;
};
PageBase pageBase = getPageBase();
PrismContainerWrapper<ResourceObjectTypeDefinitionType> container = containerModel.getObject();
PrismContainerValue<ResourceObjectTypeDefinitionType> value = container.getItem().createNewValue();
PrismContainerValueWrapper newWrapper = null;
try {
newWrapper = WebPrismUtil.createNewValueWrapper(
container, value, pageBase, getObjectDetailsModels().createWrapperContext());
container.getValues().add(newWrapper);
} catch (SchemaException e) {
LOGGER.error("Couldn't create new value for container " + container, e);
}
IModel<PrismContainerValueWrapper<ResourceObjectTypeDefinitionType>> model = Model.of(newWrapper);
onCreateValue(model, target);
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
import com.evolveum.midpoint.web.component.prism.ValueStatus;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.wicket.Component;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.LoadableDetachableModel;
Expand Down Expand Up @@ -230,10 +232,11 @@ public String getCssClass() {
MappingType.F_ENABLED,
AbstractItemWrapperColumn.ColumnType.VALUE,
getPageBase()) {

@Override
public String getCssClass() {
return "col-md-2";
protected Component createHeader(String componentId, IModel<? extends PrismContainerDefinition<MappingType>> mainModel) {
Component header = super.createHeader(componentId, mainModel);
header.add(AttributeAppender.append("class", "d-table-row"));
return header;
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,15 @@ protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<Mappi

@Override
public String getCssClass() {
return "";
return "px-1";
}
});

columns.add(new PrismPropertyWrapperColumn(
getMappingTypeDefinition(),
MappingType.F_EXPRESSION,
AbstractItemWrapperColumn.ColumnType.VALUE,
getPageBase()){

@Override
public String getCssClass() {
return "col-xl-2 col-lg-2 col-md-3";
}

});
getPageBase()));

columns.add(new IconColumn<>(Model.of()) {
@Override
Expand All @@ -100,7 +93,7 @@ protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<Mappi

@Override
public String getCssClass() {
return "";
return "px-1";
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public void setObject(Collection<VariableBindingDefinitionType> newValues) {

@Override
public String getCssClass() {
return "col-xl-4 col-lg-4 col-md-4";
return "col-xl-2 col-lg-2 col-md-2";
}
});

Expand All @@ -165,22 +165,15 @@ protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<Mappi

@Override
public String getCssClass() {
return "";
return "px-1";
}
});

columns.add(new PrismPropertyWrapperColumn(
mappingTypeDef,
MappingType.F_EXPRESSION,
AbstractItemWrapperColumn.ColumnType.VALUE,
getPageBase()){

@Override
public String getCssClass() {
return "col-xl-2 col-lg-2 col-md-3";
}

});
getPageBase()));

columns.add(new IconColumn<>(Model.of()) {
@Override
Expand All @@ -190,7 +183,7 @@ protected DisplayType getIconDisplayType(IModel<PrismContainerValueWrapper<Mappi

@Override
public String getCssClass() {
return "";
return "px-1";
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import com.evolveum.midpoint.gui.api.prism.ItemStatus;
import com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper;
import com.evolveum.midpoint.gui.api.prism.wrapper.PrismReferenceWrapper;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.api.util.WebPrismUtil;
import com.evolveum.midpoint.prism.*;
Expand Down Expand Up @@ -124,6 +125,11 @@ private void removeIdFromContainerValue(PrismValue value) {
private Collection<ItemDelta<PrismValue, ItemDefinition<?>>> processModifyDeltas(
Collection<ItemDelta<PrismValue, ItemDefinition<?>>> deltas) throws SchemaException {

PrismReferenceWrapper superRef = findReference(ItemPath.create(ResourceType.F_SUPER, SuperResourceDeclarationType.F_RESOURCE_REF));
if (superRef != null && superRef.isEmpty()) {
return deltas;
}

Collection<ItemDelta<PrismValue, ItemDefinition<?>>> processedDeltas = new ArrayList<>();

for (ItemDelta<PrismValue, ItemDefinition<?>> delta : deltas) {
Expand Down Expand Up @@ -225,18 +231,19 @@ private PrismContainerValue<?> createParentValueForAddDelta(
if (!subPath.isEmpty() && ItemPath.isId(subPath.last())) {
subPath = subPath.allExceptLast();
}
if (valueOfExistingDelta.find(subPath) != null) {
if (subPath.isEmpty()) {
newValue = valueOfExistingDelta;
} else if (valueOfExistingDelta.find(subPath) != null) {
isItemFound = true;
newContainer = (PrismContainer) valueOfExistingDelta.find(subPath);
newValue = newContainer.getValue(origParentValue.getId());
}
}

if (newContainer == null) {
newContainer = origParentValue.getDefinition().instantiate();
}

if (newValue == null) {
if (newContainer == null) {
newContainer = origParentValue.getDefinition().instantiate();
}
newValue = newContainer.createNewValue();
newValue.setId(origParentValue.getId());
Class<?> typeClass = newValue.getComplexTypeDefinition().getTypeClass();
Expand Down Expand Up @@ -268,11 +275,13 @@ private PrismContainerValue<?> createParentValueForAddDelta(
return valueOfExistingDelta;
}

if (WebPrismUtil.isValueFromResourceTemplate(parentValue, getItem())) {
return createParentValueForAddDelta(parentValue, newContainer, valueOfExistingDelta);
}
if (newContainer != null) {
if (WebPrismUtil.isValueFromResourceTemplate(parentValue, getItem())) {
return createParentValueForAddDelta(parentValue, newContainer, valueOfExistingDelta);
}

newContainer.setParent(parentValue);
newContainer.setParent(parentValue);
}
return newValue;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,15 @@
/*
* Copyright (c) 2010-2022 Evolveum
* Copyright (C) 2022-2023 Evolveum and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.web.component.breadcrumbs;

import org.apache.wicket.model.IModel;

/**
* Breadcrums text is not changing over time, we'll try to use this behavior to cache string value created by underlying IModel object.
* Breadcrumbs text is not changing over time, we'll try to use this behavior to cache string value created by underlying IModel object.
* When value is cached, underlying model is forgotten to save space - we don't want to get value when creating cached model (too soon).
*
* Created by Viliam Repan (lazyman).
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,40 @@
/*
* Copyright (C) 2021-2023 Evolveum and contributors
*
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/
package com.evolveum.midpoint.web.page.admin.reports.component;

import java.io.Serializable;
import java.util.*;
import java.util.stream.Collectors;
import javax.xml.namespace.QName;

import com.evolveum.midpoint.gui.impl.component.data.column.ReportExpressionColumn;
import com.evolveum.midpoint.gui.impl.component.data.provider.SelectableBeanDataProvider;
import com.evolveum.midpoint.gui.impl.component.search.SearchContext;

import com.evolveum.midpoint.prism.*;

import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.extensions.markup.html.repeater.data.sort.SortOrder;
import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
import org.apache.wicket.extensions.markup.html.repeater.util.SortParam;
import org.apache.wicket.model.IModel;
import org.jetbrains.annotations.NotNull;

import com.evolveum.midpoint.gui.api.component.data.provider.ISelectableDataProvider;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebComponentUtil;
import com.evolveum.midpoint.gui.impl.component.ContainerableListPanel;
import com.evolveum.midpoint.gui.impl.component.data.column.ReportExpressionColumn;
import com.evolveum.midpoint.gui.impl.component.data.provider.SelectableBeanDataProvider;
import com.evolveum.midpoint.gui.impl.component.search.SearchContext;
import com.evolveum.midpoint.gui.impl.component.search.panel.SearchPanel;
import com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView;
import com.evolveum.midpoint.model.common.util.DefaultColumnUtils;
import com.evolveum.midpoint.prism.Item;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.Referencable;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.prism.query.*;
import com.evolveum.midpoint.prism.query.ObjectOrdering;
import com.evolveum.midpoint.prism.query.ObjectQuery;
import com.evolveum.midpoint.prism.query.OrderDirection;
import com.evolveum.midpoint.schema.GetOperationOptions;
import com.evolveum.midpoint.schema.SelectorOptions;
import com.evolveum.midpoint.schema.constants.ExpressionConstants;
Expand All @@ -35,8 +44,6 @@
import com.evolveum.midpoint.util.exception.*;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.gui.api.component.data.provider.ISelectableDataProvider;
import com.evolveum.midpoint.gui.impl.component.data.provider.SelectableBeanContainerDataProvider;
import com.evolveum.midpoint.web.component.util.SelectableBean;
import com.evolveum.midpoint.web.component.util.VisibleBehaviour;
import com.evolveum.midpoint.web.session.ObjectListStorage;
Expand Down Expand Up @@ -234,7 +241,7 @@ private void processVariables(VariablesMap variablesMap) {
if (entry.getValue() == null) {
variablesMap.put(entry.getKey(), null, String.class);
} else if (entry.getValue() instanceof Item) {
variablesMap.put(entry.getKey(), (Item) entry.getValue(), ((Item) entry.getValue()).getDefinition());
variablesMap.put(entry.getKey(), entry.getValue(), ((Item) entry.getValue()).getDefinition());
} else {
variablesMap.put(entry.getKey(), entry.getValue(), entry.getValue().getClass());
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
/*
* Copyright (c) 2010-2022 Evolveum
* Copyright (C) 2022-2023 Evolveum and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* This work is dual-licensed under the Apache License 2.0
* and European Union Public License. See LICENSE file for details.
*/

package com.evolveum.midpoint.web.page.admin.reports.component;

import com.evolveum.midpoint.web.component.prism.InputPanel;

import org.apache.wicket.behavior.AttributeAppender;
import org.apache.wicket.markup.html.form.FormComponent;
import org.apache.wicket.model.IModel;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.web.component.AceEditor;
import com.evolveum.midpoint.web.component.prism.InputPanel;
import com.evolveum.midpoint.web.page.admin.configuration.component.EmptyOnBlurAjaxFormUpdatingBehaviour;

/**
Expand Down

0 comments on commit 578040b

Please sign in to comment.