-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MID-8842 ninja - initial objects action improvements + reporting. Bas…
…ic merge for some types inplace now.
- Loading branch information
Showing
5 changed files
with
233 additions
and
39 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
...schema/src/main/java/com/evolveum/midpoint/schema/merger/AdminGuiConfigurationMerger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (C) 2010-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.schema.merger; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import com.evolveum.midpoint.prism.PrismContainer; | ||
import com.evolveum.midpoint.util.exception.ConfigurationException; | ||
import com.evolveum.midpoint.util.exception.SchemaException; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.AdminGuiConfigurationType; | ||
|
||
public class AdminGuiConfigurationMerger extends BaseItemMerger<PrismContainer<AdminGuiConfigurationType>> { | ||
|
||
public AdminGuiConfigurationMerger(@Nullable OriginMarker originMarker) { | ||
super(originMarker); | ||
} | ||
|
||
@Override | ||
protected void mergeInternal( | ||
@NotNull PrismContainer<AdminGuiConfigurationType> target, | ||
@NotNull PrismContainer<AdminGuiConfigurationType> source) | ||
throws ConfigurationException, SchemaException { | ||
|
||
AdminGuiConfigurationMergeManager manager = new AdminGuiConfigurationMergeManager(); | ||
|
||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
...schema/src/main/java/com/evolveum/midpoint/schema/merger/object/ObjectMergeOperation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (C) 2010-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.schema.merger.object; | ||
|
||
import static java.util.Map.entry; | ||
|
||
import java.lang.reflect.InvocationTargetException; | ||
import java.util.Map; | ||
|
||
import org.apache.commons.lang3.Validate; | ||
|
||
import com.evolveum.midpoint.prism.PrismObject; | ||
import com.evolveum.midpoint.schema.merger.BaseMergeOperation; | ||
import com.evolveum.midpoint.util.exception.ConfigurationException; | ||
import com.evolveum.midpoint.util.exception.SchemaException; | ||
import com.evolveum.midpoint.util.exception.SystemException; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.LookupTableType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType; | ||
|
||
public class ObjectMergeOperation { | ||
|
||
public static final Map<Class<? extends ObjectType>, Class<? extends BaseMergeOperation>> MERGE_OPERATIONS = Map.ofEntries( | ||
entry(LookupTableType.class, LookupTableMergeOperation.class) | ||
); | ||
|
||
public static <O extends ObjectType> boolean hasMergeOperationFor(PrismObject<O> target) { | ||
Class<?> type = target.getCompileTimeClass(); | ||
|
||
return MERGE_OPERATIONS.containsKey(type); | ||
} | ||
|
||
public static <O extends ObjectType> void merge( | ||
PrismObject<O> target, PrismObject<O> source) throws ConfigurationException, SchemaException { | ||
Class<?> type = target.getCompileTimeClass(); | ||
|
||
Class<? extends BaseMergeOperation> clazz = MERGE_OPERATIONS.get(type); | ||
Validate.notNull(clazz, "Merge operation not available for type " + type.getName()); | ||
|
||
try { | ||
BaseMergeOperation<O> operation = clazz.getConstructor(type, type) | ||
.newInstance(target.asObjectable(), source.asObjectable()); | ||
operation.execute(); | ||
} catch (NoSuchMethodException | SecurityException | InstantiationException | | ||
IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { | ||
throw new SystemException("Couldn't merge objects", ex); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters