use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType in project midpoint by Evolveum.
the class PageReport method loadReport.
private ReportDto loadReport() {
StringValue reportOid = getPageParameters().get(OnePageParameterEncoder.PARAMETER);
Task task = createSimpleTask(OPERATION_LOAD_REPORT);
OperationResult result = task.getResult();
PrismObject<ReportType> prismReport = WebModelServiceUtils.loadObject(ReportType.class, reportOid.toString(), this, task, result);
if (prismReport == null) {
LOGGER.error("Couldn't load report.");
throw new RestartResponseException(PageReports.class);
}
return new ReportDto(prismReport.asObjectable());
// return prismReport;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType in project midpoint by Evolveum.
the class PageReports method initColumns.
private List<IColumn<ReportType, String>> initColumns() {
List<IColumn<ReportType, String>> columns = new ArrayList<IColumn<ReportType, String>>();
IColumn column;
column = new LinkColumn<SelectableBean<ReportType>>(createStringResource("PageReports.table.name"), ReportType.F_NAME.getLocalPart(), "value.name") {
@Override
public void onClick(AjaxRequestTarget target, IModel<SelectableBean<ReportType>> rowModel) {
ReportType report = rowModel.getObject().getValue();
if (report != null) {
reportTypeFilterPerformed(target, report.getOid());
}
}
@Override
public boolean isEnabled(IModel<SelectableBean<ReportType>> rowModel) {
return rowModel.getObject().getValue() != null && rowModel.getObject().getValue().isParent();
}
};
columns.add(column);
column = new PropertyColumn(createStringResource("PageReports.table.description"), "value.description");
columns.add(column);
column = new DoubleButtonColumn<SelectableBean<ReportType>>(new Model(), null) {
@Override
public String getFirstCap() {
return PageReports.this.createStringResource("PageReports.button.run").getString();
}
@Override
public String getSecondCap() {
return PageReports.this.createStringResource("PageReports.button.configure").getString();
}
@Override
public String getFirstColorCssClass() {
if (getRowModel().getObject().getValue() != null && getRowModel().getObject().getValue().isParent()) {
return BUTTON_COLOR_CLASS.PRIMARY.toString();
} else {
return BUTTON_COLOR_CLASS.PRIMARY.toString() + " " + BUTTON_DISABLED;
}
}
@Override
public void firstClicked(AjaxRequestTarget target, IModel<SelectableBean<ReportType>> model) {
runReportPerformed(target, model.getObject().getValue());
}
@Override
public void secondClicked(AjaxRequestTarget target, IModel<SelectableBean<ReportType>> model) {
configurePerformed(target, model.getObject().getValue());
}
@Override
public boolean isFirstButtonEnabled(IModel<SelectableBean<ReportType>> rowModel) {
return getRowModel().getObject().getValue() != null && rowModel.getObject().getValue().isParent();
}
};
columns.add(column);
return columns;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType in project midpoint by Evolveum.
the class PageReports method runReportPerformed.
protected void runReportPerformed(AjaxRequestTarget target, ReportType report) {
RunReportPopupPanel runReportPopupPanel = new RunReportPopupPanel(getMainPopupBodyId(), report) {
private static final long serialVersionUID = 1L;
protected void runConfirmPerformed(AjaxRequestTarget target, ReportType reportType, PrismContainer<ReportParameterType> reportParam) {
OperationResult result = new OperationResult(OPERATION_RUN_REPORT);
try {
Task task = createSimpleTask(OPERATION_RUN_REPORT);
getReportManager().runReport(reportType.asPrismObject(), reportParam, task, result);
} catch (Exception ex) {
result.recordFatalError(ex);
} finally {
result.computeStatusIfUnknown();
}
showResult(result);
target.add(getFeedbackPanel(), get(createComponentPath(ID_MAIN_FORM)));
hideMainPopup(target);
}
;
};
showMainPopup(runReportPopupPanel, target);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType in project midpoint by Evolveum.
the class PageCreatedReports method initColumns.
//TODO - consider adding Author name, File Type and ReportType to columns
private List<IColumn<SelectableBean<ReportOutputType>, String>> initColumns(final AjaxDownloadBehaviorFromStream ajaxDownloadBehavior) {
List<IColumn<SelectableBean<ReportOutputType>, String>> columns = new ArrayList<>();
IColumn column;
column = new CheckBoxHeaderColumn();
columns.add(column);
column = new PropertyColumn(createStringResource("pageCreatedReports.table.name"), "name", "value.name");
columns.add(column);
column = new PropertyColumn(createStringResource("pageCreatedReports.table.description"), "value.description");
columns.add(column);
column = new AbstractColumn<SelectableBean<ReportOutputType>, String>(createStringResource("pageCreatedReports.table.time"), "createTimestamp") {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<ReportOutputType>>> cellItem, String componentId, final IModel<SelectableBean<ReportOutputType>> rowModel) {
cellItem.add(new DateLabelComponent(componentId, new AbstractReadOnlyModel<Date>() {
@Override
public Date getObject() {
ReportOutputType object = rowModel.getObject().getValue();
MetadataType metadata = object != null ? object.getMetadata() : null;
if (metadata == null) {
return null;
}
return XmlTypeConverter.toDate(metadata.getCreateTimestamp());
}
}, DateLabelComponent.LONG_MEDIUM_STYLE));
}
};
columns.add(column);
column = new AbstractColumn<SelectableBean<ReportOutputType>, String>(new Model(), null) {
@Override
public void populateItem(Item<ICellPopulator<SelectableBean<ReportOutputType>>> cellItem, String componentId, final IModel<SelectableBean<ReportOutputType>> model) {
DownloadButtonPanel panel = new DownloadButtonPanel(componentId) {
@Override
protected void deletePerformed(AjaxRequestTarget target) {
deleteSelectedPerformed(target, ReportDeleteDialogDto.Operation.DELETE_SINGLE, model.getObject().getValue());
}
@Override
protected void downloadPerformed(AjaxRequestTarget target) {
currentReport = model.getObject().getValue();
PageCreatedReports.this.downloadPerformed(target, model.getObject().getValue(), ajaxDownloadBehavior);
}
};
cellItem.add(panel);
}
};
columns.add(column);
column = new InlineMenuHeaderColumn<InlineMenuable>(initInlineMenu()) {
@Override
public void populateItem(Item<ICellPopulator<InlineMenuable>> cellItem, String componentId, IModel<InlineMenuable> rowModel) {
cellItem.add(new Label(componentId));
}
};
columns.add(column);
return columns;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportType 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);
}
Aggregations