Skip to content

Commit

Permalink
MID-8842 ninja - use legacy approvers processor
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Jul 24, 2023
1 parent 38c40e1 commit 88d3bd2
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* 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.validator.processor;

import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.schema.validator.UpgradeObjectProcessor;
import com.evolveum.midpoint.schema.validator.UpgradePhase;
import com.evolveum.midpoint.schema.validator.UpgradePriority;
import com.evolveum.midpoint.schema.validator.UpgradeType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SystemConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.WfConfigurationType;

public class UseLegacyApproversProcessor implements UpgradeObjectProcessor<SystemConfigurationType> {

@Override
public UpgradePhase getPhase() {
return UpgradePhase.BEFORE;
}

@Override
public UpgradePriority getPriority() {
return UpgradePriority.NECESSARY;
}

@Override
public UpgradeType getType() {
return UpgradeType.SEAMLESS;
}

@Override
public boolean isApplicable(PrismObject<?> object, ItemPath path) {
return matchParentType(object, path, WfConfigurationType.class);
}

@Override
public boolean process(PrismObject<SystemConfigurationType> object, ItemPath path) throws Exception {
WfConfigurationType wfConfiguration = getItemParent(object, path);
if (wfConfiguration == null) {
return false;
}

wfConfiguration.setUseLegacyApproversSpecification(null);

wfConfiguration.asPrismContainerValue();
if (wfConfiguration.asPrismContainerValue().isEmpty()) {
object.asObjectable().setWorkflowConfiguration(null);
}

return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private String getProcessorIdentifier(Class<?> processorClass) {
@Test
public void test30TestSystemConfig() throws Exception {
testUpgradeValidator("system-configuration.xml", result -> {
Assertions.assertThat(result.getItems()).hasSize(6);
Assertions.assertThat(result.getItems()).hasSize(7);

UpgradeValidationItem item = assertGetItem(result, getProcessorIdentifier(RoleCatalogCollectionsProcessor.class));
Assertions.assertThat(item.getDelta().getModifiedItems()).hasSize(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,7 @@
<maxRecords>10</maxRecords>
</objectResults>
</cleanupPolicy>
<workflowConfiguration>
<useLegacyApproversSpecification>always</useLegacyApproversSpecification>
</workflowConfiguration>
</systemConfiguration>

0 comments on commit 88d3bd2

Please sign in to comment.