Search in sources :

Example 1 with UserFacadeEjb

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;
}
Also used : TaskJurisdictionFlagsDto(de.symeda.sormas.api.task.TaskJurisdictionFlagsDto) UserFacadeEjb(de.symeda.sormas.backend.user.UserFacadeEjb) TaskDto(de.symeda.sormas.api.task.TaskDto)

Aggregations

TaskDto (de.symeda.sormas.api.task.TaskDto)1 TaskJurisdictionFlagsDto (de.symeda.sormas.api.task.TaskJurisdictionFlagsDto)1 UserFacadeEjb (de.symeda.sormas.backend.user.UserFacadeEjb)1