Search in sources :

Example 1 with EventJurisdictionDto

use of de.symeda.sormas.app.backend.event.EventJurisdictionDto in project SORMAS-Project by hzi-braunschweig.

the class JurisdictionHelper method createEventJurisdictionDto.

public static EventJurisdictionDto createEventJurisdictionDto(Event event) {
    if (event == null) {
        return null;
    }
    Location eventLocation = event.getEventLocation();
    if (eventLocation == null) {
        return null;
    }
    EventJurisdictionDto eventJurisdiction = new EventJurisdictionDto();
    if (event.getReportingUser() != null) {
        eventJurisdiction.setReportingUserUuid(event.getReportingUser().getUuid());
    }
    if (event.getResponsibleUser() != null) {
        eventJurisdiction.setResponsibleUserUuid(event.getResponsibleUser().getUuid());
    }
    if (eventLocation.getRegion() != null) {
        eventJurisdiction.setRegionUuid(eventLocation.getRegion().getUuid());
    }
    if (eventLocation.getDistrict() != null) {
        eventJurisdiction.setDistrictUuid(eventLocation.getDistrict().getUuid());
    }
    if (eventLocation.getCommunity() != null) {
        eventJurisdiction.setCommunityUuid(eventLocation.getCommunity().getUuid());
    }
    return eventJurisdiction;
}
Also used : EventJurisdictionDto(de.symeda.sormas.app.backend.event.EventJurisdictionDto) Location(de.symeda.sormas.app.backend.location.Location)

Example 2 with EventJurisdictionDto

use of de.symeda.sormas.app.backend.event.EventJurisdictionDto in project SORMAS-Project by hzi-braunschweig.

the class TaskJurisdictionBooleanValidator method of.

public static TaskJurisdictionBooleanValidator of(TaskJurisdictionDto taskJurisdictionDto, UserJurisdiction userJurisdiction) {
    final List<BooleanJurisdictionValidator> associatedJurisdictionValidators = new ArrayList<>();
    final CaseJurisdictionDto caseJurisdiction = taskJurisdictionDto.getCaseJurisdiction();
    if (caseJurisdiction != null) {
        associatedJurisdictionValidators.add(CaseJurisdictionBooleanValidator.of(caseJurisdiction, userJurisdiction));
    }
    final ContactJurisdictionDto contactJurisdiction = taskJurisdictionDto.getContactJurisdiction();
    if (contactJurisdiction != null) {
        associatedJurisdictionValidators.add(ContactJurisdictionBooleanValidator.of(contactJurisdiction, userJurisdiction));
    }
    final EventJurisdictionDto eventJurisdiction = taskJurisdictionDto.getEventJurisdiction();
    if (eventJurisdiction != null) {
        associatedJurisdictionValidators.add(EventJurisdictionBooleanValidator.of(eventJurisdiction, userJurisdiction));
    }
    return new TaskJurisdictionBooleanValidator(taskJurisdictionDto, userJurisdiction, associatedJurisdictionValidators);
}
Also used : CaseJurisdictionDto(de.symeda.sormas.app.backend.caze.CaseJurisdictionDto) ArrayList(java.util.ArrayList) EventJurisdictionDto(de.symeda.sormas.app.backend.event.EventJurisdictionDto) BooleanJurisdictionValidator(de.symeda.sormas.app.util.BooleanJurisdictionValidator) ContactJurisdictionDto(de.symeda.sormas.app.backend.contact.ContactJurisdictionDto)

Aggregations

EventJurisdictionDto (de.symeda.sormas.app.backend.event.EventJurisdictionDto)2 CaseJurisdictionDto (de.symeda.sormas.app.backend.caze.CaseJurisdictionDto)1 ContactJurisdictionDto (de.symeda.sormas.app.backend.contact.ContactJurisdictionDto)1 Location (de.symeda.sormas.app.backend.location.Location)1 BooleanJurisdictionValidator (de.symeda.sormas.app.util.BooleanJurisdictionValidator)1 ArrayList (java.util.ArrayList)1