Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Mar 21, 2023
2 parents 5acba70 + cf3bb71 commit 3480d4d
Show file tree
Hide file tree
Showing 40 changed files with 971 additions and 400 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
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -437,9 +437,10 @@ private void assertNoOtherAttributes() throws SchemaException {
Objects.requireNonNull(attrDefBean.getRef(), () -> "No attribute name in " + attrDefBean));
// TODO check that we really look into aux object classes
if (!definition.containsAttributeDefinition(attrName) && !ResourceSchemaUtil.isIgnored(attrDefBean)) {
throw new SchemaException("Definition of attribute " + attrName + " not found in object class " +
definition.getObjectClassName() + " nor auxiliary object classes for " + definition +
" as defined in " + contextDescription);
throw new SchemaException(String.format(
"Definition of attribute %s not found in object class %s nor auxiliary object classes for %s "
+ "as defined in %s",
attrName, definition.getObjectClassName(), definition, contextDescription));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1155,19 +1155,24 @@ private interface ExtensionItemCreator {
Item<?, ?> create(PrismContainerValue<?> extension, List<?> realValues) throws SchemaException;
}

public static void setExtensionPropertyRealValues(PrismContext prismContext, PrismContainerValue<?> parent, ItemName propertyName,
Object... values) throws SchemaException {
public static void setExtensionPropertyRealValues(
PrismContext ignored, PrismContainerValue<?> parent, ItemName propertyName, Object... values) throws SchemaException {
setExtensionPropertyRealValues(parent, propertyName, values);
}

public static void setExtensionPropertyRealValues(
PrismContainerValue<?> parent, ItemName propertyName, Object... values) throws SchemaException {
setExtensionItemRealValues(parent,
extension -> extension.removeProperty(propertyName),
(extension, realValues) -> {
PrismProperty<Object> property = findPropertyDefinition(prismContext, extension, propertyName)
PrismProperty<Object> property = findPropertyDefinition(extension, propertyName)
.instantiate();
realValues.forEach(property::addRealValue);
return property;
}, values);
}

private static @NotNull PrismPropertyDefinition<Object> findPropertyDefinition(PrismContext prismContext,
private static @NotNull PrismPropertyDefinition<Object> findPropertyDefinition(
PrismContainerValue<?> extension, ItemName propertyName) {
if (extension.getDefinition() != null) {
PrismPropertyDefinition<Object> definitionInExtension = extension.getDefinition().findPropertyDefinition(propertyName);
Expand All @@ -1176,7 +1181,7 @@ public static void setExtensionPropertyRealValues(PrismContext prismContext, Pri
}
}
//noinspection unchecked
PrismPropertyDefinition<Object> globalDefinition = prismContext.getSchemaRegistry()
PrismPropertyDefinition<Object> globalDefinition = PrismContext.get().getSchemaRegistry()
.findPropertyDefinitionByElementName(propertyName);
if (globalDefinition != null) {
return globalDefinition;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,8 @@
<xsd:documentation>
Information about the shadow (if applicable).

When the simulated change of the coordinates themselves is reported, the old value is provided here.

TODO reconsider if all information from the type should be used (e.g. tombstone and discriminator order
- are they relevant?).
</xsd:documentation>
Expand All @@ -1050,6 +1052,7 @@
<xsd:annotation>
<xsd:documentation>
Name of the object processed. May be null e.g. for shadows that are to be created.
When the simulated change of the name itself is reported, the old value is provided here.
</xsd:documentation>
<xsd:appinfo>
<a:displayName>SimulationResultProcessedObjectType.name</a:displayName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,15 @@
*/
package com.evolveum.midpoint.test.util;

import static com.evolveum.midpoint.schema.constants.MidPointConstants.NS_RI;

import java.io.File;

import com.evolveum.midpoint.prism.path.ItemName;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.schema.constants.MidPointConstants;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;

import javax.xml.namespace.QName;
import java.io.File;

import static com.evolveum.midpoint.schema.constants.MidPointConstants.NS_MIDPOINT_TEST_PREFIX;
import static com.evolveum.midpoint.schema.constants.MidPointConstants.NS_RI;
import static com.evolveum.midpoint.util.QNameUtil.qNameToUri;

public class MidPointTestConstants {

public static final String TEST_RESOURCES_PATH = "src/test/resources";
Expand Down Expand Up @@ -49,7 +46,5 @@ public class MidPointTestConstants {
public static final ItemName QNAME_MAIL = new ItemName(NS_RI, "mail");
public static final ItemPath PATH_MAIL = ItemPath.create(ShadowType.F_ATTRIBUTES, QNAME_MAIL);

public static final String TEST_POLICY_SITUATION_LEGACY = qNameToUri(new QName(NS_MIDPOINT_TEST_PREFIX, "legacy"));
public static final String TEST_POLICY_SITUATION_ILLEGAL = qNameToUri(new QName(NS_MIDPOINT_TEST_PREFIX, "illegal"));
public static final String TEST_POLICY_SITUATION_PENDING = qNameToUri(new QName(NS_MIDPOINT_TEST_PREFIX, "pending"));
public static final ItemName QNAME_UID_NUMBER = new ItemName(NS_RI, "uidNumber");
}
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
/*
* Copyright (c) 2010-2020 Evolveum
* Copyright (C) 2020-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.authentication.impl.module.authentication;

import com.evolveum.midpoint.authentication.api.AuthenticationModuleState;
import com.evolveum.midpoint.authentication.api.util.AuthenticationModuleNameConstants;
import com.evolveum.midpoint.authentication.impl.util.ModuleType;
import com.evolveum.midpoint.authentication.api.AuthenticationModuleState;
import com.evolveum.midpoint.util.annotation.Experimental;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceModuleNecessityType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.AuthenticationSequenceModuleType;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,11 @@ static <O extends ObjectType> ProcessedObjectImpl<O> createSingleDelta(
delta.computeChangedObject(
asPrismObject(stateBefore)));
}
@Nullable O anyState = MiscUtil.getFirstNonNull(stateAfter, stateBefore);

// We intentionally prefer the state before. The reason is that e.g. for object name we want to display the record
// and report on it under the OLD name - it is the name of the object that is currently valid in the real world.
// The same is true for the shadow discriminator. See MID-8610.
@Nullable O anyState = MiscUtil.getFirstNonNull(stateBefore, stateAfter);

if (anyState == null) {
return null;
Expand All @@ -259,6 +263,7 @@ static <O extends ObjectType> ProcessedObjectImpl<O> createSingleDelta(
simulationTransaction.getTransactionId(),
elementContext.getOid(),
type,
// We should provide the old value here, just like for name and discriminator. See MID-8610.
elementContext instanceof LensFocusContext<?> ?
((LensFocusContext<?>) elementContext).getStructuralArchetypeRef() : null,
determineShadowDiscriminator(anyState),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,18 @@ private TypeAndDefinition(
schema != null ? schema.findObjectDefinition(knownKind, knownIntent) : null);
}

/**
* Creates type spec based on object class name only (if present).
*
* We intentionally do not use "account/default" hack based on
* {@link ResourceObjectClassDefinition#isDefaultAccountDefinition()} here, as it gives wrong results for accounts
* that are intentionally excluded from `account/default` type (if such type is defined). After all, if we have
* no `schemaHandling` present, there is no synchronization to be done. See MID-8516.
*/
public static @NotNull TypeAndDefinition of(ResourceSchema schema, QName objectClassName) {
if (schema != null && objectClassName != null) {
ResourceObjectDefinition definition = schema.findDefinitionForObjectClass(objectClassName);
if (definition != null && definition.getObjectClassDefinition().isDefaultAccountDefinition()) {
// A kind of "emergency classification" - we hope it will not cause any problems.
return new TypeAndDefinition(ResourceObjectTypeIdentification.defaultAccount(), definition);
} else {
return new TypeAndDefinition(null, definition);
}
@Nullable ResourceObjectDefinition definition = schema.findDefinitionForObjectClass(objectClassName);
return new TypeAndDefinition(null, definition);
} else {
return new TypeAndDefinition(null, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public ObjectQuery customizeQuery(ObjectQuery configuredQuery, OperationResult r
.item(syncTimestampItem).le(getReconciliationStartTimestamp(result))
.or().item(syncTimestampItem).isNull()
.endBlock()
.and().item(ShadowType.F_RESOURCE_REF).ref(processingScope.getResourceOid())
.and().item(ShadowType.F_OBJECT_CLASS).eq(processingScope.getResolvedObjectClassName())
.and().item(ShadowType.F_RESOURCE_REF).ref(processingScope.getResourceOid())
.and().item(ShadowType.F_OBJECT_CLASS).eq(processingScope.getResolvedObjectClassName())
.build();
}

Expand Down

0 comments on commit 3480d4d

Please sign in to comment.