use of org.drools.workbench.models.datamodel.auditlog.AuditLogEntry in project drools-wb by kiegroup.
the class AuditLogViewImpl method setup.
public void setup() {
// BZ-996917: Use a the gwtboostrap style "row-fluid" to allow display some events in the same row.
eventTypes.setStyleName(Styles.ROW);
// Fill panel with available events.
for (Map.Entry<String, Boolean> e : auditLog.getAuditLogFilter().getAcceptedTypes().entrySet()) {
eventTypes.add(makeEventTypeCheckBox(e.getKey(), e.getValue()));
}
// Create the GWT Cell Table as events container.
// BZ-996942: Set custom width and table css style.
events = new CellTable<>();
events.setWidth("100%");
events.addStyleName(Styles.TABLE);
dlp = new ListDataProvider<AuditLogEntry>() {
@Override
public void setList(final List<AuditLogEntry> listToWrap) {
super.setList(listToWrap);
cellTablePagination.rebuild(pager);
}
};
dlp.addDataDisplay(events);
AuditLogEntrySummaryColumn summaryColumn = new AuditLogEntrySummaryColumn(style.auditLogDetailLabel(), style.auditLogDetailValue());
AuditLogEntryCommentColumn commentColumn = new AuditLogEntryCommentColumn();
events.addColumn(summaryColumn);
events.addColumn(commentColumn);
events.setColumnWidth(summaryColumn, 60.0, Unit.PCT);
events.setColumnWidth(commentColumn, 40.0, Unit.PCT);
// If the current user is not an Administrator include the delete comment column
if (identity.getRoles().contains(new RoleImpl(AppRoles.ADMIN.getName()))) {
AuditLogEntryDeleteCommentColumn deleteCommentColumn = new AuditLogEntryDeleteCommentColumn();
deleteCommentColumn.setFieldUpdater((int index, AuditLogEntry row, SafeHtml value) -> {
row.setDeleted(true);
dlp.setList(filterDeletedEntries(auditLog));
dlp.refresh();
});
events.addColumn(deleteCommentColumn);
events.setColumnWidth(commentColumn, 35.0, Unit.PCT);
events.setColumnWidth(deleteCommentColumn, 5.0, Unit.PCT);
}
events.setEmptyTableWidget(new Label(GuidedDecisionTableConstants.INSTANCE.DecisionTableAuditLogNoEntries()));
events.setKeyboardPagingPolicy(KeyboardPagingPolicy.CHANGE_PAGE);
events.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
events.setPageSize(PAGE_SIZE);
// Configure the simple pager.
pager.setDisplay(events);
pager.setPageSize(PAGE_SIZE);
// Add the table to the container.
eventsContainer.add(events);
}
use of org.drools.workbench.models.datamodel.auditlog.AuditLogEntry in project drools-wb by kiegroup.
the class AuditLogViewImpl method filterDeletedEntries.
private List<AuditLogEntry> filterDeletedEntries(final List<AuditLogEntry> entries) {
if (!identity.getRoles().contains(new RoleImpl(AppRoles.ADMIN.getName()))) {
return entries;
}
final List<AuditLogEntry> filteredEntries = new ArrayList<>();
final Iterator<AuditLogEntry> i = entries.iterator();
while (i.hasNext()) {
final AuditLogEntry entry = i.next();
if (!entry.isDeleted()) {
filteredEntries.add(entry);
}
}
return filteredEntries;
}