use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class TestParsePasswordPolicy method assertPropertyDefinition.
private void assertPropertyDefinition(PrismContainer<?> container, String propName, QName xsdType, int minOccurs, int maxOccurs) {
ItemName propQName = new ItemName(SchemaConstantsGenerated.NS_COMMON, propName);
PrismAsserts.assertPropertyDefinition(container, propQName, xsdType, minOccurs, maxOccurs);
}
use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class TestParseObjectTemplate method assertPropertyValue.
public static void assertPropertyValue(PrismContainer<?> container, String propName, Object propValue) {
ItemName propQName = new ItemName(SchemaConstantsGenerated.NS_COMMON, propName);
PrismAsserts.assertPropertyValue(container, propQName, propValue);
}
use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class TestParseTask method assertPropertyValue.
public static void assertPropertyValue(PrismContainer<?> container, String propName, Object propValue) {
ItemName propQName = new ItemName(SchemaConstantsGenerated.NS_COMMON, propName);
PrismAsserts.assertPropertyValue(container, propQName, propValue);
}
use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class SchemaTransformer method reduceItems.
@NotNull
private UserInterfaceElementVisibilityType reduceItems(PrismContainerDefinition<?> containerDefinition, UniformItemPath containerPath, List<VisibilityPolicyEntry> visibilityPolicy) {
UserInterfaceElementVisibilityType containerVisibility = determineVisibility(visibilityPolicy, containerPath);
if (containerDefinition.isElaborate()) {
return containerVisibility;
}
Collection<ItemName> itemsToDelete;
if (containerVisibility == HIDDEN) {
// Delete everything
itemsToDelete = containerDefinition.getItemNames();
} else {
// Use item visibility to select individual items
itemsToDelete = selectItemsToDelete(containerDefinition, containerPath, visibilityPolicy);
}
MutableComplexTypeDefinition mutableContainerCtDef = containerDefinition.getComplexTypeDefinition().toMutable();
for (ItemName itemName : itemsToDelete) {
LOGGER.trace("Removing item {}/{} due to visibility constraint", containerPath, itemName.getLocalPart());
mutableContainerCtDef.delete(itemName);
}
return containerVisibility;
}
use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class SchemaTransformer method selectItemsToDelete.
@NotNull
private List<ItemName> selectItemsToDelete(PrismContainerDefinition<?> containerDefinition, UniformItemPath containerPath, List<VisibilityPolicyEntry> visibilityPolicy) {
List<ItemName> itemsToDelete = new ArrayList<>();
for (ItemDefinition<?> subDefinition : containerDefinition.getDefinitions()) {
UniformItemPath itemPath = containerPath.append(subDefinition.getItemName());
if (subDefinition instanceof PrismContainerDefinition) {
PrismContainerDefinition<?> subContainerDef = (PrismContainerDefinition<?>) subDefinition;
UserInterfaceElementVisibilityType itemVisibility = reduceItems(subContainerDef, itemPath, visibilityPolicy);
if (subContainerDef.isEmpty()) {
/*
* Empty sub-containers are treated in this way:
* - "completely defined" ones (no xsd:any) are hidden, unless explicitly set
* to VISIBLE i.e. if VACANT, HIDDEN, or AUTOMATIC
* - "open" ones (xsd:any) are dealt with just like properties: hidden if VACANT or HIDDEN
*
* Primary motivation for this behavior is the fact that we need to keep assignment/extension definition
* in the object. It is required for normal model operation, specifically for the construction of "magic
* assignment".
*
* Note that this somehow mixes presentation requirements (hiding/showing items) with the requirements of
* business logic. This is because the current solution is a temporary one, to be replaced by something
* more serious.
*/
if (itemVisibility == VACANT || itemVisibility == HIDDEN || itemVisibility == AUTOMATIC && subContainerDef.isCompletelyDefined()) {
itemsToDelete.add(subDefinition.getItemName());
}
}
} else {
UserInterfaceElementVisibilityType itemVisibility = determineVisibility(visibilityPolicy, itemPath);
if (itemVisibility == VACANT || itemVisibility == HIDDEN) {
itemsToDelete.add(subDefinition.getItemName());
}
}
}
return itemsToDelete;
}
Aggregations