Skip to content

Commit

Permalink
MID-7625 fix for recompute task ui - action field is not mandatory (w…
Browse files Browse the repository at this point in the history
…ill not throw error on submit, however still marked mandatory)

(cherry picked from commit 53be57f)
  • Loading branch information
1azyman committed Aug 31, 2022
1 parent aec917a commit 86d75c6
Showing 1 changed file with 21 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@
package com.evolveum.midpoint.gui.impl.page.admin.task.component;

import com.evolveum.midpoint.gui.api.GuiStyleConstants;
import com.evolveum.midpoint.gui.api.prism.wrapper.ItemMandatoryHandler;
import com.evolveum.midpoint.gui.api.prism.wrapper.ItemWrapper;
import com.evolveum.midpoint.gui.impl.page.admin.AbstractObjectMainPanel;
import com.evolveum.midpoint.gui.impl.page.admin.task.TaskDetailsModel;
import com.evolveum.midpoint.gui.impl.prism.panel.SingleContainerPanel;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.application.PanelDisplay;
import com.evolveum.midpoint.web.application.PanelInstance;
import com.evolveum.midpoint.web.application.PanelType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ContainerPanelConfigurationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

@PanelType(name = "work")
@PanelInstance(identifier = "work", applicableForType = TaskType.class, childOf = TaskActivityPanel.class, defaultPanel = true,
Expand All @@ -36,8 +38,24 @@ public TaskWorkPanel(String id, TaskDetailsModel model, ContainerPanelConfigurat

@Override
protected void initLayout() {
SingleContainerPanel activityDefinitionPanel = new SingleContainerPanel(ID_MAIN_PANEL, getObjectWrapperModel(), getPanelConfiguration());
SingleContainerPanel activityDefinitionPanel = new SingleContainerPanel(ID_MAIN_PANEL, getObjectWrapperModel(), getPanelConfiguration()) {

@Override
protected ItemMandatoryHandler getMandatoryHandler() {
return wrapper -> getMandatoryOverrideFor(wrapper);
}
};
add(activityDefinitionPanel);
}

private boolean getMandatoryOverrideFor(ItemWrapper<?, ?> itemWrapper) {
ItemPath conflictResolutionPath = ItemPath.create(TaskType.F_ACTIVITY, ActivityDefinitionType.F_WORK,
WorkDefinitionsType.F_RECOMPUTATION, RecomputationWorkDefinitionType.F_EXECUTION_OPTIONS,
ModelExecuteOptionsType.F_FOCUS_CONFLICT_RESOLUTION, ConflictResolutionType.F_ACTION);
if (conflictResolutionPath.equivalent(itemWrapper.getPath().namedSegmentsOnly())) {
return false;
}

return itemWrapper.isMandatory();
}
}

0 comments on commit 86d75c6

Please sign in to comment.