Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#12550 - Hide jurisdiction fields when configured #12618

Merged
merged 11 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ public enum FeatureType {
// FEATURE MODULES
AGGREGATE_REPORTING(true, true, null, null, null),
CAMPAIGNS(true, false, null, null, null),
CASE_SURVEILANCE(true, true, null, null, ImmutableMap.of(FeatureTypeProperty.AUTOMATIC_RESPONSIBILITY_ASSIGNMENT, Boolean.TRUE)),
CASE_SURVEILANCE(true,
true,
null,
null,
ImmutableMap
.of(FeatureTypeProperty.AUTOMATIC_RESPONSIBILITY_ASSIGNMENT, Boolean.TRUE, FeatureTypeProperty.HIDE_JURISDICTION_FIELDS, Boolean.FALSE)),
CLINICAL_MANAGEMENT(true, true, null, null, null),
CONTACT_TRACING(true,
true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public enum FeatureTypeProperty {
SHARE_SAMPLES(Boolean.class),
SHARE_IMMUNIZATIONS(Boolean.class),
SHARE_REPORTS(Boolean.class),
FETCH_MODE(Boolean.class);
FETCH_MODE(Boolean.class),
HIDE_JURISDICTION_FIELDS(Boolean.class);

private final Class<?> returnType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public interface Captions {
String all = "all";
String area = "area";
String Area_archived = "Area.archived";
String Area_defaultInfrastructure = "Area.defaultInfrastructure";
String Area_externalId = "Area.externalId";
String areaActiveAreas = "areaActiveAreas";
String areaAllAreas = "areaAllAreas";
Expand Down Expand Up @@ -607,6 +608,7 @@ public interface Captions {
String columnVaccineName = "columnVaccineName";
String Community = "Community";
String Community_archived = "Community.archived";
String Community_defaultInfrastructure = "Community.defaultInfrastructure";
String Community_district = "Community.district";
String Community_externalID = "Community.externalID";
String Community_region = "Community.region";
Expand Down Expand Up @@ -791,6 +793,7 @@ public interface Captions {
String contactSourceCase = "contactSourceCase";
String Continent = "Continent";
String Continent_archived = "Continent.archived";
String Continent_defaultInfrastructure = "Continent.defaultInfrastructure";
String Continent_defaultName = "Continent.defaultName";
String Continent_displayName = "Continent.displayName";
String Continent_externalId = "Continent.externalId";
Expand All @@ -801,6 +804,7 @@ public interface Captions {
String convertEventParticipantToCase = "convertEventParticipantToCase";
String Country = "Country";
String Country_archived = "Country.archived";
String Country_defaultInfrastructure = "Country.defaultInfrastructure";
String Country_defaultName = "Country.defaultName";
String Country_displayName = "Country.displayName";
String Country_externalId = "Country.externalId";
Expand Down Expand Up @@ -1009,6 +1013,7 @@ public interface Captions {
String diseaseVariantDetails = "diseaseVariantDetails";
String District = "District";
String District_archived = "District.archived";
String District_defaultInfrastructure = "District.defaultInfrastructure";
String District_epidCode = "District.epidCode";
String District_externalID = "District.externalID";
String District_growthRate = "District.growthRate";
Expand Down Expand Up @@ -1458,6 +1463,7 @@ public interface Captions {
String Facility_contactPersonFirstName = "Facility.contactPersonFirstName";
String Facility_contactPersonLastName = "Facility.contactPersonLastName";
String Facility_contactPersonPhone = "Facility.contactPersonPhone";
String Facility_defaultInfrastructure = "Facility.defaultInfrastructure";
String Facility_district = "Facility.district";
String Facility_externalID = "Facility.externalID";
String Facility_houseNumber = "Facility.houseNumber";
Expand Down Expand Up @@ -1876,6 +1882,7 @@ public interface Captions {
String PointOfEntry = "PointOfEntry";
String PointOfEntry_active = "PointOfEntry.active";
String PointOfEntry_archived = "PointOfEntry.archived";
String PointOfEntry_defaultInfrastructure = "PointOfEntry.defaultInfrastructure";
String PointOfEntry_district = "PointOfEntry.district";
String PointOfEntry_externalID = "PointOfEntry.externalID";
String PointOfEntry_latitude = "PointOfEntry.latitude";
Expand Down Expand Up @@ -1941,6 +1948,7 @@ public interface Captions {
String Region = "Region";
String Region_archived = "Region.archived";
String Region_country = "Region.country";
String Region_defaultInfrastructure = "Region.defaultInfrastructure";
String Region_epidCode = "Region.epidCode";
String Region_externalID = "Region.externalID";
String Region_growthRate = "Region.growthRate";
Expand Down Expand Up @@ -2197,6 +2205,7 @@ public interface Captions {
String Subcontinent = "Subcontinent";
String Subcontinent_archived = "Subcontinent.archived";
String Subcontinent_continent = "Subcontinent.continent";
String Subcontinent_defaultInfrastructure = "Subcontinent.defaultInfrastructure";
String Subcontinent_defaultName = "Subcontinent.defaultName";
String Subcontinent_displayName = "Subcontinent.displayName";
String Subcontinent_externalId = "Subcontinent.externalId";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ public interface Validations {
String contactFollowUpUntilDate = "contactFollowUpUntilDate";
String contactFollowUpUntilDateSoftValidation = "contactFollowUpUntilDateSoftValidation";
String contactWithoutInfrastructureData = "contactWithoutInfrastructureData";
String defaultInfrastructureAlreadyExisting = "defaultInfrastructureAlreadyExisting";
String defaultInfrastructureInvalidParentDistrict = "defaultInfrastructureInvalidParentDistrict";
String defaultInfrastructureInvalidParentRegion = "defaultInfrastructureInvalidParentRegion";
String defaultInfrastructureNotRemovableChildCommunity = "defaultInfrastructureNotRemovableChildCommunity";
String defaultInfrastructureNotRemovableChildDistrict = "defaultInfrastructureNotRemovableChildDistrict";
String duplicateEpidNumber = "duplicateEpidNumber";
String duplicateExternalToken = "duplicateExternalToken";
String emptyOverwrittenFollowUpUntilDate = "emptyOverwrittenFollowUpUntilDate";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
public abstract class InfrastructureDto extends EntityDto {

private boolean centrallyManaged;

private boolean archived;

protected InfrastructureDto() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* SORMAS® - Surveillance Outbreak Response Management & Analysis System
* Copyright © 2016-2023 Helmholtz-Zentrum für Infektionsforschung GmbH (HZI)
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package de.symeda.sormas.api.infrastructure;

import java.util.Date;

public abstract class InfrastructureDtoWithDefault extends InfrastructureDto {

public static final String DEFAULT_INFRASTRUCTURE = "defaultInfrastructure";

private boolean defaultInfrastructure;

protected InfrastructureDtoWithDefault() {
super();
}

protected InfrastructureDtoWithDefault(Date creationDate, Date changeDate, String uuid, boolean archived) {
super(creationDate, changeDate, uuid, archived);
}

public boolean isDefaultInfrastructure() {
return defaultInfrastructure;
}

public void setDefaultInfrastructure(boolean defaultInfrastructure) {
this.defaultInfrastructure = defaultInfrastructure;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,6 @@ public interface InfrastructureFacade<DTO extends EntityDto, INDEX_DTO extends S
boolean isUsedInOtherInfrastructureData(Collection<String> uuids);

boolean hasArchivedParentInfrastructure(Collection<String> uuids);

REF_DTO getDefaultInfrastructureReference();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@

import de.symeda.sormas.api.MappingException;
import de.symeda.sormas.api.i18n.Validations;
import de.symeda.sormas.api.infrastructure.InfrastructureDto;
import de.symeda.sormas.api.infrastructure.InfrastructureDtoWithDefault;
import de.symeda.sormas.api.infrastructure.district.DistrictReferenceDto;
import de.symeda.sormas.api.infrastructure.region.RegionReferenceDto;
import de.symeda.sormas.api.utils.DataHelper;
import de.symeda.sormas.api.utils.FeatureIndependent;
import de.symeda.sormas.api.utils.FieldConstraints;

@FeatureIndependent
public class CommunityDto extends InfrastructureDto {
public class CommunityDto extends InfrastructureDtoWithDefault {

private static final long serialVersionUID = -8833267932522978860L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
import com.fasterxml.jackson.annotation.JsonIgnore;

import de.symeda.sormas.api.i18n.Validations;
import de.symeda.sormas.api.infrastructure.InfrastructureDto;
import de.symeda.sormas.api.infrastructure.InfrastructureDtoWithDefault;
import de.symeda.sormas.api.infrastructure.region.RegionReferenceDto;
import de.symeda.sormas.api.utils.DataHelper;
import de.symeda.sormas.api.utils.FeatureIndependent;
import de.symeda.sormas.api.utils.FieldConstraints;

@FeatureIndependent
public class DistrictDto extends InfrastructureDto {
public class DistrictDto extends InfrastructureDtoWithDefault {

private static final long serialVersionUID = 8990957700033431836L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ public class DistrictIndexDto extends EntityDto {
public static final String GROWTH_RATE = "growthRate";
public static final String REGION = "region";
public static final String EXTERNAL_ID = "externalID";
public static final String DEFAULT_INFRASTRUCTURE = "defaultInfrastructure";

private String name;
private String epidCode;
private Integer population;
private Float growthRate;
private RegionReferenceDto region;
private String externalID;
private boolean defaultInfrastructure;

public DistrictIndexDto() {
super();
Expand Down Expand Up @@ -106,6 +108,14 @@ public void setExternalID(String externalID) {
this.externalID = externalID;
}

public boolean isDefaultInfrastructure() {
return defaultInfrastructure;
}

public void setDefaultInfrastructure(boolean defaultInfrastructure) {
this.defaultInfrastructure = defaultInfrastructure;
}

public DistrictReferenceDto toReference() {
return new DistrictReferenceDto(getUuid(), name, externalID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import de.symeda.sormas.api.feature.FeatureType;
import de.symeda.sormas.api.i18n.I18nProperties;
import de.symeda.sormas.api.i18n.Validations;
import de.symeda.sormas.api.infrastructure.InfrastructureDto;
import de.symeda.sormas.api.infrastructure.InfrastructureDtoWithDefault;
import de.symeda.sormas.api.infrastructure.area.AreaReferenceDto;
import de.symeda.sormas.api.infrastructure.country.CountryReferenceDto;
import de.symeda.sormas.api.utils.DataHelper;
Expand All @@ -32,7 +32,7 @@
import de.symeda.sormas.api.utils.FieldConstraints;

@FeatureIndependent
public class RegionDto extends InfrastructureDto {
public class RegionDto extends InfrastructureDtoWithDefault {

private static final long serialVersionUID = -1610675328037466348L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class RegionIndexDto extends EntityDto {
public static final String EXTERNAL_ID = "externalID";
public static final String AREA = "area";
public static final String COUNTRY = "country";
public static final String DEFAULT_INFRASTRUCTURE = "defaultInfrastructure";

private String name;
private String epidCode;
Expand All @@ -44,6 +45,7 @@ public class RegionIndexDto extends EntityDto {
private String externalID;
private AreaReferenceDto area;
private CountryReferenceDto country;
private boolean defaultInfrastructure;

public String getName() {
return name;
Expand Down Expand Up @@ -101,6 +103,14 @@ public void setCountry(CountryReferenceDto country) {
this.country = country;
}

public boolean isDefaultInfrastructure() {
return defaultInfrastructure;
}

public void setDefaultInfrastructure(boolean defaultInfrastructure) {
this.defaultInfrastructure = defaultInfrastructure;
}

public RegionReferenceDto toReference() {
return new RegionReferenceDto(getUuid(), name, externalID);
}
Expand Down
9 changes: 9 additions & 0 deletions sormas-api/src/main/resources/captions.properties
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ areaArchivedAreas=Archived areas
areaAllAreas=All areas
Area.archived=Archived
Area.externalId=External ID
Area.defaultInfrastructure=Default
years=years
months=months
days=days
Expand Down Expand Up @@ -674,6 +675,7 @@ Community.archived=Archived
Community.externalID=External ID
Community.region=Region
Community.district=District
Community.defaultInfrastructure=Default
communityActiveCommunities=Active communities
communityArchivedCommunities=Archived communities
communityAllCommunities=All communities
Expand Down Expand Up @@ -1070,6 +1072,7 @@ District.growthRate=Growth rate
District.population=Population
District.externalID=External ID
District.region=Region
District.defaultInfrastructure=Default
epiDataNoSourceContacts=No source contacts have been created for this case
EpiData=Epidemiological data
EpiData.areaInfectedAnimals=Residing, working or travelling to an area where infected animals have been confirmed
Expand Down Expand Up @@ -1477,6 +1480,7 @@ Facility.contactPersonFirstName=Contact person first name
Facility.contactPersonLastName=Contact person last name
Facility.contactPersonPhone=Contact person phone number
Facility.contactPersonEmail=Contact person email address
Facility.defaultInfrastructure=Default
FeatureConfiguration.districtName=District
FeatureConfiguration.enabled=Line listing enabled?
FeatureConfiguration.endDate=End date
Expand Down Expand Up @@ -1870,6 +1874,7 @@ PointOfEntry.externalID=External ID
PointOfEntry.archived=Archived
PointOfEntry.region=Region
PointOfEntry.district=District
PointOfEntry.defaultInfrastructure=Default
populationDataMaleTotal=Male total
populationDataFemaleTotal=Female total
PortHealthInfo=Port health information
Expand Down Expand Up @@ -1929,6 +1934,7 @@ Continent.archived=Archived
Continent.externalId=External ID
Continent.defaultName=Default name
Continent.displayName=Name
Continent.defaultInfrastructure=Default
# Subcontinent
subcontinentActiveSubcontinents=Active subcontinents
subcontinentArchivedSubcontinents=Archived subcontinents
Expand All @@ -1939,6 +1945,7 @@ Subcontinent.externalId=External ID
Subcontinent.defaultName=Default name
Subcontinent.displayName=Name
Subcontinent.continent=Continent name
Subcontinent.defaultInfrastructure=Default
# Country
countryActiveCountries=Active countries
countryArchivedCountries=Archived countries
Expand All @@ -1951,6 +1958,7 @@ Country.displayName=Name
Country.isoCode=ISO code
Country.unoCode=UNO code
Country.subcontinent=Subcontinent
Country.defaultInfrastructure=Default
# Region
regionActiveRegions=Active regions
regionArchivedRegions=Archived regions
Expand All @@ -1962,6 +1970,7 @@ Region.growthRate=Growth rate
Region.population=Population
Region.externalID=External ID
Region.country=Country
Region.defaultInfrastructure=Default
# Sample
sampleCreateNew=Create new sample
sampleDeletedSamples=Deleted samples
Expand Down
7 changes: 6 additions & 1 deletion sormas-api/src/main/resources/validations.properties
Original file line number Diff line number Diff line change
Expand Up @@ -280,4 +280,9 @@ externalMessageRefersToMultipleEntities = The external message refers to multipl
environmentWaterFieldsSetWithNotWaterMedia = The following fields can be set only if the media type is Water: %s
gpsCoordinatesRequired = GPS coordinates are required
latitudeBetween = Latitude must be between -90 and 90
longitudeBetween = Longitude must be between -180 and 180
longitudeBetween = Longitude must be between -180 and 180
defaultInfrastructureAlreadyExisting = There already is another default %s in the database. Only one default %s is allowed.
defaultInfrastructureInvalidParentRegion = This district is in a different region than the default region, or there is no default region.
defaultInfrastructureInvalidParentDistrict = This community is in a different district than the default district, or there is no default district.
defaultInfrastructureNotRemovableChildCommunity = You have to remove the default community before removing the default district.
defaultInfrastructureNotRemovableChildDistrict = You have to remove the default district before removing the default region.
Loading