Search in sources :

Example 1 with User

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

the class CaseEditFragment method setUpFieldVisibilities.

// Instance methods
private void setUpFieldVisibilities(final FragmentCaseEditLayoutBinding contentBinding) {
    setFieldVisibilitiesAndAccesses(CaseDataDto.class, contentBinding.mainContent);
    InfrastructureDaoHelper.initializeHealthFacilityDetailsFieldVisibility(contentBinding.caseDataHealthFacility, contentBinding.caseDataHealthFacilityDetails);
    InfrastructureDaoHelper.initializePointOfEntryDetailsFieldVisibility(contentBinding.caseDataPointOfEntry, contentBinding.caseDataPointOfEntryDetails);
    if (!isFieldAccessible(CaseDataDto.class, contentBinding.caseDataCommunity)) {
        contentBinding.caseDataRegion.setEnabled(false);
        contentBinding.caseDataDistrict.setEnabled(false);
    }
    // Smallpox vaccination scar image
    contentBinding.caseDataSmallpoxVaccinationScar.getViewTreeObserver().addOnGlobalLayoutListener(() -> contentBinding.smallpoxVaccinationScarImg.setVisibility(contentBinding.caseDataSmallpoxVaccinationScar.getVisibility()));
    // Port Health fields
    if (UserRole.isPortHealthUser(ConfigProvider.getUser().getUserRoles())) {
        contentBinding.caseDataCaseOrigin.setVisibility(GONE);
        contentBinding.facilityOrHome.setVisibility(GONE);
        contentBinding.caseDataCommunity.setVisibility(GONE);
        contentBinding.facilityTypeFieldsLayout.setVisibility(GONE);
        contentBinding.caseDataHealthFacility.setVisibility(GONE);
        contentBinding.caseDataHealthFacilityDetails.setVisibility(GONE);
    } else {
        if (record.getCaseOrigin() == CaseOrigin.POINT_OF_ENTRY) {
            if (record.getHealthFacility() == null) {
                contentBinding.facilityOrHome.setVisibility(GONE);
                contentBinding.caseDataCommunity.setVisibility(GONE);
                contentBinding.facilityTypeFieldsLayout.setVisibility(GONE);
                contentBinding.caseDataHealthFacility.setVisibility(GONE);
                contentBinding.caseDataHealthFacilityDetails.setVisibility(GONE);
            }
        } else {
            contentBinding.pointOfEntryFieldsLayout.setVisibility(GONE);
        }
    }
    // Button panel
    DiseaseClassificationCriteria classificationCriteria = DatabaseHelper.getDiseaseClassificationCriteriaDao().getByDisease(record.getDisease());
    if (classificationCriteria == null || !classificationCriteria.hasAnyCriteria()) {
        contentBinding.showClassificationRules.setVisibility(GONE);
    }
    if (!ConfigProvider.hasUserRight(UserRight.CASE_REFER_FROM_POE) || record.getCaseOrigin() != CaseOrigin.POINT_OF_ENTRY || record.getHealthFacility() != null) {
        contentBinding.referCaseFromPoe.setVisibility(GONE);
    }
    if (contentBinding.showClassificationRules.getVisibility() == GONE && contentBinding.referCaseFromPoe.getVisibility() == GONE) {
        contentBinding.caseButtonsPanel.setVisibility(GONE);
    }
    if (!ConfigProvider.isConfiguredServer(CountryHelper.COUNTRY_CODE_GERMANY)) {
        contentBinding.caseDataExternalID.setVisibility(GONE);
    } else {
        contentBinding.caseDataEpidNumber.setVisibility(GONE);
    }
    updateCaseConfirmationVisibility(contentBinding);
    contentBinding.caseDataQuarantineExtended.setVisibility(record.isQuarantineExtended() ? VISIBLE : GONE);
    contentBinding.caseDataQuarantineReduced.setVisibility(record.isQuarantineReduced() ? VISIBLE : GONE);
    User user = ConfigProvider.getUser();
    if (user.hasUserRole(UserRole.HOSPITAL_INFORMANT)) {
        // Hospital Informants are not allowed to change place of stay
        contentBinding.caseDataDifferentPlaceOfStayJurisdiction.setEnabled(false);
        contentBinding.caseDataDifferentPlaceOfStayJurisdiction.setVisibility(GONE);
    }
}
Also used : User(de.symeda.sormas.app.backend.user.User) CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) DiseaseClassificationCriteria(de.symeda.sormas.app.backend.classification.DiseaseClassificationCriteria)

