use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportConfigurationType in project midpoint by Evolveum.
the class ReportTypeUtil method applyDefinition.
public static void applyDefinition(PrismObject<ReportType> report, PrismContext prismContext) throws SchemaException {
PrismContainer<ReportConfigurationType> configuration = report.findContainer(ReportType.F_CONFIGURATION);
if (configuration == null) {
//nothing to apply definitions on
return;
}
PrismContainer xmlSchema = report.findContainer(ReportType.F_CONFIGURATION_SCHEMA);
Element xmlSchemaElement = ObjectTypeUtil.findXsdElement(xmlSchema);
if (xmlSchemaElement == null) {
//no schema definition available
throw new SchemaException("Couldn't find schema for configuration in report type " + report + ".");
}
PrismSchema schema = ReportTypeUtil.parseReportConfigurationSchema(report, prismContext);
PrismContainerDefinition<ReportConfigurationType> definition = ReportTypeUtil.findReportConfigurationDefinition(schema);
if (definition == null) {
//no definition found for container
throw new SchemaException("Couldn't find definitions for report type " + report + ".");
}
configuration.applyDefinition(definition, true);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportConfigurationType in project midpoint by Evolveum.
the class ReportTypeUtil method applyConfigurationDefinition.
public static void applyConfigurationDefinition(PrismObject<ReportType> report, ObjectDelta delta, PrismContext prismContext) throws SchemaException {
PrismSchema schema = ReportTypeUtil.parseReportConfigurationSchema(report, prismContext);
PrismContainerDefinition<ReportConfigurationType> definition = ReportTypeUtil.findReportConfigurationDefinition(schema);
if (definition == null) {
//no definition found for container
throw new SchemaException("Couldn't find definitions for report type " + report + ".");
}
Collection<ItemDelta> modifications = delta.getModifications();
for (ItemDelta itemDelta : modifications) {
if (itemDelta.hasCompleteDefinition()) {
continue;
}
ItemDefinition def = definition.findItemDefinition(itemDelta.getPath().tail());
if (def != null) {
itemDelta.applyDefinition(def);
}
}
}
Aggregations