Skip to content

Commit

Permalink
MID-8842 ninja - objects forms manual processor
Browse files Browse the repository at this point in the history
  • Loading branch information
1azyman committed Aug 1, 2023
1 parent 2eb8cb3 commit a362a6b
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
* 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.AdminGuiConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;

@SuppressWarnings("unused")
public class ObjectFormsProcessor implements UpgradeObjectProcessor<ObjectType> {

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

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

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

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

@Override
public boolean process(PrismObject<ObjectType> object, ItemPath path) throws Exception {
return false;
}

@Override
public String upgradeDescription(PrismObject<ObjectType> object, ItemPath path) {
return "Forms has to be converted to panels."; // todo maybe link to doc?
}
}
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(12);
Assertions.assertThat(result.getItems()).hasSize(13);

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 @@ -115,6 +115,15 @@
<userDashboardLink>
<targetUrl>https://google.com</targetUrl>
</userDashboardLink>
<objectForms>
<objectForm>
<type>OrgType</type>
<formSpecification>
<title>Transform</title>
<panelClass>com.example.midpoint.gui.forms.ConfigurationTableTabPanel</panelClass>
</formSpecification>
</objectForm>
</objectForms>
<accessRequest>
<roleCatalog>
<roleCatalogRef oid="0e5b7304-ea5c-438e-84d1-2b0ce40517ce" type="OrgType"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@
<userDashboardLink>
<targetUrl>https://google.com</targetUrl>
</userDashboardLink>
<objectForms>
<objectForm>
<type>OrgType</type>
<formSpecification>
<title>Transform</title>
<panelClass>com.example.midpoint.gui.forms.ConfigurationTableTabPanel</panelClass>
</formSpecification>
</objectForm>
</objectForms>
</adminGuiConfiguration>

<defaultObjectPolicyConfiguration id="2">
Expand Down

0 comments on commit a362a6b

Please sign in to comment.