Example 2 with User

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

the class CaseNewFragment method onAfterLayoutBinding.

@Override
public void onAfterLayoutBinding(final FragmentCaseNewLayoutBinding contentBinding) {
    InfrastructureDaoHelper.initializeHealthFacilityDetailsFieldVisibility(contentBinding.caseDataHealthFacility, contentBinding.caseDataHealthFacilityDetails);
    InfrastructureDaoHelper.initializePointOfEntryDetailsFieldVisibility(contentBinding.caseDataPointOfEntry, contentBinding.caseDataPointOfEntryDetails);
    if (!ConfigProvider.isConfiguredServer(CountryHelper.COUNTRY_CODE_GERMANY) && !ConfigProvider.isConfiguredServer(CountryHelper.COUNTRY_CODE_SWITZERLAND)) {
        contentBinding.caseDataExternalID.setVisibility(GONE);
        contentBinding.caseDataExternalToken.setVisibility(GONE);
    } else {
        contentBinding.caseDataEpidNumber.setVisibility(GONE);
    }
    contentBinding.caseDataResponsibleRegion.setEnabled(false);
    contentBinding.caseDataResponsibleRegion.setRequired(false);
    contentBinding.caseDataResponsibleDistrict.setEnabled(false);
    contentBinding.caseDataResponsibleDistrict.setRequired(false);
    User user = ConfigProvider.getUser();
    if (user.getPointOfEntry() == null) {
        contentBinding.facilityOrHome.setValue(TypeOfPlace.FACILITY);
    }
    if (user.hasUserRole(UserRole.HOSPITAL_INFORMANT) && user.getHealthFacility() != null) {
        // Hospital Informants are not allowed to create cases in another health facility
        contentBinding.caseDataCommunity.setEnabled(false);
        contentBinding.caseDataCommunity.setRequired(false);
        contentBinding.caseDataHealthFacility.setEnabled(false);
        contentBinding.caseDataHealthFacility.setRequired(false);
        contentBinding.facilityOrHome.setEnabled(false);
        contentBinding.facilityTypeGroup.setEnabled(false);
        contentBinding.caseDataFacilityType.setEnabled(false);
        contentBinding.caseDataDifferentPlaceOfStayJurisdiction.setEnabled(false);
        contentBinding.caseDataDifferentPlaceOfStayJurisdiction.setVisibility(GONE);
    }
    if (user.hasUserRole(UserRole.POE_INFORMANT) && user.getPointOfEntry() != null) {
        contentBinding.caseDataPointOfEntry.setEnabled(false);
        contentBinding.caseDataPointOfEntry.setRequired(false);
    }
    if (user.hasUserRole(UserRole.COMMUNITY_INFORMANT) && user.getCommunity() != null) {
        // Community Informants are not allowed to create cases in another community
        contentBinding.caseDataCommunity.setEnabled(false);
        contentBinding.caseDataCommunity.setRequired(false);
    }
    // Disable personal details and disease fields when case is created from contact
    // or event person
    Bundler bundler = new Bundler(getArguments());
    if (bundler.getContactUuid() != null || bundler.getEventParticipantUuid() != null) {
        contentBinding.caseDataFirstName.setEnabled(false);
        contentBinding.caseDataLastName.setEnabled(false);
        contentBinding.personSex.setEnabled(false);
        contentBinding.personBirthdateYYYY.setEnabled(false);
        contentBinding.personBirthdateMM.setEnabled(false);
        contentBinding.personBirthdateDD.setEnabled(false);
        contentBinding.caseDataDisease.setEnabled(false);
        contentBinding.caseDataDiseaseDetails.setEnabled(false);
        contentBinding.caseDataPlagueType.setEnabled(false);
        contentBinding.caseDataDengueFeverType.setEnabled(false);
        contentBinding.caseDataHumanRabiesType.setEnabled(false);
    }
    // Set up port health visibilities
    if (UserRole.isPortHealthUser(ConfigProvider.getUser().getUserRoles())) {
        contentBinding.caseDataCaseOrigin.setVisibility(GONE);
        contentBinding.caseDataDisease.setVisibility(GONE);
        contentBinding.facilityOrHome.setVisibility(GONE);
        contentBinding.caseDataCommunity.setVisibility(GONE);
        contentBinding.facilityTypeFieldsLayout.setVisibility(GONE);
        contentBinding.caseDataHealthFacility.setVisibility(GONE);
        contentBinding.facilityTypeGroup.setRequired(false);
        contentBinding.caseDataFacilityType.setRequired(false);
        contentBinding.caseDataHealthFacility.setRequired(false);
        contentBinding.caseDataHealthFacilityDetails.setRequired(false);
    } else if (DatabaseHelper.getPointOfEntryDao().hasActiveEntriesInDistrict()) {
        if (record.getCaseOrigin() == CaseOrigin.IN_COUNTRY) {
            contentBinding.caseDataPointOfEntry.setRequired(false);
            contentBinding.caseDataPointOfEntry.setVisibility(GONE);
        } else {
            contentBinding.caseDataHealthFacility.setRequired(false);
        }
        contentBinding.caseDataCaseOrigin.addValueChangedListener(e -> {
            if (e.getValue() == CaseOrigin.IN_COUNTRY) {
                contentBinding.caseDataPointOfEntry.setVisibility(GONE);
                contentBinding.caseDataPointOfEntry.setRequired(false);
                contentBinding.caseDataPointOfEntry.setValue(null);
                contentBinding.caseDataHealthFacility.setRequired(true);
            } else {
                contentBinding.caseDataPointOfEntry.setVisibility(VISIBLE);
                contentBinding.caseDataHealthFacility.setRequired(false);
                contentBinding.caseDataPointOfEntry.setRequired(true);
            }
        });
    } else {
        contentBinding.caseDataCaseOrigin.setVisibility(GONE);
        contentBinding.caseDataPointOfEntry.setVisibility(GONE);
    }
}
Also used : PlagueType(de.symeda.sormas.api.caze.PlagueType) DataUtils(de.symeda.sormas.app.util.DataUtils) PersonValidator(de.symeda.sormas.app.person.edit.PersonValidator) DateHelper(de.symeda.sormas.api.utils.DateHelper) Facility(de.symeda.sormas.app.backend.facility.Facility) ArrayList(java.util.ArrayList) CustomizableEnumType(de.symeda.sormas.api.customizableenum.CustomizableEnumType) User(de.symeda.sormas.app.backend.user.User) Calendar(java.util.Calendar) ConfigProvider(de.symeda.sormas.app.backend.config.ConfigProvider) VISIBLE(android.view.View.VISIBLE) CountryHelper(de.symeda.sormas.api.CountryHelper) Item(de.symeda.sormas.app.component.Item) UserRole(de.symeda.sormas.api.user.UserRole) InfrastructureFieldsDependencyHandler(de.symeda.sormas.app.util.InfrastructureFieldsDependencyHandler) Bundler(de.symeda.sormas.app.util.Bundler) Case(de.symeda.sormas.app.backend.caze.Case) FragmentCaseNewLayoutBinding(de.symeda.sormas.app.databinding.FragmentCaseNewLayoutBinding) FacilityType(de.symeda.sormas.api.infrastructure.facility.FacilityType) Sex(de.symeda.sormas.api.person.Sex) CaseOrigin(de.symeda.sormas.api.caze.CaseOrigin) DengueFeverType(de.symeda.sormas.api.caze.DengueFeverType) DiseaseVariant(de.symeda.sormas.api.disease.DiseaseVariant) TypeOfPlace(de.symeda.sormas.api.event.TypeOfPlace) R(de.symeda.sormas.app.R) InfrastructureDaoHelper(de.symeda.sormas.app.util.InfrastructureDaoHelper) PresentCondition(de.symeda.sormas.api.person.PresentCondition) List(java.util.List) Disease(de.symeda.sormas.api.Disease) DiseaseConfigurationCache(de.symeda.sormas.app.util.DiseaseConfigurationCache) GONE(android.view.View.GONE) RabiesType(de.symeda.sormas.api.caze.RabiesType) DatabaseHelper(de.symeda.sormas.app.backend.common.DatabaseHelper) BaseEditFragment(de.symeda.sormas.app.BaseEditFragment) FacilityTypeGroup(de.symeda.sormas.api.infrastructure.facility.FacilityTypeGroup) JurisdictionLevel(de.symeda.sormas.api.user.JurisdictionLevel) User(de.symeda.sormas.app.backend.user.User) Bundler(de.symeda.sormas.app.util.Bundler)

