Skip to content

Commit

Permalink
MID-8970:fix for saving empty activation container for resource objec…
Browse files Browse the repository at this point in the history
…t type
  • Loading branch information
skublik committed Aug 22, 2023
1 parent 0d084cb commit aeb697c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,7 @@ private static <C extends Containerable> boolean isUseAsEmptyValue(Item item) {
}

private static <C extends Containerable> boolean isUseAsEmptyValue(Class<?> typeClass) {
return typeClass != null &&
(AbstractSynchronizationActionType.class.isAssignableFrom(typeClass)
|| AbstractPredefinedActivationMappingType.class.isAssignableFrom(typeClass));
return typeClass != null && AbstractSynchronizationActionType.class.isAssignableFrom(typeClass);
}

public static <C extends Containerable> PrismContainerValue<C> cleanupEmptyContainerValue(PrismContainerValue<C> value) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import com.evolveum.midpoint.prism.Containerable;
import com.evolveum.midpoint.prism.path.ItemName;
import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.model.ContainerValueWrapperFromObjectWrapperModel;
Expand All @@ -27,6 +29,8 @@

public abstract class ActivationMappingTileTable extends AbstractSpecificMappingTileTable<ResourceActivationDefinitionType> {

private static final Trace LOGGER = TraceManager.getTrace(ActivationMappingTileTable.class);

public ActivationMappingTileTable(
String id,
IModel<PrismContainerWrapper<ResourceActivationDefinitionType>> containerModel,
Expand Down Expand Up @@ -58,6 +62,11 @@ protected <T extends PrismContainerValueWrapper<? extends Containerable>> void s
if (valueModel.getObject().getItems().size() == 1) {
@NotNull ItemName itemName = valueModel.getObject().getItems().iterator().next().getItemName();
if (itemName.equivalent(MappingType.F_LIFECYCLE_STATE)) {
try {
valueModel.getObject().findProperty(itemName).getValue().setRealValue(SchemaConstants.LIFECYCLE_ACTIVE);
} catch (SchemaException e) {
LOGGER.error("Couldn't find property for " + itemName);
}
refresh(target);
return;
}
Expand Down

0 comments on commit aeb697c

Please sign in to comment.