use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType in project midpoint by Evolveum.
the class PageCreatedReports method deleteSelectedPerformed.
private void deleteSelectedPerformed(AjaxRequestTarget target, ReportDeleteDialogDto.Operation op, ReportOutputType single) {
List<ReportOutputType> selected = getSelectedData();
if (single != null) {
selected.clear();
selected.add(single);
}
if (selected.isEmpty()) {
return;
}
ReportDeleteDialogDto dto = new ReportDeleteDialogDto(op, selected);
deleteModel.setObject(dto);
getPageBase().showMainPopup(getDeleteDialogPanel(), target);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType 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.ReportOutputType in project midpoint by Evolveum.
the class ReportCreateHandlerPanel method initLayout.
private void initLayout(final PageTaskEdit parentPage) {
final AjaxDownloadBehaviorFromStream ajaxDownloadBehavior = new AjaxDownloadBehaviorFromStream() {
@Override
protected InputStream initStream() {
String outputOid = getModelObject().getReportOutputOid();
if (outputOid == null) {
return null;
}
Task task = parentPage.createSimpleTask(OPERATION_LOAD_REPORT_OUTPUT);
PrismObject<ReportOutputType> reportObject = WebModelServiceUtils.loadObject(ReportOutputType.class, outputOid, parentPage, task, task.getResult());
if (reportObject != null) {
return PageCreatedReports.createReport(reportObject.asObjectable(), this, parentPage);
} else {
return null;
}
}
};
parentPage.getForm().add(ajaxDownloadBehavior);
WebMarkupContainer reportParametersContainer = new WebMarkupContainer(ID_REPORT_PARAMETERS_CONTAINER);
TextArea reportParameters = new TextArea<>(ID_REPORT_PARAMETERS, new PropertyModel<>(getModel(), ReportCreateHandlerDto.F_REPORT_PARAMS));
reportParameters.setEnabled(false);
reportParametersContainer.add(reportParameters);
add(reportParametersContainer);
WebMarkupContainer downloadContainer = new WebMarkupContainer(ID_DOWNLOAD_CONTAINER);
AjaxButton download = new AjaxButton(ID_DOWNLOAD) {
@Override
public void onClick(AjaxRequestTarget target) {
ajaxDownloadBehavior.initiate(target);
}
};
downloadContainer.add(download);
downloadContainer.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return getModelObject().getReportOutputOid() != null;
}
});
add(downloadContainer);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType in project midpoint by Evolveum.
the class RReportOutput method toJAXB.
@Override
public ReportOutputType toJAXB(PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>> options) throws DtoTranslationException {
ReportOutputType object = new ReportOutputType();
RUtil.revive(object, prismContext);
RReportOutput.copyToJAXB(this, object, prismContext, options);
return object;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ReportOutputType in project midpoint by Evolveum.
the class ReportCreateTaskHandler method saveReportOutputType.
private void saveReportOutputType(String filePath, ReportType reportType, Task task, OperationResult parentResult) throws Exception {
String fileName = FilenameUtils.getBaseName(filePath);
String reportOutputName = fileName + " - " + reportType.getExport().value();
ReportOutputType reportOutputType = new ReportOutputType();
prismContext.adopt(reportOutputType);
reportOutputType.setFilePath(filePath);
reportOutputType.setReportRef(MiscSchemaUtil.createObjectReference(reportType.getOid(), ReportType.COMPLEX_TYPE));
reportOutputType.setName(new PolyStringType(reportOutputName));
reportOutputType.setDescription(reportType.getDescription() + " - " + reportType.getExport().value());
reportOutputType.setExportType(reportType.getExport());
ObjectDelta<ReportOutputType> objectDelta = null;
Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<ObjectDelta<? extends ObjectType>>();
OperationResult subResult = null;
objectDelta = ObjectDelta.createAddDelta((PrismObject<ReportOutputType>) reportOutputType.asPrismObject());
deltas.add(objectDelta);
subResult = parentResult.createSubresult(ReportCreateTaskHandler.class.getName() + "createRepourtOutput");
modelService.executeChanges(deltas, null, task, subResult);
String outputOid = objectDelta.getOid();
LOGGER.debug("Created report output with OID {}", outputOid);
PrismProperty<String> outputOidProperty = prismContext.getSchemaRegistry().findPropertyDefinitionByElementName(ReportConstants.REPORT_OUTPUT_OID_PROPERTY_NAME).instantiate();
outputOidProperty.setRealValue(outputOid);
task.setExtensionPropertyImmediate(outputOidProperty, subResult);
subResult.computeStatus();
}
Aggregations