use of com.evolveum.midpoint.xml.ns._public.common.common_3.GuiObjectColumnType in project midpoint by Evolveum.
the class PageAttorneySelection method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
ObjectListPanel<UserType> table = new ObjectListPanel<>(ID_TABLE, UserType.class, Collections.emptyList()) {
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_USER_SELECTION;
}
@Override
protected IColumn<SelectableBean<UserType>, String> createCheckboxColumn() {
return null;
}
@Override
protected IColumn<SelectableBean<UserType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
return new ObjectNameColumn<>(createStringResource("ObjectType.name")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target, IModel<SelectableBean<UserType>> rowModel) {
UserType object = rowModel.getObject().getValue();
selectUserPerformed(object.getOid());
}
};
}
@Override
protected List<IColumn<SelectableBean<UserType>, String>> createDefaultColumns() {
List<IColumn<SelectableBean<UserType>, String>> columns = new ArrayList<>();
columns.add(createNameColumn(null, null, null, null));
columns.addAll(PageAttorneySelection.this.initColumns());
return columns;
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return null;
}
@Override
protected ISelectableDataProvider<UserType, SelectableBean<UserType>> createProvider() {
return createSelectableBeanObjectDataProvider(() -> getAttorneySelectionQuery(), null);
}
};
table.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_USER_BOX_CSS_CLASSES);
table.setOutputMarkupId(true);
mainForm.add(table);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.GuiObjectColumnType in project midpoint by Evolveum.
the class AuditLogViewerPanel method initLayout.
private void initLayout() {
ContainerableListPanel<AuditEventRecordType, SelectableBean<AuditEventRecordType>> auditLogViewerTable = new ContainerableListPanel<>(ID_AUDIT_LOG_VIEWER_TABLE, AuditEventRecordType.class) {
@Override
protected List<IColumn<SelectableBean<AuditEventRecordType>, String>> createDefaultColumns() {
return AuditLogViewerPanel.this.createColumns();
}
@Override
protected List<InlineMenuItem> createInlineMenu() {
return null;
}
@Override
protected IColumn<SelectableBean<AuditEventRecordType>, String> createNameColumn(IModel<String> displayModel, GuiObjectColumnType customColumn, ItemPath itemPath, ExpressionType expression) {
return AuditLogViewerPanel.this.createNameColumn();
}
@Override
protected IColumn<SelectableBean<AuditEventRecordType>, String> createCheckboxColumn() {
return null;
}
@Override
protected IColumn<SelectableBean<AuditEventRecordType>, String> createIconColumn() {
return null;
}
@Override
protected Search createSearch(Class<AuditEventRecordType> type) {
// TODO: use storage?
AuditLogStorage storage = (AuditLogStorage) getPageStorage();
Search search = SearchFactory.createContainerSearch(new ContainerTypeSearchItem(new SearchValue(type, "")), AuditEventRecordType.F_TIMESTAMP, getPageBase(), true);
DateSearchItem timestampItem = (DateSearchItem) search.findPropertySearchItem(AuditEventRecordType.F_TIMESTAMP);
if (timestampItem != null && timestampItem.getFromDate() == null && timestampItem.getToDate() == null && !isCollectionViewPanelForWidget()) {
Date todayDate = Date.from(LocalDate.now().atStartOfDay(ZoneId.systemDefault()).toInstant());
timestampItem.setFromDate(MiscUtil.asXMLGregorianCalendar(todayDate));
}
return search;
}
@Override
protected UserProfileStorage.TableId getTableId() {
return UserProfileStorage.TableId.PAGE_AUDIT_LOG_VIEWER;
}
@Override
protected String getStorageKey() {
String collectionNameValue = null;
if (isCollectionViewPanelForCompiledView()) {
StringValue collectionName = getCollectionNameParameterValue();
collectionNameValue = collectionName != null ? collectionName.toString() : "";
}
return getAuditStorageKey(collectionNameValue);
}
@Override
protected ISelectableDataProvider createProvider() {
PageStorage pageStorage = getPageStorage();
SelectableBeanContainerDataProvider<AuditEventRecordType> provider = new SelectableBeanContainerDataProvider<AuditEventRecordType>(AuditLogViewerPanel.this, getSearchModel(), null, false) {
@Override
protected PageStorage getPageStorage() {
return pageStorage;
}
@Override
protected Integer countObjects(Class<? extends AuditEventRecordType> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> currentOptions, Task task, OperationResult result) throws CommonException {
return getPageBase().getModelAuditService().countObjects(query, currentOptions, task, result);
}
@Override
protected List<AuditEventRecordType> searchObjects(Class<? extends AuditEventRecordType> type, ObjectQuery query, Collection<SelectorOptions<GetOperationOptions>> options, Task task, OperationResult result) throws CommonException {
return getPageBase().getModelAuditService().searchObjects(query, options, task, result);
}
@NotNull
@Override
protected List<ObjectOrdering> createObjectOrderings(SortParam<String> sortParam) {
if (sortParam != null && sortParam.getProperty() != null) {
OrderDirection order = sortParam.isAscending() ? OrderDirection.ASCENDING : OrderDirection.DESCENDING;
return Collections.singletonList(getPrismContext().queryFactory().createOrdering(ItemPath.create(new QName(AuditEventRecordType.COMPLEX_TYPE.getNamespaceURI(), sortParam.getProperty())), order));
} else {
return Collections.emptyList();
}
}
@Override
protected ObjectQuery getCustomizeContentQuery() {
return AuditLogViewerPanel.this.getCustomizeContentQuery();
}
};
provider.setSort(AuditEventRecordType.F_TIMESTAMP.getLocalPart(), SortOrder.DESCENDING);
return provider;
}
@Override
protected AuditEventRecordType getRowRealValue(SelectableBean<AuditEventRecordType> rowModelObject) {
if (rowModelObject == null) {
return null;
}
return rowModelObject.getValue();
}
@Override
protected List<Component> createToolbarButtonsList(String idButton) {
List<Component> buttonsList = new ArrayList<>();
CsvDownloadButtonPanel exportDataLink = new CsvDownloadButtonPanel(idButton) {
private static final long serialVersionUID = 1L;
@Override
protected String getFilename() {
return "AuditLogViewer_" + createStringResource("MainObjectListPanel.exportFileName").getString();
}
@Override
protected DataTable<?, ?> getDataTable() {
return getTable().getDataTable();
}
};
exportDataLink.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return WebComponentUtil.isAuthorized(AuthorizationConstants.AUTZ_UI_ADMIN_CSV_EXPORT_ACTION_URI);
}
});
buttonsList.add(exportDataLink);
AjaxCompositedIconButton createReport = new AjaxCompositedIconButton(idButton, WebComponentUtil.createCreateReportIcon(), getPageBase().createStringResource("MainObjectListPanel.createReport")) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
createReportPerformed(target);
}
};
createReport.add(AttributeAppender.append("class", "btn btn-default btn-sm btn-margin-right"));
buttonsList.add(createReport);
return buttonsList;
}
};
auditLogViewerTable.setOutputMarkupId(true);
add(auditLogViewerTable);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.GuiObjectColumnType in project midpoint by Evolveum.
the class GenericSupport method getLabel.
static <C extends Containerable> String getLabel(GuiObjectColumnType column, PrismContainerDefinition<C> objectDefinition, LocalizationService localizationService) {
ItemPath path = column.getPath() == null ? null : column.getPath().getItemPath();
DisplayType columnDisplay = column.getDisplay();
String label;
if (columnDisplay != null && columnDisplay.getLabel() != null) {
label = getMessage(localizationService, columnDisplay.getLabel().getOrig());
} else {
String name = column.getName();
String displayName = null;
if (path != null) {
ItemDefinition<Item<?, ?>> def = objectDefinition.findItemDefinition(path);
if (def == null) {
throw new IllegalArgumentException("Could'n find item for path " + path);
}
displayName = def.getDisplayName();
}
if (StringUtils.isNotEmpty(displayName)) {
label = getMessage(localizationService, displayName);
} else {
label = name;
}
}
return label;
}
Aggregations