use of com.evolveum.midpoint.gui.impl.prism.wrapper.ValueMetadataWrapperImpl in project midpoint by Evolveum.
the class PrismValueMetadataPanel method createMetadataListModel.
private ReadOnlyModel<List<ContainersPopupDto>> createMetadataListModel() {
return new ReadOnlyModel<>(() -> {
ValueMetadataWrapperImpl metadataWrapper = getValueMetadata();
List<PrismContainerDefinition<? extends Containerable>> childContainers;
try {
childContainers = metadataWrapper != null ? metadataWrapper.getChildContainers() : Collections.emptyList();
} catch (SchemaException e) {
LOGGER.error("Cannot get child containers: {}", e.getMessage(), e);
childContainers = Collections.emptyList();
}
List<ContainersPopupDto> navigation = childContainers.stream().map(c -> new ContainersPopupDto(false, c)).collect(Collectors.toList());
List<? extends ItemDefinition> childNonContainers = metadataWrapper != null ? metadataWrapper.getChildNonContainers() : Collections.emptyList();
if (!childNonContainers.isEmpty()) {
navigation.add(new ContainersPopupDto(false, metadataWrapper));
}
return navigation;
});
}
use of com.evolveum.midpoint.gui.impl.prism.wrapper.ValueMetadataWrapperImpl in project midpoint by Evolveum.
the class ItemWrapperFactoryImpl method setupMetadata.
protected <VW extends PrismValueWrapper> void setupMetadata(IW itemWrapper, VW valueWrapper, WrapperContext ctx) throws SchemaException {
if (itemWrapper.isMetadata()) {
return;
}
PrismValue oldValue = valueWrapper.getNewValue();
PrismContainer<ValueMetadataType> metadataContainer = oldValue.getValueMetadataAsContainer();
if (canContainLegacyMetadata(oldValue)) {
PrismContainer<MetadataType> oldMetadata = ((PrismContainerValue) oldValue).findContainer(ObjectType.F_METADATA);
if (oldMetadata != null && oldMetadata.getValue() != null) {
PrismContainerValue<ValueMetadataType> newMetadataValue = metadataContainer.createNewValue();
transformStorageMetadata(newMetadataValue, oldMetadata);
transformProcessMetadata(newMetadataValue, oldMetadata);
}
}
ValueMetadataWrapperFactoryImpl valueMetadataWrapperFactory = new ValueMetadataWrapperFactoryImpl(getRegistry());
PrismContainerWrapper<ValueMetadataType> valueMetadataWrapper = valueMetadataWrapperFactory.createWrapper(null, metadataContainer, ItemStatus.NOT_CHANGED, ctx);
if (valueMetadataWrapper != null) {
valueWrapper.setValueMetadata(new ValueMetadataWrapperImpl(valueMetadataWrapper));
}
}
Aggregations