Example 3 with User

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

the class ContactDtoHelper method fillInnerFromAdo.

@Override
public void fillInnerFromAdo(ContactDto target, Contact source) {
    if (source.getPerson() != null) {
        Person person = DatabaseHelper.getPersonDao().queryForId(source.getPerson().getId());
        target.setPerson(PersonDtoHelper.toReferenceDto(person));
    } else {
        target.setPerson(null);
    }
    if (source.getRegion() != null) {
        Region region = DatabaseHelper.getRegionDao().queryForId(source.getRegion().getId());
        target.setRegion(RegionDtoHelper.toReferenceDto(region));
    } else {
        target.setRegion(null);
    }
    if (source.getDistrict() != null) {
        District district = DatabaseHelper.getDistrictDao().queryForId(source.getDistrict().getId());
        target.setDistrict(DistrictDtoHelper.toReferenceDto(district));
    } else {
        target.setDistrict(null);
    }
    if (source.getCommunity() != null) {
        Community community = DatabaseHelper.getCommunityDao().queryForId(source.getCommunity().getId());
        target.setCommunity(CommunityDtoHelper.toReferenceDto(community));
    } else {
        target.setCommunity(null);
    }
    if (source.getCaseUuid() != null) {
        target.setCaze(new CaseReferenceDto(source.getCaseUuid()));
    } else {
        target.setCaze(null);
    }
    if (source.getResultingCaseUuid() != null) {
        target.setResultingCase(new CaseReferenceDto(source.getResultingCaseUuid()));
    } else {
        target.setResultingCase(null);
    }
    target.setDisease(source.getDisease());
    target.setDiseaseDetails(source.getDiseaseDetails());
    if (source.getReportingUser() != null) {
        User user = DatabaseHelper.getUserDao().queryForId(source.getReportingUser().getId());
        target.setReportingUser(UserDtoHelper.toReferenceDto(user));
    } else {
        target.setReportingUser(null);
    }
    target.setReportDateTime(source.getReportDateTime());
    target.setMultiDayContact(source.isMultiDayContact());
    target.setFirstContactDate(source.getFirstContactDate());
    target.setLastContactDate(source.getLastContactDate());
    target.setContactIdentificationSource(source.getContactIdentificationSource());
    target.setContactIdentificationSourceDetails(source.getContactIdentificationSourceDetails());
    target.setTracingApp(source.getTracingApp());
    target.setTracingAppDetails(source.getTracingAppDetails());
    target.setContactProximity(source.getContactProximity());
    target.setContactClassification(source.getContactClassification());
    target.setContactStatus(source.getContactStatus());
    target.setRelationToCase(source.getRelationToCase());
    target.setRelationDescription(source.getRelationDescription());
    target.setFollowUpStatus(source.getFollowUpStatus());
    target.setFollowUpComment(source.getFollowUpComment());
    target.setFollowUpUntil(source.getFollowUpUntil());
    if (source.getContactOfficer() != null) {
        User user = DatabaseHelper.getUserDao().queryForId(source.getContactOfficer().getId());
        target.setContactOfficer(UserDtoHelper.toReferenceDto(user));
    } else {
        target.setContactOfficer(null);
    }
    target.setDescription(source.getDescription());
    target.setReportLat(source.getReportLat());
    target.setReportLon(source.getReportLon());
    target.setReportLatLonAccuracy(source.getReportLatLonAccuracy());
    target.setExternalID(source.getExternalID());
    target.setExternalToken(source.getExternalToken());
    target.setInternalToken(source.getInternalToken());
    target.setHighPriority(source.isHighPriority());
    target.setImmunosuppressiveTherapyBasicDisease(source.getImmunosuppressiveTherapyBasicDisease());
    target.setImmunosuppressiveTherapyBasicDiseaseDetails(source.getImmunosuppressiveTherapyBasicDiseaseDetails());
    target.setCareForPeopleOver60(source.getCareForPeopleOver60());
    target.setQuarantine(source.getQuarantine());
    target.setQuarantineTypeDetails(source.getQuarantineTypeDetails());
    target.setQuarantineFrom(source.getQuarantineFrom());
    target.setQuarantineTo(source.getQuarantineTo());
    target.setCaseIdExternalSystem(source.getCaseIdExternalSystem());
    target.setCaseOrEventInformation(source.getCaseOrEventInformation());
    target.setQuarantineHelpNeeded(source.getQuarantineHelpNeeded());
    target.setQuarantineOrderedVerbally(source.isQuarantineOrderedVerbally());
    target.setQuarantineOrderedOfficialDocument(source.isQuarantineOrderedOfficialDocument());
    target.setQuarantineOrderedVerballyDate(source.getQuarantineOrderedVerballyDate());
    target.setQuarantineOrderedOfficialDocumentDate(source.getQuarantineOrderedOfficialDocumentDate());
    target.setQuarantineExtended(source.isQuarantineExtended());
    target.setQuarantineReduced(source.isQuarantineReduced());
    target.setQuarantineHomePossible(source.getQuarantineHomePossible());
    target.setQuarantineHomePossibleComment(source.getQuarantineHomePossibleComment());
    target.setQuarantineHomeSupplyEnsured(source.getQuarantineHomeSupplyEnsured());
    target.setQuarantineHomeSupplyEnsuredComment(source.getQuarantineHomeSupplyEnsuredComment());
    target.setQuarantineOfficialOrderSent(source.isQuarantineOfficialOrderSent());
    target.setQuarantineOfficialOrderSentDate(source.getQuarantineOfficialOrderSentDate());
    target.setAdditionalDetails(source.getAdditionalDetails());
    if (source.getEpiData() != null) {
        EpiData epiData = DatabaseHelper.getEpiDataDao().queryForId(source.getEpiData().getId());
        target.setEpiData(epiDataDtoHelper.adoToDto(epiData));
    } else {
        target.setEpiData(null);
    }
    if (source.getHealthConditions() != null) {
        HealthConditions healthConditions = DatabaseHelper.getHealthConditionsDao().queryForId(source.getHealthConditions().getId());
        target.setHealthConditions(healthConditionsDtoHelper.adoToDto(healthConditions));
    } else {
        target.setHealthConditions(null);
    }
    if (source.getSormasToSormasOriginInfo() != null) {
        target.setSormasToSormasOriginInfo(sormasToSormasOriginInfoDtoHelper.adoToDto(source.getSormasToSormasOriginInfo()));
    }
    target.setEndOfQuarantineReason(source.getEndOfQuarantineReason());
    target.setEndOfQuarantineReasonDetails(source.getEndOfQuarantineReasonDetails());
    target.setPseudonymized(source.isPseudonymized());
    target.setReturningTraveler(source.getReturningTraveler());
    target.setProhibitionToWork(source.getProhibitionToWork());
    target.setProhibitionToWorkFrom(source.getProhibitionToWorkFrom());
    target.setProhibitionToWorkUntil(source.getProhibitionToWorkUntil());
    if (source.getReportingDistrict() != null) {
        District district = DatabaseHelper.getDistrictDao().queryForId(source.getReportingDistrict().getId());
        target.setReportingDistrict(DistrictDtoHelper.toReferenceDto(district));
    } else {
        target.setReportingDistrict(null);
    }
    target.setFollowUpStatusChangeDate(source.getFollowUpStatusChangeDate());
    target.setFollowUpStatusChangeUser(UserDtoHelper.toReferenceDto(source.getFollowUpStatusChangeUser()));
    target.setVaccinationStatus(source.getVaccinationStatus());
}
Also used : HealthConditions(de.symeda.sormas.app.backend.clinicalcourse.HealthConditions) User(de.symeda.sormas.app.backend.user.User) Region(de.symeda.sormas.app.backend.region.Region) EpiData(de.symeda.sormas.app.backend.epidata.EpiData) Person(de.symeda.sormas.app.backend.person.Person) District(de.symeda.sormas.app.backend.region.District) Community(de.symeda.sormas.app.backend.region.Community) CaseReferenceDto(de.symeda.sormas.api.caze.CaseReferenceDto)

