use of org.apache.nifi.history.HistoryQuery in project nifi by apache.
the class StandardNiFiServiceFacade method getActions.
@Override
public HistoryDTO getActions(final HistoryQueryDTO historyQueryDto) {
// extract the query criteria
final HistoryQuery historyQuery = new HistoryQuery();
historyQuery.setStartDate(historyQueryDto.getStartDate());
historyQuery.setEndDate(historyQueryDto.getEndDate());
historyQuery.setSourceId(historyQueryDto.getSourceId());
historyQuery.setUserIdentity(historyQueryDto.getUserIdentity());
historyQuery.setOffset(historyQueryDto.getOffset());
historyQuery.setCount(historyQueryDto.getCount());
historyQuery.setSortColumn(historyQueryDto.getSortColumn());
historyQuery.setSortOrder(historyQueryDto.getSortOrder());
// perform the query
final History history = auditService.getActions(historyQuery);
// only retain authorized actions
final HistoryDTO historyDto = dtoFactory.createHistoryDto(history);
if (history.getActions() != null) {
final List<ActionEntity> actionEntities = new ArrayList<>();
for (final Action action : history.getActions()) {
final AuthorizationResult result = authorizeAction(action);
actionEntities.add(entityFactory.createActionEntity(dtoFactory.createActionDto(action), Result.Approved.equals(result.getResult())));
}
historyDto.setActions(actionEntities);
}
// create the response
return historyDto;
}
use of org.apache.nifi.history.HistoryQuery in project nifi by apache.
the class StandardAuditService method getActions.
@Override
public History getActions(int firstActionId, int maxActions) {
final HistoryQuery query = new HistoryQuery();
query.setOffset(firstActionId);
query.setCount(maxActions);
query.setSortOrder("asc");
query.setSortColumn("timestamp");
return getActions(query);
}
Aggregations