use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class ObjectCollectionViewFinder method assertCount.
public ObjectCollectionViewsAsserter<RA> assertCount(int expectedCount) throws ObjectNotFoundException, SchemaException {
int foundCount = 0;
for (CompiledObjectCollectionView view : viewsAsserter.getViews()) {
if (matches(view)) {
foundCount++;
}
}
assertEquals("Wrong number of links for specified criteria in " + viewsAsserter.desc(), expectedCount, foundCount);
return viewsAsserter;
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class DashboardServiceImpl method generateNumberMessageForCollection.
private String generateNumberMessageForCollection(DashboardWidgetType widget, DashboardWidget data, Task task, OperationResult result) throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, ObjectNotFoundException {
CollectionRefSpecificationType collectionSpec = getCollectionRefSpecificationType(widget, task, result);
if (collectionSpec != null) {
CompiledObjectCollectionView compiledCollection = modelInteractionService.compileObjectCollectionView(collectionSpec, null, task, task.getResult());
CollectionStats collStats = modelInteractionService.determineCollectionStats(compiledCollection, task, result);
// getObjectCount(valueCollection, true, task, result);
Integer value = collStats.getObjectCount();
Integer domainValue = collStats.getDomainCount();
IntegerStatType statType = generateIntegerStat(value, domainValue);
Collection<EvaluatedPolicyRule> evalPolicyRules = new ArrayList<>();
if (collectionSpec.getCollectionRef() != null && QNameUtil.match(ObjectCollectionType.COMPLEX_TYPE, collectionSpec.getCollectionRef().getType())) {
ObjectCollectionType valueCollection = getObjectCollectionType(widget, task, result);
evalPolicyRules = modelInteractionService.evaluateCollectionPolicyRules(valueCollection.asPrismObject(), compiledCollection, null, task, task.getResult());
}
Collection<String> policySituations = new ArrayList<>();
for (EvaluatedPolicyRule evalPolicyRule : evalPolicyRules) {
if (!evalPolicyRule.getAllTriggers().isEmpty()) {
policySituations.add(evalPolicyRule.getPolicySituation());
}
}
return generateNumberMessage(widget, createVariables(null, statType, policySituations, null), data);
} else {
LOGGER.error("CollectionRefSpecificationType is null in widget " + widget.getIdentifier());
}
return null;
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class CollectionProcessor method compileObjectCollectionView.
public CompiledObjectCollectionView compileObjectCollectionView(CollectionRefSpecificationType collectionRef, Class<? extends Containerable> targetTypeClass, Task task, OperationResult result) throws SchemaException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException, ObjectNotFoundException {
CompiledObjectCollectionView view = new CompiledObjectCollectionView();
compileObjectCollectionView(view, collectionRef, targetTypeClass, task, result);
return view;
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class HtmlDashboardReportDataWriter method setupDefaultExportedWidgetData.
private void setupDefaultExportedWidgetData(ReportServiceImpl reportService) {
ExportedWidgetData widgetData = new ExportedWidgetData();
CompiledObjectCollectionView compiledView = new CompiledObjectCollectionView();
compiledView.setViewIdentifier(GenericSupport.getMessage(localizationService, CommonHtmlSupport.REPORT_WIDGET_TABLE_NAME));
widgetData.setSupport(new CommonHtmlSupport(reportService.getClock(), compiledView));
data.put(BASIC_WIDGET_ROW_KEY, widgetData);
}
use of com.evolveum.midpoint.model.api.authentication.CompiledObjectCollectionView in project midpoint by Evolveum.
the class ReportServiceImpl method createCompiledView.
public CompiledObjectCollectionView createCompiledView(ObjectCollectionReportEngineConfigurationType collectionConfig, boolean useDefaultView, Task task, OperationResult result) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException {
Validate.notNull(collectionConfig, "Collection engine in report couldn't be null.");
CompiledObjectCollectionView compiledCollection = new CompiledObjectCollectionView();
GuiObjectListViewType reportView = collectionConfig.getView();
if (reportView != null) {
getModelInteractionService().applyView(compiledCollection, reportView);
}
CollectionRefSpecificationType collectionRefSpecification = collectionConfig.getCollection();
if (collectionRefSpecification != null) {
@NotNull CompiledObjectCollectionView compiledCollectionRefSpec = getModelInteractionService().compileObjectCollectionView(collectionRefSpecification, compiledCollection.getTargetClass(prismContext), task, result);
if (Boolean.TRUE.equals(collectionConfig.isUseOnlyReportView())) {
compiledCollectionRefSpec.getColumns().clear();
}
getModelInteractionService().applyView(compiledCollectionRefSpec, compiledCollection.toGuiObjectListViewType());
compiledCollection = compiledCollectionRefSpec;
}
if (compiledCollection.getColumns().isEmpty()) {
if (useDefaultView) {
Class<Containerable> type = resolveTypeForReport(compiledCollection);
getModelInteractionService().applyView(compiledCollection, DefaultColumnUtils.getDefaultView(ObjectUtils.defaultIfNull(type, ObjectType.class)));
} else {
return null;
}
}
return compiledCollection;
}
Aggregations