use of com.evolveum.midpoint.gui.impl.prism.wrapper.ConstructionValueWrapper in project midpoint by Evolveum.
the class ConstructionWrapperFactory method createContainerValueWrapper.
@Override
public PrismContainerValueWrapper<ConstructionType> createContainerValueWrapper(PrismContainerWrapper<ConstructionType> objectWrapper, PrismContainerValue<ConstructionType> objectValue, ValueStatus status, WrapperContext context) {
ConstructionValueWrapper constructionValueWrapper = new ConstructionValueWrapper(objectWrapper, objectValue, status);
ConstructionType constructionType = objectValue.asContainerable();
if (constructionType.getResourceRef() != null) {
PrismObject resource = constructionType.getResourceRef().asReferenceValue().getObject();
if (resource != null) {
constructionValueWrapper.setResource(resource);
return constructionValueWrapper;
}
}
setupResource(constructionValueWrapper, constructionType, context);
return constructionValueWrapper;
}
use of com.evolveum.midpoint.gui.impl.prism.wrapper.ConstructionValueWrapper in project midpoint by Evolveum.
the class ResourceAttributeRefPanelFactory method getChoicesList.
private List<ItemName> getChoicesList(PrismPropertyPanelContext<ItemPathType> ctx) {
PrismPropertyWrapper<?> wrapper = ctx.unwrapWrapperModel();
// attribute/ref
if (wrapper == null) {
return Collections.emptyList();
}
// attribute value
if (wrapper.getParent() == null) {
return Collections.emptyList();
}
// attribute
ItemWrapper<?, ?> attributeWrapper = wrapper.getParent().getParent();
if (attributeWrapper == null) {
return Collections.emptyList();
}
PrismContainerValueWrapper<?> itemWrapper = attributeWrapper.getParent();
if (itemWrapper == null) {
return Collections.emptyList();
}
if (!(itemWrapper instanceof ConstructionValueWrapper)) {
return Collections.emptyList();
}
ConstructionValueWrapper constructionWrapper = (ConstructionValueWrapper) itemWrapper;
try {
ResourceSchema schema = constructionWrapper.getRefinedSchema();
if (schema == null) {
return new ArrayList<>();
}
ResourceObjectDefinition rOcd = schema.findObjectDefinition(constructionWrapper.getKind(), constructionWrapper.getIntent());
if (rOcd == null) {
return Collections.emptyList();
}
if (ConstructionType.F_ASSOCIATION.equivalent(attributeWrapper.getItemName())) {
Collection<ResourceAssociationDefinition> associationDefs = rOcd.getAssociationDefinitions();
return associationDefs.stream().map(ResourceAssociationDefinition::getName).collect(Collectors.toList());
}
Collection<? extends ResourceAttributeDefinition<?>> attrDefs = rOcd.getAttributeDefinitions();
return attrDefs.stream().map(a -> a.getItemName()).collect(Collectors.toList());
} catch (SchemaException e) {
LOGGER.warn("Cannot get resource attribute definitions");
}
return Collections.emptyList();
}
Aggregations