use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType in project midpoint by Evolveum.
the class ReportDto method getObject.
public PrismObject<ReportType> getObject() {
if (reportType == null) {
reportType = new ReportType();
//TODO FIXME temporary every new report will be set as parent report
reportType.setParent(Boolean.TRUE);
}
reportType.setName(new PolyStringType(name));
reportType.setExport(exportType);
reportType.setTemplate(jasperReportDto.getTemplate());
reportType.setTemplateStyle(templateStyle);
reportType.setDescription(description);
reportType.setVirtualizer(virtualizer);
reportType.setVirtualizerKickOn(virtualizerKickOn);
reportType.setMaxPages(maxPages);
reportType.setTimeout(timeout);
return reportType.asPrismObject();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType in project midpoint by Evolveum.
the class PageReport method onSavePerformed.
protected void onSavePerformed(AjaxRequestTarget target) {
Task task = createSimpleTask(OPERATION_SAVE_REPORT);
OperationResult result = task.getResult();
try {
//TODO TODO TODO
PrismObject<ReportType> newReport = model.getObject().getObject();
ObjectDelta<ReportType> delta = null;
if (newReport.getOid() == null) {
getPrismContext().adopt(newReport);
delta = ObjectDelta.createAddDelta(newReport);
delta.setPrismContext(getPrismContext());
} else {
PrismObject<ReportType> oldReport = WebModelServiceUtils.loadObject(ReportType.class, newReport.getOid(), this, task, result);
if (oldReport != null) {
delta = oldReport.diff(newReport);
}
}
if (delta != null) {
getPrismContext().adopt(delta);
getModelService().executeChanges(WebComponentUtil.createDeltaCollection(delta), null, task, result);
}
} catch (Exception e) {
result.recordFatalError("Couldn't save report.", e);
} finally {
result.computeStatusIfUnknown();
}
if (WebComponentUtil.isSuccessOrHandledError(result)) {
showResult(result);
redirectBack();
} else {
showResult(result);
target.add(getFeedbackPanel());
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType in project jqa-core-framework by buschmais.
the class ReportPluginRepositoryImpl method getReportPlugins.
private Map<String, ReportPlugin> getReportPlugins(List<JqassistantPlugin> plugins) throws PluginRepositoryException {
Map<String, ReportPlugin> reportPlugins = new HashMap<>();
for (JqassistantPlugin plugin : plugins) {
ReportType reportType = plugin.getReport();
if (reportType != null) {
for (IdClassType classType : reportType.getClazz()) {
ReportPlugin reportPlugin = createInstance(classType.getValue());
if (reportPlugin != null) {
try {
reportPlugin.initialize();
} catch (ReportException e) {
throw new PluginRepositoryException("Cannot initialize report plugin " + reportPlugin, e);
}
String id = classType.getId();
if (id == null) {
id = reportPlugin.getClass().getSimpleName();
}
reportPlugins.put(id, reportPlugin);
}
}
}
}
return reportPlugins;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType in project midpoint by Evolveum.
the class ReportServiceImpl method evaluateSubreportParameters.
public VariablesMap evaluateSubreportParameters(PrismObject<ReportType> report, VariablesMap variables, Task task, OperationResult result) {
VariablesMap subreportVariable = new VariablesMap();
if (report != null && report.asObjectable().getObjectCollection() != null && report.asObjectable().getObjectCollection().getSubreport() != null && !report.asObjectable().getObjectCollection().getSubreport().isEmpty()) {
Collection<SubreportParameterType> subreports = report.asObjectable().getObjectCollection().getSubreport();
List<SubreportParameterType> sortedSubreports = new ArrayList<>(subreports);
sortedSubreports.sort(Comparator.comparingInt(s -> ObjectUtils.defaultIfNull(s.getOrder(), Integer.MAX_VALUE)));
for (SubreportParameterType subreport : sortedSubreports) {
if (subreport.getExpression() == null || subreport.getName() == null) {
continue;
}
ExpressionType expression = subreport.getExpression();
try {
Collection<? extends PrismValue> subreportParameter = evaluateScript(report, expression, variables, "subreport parameter", task, result);
Class<?> subreportParameterClass;
if (subreport.getType() != null) {
subreportParameterClass = getPrismContext().getSchemaRegistry().determineClassForType(subreport.getType());
} else {
if (subreportParameter != null && !subreportParameter.isEmpty()) {
subreportParameterClass = subreportParameter.iterator().next().getRealClass();
} else {
subreportParameterClass = Object.class;
}
}
subreportVariable.put(subreport.getName(), subreportParameter, subreportParameterClass);
} catch (Exception e) {
LOGGER.error("Couldn't execute expression " + expression, e);
}
}
return subreportVariable;
}
return subreportVariable;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType in project midpoint by Evolveum.
the class TestCsvReportMultiNode method test102ExportAuditRecordsInsideTwoTimestamps.
@Test
public void test102ExportAuditRecordsInsideTwoTimestamps() throws Exception {
List<AuditEventRecordType> auditRecords = getAllAuditRecords(getTestTask(), getTestTask().getResult());
SearchFilterType filter = PrismContext.get().getQueryConverter().createSearchFilterType(PrismContext.get().queryFor(AuditEventRecordType.class).item(AuditEventRecordType.F_TIMESTAMP).ge(auditRecords.get(500).getTimestamp()).and().item(AuditEventRecordType.F_TIMESTAMP).le(auditRecords.get(1300).getTimestamp()).buildFilter());
modifyObjectReplaceProperty(ObjectCollectionType.class, OBJECT_COLLECTION_ALL_AUDIT_RECORDS.oid, ObjectCollectionType.F_FILTER, getTestTask(), getTestTask().getResult(), filter);
auditTest();
PrismObject<ReportType> report = getObject(ReportType.class, REPORT_AUDIT_COLLECTION_WITH_DEFAULT_COLUMN.oid);
List<String> rows = basicCheckOutputFile(report, -1, 8, null);
assertTrue(rows.size() > 800 && rows.size() <= 810, "Unexpected number of rows in report. Expected:800-810, Actual:" + rows.size());
}
Aggregations