use of de.symeda.sormas.api.event.EventActionExportDto in project SORMAS-Project by hzi-braunschweig.
the class ActionService method getEventActionExportList.
public List<EventActionExportDto> getEventActionExportList(EventCriteria criteria, Integer first, Integer max) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<EventActionExportDto> cq = cb.createQuery(EventActionExportDto.class);
Root<Action> action = cq.from(getElementClass());
final ActionQueryContext actionQueryContext = new ActionQueryContext(cb, cq, action);
ActionJoins actionJoins = (ActionJoins) actionQueryContext.getJoins();
Join<Action, User> lastModifiedBy = actionJoins.getLastModifiedBy();
Join<Action, User> creator = actionJoins.getCreator();
Join<Action, Event> event = actionJoins.getEvent(JoinType.INNER);
Join<Event, User> eventReportingUser = event.join(Event.REPORTING_USER, JoinType.LEFT);
Join<Event, User> eventResponsibleUser = event.join(Event.RESPONSIBLE_USER, JoinType.LEFT);
// Add filters
Predicate filter = eventService.createUserFilter(cb, cq, event);
if (criteria != null) {
Predicate criteriaFilter = buildEventCriteriaFilter(criteria, actionQueryContext);
filter = CriteriaBuilderHelper.and(cb, filter, criteriaFilter);
}
if (filter != null) {
cq.where(filter);
}
cq.multiselect(event.get(Event.UUID), event.get(Event.EVENT_TITLE), event.get(Event.DISEASE), event.get(Event.DISEASE_VARIANT), event.get(Event.DISEASE_DETAILS), event.get(Event.EVENT_DESC), event.get(Event.EVENT_IDENTIFICATION_SOURCE), event.get(Event.START_DATE), event.get(Event.END_DATE), event.get(Event.EVOLUTION_DATE), event.get(Event.EVOLUTION_COMMENT), event.get(Event.EVENT_STATUS), event.get(Event.RISK_LEVEL), event.get(Event.EVENT_INVESTIGATION_STATUS), eventReportingUser.get(User.UUID), eventReportingUser.get(User.FIRST_NAME), eventReportingUser.get(User.LAST_NAME), eventResponsibleUser.get(User.UUID), eventResponsibleUser.get(User.FIRST_NAME), eventResponsibleUser.get(User.LAST_NAME), action.get(Action.ACTION_MEASURE), action.get(Action.TITLE), action.get(Action.CREATION_DATE), action.get(Action.CHANGE_DATE), action.get(Action.DATE), action.get(Action.ACTION_STATUS), action.get(Action.PRIORITY), lastModifiedBy.get(User.UUID), lastModifiedBy.get(User.FIRST_NAME), lastModifiedBy.get(User.LAST_NAME), creator.get(User.UUID), creator.get(User.FIRST_NAME), creator.get(User.LAST_NAME));
cq.orderBy(cb.desc(event.get(Event.CHANGE_DATE)));
return QueryHelper.getResultList(em, cq, first, max);
}
Aggregations