Example 4 with User

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

the class ExposureDtoHelper method fillInnerFromAdo.

@Override
protected void fillInnerFromAdo(ExposureDto target, Exposure source) {
    if (source.getLocation() != null) {
        Location location = DatabaseHelper.getLocationDao().queryForId(source.getLocation().getId());
        target.setLocation(locationDtoHelper.adoToDto(location));
    } else {
        target.setLocation(null);
    }
    if (source.getContactToCase() != null) {
        Contact contactToCase = DatabaseHelper.getContactDao().queryForId(source.getContactToCase().getId());
        target.setContactToCase(ContactDtoHelper.toReferenceDto(contactToCase));
    } else {
        target.setContactToCase(null);
    }
    if (source.getReportingUser() != null) {
        User reportingUser = DatabaseHelper.getUserDao().queryForId(source.getReportingUser().getId());
        target.setReportingUser(UserDtoHelper.toReferenceDto(reportingUser));
    } else {
        target.setReportingUser(null);
    }
    target.setAnimalCondition(source.getAnimalCondition());
    target.setTypeOfAnimal(source.getTypeOfAnimal());
    target.setTypeOfAnimalDetails(source.getTypeOfAnimalDetails());
    target.setExposureRole(source.getExposureRole());
    target.setAnimalContactType(source.getAnimalContactType());
    target.setAnimalContactTypeDetails(source.getAnimalContactTypeDetails());
    target.setAnimalMarket(source.getAnimalMarket());
    target.setAnimalVaccinated(source.getAnimalVaccinated());
    target.setContactToBodyFluids(source.getContactToBodyFluids());
    target.setDeceasedPersonIll(source.getDeceasedPersonIll());
    target.setDeceasedPersonName(source.getDeceasedPersonName());
    target.setDeceasedPersonRelation(source.getDeceasedPersonRelation());
    target.setDescription(source.getDescription());
    target.setEatingRawAnimalProducts(source.getEatingRawAnimalProducts());
    target.setEndDate(source.getEndDate());
    target.setExposureType(source.getExposureType());
    target.setExposureTypeDetails(source.getExposureTypeDetails());
    target.setGatheringDetails(source.getGatheringDetails());
    target.setGatheringType(source.getGatheringType());
    target.setHabitationDetails(source.getHabitationDetails());
    target.setHabitationType(source.getHabitationType());
    target.setHandlingAnimals(source.getHandlingAnimals());
    target.setHandlingSamples(source.getHandlingSamples());
    target.setIndoors(source.getIndoors());
    target.setLongFaceToFaceContact(source.getLongFaceToFaceContact());
    target.setOtherProtectiveMeasures(source.getOtherProtectiveMeasures());
    target.setProtectiveMeasuresDetails(source.getProtectiveMeasuresDetails());
    target.setOutdoors(source.getOutdoors());
    target.setPercutaneous(source.getPercutaneous());
    target.setPhysicalContactDuringPreparation(source.getPhysicalContactDuringPreparation());
    target.setPhysicalContactWithBody(source.getPhysicalContactWithBody());
    target.setShortDistance(source.getShortDistance());
    target.setProbableInfectionEnvironment(source.isProbableInfectionEnvironment());
    target.setStartDate(source.getStartDate());
    target.setWearingMask(source.getWearingMask());
    target.setWearingPpe(source.getWearingPpe());
    target.setTypeOfPlace(source.getTypeOfPlace());
    target.setTypeOfPlaceDetails(source.getTypeOfPlaceDetails());
    target.setMeansOfTransport(source.getMeansOfTransport());
    target.setMeansOfTransportDetails(source.getMeansOfTransportDetails());
    target.setConnectionNumber(source.getConnectionNumber());
    target.setSeatNumber(source.getSeatNumber());
    target.setWorkEnvironment(source.getWorkEnvironment());
    target.setBodyOfWater(source.getBodyOfWater());
    target.setWaterSource(source.getWaterSource());
    target.setWaterSourceDetails(source.getWaterSourceDetails());
    target.setProphylaxis(source.getProphylaxis());
    target.setProphylaxisDate(source.getProphylaxisDate());
    target.setRiskArea(source.getRiskArea());
    target.setLargeAttendanceNumber(source.getLargeAttendanceNumber());
}
Also used : User(de.symeda.sormas.app.backend.user.User) Location(de.symeda.sormas.app.backend.location.Location) Contact(de.symeda.sormas.app.backend.contact.Contact)

