use of de.symeda.sormas.backend.user.UserFacadeEjb in project SORMAS-Project by hzi-braunschweig.
the class TaskFacadeEjb method toDto.
public TaskDto toDto(Task source, Pseudonymizer pseudonymizer) {
if (source == null) {
return null;
}
TaskDto target = new TaskDto();
DtoHelper.fillDto(target, source);
target.setAssigneeUser(UserFacadeEjb.toReferenceDto(source.getAssigneeUser()));
target.setAssigneeReply(source.getAssigneeReply());
target.setCreatorUser(UserFacadeEjb.toReferenceDto(source.getCreatorUser()));
target.setCreatorComment(source.getCreatorComment());
if (source.getObserverUsers() != null) {
target.setObserverUsers(source.getObserverUsers().stream().map(UserFacadeEjb::toReferenceDto).collect(Collectors.toSet()));
}
target.setPriority(source.getPriority());
target.setDueDate(source.getDueDate());
target.setSuggestedStart(source.getSuggestedStart());
target.setPerceivedStart(source.getPerceivedStart());
target.setStatusChangeDate(source.getStatusChangeDate());
target.setTaskContext(source.getTaskContext());
target.setTaskStatus(source.getTaskStatus());
target.setTaskType(source.getTaskType());
target.setCaze(CaseFacadeEjb.toReferenceDto(source.getCaze()));
target.setContact(ContactFacadeEjb.toReferenceDto(source.getContact()));
target.setEvent(EventFacadeEjb.toReferenceDto(source.getEvent()));
target.setTravelEntry(travelEntryFacade.toRefDto(source.getTravelEntry()));
target.setClosedLat(source.getClosedLat());
target.setClosedLon(source.getClosedLon());
target.setClosedLatLonAccuracy(source.getClosedLatLonAccuracy());
TaskJurisdictionFlagsDto taskJurisdictionFlagsDto = taskService.inJurisdictionOrOwned(source);
pseudonymizer.pseudonymizeDto(TaskDto.class, target, taskJurisdictionFlagsDto.getInJurisdiction(), t -> {
if (source.getCaze() != null) {
pseudonymizer.pseudonymizeDto(CaseReferenceDto.class, target.getCaze(), taskJurisdictionFlagsDto.getCaseInJurisdiction(), null);
}
if (source.getContact() != null) {
pseudonymizeContactReference(pseudonymizer, target.getContact(), taskJurisdictionFlagsDto.getContactInJurisdiction(), taskJurisdictionFlagsDto.getContactCaseInJurisdiction());
}
if (source.getEvent() != null) {
pseudonymizer.pseudonymizeDto(EventReferenceDto.class, target.getEvent(), taskJurisdictionFlagsDto.getEventInJurisdiction(), null);
}
if (source.getTravelEntry() != null) {
pseudonymizer.pseudonymizeDto(TravelEntryReferenceDto.class, target.getTravelEntry(), taskJurisdictionFlagsDto.getTravelEntryInJurisdiction(), null);
}
});
return target;
}
Aggregations