Example 5 with User

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

the class ContactEditAuthorization method isContactEditAllowed.

public static boolean isContactEditAllowed(Contact contact) {
    if (contact.getSormasToSormasOriginInfo() != null) {
        return contact.getSormasToSormasOriginInfo().isOwnershipHandedOver();
    }
    final User user = ConfigProvider.getUser();
    final ContactJurisdictionBooleanValidator contactJurisdictionBooleanValidator = ContactJurisdictionBooleanValidator.of(JurisdictionHelper.createContactJurisdictionDto(contact), JurisdictionHelper.createUserJurisdiction(user));
    return !contact.isOwnershipHandedOver() && contactJurisdictionBooleanValidator.inJurisdictionOrOwned();
}
Also used : User(de.symeda.sormas.app.backend.user.User)

Aggregations

User (de.symeda.sormas.app.backend.user.User)50 Case (de.symeda.sormas.app.backend.caze.Case)12 District (de.symeda.sormas.app.backend.region.District)12 Facility (de.symeda.sormas.app.backend.facility.Facility)10 Community (de.symeda.sormas.app.backend.region.Community)9 Person (de.symeda.sormas.app.backend.person.Person)7 Task (de.symeda.sormas.app.backend.task.Task)7 ArrayList (java.util.ArrayList)7 Disease (de.symeda.sormas.api.Disease)6 Contact (de.symeda.sormas.app.backend.contact.Contact)6 Region (de.symeda.sormas.app.backend.region.Region)6 HashSet (java.util.HashSet)6 Test (org.junit.Test)6 UserRole (de.symeda.sormas.api.user.UserRole)5 HealthConditions (de.symeda.sormas.app.backend.clinicalcourse.HealthConditions)5 Location (de.symeda.sormas.app.backend.location.Location)5 CaseDao (de.symeda.sormas.app.backend.caze.CaseDao)4 TaskDao (de.symeda.sormas.app.backend.task.TaskDao)4 Date (java.util.Date)4 ActivityAsCase (de.symeda.sormas.app.backend.activityascase.ActivityAsCase)3