diff --git a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java index 73900520cec2..7bafa99c7e77 100644 --- a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java +++ b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/Program.java @@ -459,28 +459,22 @@ public List getTrackedEntityAttributes() { } /** - * Returns non-confidential TrackedEntityAttributes from ProgramTrackedEntityAttributes. Use - * getAttributes() to access the persisted attribute list. Skipped attributes are also considered - * confidential. + * Returns non-skipped TrackedEntityAttributes from ProgramTrackedEntityAttributes. Use + * getAttributes() to access the persisted attribute list. */ - public List getNonConfidentialTrackedEntityAttributes() { + public List getAnalyzableTrackedEntityAttributes() { return getTrackedEntityAttributes().stream() - .filter(a -> !a.isConfidentialBool() && !a.isSkipAnalytics()) + .filter(a -> !a.getSkipAnalytics()) .collect(Collectors.toList()); } /** - * Returns TrackedEntityAttributes from ProgramTrackedEntityAttributes which have a legend set and - * is of numeric value type. Skipped attributes are also considered confidential. + * Returns TrackedEntityAttributes from ProgramTrackedEntityAttributes which have a legend set, + * are of numeric value type and are not skipped. */ - public List getNonConfidentialTrackedEntityAttributesWithLegendSet() { + public List getAnalyzableTrackedEntityAttributesWithLegendSet() { return getTrackedEntityAttributes().stream() - .filter( - a -> - !a.isConfidentialBool() - && !a.isSkipAnalytics() - && a.hasLegendSet() - && a.isNumericType()) + .filter(a -> !a.getSkipAnalytics() && a.hasLegendSet() && a.isNumericType()) .collect(Collectors.toList()); } diff --git a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/system/SystemInfo.java b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/system/SystemInfo.java index 056a8161567e..17d9bf348ef9 100644 --- a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/system/SystemInfo.java +++ b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/system/SystemInfo.java @@ -96,7 +96,6 @@ public final class SystemInfo { @JsonProperty private final Integer readReplicaCount; @JsonProperty private final String memoryInfo; @JsonProperty private final Integer cpuCores; - @JsonProperty private final boolean encryption; @JsonProperty private final boolean emailConfigured; @JsonProperty private final boolean redisEnabled; @JsonProperty private final String redisHostname; @@ -109,6 +108,7 @@ public final class SystemInfo { @JsonProperty private final Boolean isMetadataVersionEnabled; @JsonProperty private final Date lastMetadataVersionSyncAttempt; @JsonProperty private final Boolean isMetadataSyncEnabled; + @JsonProperty private final boolean encryption; /** * Clears sensitive system info properties. @@ -134,10 +134,10 @@ public SystemInfo withoutSensitiveInfo() { .memoryInfo(null) .cpuCores(null) .systemMonitoringUrl(null) - .encryption(false) .redisEnabled(false) .redisHostname(null) .clusterHostname(null) + .encryption(false) .databaseInfo(databaseInfo.withoutSensitiveInfo()) .build(); } diff --git a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java index 228ed3634184..2283b7068879 100644 --- a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java +++ b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/trackedentity/TrackedEntityAttribute.java @@ -77,8 +77,6 @@ public class TrackedEntityAttribute extends BaseDimensionalItemObject private Integer sortOrderInListNoProgram; - private Boolean confidential = false; - private Boolean unique = false; // For TextPattern: @@ -120,7 +118,7 @@ public class TrackedEntityAttribute extends BaseDimensionalItemObject @Transient private Boolean trigramIndexed = false; @OpenApi.Description("Indicates whether this attribute should be excluded from analytics.") - private boolean skipAnalytics; + private Boolean skipAnalytics = false; // ------------------------------------------------------------------------- // Constructors @@ -155,12 +153,6 @@ public boolean isDateType() { return valueType.isDate(); } - /** Indicates whether this attribute has confidential information. */ - @JsonIgnore - public boolean isConfidentialBool() { - return confidential != null && confidential; - } - /** Indicates whether this attribute has an option set. */ @Override public boolean hasOptionSet() { @@ -342,16 +334,6 @@ public void setOptionSet(OptionSet optionSet) { this.optionSet = optionSet; } - @JsonProperty - @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) - public Boolean getConfidential() { - return confidential; - } - - public void setConfidential(Boolean confidential) { - this.confidential = confidential; - } - public TextPattern getTextPattern() { return textPattern; } @@ -454,11 +436,11 @@ public void setTrigramIndexed(Boolean trigramIndexed) { @JsonProperty @JacksonXmlProperty(namespace = DxfNamespaces.DXF_2_0) - public boolean isSkipAnalytics() { + public Boolean getSkipAnalytics() { return skipAnalytics; } - public void setSkipAnalytics(boolean skipAnalytics) { + public void setSkipAnalytics(Boolean skipAnalytics) { this.skipAnalytics = skipAnalytics; } @@ -488,8 +470,6 @@ public String toString() { + displayInListNoProgram + ", sortOrderInListNoProgram=" + sortOrderInListNoProgram - + ", confidential=" - + confidential + ", unique=" + unique + ", generated=" diff --git a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/tracker/imports/validation/ValidationCode.java b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/tracker/imports/validation/ValidationCode.java index 1f98c2ce2904..e271a9ba43cb 100644 --- a/dhis-2/dhis-api/src/main/java/org/hisp/dhis/tracker/imports/validation/ValidationCode.java +++ b/dhis-2/dhis-api/src/main/java/org/hisp/dhis/tracker/imports/validation/ValidationCode.java @@ -112,7 +112,6 @@ public enum ValidationCode { E1103("User: `{0}` lacks 'F_ENROLLMENT_CASCADE_DELETE' authority to delete Enrollment : `{1}`."), E1104("User: `{0}` has no data read access to Program: `{1}`, TrackedEntityType: `{2}`."), E1105("User: `{0}` has no search scope access to OrganisationUnit: `{1}`."), - E1112("AttributeValue: `{0}` is confidential but encryption is not enabled: `{1}`"), E1113("Enrollment: `{0}` is already deleted and cannot be modified."), E1114("TrackedEntity: `{0}` is already deleted and cannot be modified."), E1115("Could not find CategoryOptionCombo: `{0}`."), diff --git a/dhis-2/dhis-api/src/test/java/org/hisp/dhis/program/ProgramTest.java b/dhis-2/dhis-api/src/test/java/org/hisp/dhis/program/ProgramTest.java index 79a18c949040..72fe4bc8adbd 100644 --- a/dhis-2/dhis-api/src/test/java/org/hisp/dhis/program/ProgramTest.java +++ b/dhis-2/dhis-api/src/test/java/org/hisp/dhis/program/ProgramTest.java @@ -188,8 +188,8 @@ void testCopyOfWithNulls() { assertTrue(copy.getAnalyticsDataElements().isEmpty()); assertTrue(copy.getCategoryMappings().isEmpty()); assertTrue(copy.getDataElements().isEmpty()); - assertTrue(copy.getNonConfidentialTrackedEntityAttributes().isEmpty()); - assertTrue(copy.getNonConfidentialTrackedEntityAttributesWithLegendSet().isEmpty()); + assertTrue(copy.getAnalyzableTrackedEntityAttributes().isEmpty()); + assertTrue(copy.getAnalyzableTrackedEntityAttributesWithLegendSet().isEmpty()); assertTrue(copy.getNotificationTemplates().isEmpty()); assertTrue(copy.getOrganisationUnits().isEmpty()); assertTrue(copy.getProgramAttributes().isEmpty()); diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/AbstractJdbcEventAnalyticsManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/AbstractJdbcEventAnalyticsManager.java index e7fef3037254..9e0ba7d35303 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/AbstractJdbcEventAnalyticsManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/AbstractJdbcEventAnalyticsManager.java @@ -2500,7 +2500,7 @@ private Set getEnrollmentColumnsFromProgramIndicators(EventQueryParams p Set enrollmentColumns = new HashSet<>(); Set columns = - params.getProgram().getNonConfidentialTrackedEntityAttributes().stream() + params.getProgram().getAnalyzableTrackedEntityAttributes().stream() .map(columnMapper::getColumnsForAttribute) .flatMap(Collection::stream) .map(AnalyticsTableColumn::getName) diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEnrollmentAnalyticsDimensionsService.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEnrollmentAnalyticsDimensionsService.java index ec7740395bd1..acae10373fae 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEnrollmentAnalyticsDimensionsService.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEnrollmentAnalyticsDimensionsService.java @@ -81,7 +81,7 @@ public List getQueryDimensionsByProgramId(String programId) { filterByValueType( QUERY, ofItemsWithProgram( - program, getTeasIfRegistrationAndNotConfidential(program)))))) + program, getTeasIfRegistrationAndNotSkipped(program)))))) .orElse(List.of()); } @@ -127,23 +127,17 @@ public List getAggregateDimensionsByProgramId(String programI .orElse(List.of()); } - private Collection getTeasIfRegistrationAndNotConfidential( - Program program) { + private Collection getTeasIfRegistrationAndNotSkipped(Program program) { return Optional.of(program) .filter(Program::isRegistration) .map(Program::getTrackedEntityAttributes) .orElse(List.of()) .stream() - .filter(this::isNotConfidential) .filter(this::isNotSkipped) .collect(Collectors.toList()); } - private boolean isNotConfidential(TrackedEntityAttribute trackedEntityAttribute) { - return !trackedEntityAttribute.isConfidentialBool(); - } - private boolean isNotSkipped(TrackedEntityAttribute trackedEntityAttribute) { - return !trackedEntityAttribute.isSkipAnalytics(); + return !Boolean.TRUE.equals(trackedEntityAttribute.getSkipAnalytics()); } } diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsDimensionsService.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsDimensionsService.java index 36511965df02..1d185819b9a6 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsDimensionsService.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/DefaultEventAnalyticsDimensionsService.java @@ -158,8 +158,7 @@ private List dimensions(ProgramStage programStage) { .collect(Collectors.toSet())), filterByValueType(QUERY, ofDataElements(programStage)), filterByValueType( - QUERY, - ofItemsWithProgram(p, getTeasIfRegistrationAndNotConfidential(p))), + QUERY, ofItemsWithProgram(p, getTeasIfRegistrationAndAnalyzable(p))), ofItemsWithProgram(p, getCategories(p)), ofItemsWithProgram(p, getAttributeCategoryOptionGroupSetsIfNeeded(p))))) .orElse(List.of()); @@ -189,22 +188,17 @@ private List getCategories(Program program) { .orElse(List.of()); } - private List getTeasIfRegistrationAndNotConfidential(Program program) { + private List getTeasIfRegistrationAndAnalyzable(Program program) { return Optional.of(program) .filter(Program::isRegistration) .map(Program::getTrackedEntityAttributes) .orElse(List.of()) .stream() - .filter(this::isNotConfidential) .filter(this::isNotSkipped) .collect(Collectors.toList()); } - private boolean isNotConfidential(TrackedEntityAttribute trackedEntityAttribute) { - return !trackedEntityAttribute.isConfidentialBool(); - } - private boolean isNotSkipped(TrackedEntityAttribute trackedEntityAttribute) { - return !trackedEntityAttribute.isSkipAnalytics(); + return !trackedEntityAttribute.getSkipAnalytics(); } } diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractEventJdbcTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractEventJdbcTableManager.java index f482a7f28903..f356f07d1412 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractEventJdbcTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/AbstractEventJdbcTableManager.java @@ -143,7 +143,7 @@ protected String getAttributeValueJoinClause(Program program) { on en.trackedentityid=${uid}.trackedentityid \ and ${uid}.trackedentityattributeid = ${id}\s"""; - return program.getNonConfidentialTrackedEntityAttributes().stream() + return program.getAnalyzableTrackedEntityAttributes().stream() .map(attribute -> replaceQualify(sqlBuilder, template, toVariableMap(attribute))) .collect(Collectors.joining()); } diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEnrollmentAnalyticsTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEnrollmentAnalyticsTableManager.java index a00faf2f9a92..cc34d00d7969 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEnrollmentAnalyticsTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEnrollmentAnalyticsTableManager.java @@ -205,7 +205,7 @@ private List getColumns(Program program) { * @return a list of {@link AnalyticsTableColumn}. */ private List getTrackedEntityAttributeColumns(Program program) { - return program.getNonConfidentialTrackedEntityAttributes().stream() + return program.getAnalyzableTrackedEntityAttributes().stream() .map(this::getColumnForAttribute) .flatMap(Collection::stream) .toList(); diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java index 6702c5130961..80166d47d075 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcEventAnalyticsTableManager.java @@ -752,12 +752,12 @@ private String getSelectExpression(DataElement dataElement, String columnExpress private List getAttributeColumns(Program program) { List columns = new ArrayList<>(); columns.addAll( - program.getNonConfidentialTrackedEntityAttributes().stream() + program.getAnalyzableTrackedEntityAttributes().stream() .map(this::getColumnForAttribute) .flatMap(Collection::stream) .toList()); columns.addAll( - program.getNonConfidentialTrackedEntityAttributesWithLegendSet().stream() + program.getAnalyzableTrackedEntityAttributesWithLegendSet().stream() .map(this::getColumnForAttributeWithLegendSet) .flatMap(Collection::stream) .toList()); diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcTrackedEntityAnalyticsTableManager.java b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcTrackedEntityAnalyticsTableManager.java index c86ab9651e5a..3126a8bb5d29 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcTrackedEntityAnalyticsTableManager.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/table/JdbcTrackedEntityAnalyticsTableManager.java @@ -219,7 +219,7 @@ private List getColumns( List trackedEntityAttributes = getAllTrackedEntityAttributes(trackedEntityType, programsByTetUid) - .filter(tea -> !tea.isConfidentialBool() && !tea.isSkipAnalytics()) + .filter(tea -> !tea.getSkipAnalytics()) .toList(); params.addExtraParam( @@ -334,7 +334,7 @@ public void populateTable(AnalyticsTableUpdateParams params, AnalyticsTableParti ((List) params.getExtraParam( trackedEntityType.getUid(), ALL_NON_CONFIDENTIAL_TET_ATTRIBUTES)) - .stream().filter(tea -> !tea.isSkipAnalytics()).toList(); + .stream().filter(tea -> !tea.getSkipAnalytics()).toList(); if (isNotEmpty(attributes)) { attributes.forEach( diff --git a/dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/table/JdbcTrackedEntityAnalyticsTableManagerTest.java b/dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/table/JdbcTrackedEntityAnalyticsTableManagerTest.java index 9227d79607ed..085d6e3892cd 100644 --- a/dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/table/JdbcTrackedEntityAnalyticsTableManagerTest.java +++ b/dhis-2/dhis-services/dhis-service-analytics/src/test/java/org/hisp/dhis/analytics/table/JdbcTrackedEntityAnalyticsTableManagerTest.java @@ -126,54 +126,37 @@ void setUp() { } @Test - void verifyNonConfidentialTeasAreSkipped() { + void verifySkippedTeasAreExcluded() { AnalyticsTableUpdateParams params = AnalyticsTableUpdateParams.newBuilder().build(); TrackedEntityType tet = mock(TrackedEntityType.class); when(tet.getUid()).thenReturn("tetUid"); - TrackedEntityAttribute nonConfidentialTea = new TrackedEntityAttribute(); - nonConfidentialTea.setUid("nonConfidentialTeaUid"); - nonConfidentialTea.setConfidential(false); - nonConfidentialTea.setValueType(ValueType.TEXT); + TrackedEntityAttribute tea = new TrackedEntityAttribute(); + tea.setUid("teaUid"); + tea.setSkipAnalytics(false); + tea.setValueType(ValueType.TEXT); - TrackedEntityAttribute confidentialTea = new TrackedEntityAttribute(); - confidentialTea.setUid("confidentialTeaUid"); - confidentialTea.setConfidential(true); - confidentialTea.setValueType(ValueType.TEXT); + TrackedEntityAttribute skippedTea = new TrackedEntityAttribute(); + skippedTea.setUid("skippedTeaUid"); + skippedTea.setSkipAnalytics(true); + skippedTea.setValueType(ValueType.TEXT); Program program = mock(Program.class); - when(tet.getTrackedEntityAttributes()).thenReturn(List.of(nonConfidentialTea, confidentialTea)); - + when(tet.getTrackedEntityAttributes()).thenReturn(List.of(tea, skippedTea)); when(program.getTrackedEntityType()).thenReturn(tet); - when(trackedEntityTypeService.getAllTrackedEntityType()).thenReturn(List.of(tet)); - when(trackedEntityAttributeService.getProgramTrackedEntityAttributes(List.of(program))) .thenReturn(List.of()); - when(identifiableObjectManager.getAllNoAcl(Program.class)).thenReturn(List.of(program)); List analyticsTables = tableManager.getAnalyticsTables(params); assertEquals(1, analyticsTables.size()); - AnalyticsTable analyticsTable = analyticsTables.get(0); - - assertContainsNonConfidentialTeaColumns(analyticsTable); - assertDoesntContainConfidentialTeaColumns(analyticsTable); - } - - private void assertDoesntContainConfidentialTeaColumns(AnalyticsTable analyticsTable) { - List columns = analyticsTable.getColumns(); - - assertFalse(columns.stream().map(Column::getName).anyMatch("confidentialTeaUid"::equals)); - } - - private void assertContainsNonConfidentialTeaColumns(AnalyticsTable analyticsTable) { - List columns = analyticsTable.getColumns(); - - assertTrue(columns.stream().map(Column::getName).anyMatch("nonConfidentialTeaUid"::equals)); + List columns = analyticsTables.get(0).getColumns(); + assertTrue(columns.stream().map(Column::getName).anyMatch("teaUid"::equals)); + assertFalse(columns.stream().map(Column::getName).anyMatch("skippedTeaUid"::equals)); } } diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/notification/BaseNotificationMessageRenderer.java b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/notification/BaseNotificationMessageRenderer.java index 26ed865206b1..f01a73c29944 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/notification/BaseNotificationMessageRenderer.java +++ b/dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/notification/BaseNotificationMessageRenderer.java @@ -72,8 +72,6 @@ public abstract class BaseNotificationMessageRenderer implements Notification protected static final int SUBJECT_CHAR_LIMIT = 100; - protected static final String CONFIDENTIAL_VALUE_REPLACEMENT = "[CONFIDENTIAL]"; - // Error placeholders protected static final String MISSING_VALUE_REPLACEMENT = "[N/A]"; protected static final String VALUE_ON_ERROR = "[SERVER ERROR]"; @@ -199,7 +197,6 @@ protected abstract Map resolveDataElementValues( * *
    *
  • Returns a placeholder if the {@code DataElement} is not part of the program stage. - *
  • Returns a confidential replacement if the underlying value is {@code null}. *
  • Resolves OptionSet codes to their corresponding display names when applicable. *
  • Otherwise, returns the raw data value. *
@@ -214,10 +211,6 @@ protected String renderDataElementValue(EventDataValue dv, DataElement dataEleme } String value = dv.getValue(); - if (value == null) { - return CONFIDENTIAL_VALUE_REPLACEMENT; - } - // If the DV has an OptionSet -> substitute value with the name of the // Option diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml b/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml index 7bdcf5182b31..06bfb23d13ac 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml +++ b/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentity/hibernate/TrackedEntityAttribute.hbm.xml @@ -62,8 +62,6 @@ - - diff --git a/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValue.hbm.xml b/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValue.hbm.xml index b9a54b16a253..bea7cc6d613f 100644 --- a/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValue.hbm.xml +++ b/dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/trackedentityattributevalue/hibernate/TrackedEntityAttributeValue.hbm.xml @@ -21,9 +21,7 @@ - - - + diff --git a/dhis-2/dhis-support/dhis-support-db-migration/src/main/resources/org/hisp/dhis/db/migration/2.44/V2_44_6__remove_confidential_from_tea.sql b/dhis-2/dhis-support/dhis-support-db-migration/src/main/resources/org/hisp/dhis/db/migration/2.44/V2_44_6__remove_confidential_from_tea.sql new file mode 100644 index 000000000000..cbceaea98714 --- /dev/null +++ b/dhis-2/dhis-support/dhis-support-db-migration/src/main/resources/org/hisp/dhis/db/migration/2.44/V2_44_6__remove_confidential_from_tea.sql @@ -0,0 +1,34 @@ +-- Abort if any tracked entity attribute value has an encrypted value but no plain text value, +-- as removing the encryptedvalue column would cause irreversible data loss. +DO $$ +DECLARE + encrypted_only_count INTEGER; +BEGIN + SELECT COUNT(*) + INTO encrypted_only_count + FROM trackedentityattributevalue + WHERE encryptedvalue IS NOT NULL + AND (value IS NULL OR value = ''); + + IF encrypted_only_count > 0 THEN + RAISE EXCEPTION + 'Migration aborted: % row(s) in trackedentityattributevalue have an encrypted value but no plain text value. ' + 'Resolve this data inconsistency before running the migration. ' + 'See the 2.44 migration notes: ' + 'https://github.com/dhis2/dhis2-releases/blob/master/releases/2.44/migration-notes.md#tracked-entity-value-has-encrypted-value-but-no-plain-text-value', + encrypted_only_count; + END IF; +END; +$$; + +-- Preserve analytics exclusion intent: attributes that were confidential should skip analytics. +UPDATE trackedentityattribute +SET skipanalytics = true +WHERE confidential = true + AND skipanalytics = false; + +ALTER TABLE trackedentityattribute +DROP COLUMN IF EXISTS confidential; + +ALTER TABLE trackedentityattributevalue +DROP COLUMN IF EXISTS encryptedvalue; diff --git a/dhis-2/dhis-test-e2e/src/main/java/org/hisp/dhis/test/e2e/actions/metadata/TrackedEntityAttributeActions.java b/dhis-2/dhis-test-e2e/src/main/java/org/hisp/dhis/test/e2e/actions/metadata/TrackedEntityAttributeActions.java index 679fb2a54942..00e6d2dde3dd 100644 --- a/dhis-2/dhis-test-e2e/src/main/java/org/hisp/dhis/test/e2e/actions/metadata/TrackedEntityAttributeActions.java +++ b/dhis-2/dhis-test-e2e/src/main/java/org/hisp/dhis/test/e2e/actions/metadata/TrackedEntityAttributeActions.java @@ -57,16 +57,6 @@ public String create(String valueType, Boolean unique) { return this.post(ob).validateStatus(201).extractUid(); } - public String create(String valueType, Boolean unique, Boolean confidential) { - JsonObject ob = - new JsonObjectBuilder(build(valueType)) - .addProperty("confidential", String.valueOf(confidential)) - .addProperty("unique", String.valueOf(unique)) - .build(); - - return this.post(ob).validateStatus(201).extractUid(); - } - public String createOptionSetAttribute(String optionSet) { JsonObject ob = new JsonObjectBuilder(build("TEXT")) diff --git a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/AnalyticsDimensionsTest.java b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/AnalyticsDimensionsTest.java index b8fa5deacc75..bdb773145b81 100644 --- a/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/AnalyticsDimensionsTest.java +++ b/dhis-2/dhis-test-e2e/src/test/java/org/hisp/dhis/analytics/AnalyticsDimensionsTest.java @@ -48,7 +48,6 @@ import java.util.function.Consumer; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.hamcrest.CoreMatchers; import org.hamcrest.Description; import org.hamcrest.Matcher; import org.hamcrest.Matchers; @@ -175,26 +174,6 @@ public void shouldOnlyReturnProgramTrackedEntityAttributes() { .body("dimensions.uid", not(hasItem(equalTo(teaNotAssignedToProgram)))); } - @Test - public void shouldOnlyReturnConfidentialAttributeInAggregateDimensions() { - String confidentialAttribute = trackedEntityAttributeActions.create("NUMBER", true, true); - programActions - .addAttribute(Constants.TRACKER_PROGRAM_ID, confidentialAttribute, false) - .validateStatus(200); - - analyticsEnrollmentsActions - .query() - .getDimensionsByDimensionType(trackerProgram.getUid(), "PROGRAM_ATTRIBUTE") - .validate() - .body("dimensions.uid", not(CoreMatchers.hasItem(confidentialAttribute))); - - analyticsEnrollmentsActions - .aggregate() - .getDimensionsByDimensionType(trackerProgram.getUid(), "PROGRAM_ATTRIBUTE") - .validate() - .body("dimensions.uid", CoreMatchers.hasItem(confidentialAttribute)); - } - @ValueSource(strings = {"DATA_ELEMENT", "PROGRAM_ATTRIBUTE"}) @ParameterizedTest @Disabled diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/imports/bundle/TrackedEntityAttributeTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/imports/bundle/TrackedEntityAttributeTest.java index 463bc7ecc163..096479455d96 100644 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/imports/bundle/TrackedEntityAttributeTest.java +++ b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/imports/bundle/TrackedEntityAttributeTest.java @@ -313,7 +313,7 @@ private void assertSkipAnalytics( assertEquals( expected, - tea.isSkipAnalytics(), + tea.getSkipAnalytics(), "Expected skip individual analytics flag for UID " + uid + " to be " + expected); } } diff --git a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/imports/bundle/TrackedEntityProgramAttributeEncryptionTest.java b/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/imports/bundle/TrackedEntityProgramAttributeEncryptionTest.java deleted file mode 100644 index 00c1f6545809..000000000000 --- a/dhis-2/dhis-test-integration/src/test/java/org/hisp/dhis/tracker/imports/bundle/TrackedEntityProgramAttributeEncryptionTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2004-2022, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package org.hisp.dhis.tracker.imports.bundle; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -import java.io.IOException; -import java.util.List; -import org.hisp.dhis.common.IdentifiableObjectManager; -import org.hisp.dhis.test.integration.PostgresIntegrationTestBase; -import org.hisp.dhis.tracker.TestSetup; -import org.hisp.dhis.tracker.model.TrackedEntity; -import org.hisp.dhis.tracker.model.TrackedEntityAttributeValue; -import org.hisp.dhis.tracker.trackedentityattributevalue.TrackedEntityAttributeValueService; -import org.hisp.dhis.user.User; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInstance; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.core.RowCallbackHandler; -import org.springframework.transaction.annotation.Transactional; - -/** - * @author Morten Olav Hansen - */ -@Transactional -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -class TrackedEntityProgramAttributeEncryptionTest extends PostgresIntegrationTestBase { - @Autowired private TestSetup testSetup; - - @Autowired private TrackedEntityAttributeValueService trackedEntityAttributeValueService; - - @Autowired private IdentifiableObjectManager manager; - - @Autowired private JdbcTemplate jdbcTemplate; - - private User importUser; - - @BeforeAll - void setUp() throws IOException { - testSetup.importMetadata( - "tracker/te_program_with_tea_encryption_metadata.json", getAdminUser()); - - importUser = userService.getUser("tTgjgobT1oS"); - injectSecurityContextUser(importUser); - } - - @Test - void testTrackedEntityProgramAttributeEncryptedValue() throws IOException { - testSetup.importTrackerData("tracker/te_program_with_tea_encryption_data.json"); - - List trackedEntities = manager.getAll(TrackedEntity.class); - assertEquals(1, trackedEntities.size()); - - TrackedEntity trackedEntity = trackedEntities.get(0); - List attributeValues = - trackedEntityAttributeValueService.getTrackedEntityAttributeValues(trackedEntity); - assertEquals(5, attributeValues.size()); - // not really a great test, but we are using a random seed for salt, so - // it changes on every run... we might want to - // add another EncryptionConfig test profile - RowCallbackHandler handler = resultSet -> assertNotNull(resultSet.getString("encryptedvalue")); - jdbcTemplate.query( - "select * from trackedentityattributevalue where encryptedvalue is not null ", handler); - } -} diff --git a/dhis-2/dhis-test-integration/src/test/resources/dxf2/eventreport_with_program_indicator.json b/dhis-2/dhis-test-integration/src/test/resources/dxf2/eventreport_with_program_indicator.json index 09f7d2298edf..6f16e0d20a6a 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/dxf2/eventreport_with_program_indicator.json +++ b/dhis-2/dhis-test-integration/src/test/resources/dxf2/eventreport_with_program_indicator.json @@ -2397,7 +2397,6 @@ "generated": false, "displayOnVisitSchedule": false, "valueType": "TEXT", - "confidential": false, "orgunitScope": false, "unique": false, "inherit": false, @@ -2442,7 +2441,6 @@ "generated": false, "displayOnVisitSchedule": false, "valueType": "TEXT", - "confidential": false, "orgunitScope": false, "unique": false, "inherit": false, diff --git a/dhis-2/dhis-test-integration/src/test/resources/dxf2/import/te_type_tea_ok.json b/dhis-2/dhis-test-integration/src/test/resources/dxf2/import/te_type_tea_ok.json index 3ddbb33728e8..f394a6e7c3dc 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/dxf2/import/te_type_tea_ok.json +++ b/dhis-2/dhis-test-integration/src/test/resources/dxf2/import/te_type_tea_ok.json @@ -125,7 +125,6 @@ "aggregationType": "COUNT", "attributeValues": [], "code": "area_urban_rural", - "confidential": false, "description": "Whether client lives in an urban or rural setting", "dimensionItem": "YCqoNJZKvAG", "dimensionItemType": "PROGRAM_ATTRIBUTE", diff --git a/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_program_rules_with_invalid_ruleActions.json b/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_program_rules_with_invalid_ruleActions.json index 0e39c5da4c63..70259da6bc39 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_program_rules_with_invalid_ruleActions.json +++ b/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_program_rules_with_invalid_ruleActions.json @@ -2460,7 +2460,6 @@ "generated": false, "displayOnVisitSchedule": false, "valueType": "TEXT", - "confidential": false, "orgunitScope": false, "unique": false, "inherit": false, @@ -2505,7 +2504,6 @@ "generated": false, "displayOnVisitSchedule": false, "valueType": "TEXT", - "confidential": false, "orgunitScope": false, "unique": false, "inherit": false, diff --git a/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_program_rules_with_valid_ruleActions.json b/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_program_rules_with_valid_ruleActions.json index 15fdbf37b8aa..1a726bdf1167 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_program_rules_with_valid_ruleActions.json +++ b/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_program_rules_with_valid_ruleActions.json @@ -2204,7 +2204,6 @@ "generated": false, "displayOnVisitSchedule": false, "valueType": "TEXT", - "confidential": false, "orgunitScope": false, "unique": false, "inherit": false, @@ -2249,7 +2248,6 @@ "generated": false, "displayOnVisitSchedule": false, "valueType": "TEXT", - "confidential": false, "orgunitScope": false, "unique": false, "inherit": false, diff --git a/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_programrules.json b/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_programrules.json index 586e52b42470..a8d9f951e430 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_programrules.json +++ b/dhis-2/dhis-test-integration/src/test/resources/dxf2/metadata_with_program_and_programrules.json @@ -2410,7 +2410,6 @@ "generated": false, "displayOnVisitSchedule": false, "valueType": "TEXT", - "confidential": false, "orgunitScope": false, "unique": false, "inherit": false, @@ -2455,7 +2454,6 @@ "generated": false, "displayOnVisitSchedule": false, "valueType": "TEXT", - "confidential": false, "orgunitScope": false, "unique": false, "inherit": false, diff --git a/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_noreg_sections.json b/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_noreg_sections.json index 0b7b91829d88..4f3b7a3658bd 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_noreg_sections.json +++ b/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_noreg_sections.json @@ -481,7 +481,6 @@ "unique": false, "inherit": false, "created": "2016-03-10T07:25:57.406+0000", - "confidential": false, "shortName": "TrackedEntityAttributeA", "lastUpdated": "2016-03-10T07:26:32.131+0000", "displayOnVisitSchedule": false, diff --git a/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1.json b/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1.json index 8607a5a5b1bc..6b9770bf1d68 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1.json +++ b/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1.json @@ -311,7 +311,6 @@ "displayOnVisitSchedule": false, "unique": false, "lastUpdated": "2016-03-11T06:59:40.866+0000", - "confidential": false, "code": "TrackedEntityAttributeCodeA", "shortName": "TrackedEntityAttributeShortA", "user": { @@ -353,7 +352,6 @@ "code": "TrackedEntityAttributeCodeB", "displayOnVisitSchedule": false, "unique": false, - "confidential": false, "lastUpdated": "2016-03-11T06:59:51.889+0000", "sharing": { "public": "rw------", diff --git a/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1_invalid_nextschedule.json b/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1_invalid_nextschedule.json index 11673b9118ef..d4f19f9fe60e 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1_invalid_nextschedule.json +++ b/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1_invalid_nextschedule.json @@ -314,7 +314,6 @@ "displayOnVisitSchedule": false, "unique": false, "lastUpdated": "2016-03-11T06:59:40.866+0000", - "confidential": false, "code": "TrackedEntityAttributeCodeA", "shortName": "TrackedEntityAttributeShortA", "user": { @@ -356,7 +355,6 @@ "code": "TrackedEntityAttributeCodeB", "displayOnVisitSchedule": false, "unique": false, - "confidential": false, "lastUpdated": "2016-03-11T06:59:51.889+0000", "sharing": { "public": "rw------", diff --git a/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1_valid_nextschedule.json b/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1_valid_nextschedule.json index 91a7363e7ee5..cd80a214a598 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1_valid_nextschedule.json +++ b/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_reg1_valid_nextschedule.json @@ -314,7 +314,6 @@ "displayOnVisitSchedule": false, "unique": false, "lastUpdated": "2016-03-11T06:59:40.866+0000", - "confidential": false, "code": "TrackedEntityAttributeCodeA", "shortName": "TrackedEntityAttributeShortA", "user": { @@ -356,7 +355,6 @@ "code": "TrackedEntityAttributeCodeB", "displayOnVisitSchedule": false, "unique": false, - "confidential": false, "lastUpdated": "2016-03-11T06:59:51.889+0000", "sharing": { "public": "rw------", diff --git a/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_tea_not_shared.json b/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_tea_not_shared.json index 73b96a227ae0..0276fb59fc87 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_tea_not_shared.json +++ b/dhis-2/dhis-test-integration/src/test/resources/dxf2/program_tea_not_shared.json @@ -311,7 +311,6 @@ "displayOnVisitSchedule": false, "unique": false, "lastUpdated": "2016-03-11T06:59:40.866+0000", - "confidential": false, "code": "TrackedEntityAttributeCodeA", "shortName": "TrackedEntityAttributeShortA", "user": { @@ -353,7 +352,6 @@ "code": "TrackedEntityAttributeCodeB", "displayOnVisitSchedule": false, "unique": false, - "confidential": false, "lastUpdated": "2016-03-11T06:59:51.889+0000", "sharing": { "public": "--------", diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/event_metadata.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/event_metadata.json index ea746a74fb5e..53f3454a133d 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/event_metadata.json +++ b/dhis-2/dhis-test-integration/src/test/resources/tracker/event_metadata.json @@ -1872,7 +1872,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/identifier_metadata.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/identifier_metadata.json index eed1a1b69336..e4d2a7dae7c4 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/identifier_metadata.json +++ b/dhis-2/dhis-test-integration/src/test/resources/tracker/identifier_metadata.json @@ -296,7 +296,6 @@ "publicAccess": "rw------", "valueType": "INTEGER", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/ownership_metadata.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/ownership_metadata.json index e327df87dc13..cc00dd441fe5 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/ownership_metadata.json +++ b/dhis-2/dhis-test-integration/src/test/resources/tracker/ownership_metadata.json @@ -951,7 +951,6 @@ "valueType": "TEXT", "formName": "to-update-tei-attribute", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -986,7 +985,6 @@ "valueType": "TEXT", "formName": "to-delete-tei-attribute", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -1021,7 +1019,6 @@ "valueType": "TEXT", "formName": "not-updated-tei-attribute", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_encryption_data.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_encryption_data.json deleted file mode 100644 index 65a24369f703..000000000000 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_encryption_data.json +++ /dev/null @@ -1,138 +0,0 @@ -{ - "importMode": "COMMIT", - "idSchemes": { - "dataElementIdScheme": { - "idScheme": "UID" - }, - "orgUnitIdScheme": { - "idScheme": "UID" - }, - "programIdScheme": { - "idScheme": "UID" - }, - "programStageIdScheme": { - "idScheme": "UID" - }, - "idScheme": { - "idScheme": "UID" - }, - "categoryOptionComboIdScheme": { - "idScheme": "UID" - }, - "categoryOptionIdScheme": { - "idScheme": "UID" - } - }, - "importStrategy": "CREATE", - "atomicMode": "ALL", - "flushMode": "AUTO", - "validationMode": "FULL", - "skipPatternValidation": false, - "skipSideEffects": false, - "skipRuleEngine": false, - "trackedEntities": [ - { - "trackedEntity": "EEFkxTWB55Y", - "trackedEntityType": { - "idScheme": "UID", - "identifier": "KrYIdvLxkMb" - }, - "createdAtClient": "2020-02-20T12:09:21.844", - "orgUnit": { - "idScheme": "UID", - "identifier": "cNEZTkdAvmg" - }, - "inactive": false, - "deleted": false, - "potentialDuplicate": false, - "relationships": [], - "attributes": [ - { - "attribute": { - "idScheme": "UID", - "identifier": "sYn3tkL3XKa" - }, - "displayName": "Attribute_Integer", - "storedBy": "admin", - "valueType": "INTEGER", - "value": "321" - }, - { - "attribute": { - "idScheme": "UID", - "identifier": "TsfP85GKsU5" - }, - "displayName": "Attribute_Text", - "storedBy": "admin", - "valueType": "TEXT", - "value": "TEXT" - }, - { - "attribute": { - "idScheme": "UID", - "identifier": "sTGqP5JNy6E" - }, - "displayName": "Attribute_Date", - "storedBy": "admin", - "valueType": "DATE", - "value": "2020-02-20" - }, - { - "attribute": { - "idScheme": "UID", - "identifier": "CWMLspQP2RH" - }, - "displayName": "Attribute_Encrypted_Text", - "storedBy": "admin", - "valueType": "TEXT", - "value": "Value To Encrypt" - } - ], - "enrollments": [] - } - ], - "enrollments": [ - { - "enrollment": "NfX6INLTOVq", - "createdAtClient": "2020-02-20T12:09:21.917", - "trackedEntity": "EEFkxTWB55Y", - "program": { - "idScheme": "UID", - "identifier": "hJUBNVQWl4e" - }, - "status": "ACTIVE", - "orgUnit": { - "idScheme": "UID", - "identifier": "cNEZTkdAvmg" - }, - "orgUnitName": "Country", - "enrolledAt": "2020-02-20T00:00:00.000", - "occurredAt": "2020-02-20T00:00:00.000", - "followUp": false, - "deleted": false, - "storedBy": "admin", - "events": [], - "relationships": [], - "attributes": [ - { - "attribute": { - "idScheme": "UID", - "identifier": "p5TPww5Uhrd" - }, - "displayName": "Attribute_Identifier_Integer", - "storedBy": "admin", - "valueType": "INTEGER_POSITIVE", - "value": "321" - } - ], - "notes": [], - "attributeOptionCombo": { - "idScheme": "UID", - "identifier": "HllvX50cXC0" - } - } - ], - "events": [], - "relationships": [], - "username": "system-process" -} \ No newline at end of file diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_encryption_metadata.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_encryption_metadata.json deleted file mode 100644 index 2bbfae9c85d7..000000000000 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_encryption_metadata.json +++ /dev/null @@ -1,686 +0,0 @@ -{ - "system": { - "id": "38c6f1b0-e6f9-4bc5-b923-0ae66c738b87", - "rev": "ef5a907", - "version": "2.34-SNAPSHOT", - "date": "2020-02-23T13:53:38.816" - }, - "organisationUnits": [ - { - "code": "Country", - "level": 1, - "created": "2020-02-10T09:07:13.082", - "lastUpdated": "2020-02-10T09:52:02.551", - "name": "Country", - "id": "cNEZTkdAvmg", - "shortName": "Country", - "path": "/cNEZTkdAvmg", - "openingDate": "2020-02-10T00:00:00.000", - "lastUpdatedBy": { - "id": "tTgjgobT1oS" - }, - "user": { - "id": "tTgjgobT1oS" - }, - "attributeValues": [], - "translations": [] - } - ], - "users": [ - { - "code": "tracker admin", - "lastUpdated": "2020-02-10T09:52:02.511", - "id": "tTgjgobT1oS", - "created": "2020-02-10T09:06:38.138", - "surname": "tracker admin", - "lastCheckedInterpretations": "2020-02-10T09:06:47.644", - "firstName": "tracker admin", - "name": "tracker admin", - "lastLogin": "2020-02-23T13:09:36.572", - "displayName": "tracker admin", - "externalAuth": false, - "externalAccess": false, - "disabled": false, - "twoFA": false, - "passwordLastUpdated": "2020-02-10T09:07:34.946", - "invitation": false, - "selfRegistered": false, - "favorite": false, - "username": "trackeradmin", - "access": { - "read": true, - "update": true, - "externalize": true, - "delete": true, - "write": true, - "manage": true - }, - "favorites": [], - "cogsDimensionConstraints": [], - "catDimensionConstraints": [], - "translations": [], - "userGroupAccesses": [], - "userRoles": [ - { - "id": "nJ4Ml8ads4M" - } - ], - "userAccesses": [], - "teiSearchOrganisationUnits": [], - "organisationUnits": [ - { - "id": "cNEZTkdAvmg" - } - ], - "dataViewOrganisationUnits": [ - { - "id": "cNEZTkdAvmg" - } - ], - "attributeValues": [] - } - ], - "trackedEntityAttributes": [ - { - "lastUpdated": "2020-02-10T10:08:27.188", - "id": "sTGqP5JNy6E", - "created": "2020-02-10T09:12:11.348", - "name": "Attribute_Date", - "shortName": "Attribute_Date", - "aggregationType": "COUNT", - "displayInListNoProgram": true, - "publicAccess": "rw------", - "pattern": "", - "skipSynchronization": false, - "generated": false, - "displayOnVisitSchedule": false, - "valueType": "DATE", - "orgunitScope": false, - "confidential": false, - "unique": false, - "inherit": false, - "lastUpdatedBy": { - "id": "tTgjgobT1oS" - }, - "user": { - "id": "tTgjgobT1oS" - }, - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [], - "legendSets": [] - }, - { - "lastUpdated": "2020-02-23T13:53:30.087", - "id": "CWMLspQP2RH", - "created": "2020-02-23T13:10:32.783", - "name": "Attribute_Encrypted_Text", - "shortName": "Attribute_Encrypted_Text", - "aggregationType": "COUNT", - "displayInListNoProgram": false, - "publicAccess": "rw------", - "pattern": "", - "skipSynchronization": false, - "generated": false, - "displayOnVisitSchedule": false, - "valueType": "TEXT", - "orgunitScope": false, - "confidential": true, - "unique": false, - "inherit": false, - "lastUpdatedBy": { - "id": "tTgjgobT1oS" - }, - "user": { - "id": "tTgjgobT1oS" - }, - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [], - "legendSets": [] - }, - { - "lastUpdated": "2020-02-12T15:06:45.404", - "id": "p5TPww5Uhrd", - "created": "2020-02-12T15:06:45.404", - "name": "Attribute_Identifier_Integer", - "shortName": "Attribute_Identifier_Integer", - "aggregationType": "COUNT", - "displayInListNoProgram": false, - "publicAccess": "rw------", - "pattern": "", - "skipSynchronization": false, - "generated": false, - "displayOnVisitSchedule": false, - "valueType": "INTEGER_POSITIVE", - "orgunitScope": false, - "confidential": false, - "unique": true, - "inherit": false, - "lastUpdatedBy": { - "id": "tTgjgobT1oS" - }, - "user": { - "id": "tTgjgobT1oS" - }, - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [], - "legendSets": [] - }, - { - "lastUpdated": "2020-02-10T10:55:43.245", - "id": "sYn3tkL3XKa", - "created": "2020-02-10T09:10:22.603", - "name": "Attribute_Integer", - "shortName": "Attribute_Integer", - "aggregationType": "SUM", - "displayInListNoProgram": true, - "publicAccess": "rw------", - "pattern": "", - "skipSynchronization": false, - "generated": false, - "displayOnVisitSchedule": false, - "valueType": "INTEGER", - "orgunitScope": false, - "confidential": false, - "unique": false, - "inherit": false, - "lastUpdatedBy": { - "id": "tTgjgobT1oS" - }, - "user": { - "id": "tTgjgobT1oS" - }, - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [], - "legendSets": [] - }, - { - "lastUpdated": "2020-02-10T10:55:46.706", - "id": "TsfP85GKsU5", - "created": "2020-02-10T09:10:00.847", - "name": "Attribute_Text", - "shortName": "Attribute_Text", - "aggregationType": "COUNT", - "displayInListNoProgram": true, - "publicAccess": "rw------", - "pattern": "", - "skipSynchronization": false, - "generated": false, - "displayOnVisitSchedule": false, - "valueType": "TEXT", - "orgunitScope": false, - "confidential": false, - "unique": false, - "inherit": false, - "lastUpdatedBy": { - "id": "tTgjgobT1oS" - }, - "user": { - "id": "tTgjgobT1oS" - }, - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [], - "legendSets": [] - } - ], - "categoryOptionCombos": [ - { - "lastUpdated": "2020-02-10T09:51:52.091", - "code": "default", - "created": "2020-02-10T09:51:52.086", - "name": "default", - "id": "HllvX50cXC0", - "ignoreApproval": false, - "categoryCombo": { - "id": "bjDvmb4bfuf" - }, - "translations": [], - "attributeValues": [], - "categoryOptions": [ - { - "id": "xYerKDKCefk" - } - ] - } - ], - "programs": [ - { - "code": "Program", - "lastUpdated": "2020-02-20T12:08:40.004", - "id": "hJUBNVQWl4e", - "created": "2020-02-12T13:39:22.692", - "name": "Program", - "shortName": "Program", - "publicAccess": "rwrw----", - "completeEventsExpiryDays": 0, - "ignoreOverdueEvents": false, - "skipOffline": false, - "minAttributesRequiredToSearch": 0, - "displayFrontPageList": false, - "onlyEnrollOnce": false, - "programType": "WITH_REGISTRATION", - "accessLevel": "OPEN", - "version": 3, - "maxTeiCountToReturn": 0, - "selectIncidentDatesInFuture": false, - "displayIncidentDate": true, - "selectEnrollmentDatesInFuture": false, - "expiryDays": 0, - "useFirstStageDuringRegistration": false, - "categoryCombo": { - "id": "bjDvmb4bfuf" - }, - "lastUpdatedBy": { - "id": "tTgjgobT1oS" - }, - "trackedEntityType": { - "id": "KrYIdvLxkMb" - }, - "user": { - "id": "tTgjgobT1oS" - }, - "programTrackedEntityAttributes": [ - { - "lastUpdated": "2020-02-20T12:08:40.006", - "id": "OQeqChgVcMi", - "created": "2020-02-12T15:07:06.260", - "name": "Program Attribute_Identifier_Integer", - "displayName": "Program Attribute_Identifier_Integer", - "mandatory": true, - "displayShortName": "Program Attribute_Identifier_Integer", - "externalAccess": false, - "renderOptionsAsRadio": false, - "valueType": "INTEGER_POSITIVE", - "searchable": false, - "displayInList": true, - "sortOrder": 1, - "favorite": false, - "access": { - "read": true, - "update": true, - "externalize": true, - "delete": true, - "write": true, - "manage": true - }, - "program": { - "id": "hJUBNVQWl4e" - }, - "trackedEntityAttribute": { - "id": "p5TPww5Uhrd" - }, - "favorites": [], - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [] - }, - { - "lastUpdated": "2020-02-20T12:08:40.007", - "id": "t7bgkwps3BJ", - "created": "2020-02-20T12:08:39.840", - "name": "Program Attribute_Date", - "displayName": "Program Attribute_Date", - "mandatory": false, - "displayShortName": "Program Attribute_Date", - "externalAccess": false, - "renderOptionsAsRadio": false, - "valueType": "DATE", - "searchable": false, - "displayInList": false, - "sortOrder": 2, - "favorite": false, - "access": { - "read": true, - "update": true, - "externalize": true, - "delete": true, - "write": true, - "manage": true - }, - "program": { - "id": "hJUBNVQWl4e" - }, - "trackedEntityAttribute": { - "id": "sTGqP5JNy6E" - }, - "favorites": [], - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [] - }, - { - "lastUpdated": "2020-02-20T12:08:40.008", - "id": "udcanvFpkh9", - "created": "2020-02-20T12:08:39.841", - "name": "Program Attribute_Integer", - "displayName": "Program Attribute_Integer", - "mandatory": false, - "displayShortName": "Program Attribute_Integer", - "externalAccess": false, - "renderOptionsAsRadio": false, - "valueType": "INTEGER", - "searchable": false, - "displayInList": false, - "sortOrder": 3, - "favorite": false, - "access": { - "read": true, - "update": true, - "externalize": true, - "delete": true, - "write": true, - "manage": true - }, - "program": { - "id": "hJUBNVQWl4e" - }, - "trackedEntityAttribute": { - "id": "sYn3tkL3XKa" - }, - "favorites": [], - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [] - }, - { - "lastUpdated": "2020-02-20T12:08:40.008", - "id": "UOCaOMetAO5", - "created": "2020-02-20T12:08:39.841", - "name": "Program Attribute_Text", - "displayName": "Program Attribute_Text", - "mandatory": false, - "displayShortName": "Program Attribute_Text", - "externalAccess": false, - "renderOptionsAsRadio": false, - "valueType": "TEXT", - "searchable": false, - "displayInList": false, - "sortOrder": 4, - "favorite": false, - "access": { - "read": true, - "update": true, - "externalize": true, - "delete": true, - "write": true, - "manage": true - }, - "program": { - "id": "hJUBNVQWl4e" - }, - "trackedEntityAttribute": { - "id": "TsfP85GKsU5" - }, - "favorites": [], - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [] - } - ], - "notificationTemplates": [], - "translations": [], - "organisationUnits": [ - { - "id": "cNEZTkdAvmg" - } - ], - "userGroupAccesses": [], - "programSections": [], - "attributeValues": [], - "programStages": [], - "userAccesses": [] - } - ], - "userRoles": [ - { - "code": "tracker Superuser", - "created": "2020-02-10T09:06:38.148", - "lastUpdated": "2020-02-10T09:52:02.499", - "name": "tracker Superuser", - "id": "nJ4Ml8ads4M", - "publicAccess": "--------", - "description": "tracker Superuser", - "lastUpdatedBy": { - "id": "tTgjgobT1oS" - }, - "user": { - "id": "tTgjgobT1oS" - }, - "userGroupAccesses": [], - "authorities": [ - "F_TRACKED_ENTITY_INSTANCE_SEARCH_IN_ALL_ORGUNITS", - "ALL", - "F_USER_VIEW", - "F_GENERATE_MIN_MAX_VALUES", - "F_ORGANISATIONUNIT_MOVE", - "F_USER_GROUPS_READ_ONLY_ADD_MEMBERS", - "F_PREDICTOR_RUN", - "F_SKIP_DATA_IMPORT_AUDIT", - "F_RUN_VALIDATION", - "F_LOCALE_ADD", - "F_REPLICATE_USER", - "F_SEND_EMAIL", - "F_INSERT_CUSTOM_JS_CSS", - "F_ENROLLMENT_CASCADE_DELETE", - "F_METADATA_IMPORT", - "F_VIEW_EVENT_ANALYTICS", - "F_VIEW_UNAPPROVED_DATA", - "F_PERFORM_MAINTENANCE", - "F_METADATA_EXPORT", - "F_TEI_CASCADE_DELETE", - "F_EXPORT_DATA", - "F_APPROVE_DATA", - "F_ACCEPT_DATA_LOWER_LEVELS", - "F_EDIT_EXPIRED", - "F_APPROVE_DATA_LOWER_LEVELS", - "F_UNCOMPLETE_EVENT" - ], - "translations": [], - "userAccesses": [] - } - ], - "trackedEntityTypes": [ - { - "created": "2020-02-10T09:09:22.093", - "lastUpdated": "2020-02-10T09:56:30.292", - "name": "Person", - "shortName": "Person", - "id": "KrYIdvLxkMb", - "publicAccess": "rwrw----", - "maxTeiCountToReturn": 0, - "allowAuditLog": false, - "featureType": "NONE", - "minAttributesRequiredToSearch": 1, - "lastUpdatedBy": { - "id": "tTgjgobT1oS" - }, - "style": {}, - "user": { - "id": "tTgjgobT1oS" - }, - "userGroupAccesses": [], - "attributeValues": [], - "trackedEntityTypeAttributes": [ - { - "lastUpdated": "2020-02-10T09:52:02.656", - "id": "fOV8XA0v4ep", - "created": "2020-02-10T09:12:52.050", - "name": "Person Attribute_Date", - "displayName": "Person Attribute_Date", - "displayShortName": "null Attribute_Date", - "externalAccess": false, - "valueType": "DATE", - "searchable": true, - "displayInList": true, - "favorite": false, - "access": { - "read": true, - "update": true, - "externalize": true, - "delete": true, - "write": true, - "manage": true - }, - "trackedEntityAttribute": { - "id": "sTGqP5JNy6E" - }, - "trackedEntityType": { - "id": "KrYIdvLxkMb" - }, - "favorites": [], - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [] - }, - { - "lastUpdated": "2020-02-10T09:52:02.657", - "id": "zuhKhAf8wJW", - "created": "2020-02-10T09:12:52.050", - "name": "Person Attribute_Integer", - "displayName": "Person Attribute_Integer", - "displayShortName": "null Attribute_Integer", - "externalAccess": false, - "valueType": "INTEGER", - "searchable": true, - "displayInList": true, - "favorite": false, - "access": { - "read": true, - "update": true, - "externalize": true, - "delete": true, - "write": true, - "manage": true - }, - "trackedEntityAttribute": { - "id": "sYn3tkL3XKa" - }, - "trackedEntityType": { - "id": "KrYIdvLxkMb" - }, - "favorites": [], - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [] - }, - { - "lastUpdated": "2020-02-10T09:52:02.657", - "id": "TtJqssrQNla", - "created": "2020-02-10T09:12:52.050", - "name": "Person Attribute_Text", - "displayName": "Person Attribute_Text", - "mandatory": false, - "displayShortName": "null Attribute_Text", - "externalAccess": false, - "valueType": "TEXT", - "searchable": true, - "displayInList": true, - "favorite": false, - "access": { - "read": true, - "update": true, - "externalize": true, - "delete": true, - "write": true, - "manage": true - }, - "trackedEntityAttribute": { - "id": "TsfP85GKsU5" - }, - "trackedEntityType": { - "id": "KrYIdvLxkMb" - }, - "favorites": [], - "translations": [], - "userGroupAccesses": [], - "attributeValues": [], - "userAccesses": [] - } - ], - "translations": [], - "userAccesses": [] - } - ], - "organisationUnitLevels": [ - { - "lastUpdated": "2020-02-10T10:01:02.674", - "level": 1, - "created": "2020-02-10T10:01:02.674", - "name": "Level 1", - "id": "Ph8mdZMxZHm", - "translations": [] - } - ], - "categories": [ - { - "code": "default", - "created": "2020-02-10T09:51:52.071", - "lastUpdated": "2020-02-23T12:57:37.336", - "name": "default", - "shortName": "default", - "id": "GLevLNI9wkl", - "dataDimensionType": "DISAGGREGATION", - "publicAccess": "rw------", - "dataDimension": false, - "userGroupAccesses": [], - "attributeValues": [], - "translations": [], - "userAccesses": [], - "categoryOptions": [ - { - "id": "xYerKDKCefk" - } - ] - } - ], - "categoryOptions": [ - { - "code": "default", - "created": "2020-02-10T09:51:52.020", - "lastUpdated": "2020-02-10T09:51:52.096", - "name": "default", - "id": "xYerKDKCefk", - "publicAccess": "rwrw----", - "userGroupAccesses": [], - "attributeValues": [], - "translations": [], - "userAccesses": [], - "organisationUnits": [] - } - ], - "categoryCombos": [ - { - "code": "default", - "created": "2020-02-10T09:51:52.081", - "lastUpdated": "2020-02-10T09:51:52.093", - "name": "default", - "id": "bjDvmb4bfuf", - "dataDimensionType": "DISAGGREGATION", - "publicAccess": "rw------", - "skipTotal": false, - "userGroupAccesses": [], - "translations": [], - "userAccesses": [], - "categories": [ - { - "id": "GLevLNI9wkl" - } - ] - } - ] -} diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_fileresource_metadata.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_fileresource_metadata.json index f5de62f81462..684e20e664f8 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_fileresource_metadata.json +++ b/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_fileresource_metadata.json @@ -41,7 +41,6 @@ "displayOnVisitSchedule": false, "valueType": "DATE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -71,7 +70,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": true, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -101,7 +99,6 @@ "displayOnVisitSchedule": false, "valueType": "FILE_RESOURCE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -131,7 +128,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER_POSITIVE", "orgunitScope": false, - "confidential": false, "unique": true, "inherit": false, "lastUpdatedBy": { @@ -161,7 +157,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -191,7 +186,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_metadata.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_metadata.json index b6efa3301013..91810a60ea92 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_metadata.json +++ b/dhis-2/dhis-test-integration/src/test/resources/tracker/te_program_with_tea_metadata.json @@ -582,7 +582,6 @@ "displayOnVisitSchedule": false, "valueType": "DATE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -612,7 +611,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER_POSITIVE", "orgunitScope": false, - "confidential": false, "unique": true, "inherit": false, "lastUpdatedBy": { @@ -642,7 +640,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -672,7 +669,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -702,7 +698,6 @@ "displayOnVisitSchedule": false, "valueType": "PERCENTAGE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/te_with_tea_metadata.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/te_with_tea_metadata.json index f6f1f06523d6..1b82d249b0de 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/te_with_tea_metadata.json +++ b/dhis-2/dhis-test-integration/src/test/resources/tracker/te_with_tea_metadata.json @@ -43,7 +43,6 @@ "displayOnVisitSchedule": false, "valueType": "DATE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -82,7 +81,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -120,7 +118,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_basic_metadata.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_basic_metadata.json index 2601cb1d66da..f3a450bfe5f9 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_basic_metadata.json +++ b/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_basic_metadata.json @@ -2152,7 +2152,6 @@ "displayOnVisitSchedule": false, "valueType": "DATE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -2186,7 +2185,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -2220,7 +2218,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -2252,7 +2249,6 @@ "programScope": false, "displayInListNoProgram": false, "displayOnVisitSchedule": false, - "confidential": false, "shortName": "Address", "created": "2019-03-29T09:12:14.409", "legendSets": [], @@ -2293,7 +2289,6 @@ "legendSets": [], "created": "2019-03-29T09:12:01.065", "shortName": "Name", - "confidential": false, "displayInListNoProgram": false, "displayOnVisitSchedule": false, "id": "fmBIpOStKkF", @@ -2322,7 +2317,6 @@ "programScope": false, "displayInListNoProgram": false, "displayOnVisitSchedule": false, - "confidential": false, "shortName": "Gender", "created": "2019-03-29T09:12:14.409", "legendSets": [], @@ -2362,7 +2356,6 @@ "programScope": false, "displayInListNoProgram": false, "displayOnVisitSchedule": false, - "confidential": false, "shortName": "Multi Text Attribute", "created": "2019-03-29T09:12:14.409", "legendSets": [], diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_basic_metadata_mandatory_attr.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_basic_metadata_mandatory_attr.json index b61bb64c91ab..a6e128a7a3fc 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_basic_metadata_mandatory_attr.json +++ b/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_basic_metadata_mandatory_attr.json @@ -1037,7 +1037,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -1071,7 +1070,6 @@ "displayOnVisitSchedule": false, "valueType": "DATE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -1105,7 +1103,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -1139,7 +1136,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -1171,7 +1167,6 @@ "programScope": false, "displayInListNoProgram": false, "displayOnVisitSchedule": false, - "confidential": false, "shortName": "Address", "created": "2019-03-29T09:12:14.409", "legendSets": [], @@ -1212,7 +1207,6 @@ "legendSets": [], "created": "2019-03-29T09:12:01.065", "shortName": "Name", - "confidential": false, "displayInListNoProgram": false, "displayOnVisitSchedule": false, "id": "fmBIpOStKkF", @@ -1241,7 +1235,6 @@ "programScope": false, "displayInListNoProgram": false, "displayOnVisitSchedule": false, - "confidential": false, "shortName": "name", "created": "2019-03-29T09:12:14.409", "legendSets": [], diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_metadata_with_program_rules_variables.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_metadata_with_program_rules_variables.json index 24ce7ebc2024..53a96f335b13 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_metadata_with_program_rules_variables.json +++ b/dhis-2/dhis-test-integration/src/test/resources/tracker/tracker_metadata_with_program_rules_variables.json @@ -248,7 +248,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/validations/te-program_with_tea_encryption_metadata.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/validations/te-program_with_tea_encryption_metadata.json index 0b20f46a3ac5..c55300ed2295 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/validations/te-program_with_tea_encryption_metadata.json +++ b/dhis-2/dhis-test-integration/src/test/resources/tracker/validations/te-program_with_tea_encryption_metadata.json @@ -121,7 +121,6 @@ "displayOnVisitSchedule": false, "valueType": "DATE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -151,7 +150,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": true, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -181,7 +179,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER_POSITIVE", "orgunitScope": false, - "confidential": false, "unique": true, "inherit": false, "lastUpdatedBy": { @@ -211,7 +208,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER_POSITIVE", "orgunitScope": true, - "confidential": false, "unique": true, "inherit": false, "lastUpdatedBy": { @@ -241,7 +237,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -271,7 +266,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { diff --git a/dhis-2/dhis-test-integration/src/test/resources/tracker/validations/te-program_with_tea_fileresource_metadata.json b/dhis-2/dhis-test-integration/src/test/resources/tracker/validations/te-program_with_tea_fileresource_metadata.json index f9f180e2ee5b..3fe152eba373 100644 --- a/dhis-2/dhis-test-integration/src/test/resources/tracker/validations/te-program_with_tea_fileresource_metadata.json +++ b/dhis-2/dhis-test-integration/src/test/resources/tracker/validations/te-program_with_tea_fileresource_metadata.json @@ -38,7 +38,6 @@ "generated": false, "valueType": "IMAGE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -65,7 +64,6 @@ "generated": false, "valueType": "IMAGE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -95,7 +93,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -125,7 +122,6 @@ "displayOnVisitSchedule": false, "valueType": "DATE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -155,7 +151,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": true, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -185,7 +180,6 @@ "displayOnVisitSchedule": false, "valueType": "FILE_RESOURCE", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -215,7 +209,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER_POSITIVE", "orgunitScope": false, - "confidential": false, "unique": true, "inherit": false, "lastUpdatedBy": { @@ -245,7 +238,6 @@ "displayOnVisitSchedule": false, "valueType": "INTEGER", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { @@ -275,7 +267,6 @@ "displayOnVisitSchedule": false, "valueType": "TEXT", "orgunitScope": false, - "confidential": false, "unique": false, "inherit": false, "lastUpdatedBy": { diff --git a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/imports/TrackerEnrollmentSMSTest.java b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/imports/TrackerEnrollmentSMSTest.java index c020eae32eee..633670be6e20 100644 --- a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/imports/TrackerEnrollmentSMSTest.java +++ b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/imports/TrackerEnrollmentSMSTest.java @@ -170,7 +170,6 @@ void setUp() { trackedEntityType = trackedEntityTypeAccessible(); teaA = createTrackedEntityAttribute('A', ValueType.TEXT); - teaA.setConfidential(false); teaA.getSharing().setOwner(user); teaA.getSharing().addUserAccess(fullAccess(user)); manager.save(teaA, false); @@ -179,14 +178,12 @@ void setUp() { teaB = createTrackedEntityAttribute('B', ValueType.TEXT); teaB.getSharing().setOwner(user); teaB.getSharing().addUserAccess(fullAccess(user)); - teaB.setConfidential(false); manager.save(teaB, false); // this TEA will only be a program attribute teaC = createTrackedEntityAttribute('C', ValueType.TEXT); teaC.getSharing().setOwner(user); teaC.getSharing().addUserAccess(fullAccess(user)); - teaC.setConfidential(false); manager.save(teaC, false); trackedEntityType diff --git a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/imports/TrackerEventSMSTest.java b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/imports/TrackerEventSMSTest.java index 67596bd16848..8ea0bfd68ad4 100644 --- a/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/imports/TrackerEventSMSTest.java +++ b/dhis-2/dhis-test-web-api/src/test/java/org/hisp/dhis/webapi/controller/tracker/imports/TrackerEventSMSTest.java @@ -222,7 +222,6 @@ void setUp() { trackedEntityType = trackedEntityTypeAccessible(); teaA = createTrackedEntityAttribute('A', ValueType.PHONE_NUMBER); - teaA.setConfidential(false); teaA.getSharing().setOwner(user1); teaA.getSharing().addUserAccess(fullAccess(user1)); manager.save(teaA, false); diff --git a/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_inaccessible_dataelement.json b/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_inaccessible_dataelement.json index 24ee5726eef4..efc723300567 100644 --- a/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_inaccessible_dataelement.json +++ b/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_inaccessible_dataelement.json @@ -161,7 +161,6 @@ "displayInListNoProgram": false, "unique": false, "inherit": false, - "confidential": false, "shortName": "TrackedEntityAttributeA", "displayOnVisitSchedule": false, "name": "TrackedEntityAttributeA", diff --git a/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_inaccessible_programStage.json b/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_inaccessible_programStage.json index 8bcd397d7f1b..92a80a4dd9d0 100644 --- a/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_inaccessible_programStage.json +++ b/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_inaccessible_programStage.json @@ -193,7 +193,6 @@ "displayInListNoProgram": false, "unique": false, "inherit": false, - "confidential": false, "shortName": "TrackedEntityAttributeA", "displayOnVisitSchedule": false, "name": "TrackedEntityAttributeA", diff --git a/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_readable_programStage.json b/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_readable_programStage.json index 7aed22378032..2504cb08e6cd 100644 --- a/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_readable_programStage.json +++ b/dhis-2/dhis-test-web-api/src/test/resources/metadata/program_with_readable_programStage.json @@ -169,7 +169,6 @@ "displayInListNoProgram": false, "unique": false, "inherit": false, - "confidential": false, "shortName": "TrackedEntityAttributeA", "displayOnVisitSchedule": false, "name": "TrackedEntityAttributeA", diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/deduplication/HibernatePotentialDuplicateStore.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/deduplication/HibernatePotentialDuplicateStore.java index 4702fce132e6..9af858c65a27 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/deduplication/HibernatePotentialDuplicateStore.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/deduplication/HibernatePotentialDuplicateStore.java @@ -207,8 +207,8 @@ public void moveTrackedEntityAttributeValues( if (originalAttributeValueMap.containsKey(dav.getAttribute().getUid())) { // Teav exists in original, overwrite the value updatedTeav = originalAttributeValueMap.get(dav.getAttribute().getUid()); - previousValue = updatedTeav.getPlainValue(); - updatedTeav.setValue(dav.getPlainValue()); + previousValue = updatedTeav.getValue(); + updatedTeav.setValue(dav.getValue()); changeLogType = UPDATE; } else { // teav does not exist in original, so create new and attach @@ -216,7 +216,7 @@ public void moveTrackedEntityAttributeValues( updatedTeav = new TrackedEntityAttributeValue(); updatedTeav.setAttribute(dav.getAttribute()); updatedTeav.setTrackedEntity(original); - updatedTeav.setValue(dav.getPlainValue()); + updatedTeav.setValue(dav.getValue()); changeLogType = CREATE; } getSession().delete(dav); @@ -244,7 +244,7 @@ private void addTrackedEntityChangeLog( createOrUpdateTeav.getTrackedEntity(), createOrUpdateTeav.getAttribute(), previousValue, - createOrUpdateTeav.getPlainValue(), + createOrUpdateTeav.getValue(), changeLogType, new Date(), currentUsername); diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/export/enrollment/JdbcEnrollmentStore.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/export/enrollment/JdbcEnrollmentStore.java index 015e09264e2a..abe089fb671b 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/export/enrollment/JdbcEnrollmentStore.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/export/enrollment/JdbcEnrollmentStore.java @@ -309,8 +309,8 @@ private void addLeftJoinOnAttributes(StringBuilder sql, EnrollmentQueryParams pa """ left join lateral ( select json_agg(json_build_object('uid', tea.uid, 'name', tea.name, - 'code', tea.code, 'value', teav.value, 'encryptedValue', teav.encryptedvalue, - 'valueType', tea.valuetype, 'confidential', tea.confidential, 'created', teav.created, + 'code', tea.code, 'value', teav.value, + 'valueType', tea.valuetype, 'created', teav.created, 'lastUpdated', teav.lastupdated, 'storedBy', teav.storedby)) as jsonattributes from trackedentityattributevalue teav join trackedentityattribute tea ON tea.trackedentityattributeid = teav.trackedentityattributeid @@ -760,13 +760,11 @@ private Set mapTrackedEntityAttributeValues( tea.setValueType(ValueType.valueOf(attribute.getValueType())); tea.setName(attribute.getName()); tea.setCode(attribute.getCode()); - tea.setConfidential(attribute.isConfidential()); teav.setAttribute(tea); teav.setStoredBy(attribute.getStoredBy()); teav.setCreated(DateUtils.safeParseDate(attribute.getCreated())); teav.setLastUpdated(DateUtils.safeParseDate(attribute.getLastUpdated())); - teav.setEncryptedValue(attribute.getEncryptedValue()); - teav.setPlainValue(attribute.getValue()); + teav.setValue(attribute.getValue()); teav.setTrackedEntity(trackedEntity); trackedEntityAttributeValues.add(teav); @@ -804,9 +802,7 @@ private static class JdbcAttribute { private String name; private String code; private String value; - private String encryptedValue; private String valueType; - private boolean confidential; private String created; private String lastUpdated; private String storedBy; diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/bundle/persister/AbstractTrackerPersister.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/bundle/persister/AbstractTrackerPersister.java index fc4d984c9432..a1227b998d22 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/bundle/persister/AbstractTrackerPersister.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/bundle/persister/AbstractTrackerPersister.java @@ -428,15 +428,13 @@ protected void handleTrackedEntityAttributeValues( payloadAttributes.forEach( attribute -> { - // We cannot get the value from attributeToStore because it uses - // encryption logic, so we need to use the one from payload boolean isDelete = StringUtils.isEmpty(attribute.getValue()); TrackedEntityAttributeValue currentValue = attributeValueById.get(attribute.getAttribute()); boolean isNew = Objects.isNull(currentValue); - String previousValue = isNew ? null : currentValue.getPlainValue(); + String previousValue = isNew ? null : currentValue.getValue(); boolean valueChanged = isNew || !Objects.equals(previousValue, attribute.getValue()); if (isDelete && !isNew) { @@ -500,7 +498,7 @@ private void delete( changeLogs.addTrackedEntityChangeLog( trackedEntity, trackedEntityAttributeValue.getAttribute(), - trackedEntityAttributeValue.getPlainValue(), + trackedEntityAttributeValue.getValue(), null, DELETE, user.getUsername()); @@ -532,7 +530,7 @@ private void saveOrUpdate( trackedEntity, trackedEntityAttributeValue.getAttribute(), previousValue, - trackedEntityAttributeValue.getPlainValue(), + trackedEntityAttributeValue.getValue(), changeLogType, user.getUsername()); } diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/preheat/mappers/TrackedEntityAttributeMapper.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/preheat/mappers/TrackedEntityAttributeMapper.java index 24579359ee12..6a4f049e8232 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/preheat/mappers/TrackedEntityAttributeMapper.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/preheat/mappers/TrackedEntityAttributeMapper.java @@ -46,7 +46,6 @@ public interface TrackedEntityAttributeMapper extends PreheatMapper value.length() > Constant.MAX_ATTR_VALUE_LENGTH, @@ -65,17 +58,6 @@ public void validateAttributeValue( E1077, value, Constant.MAX_ATTR_VALUE_LENGTH); - - // Validate if that encryption is configured properly if someone sets - // value to (confidential) - boolean isConfidential = tea.isConfidentialBool(); - EncryptionStatus encryptionStatus = dhisConfigurationProvider.getEncryptionStatus(); - reporter.addErrorIf( - () -> isConfidential && !encryptionStatus.isOk(), - trackerDto, - E1112, - value, - encryptionStatus.getKey()); } protected void validateAttributeUniqueness( diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/validation/validator/enrollment/AttributeValidator.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/validation/validator/enrollment/AttributeValidator.java index 73573399cba1..f6f492de8370 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/validation/validator/enrollment/AttributeValidator.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/validation/validator/enrollment/AttributeValidator.java @@ -44,7 +44,6 @@ import java.util.Set; import java.util.stream.Collectors; import org.hisp.dhis.common.UID; -import org.hisp.dhis.external.conf.DhisConfigurationProvider; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramTrackedEntityAttribute; @@ -68,10 +67,6 @@ class AttributeValidator extends org.hisp.dhis.tracker.imports.validation.validator.AttributeValidator implements Validator { - public AttributeValidator(DhisConfigurationProvider dhisConfigurationProvider) { - super(dhisConfigurationProvider); - } - @Override public void validate(Reporter reporter, TrackerBundle bundle, Enrollment enrollment) { TrackerPreheat preheat = bundle.getPreheat(); @@ -98,7 +93,7 @@ public void validate(Reporter reporter, TrackerBundle bundle, Enrollment enrollm && teAttribute != null) { attributeValueMap.put(attribute.getAttribute(), attribute.getValue()); - validateAttributeValue(reporter, enrollment, teAttribute, attribute.getValue()); + validateAttributeValue(reporter, enrollment, attribute.getValue()); validateValueType(reporter, bundle, enrollment, attribute.getValue(), teAttribute); validateOptionSet(reporter, enrollment, teAttribute, attribute.getValue()); diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/validation/validator/trackedentity/AttributeValidator.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/validation/validator/trackedentity/AttributeValidator.java index 430968264227..f108bd9c93a5 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/validation/validator/trackedentity/AttributeValidator.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/imports/validation/validator/trackedentity/AttributeValidator.java @@ -37,7 +37,6 @@ import static org.hisp.dhis.tracker.imports.validation.validator.ValidationUtils.validateValueType; import java.util.Set; -import org.hisp.dhis.external.conf.DhisConfigurationProvider; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.trackedentity.TrackedEntityAttribute; import org.hisp.dhis.trackedentity.TrackedEntityType; @@ -58,10 +57,6 @@ class AttributeValidator extends org.hisp.dhis.tracker.imports.validation.validator.AttributeValidator implements Validator { - public AttributeValidator(DhisConfigurationProvider dhisConfigurationProvider) { - super(dhisConfigurationProvider); - } - @Override public void validate( Reporter reporter, @@ -131,7 +126,7 @@ protected void validateAttributes( continue; } - validateAttributeValue(reporter, trackedEntity, tea, attribute.getValue()); + validateAttributeValue(reporter, trackedEntity, attribute.getValue()); validateValueType(reporter, bundle, trackedEntity, attribute.getValue(), tea); validateOptionSet(reporter, trackedEntity, tea, attribute.getValue()); diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/model/TrackedEntityAttributeValue.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/model/TrackedEntityAttributeValue.java index 6441b0605aaa..713d82440907 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/model/TrackedEntityAttributeValue.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/model/TrackedEntityAttributeValue.java @@ -29,7 +29,6 @@ */ package org.hisp.dhis.tracker.model; -import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.io.Serial; @@ -67,14 +66,6 @@ public class TrackedEntityAttributeValue implements Serializable { @Setter @ToString.Include private Date created; @Setter @ToString.Include private Date lastUpdated; @Setter @ToString.Include private String storedBy; - - private String encryptedValue; - private String plainValue; - - /** - * This value is only used to store values from setValue when we don't know if attribute is set or - * not. - */ @ToString.Include private String value; private transient boolean auditValueIsSet = false; @@ -120,67 +111,13 @@ public Date getLastUpdated() { return lastUpdated; } - /** - * Retrieves the encrypted value if the attribute is confidential. If the value is not - * confidential, returns old value. Should be null unless it was confidential at an earlier stage. - * - * @return String with decrypted value or null. - */ - @JsonIgnore - public String getEncryptedValue() { - return (getAttribute().getConfidential() && this.value != null - ? this.value - : this.encryptedValue); - } - - public void setEncryptedValue(String encryptedValue) { - this.encryptedValue = encryptedValue; - - if (getAttribute().getConfidential()) { - auditValue = encryptedValue; - auditValueIsSet = true; - } - } - - /** - * Retrieves the plain-text value if the attribute isn't confidential. If the value is - * confidential, this value should be null, unless it was non-confidential at an earlier stage. - * - * @return String with plain-text value or null. - */ - @JsonIgnore - public String getPlainValue() { - return (!getAttribute().getConfidential() && this.value != null ? this.value : this.plainValue); - } - - public void setPlainValue(String plainValue) { - this.plainValue = plainValue; - - if (!getAttribute().getConfidential()) { - auditValue = plainValue; - auditValueIsSet = true; - } - } - - /** - * Returns the encrypted or the plain-text value based on the confidential state of the attribute. - * - * @return String with value, either plain-text or decrypted. - */ @AuditAttribute @JsonProperty @EqualsAndHashCode.Include public String getValue() { - return (getAttribute().getConfidential() ? this.getEncryptedValue() : this.getPlainValue()); + return this.value; } - /** - * Property which temporarily stores the attribute value. The {@link #getEncryptedValue} and - * {@link #getPlainValue} methods handle the value when requested. - * - * @param value the value to be stored. - * @return a {@link TrackedEntityAttributeValue}. - */ public TrackedEntityAttributeValue setValue(String value) { if (!auditValueIsSet) { this.auditValue = valueIsSet ? this.value : value; @@ -188,9 +125,7 @@ public TrackedEntityAttributeValue setValue(String value) { } valueIsSet = true; - this.value = value; - this.plainValue = value; return this; } diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/message/DeliveryChannelStrategy.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/message/DeliveryChannelStrategy.java index 627b9caa3340..1bff9f62a109 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/message/DeliveryChannelStrategy.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/message/DeliveryChannelStrategy.java @@ -76,9 +76,9 @@ public String getTrackedEntityRecipient(TrackedEntity te, ValueType type) { for (TrackedEntityAttributeValue value : attributeValues) { if (value != null && value.getAttribute().getValueType().equals(type) - && value.getPlainValue() != null - && !value.getPlainValue().trim().isEmpty()) { - return value.getPlainValue(); + && value.getValue() != null + && !value.getValue().trim().isEmpty()) { + return value.getValue(); } } diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/DefaultProgramNotificationService.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/DefaultProgramNotificationService.java index e30ed78e8ea5..f7cff3d447cf 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/DefaultProgramNotificationService.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/DefaultProgramNotificationService.java @@ -716,7 +716,7 @@ private ProgramMessageRecipients resolveRecipients( .getRecipientProgramAttribute() .getUid() .equals(av.getAttribute().getUid())) - .map(TrackedEntityAttributeValue::getPlainValue) + .map(TrackedEntityAttributeValue::getValue) .toList(); if (template.getDeliveryChannels().contains(DeliveryChannel.SMS)) { diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/ProgramNotificationMessageRenderer.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/ProgramNotificationMessageRenderer.java index f7fecbacf06e..5c223c596fae 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/ProgramNotificationMessageRenderer.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/ProgramNotificationMessageRenderer.java @@ -127,10 +127,10 @@ protected Map resolveDataElementValues( // ------------------------------------------------------------------------- private String renderAttributeValue(TrackedEntityAttributeValue av) { - String value = av.getPlainValue(); + String value = av.getValue(); if (value == null) { - return CONFIDENTIAL_VALUE_REPLACEMENT; + return MISSING_VALUE_REPLACEMENT; } return av.getAttribute().hasOptionSet() diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/ProgramStageNotificationMessageRenderer.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/ProgramStageNotificationMessageRenderer.java index d5bcc50300fa..0e35ae879ad6 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/ProgramStageNotificationMessageRenderer.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/program/notification/ProgramStageNotificationMessageRenderer.java @@ -172,10 +172,10 @@ protected Set getSupportedExpressionTypes() { // Internal methods // ------------------------------------------------------------------------- private String resolveAttributeValue(TrackedEntityAttributeValue av) { - String value = av.getPlainValue(); + String value = av.getValue(); if (value == null) { - return CONFIDENTIAL_VALUE_REPLACEMENT; + return MISSING_VALUE_REPLACEMENT; } return av.getAttribute().hasOptionSet() diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java index e854bd034d0e..86d74d2fcd47 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/trackedentityattributevalue/DefaultTrackedEntityAttributeValueService.java @@ -69,7 +69,7 @@ public void deleteTrackedEntityAttributeValue(TrackedEntityAttributeValue attrib trackedEntityChangeLogService.addTrackedEntityChangeLog( attributeValue.getTrackedEntity(), attributeValue.getAttribute(), - attributeValue.getPlainValue(), + attributeValue.getValue(), null, DELETE, getCurrentUsername()); @@ -94,12 +94,6 @@ public void addTrackedEntityAttributeValue(TrackedEntityAttributeValue attribute throw new IllegalQueryException("Attribute or type is null or empty"); } - if (attributeValue.getAttribute().isConfidentialBool() - && !config.getEncryptionStatus().isOk()) { - throw new IllegalStateException( - "Unable to encrypt data, encryption is not correctly configured"); - } - String result = valueIsValid(attributeValue.getValue(), attributeValue.getAttribute().getValueType()); diff --git a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/trackedentityattributevalue/HibernateTrackedEntityAttributeValueStore.java b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/trackedentityattributevalue/HibernateTrackedEntityAttributeValueStore.java index b0dd226f9252..1d41b1168f6d 100644 --- a/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/trackedentityattributevalue/HibernateTrackedEntityAttributeValueStore.java +++ b/dhis-2/dhis-tracker/src/main/java/org/hisp/dhis/tracker/trackedentityattributevalue/HibernateTrackedEntityAttributeValueStore.java @@ -72,7 +72,7 @@ public List get(TrackedEntity trackedEntity) { public List get( TrackedEntityAttribute attribute, Collection values) { String query = - " from TrackedEntityAttributeValue v where v.attribute =:attribute and lower(v.plainValue) in :values"; + " from TrackedEntityAttributeValue v where v.attribute =:attribute and lower(v.value) in :values"; Query typedQuery = getQuery(query) diff --git a/dhis-2/dhis-tracker/src/test/java/org/hisp/dhis/tracker/imports/validation/validator/enrollment/AttributeValidatorTest.java b/dhis-2/dhis-tracker/src/test/java/org/hisp/dhis/tracker/imports/validation/validator/enrollment/AttributeValidatorTest.java index b034a3ba0ceb..8cae585064e1 100644 --- a/dhis-2/dhis-tracker/src/test/java/org/hisp/dhis/tracker/imports/validation/validator/enrollment/AttributeValidatorTest.java +++ b/dhis-2/dhis-tracker/src/test/java/org/hisp/dhis/tracker/imports/validation/validator/enrollment/AttributeValidatorTest.java @@ -47,8 +47,6 @@ import org.hisp.dhis.common.CodeGenerator; import org.hisp.dhis.common.UID; import org.hisp.dhis.common.ValueType; -import org.hisp.dhis.encryption.EncryptionStatus; -import org.hisp.dhis.external.conf.DhisConfigurationProvider; import org.hisp.dhis.fileresource.FileResource; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramTrackedEntityAttribute; @@ -92,8 +90,6 @@ class AttributeValidatorTest { @Mock private TrackerPreheat preheat; - @Mock private DhisConfigurationProvider dhisConfigurationProvider; - private TrackerBundle bundle; @Mock private TrackedEntity trackedEntity; @@ -147,9 +143,6 @@ void setUp() { when(preheat.getTrackedEntityAttribute(MetadataIdentifier.ofUid(TRACKED_ATTRIBUTE_P))) .thenReturn(trackedEntityAttributeP); - when(dhisConfigurationProvider.getEncryptionStatus()) - .thenReturn(EncryptionStatus.MISSING_ENCRYPTION_PASSWORD); - UID uid = UID.generate(); when(enrollment.getUID()).thenReturn(uid); when(enrollment.getEnrollment()).thenReturn(uid); diff --git a/dhis-2/dhis-tracker/src/test/java/org/hisp/dhis/tracker/imports/validation/validator/trackedentity/AttributeValidatorTest.java b/dhis-2/dhis-tracker/src/test/java/org/hisp/dhis/tracker/imports/validation/validator/trackedentity/AttributeValidatorTest.java index c14428d95169..84a2298c342e 100644 --- a/dhis-2/dhis-tracker/src/test/java/org/hisp/dhis/tracker/imports/validation/validator/trackedentity/AttributeValidatorTest.java +++ b/dhis-2/dhis-tracker/src/test/java/org/hisp/dhis/tracker/imports/validation/validator/trackedentity/AttributeValidatorTest.java @@ -45,8 +45,6 @@ import org.hisp.dhis.common.CodeGenerator; import org.hisp.dhis.common.UID; import org.hisp.dhis.common.ValueType; -import org.hisp.dhis.encryption.EncryptionStatus; -import org.hisp.dhis.external.conf.DhisConfigurationProvider; import org.hisp.dhis.fileresource.FileResource; import org.hisp.dhis.option.Option; import org.hisp.dhis.option.OptionSet; @@ -87,8 +85,6 @@ class AttributeValidatorTest { @Mock private TrackerPreheat preheat; - @Mock private DhisConfigurationProvider dhisConfigurationProvider; - private TrackerBundle bundle; private Reporter reporter; @@ -111,7 +107,6 @@ public void setUp() { .collect(Collectors.toUnmodifiableSet()); }); reporter = new Reporter(idSchemes); - when(dhisConfigurationProvider.getEncryptionStatus()).thenReturn(EncryptionStatus.OK); } @Test @@ -385,31 +380,11 @@ void shouldFailValueTooLong() { trackedEntityAttribute.setValueType(ValueType.TEXT); TrackedEntity te = TrackedEntity.builder().trackedEntity(UID.generate()).build(); - validator.validateAttributeValue( - reporter, te, trackedEntityAttribute, "a".repeat(Constant.MAX_ATTR_VALUE_LENGTH + 1)); + validator.validateAttributeValue(reporter, te, "a".repeat(Constant.MAX_ATTR_VALUE_LENGTH + 1)); assertHasError(reporter, te, ValidationCode.E1077); } - @Test - void shouldFailEncryptionStatus() { - TrackedEntityAttribute trackedEntityAttribute = new TrackedEntityAttribute(); - trackedEntityAttribute.setValueType(ValueType.AGE); - trackedEntityAttribute.setConfidential(true); - - when(dhisConfigurationProvider.getEncryptionStatus()) - .thenReturn(EncryptionStatus.ENCRYPTION_PASSWORD_TOO_SHORT); - when(dhisConfigurationProvider.getProperty(any())).thenReturn("property"); - - when(preheat.getTrackedEntityAttribute((MetadataIdentifier) any())) - .thenReturn(trackedEntityAttribute); - - TrackedEntity te = TrackedEntity.builder().trackedEntity(UID.generate()).build(); - validator.validateAttributeValue(reporter, te, trackedEntityAttribute, "value"); - - assertHasError(reporter, te, ValidationCode.E1112); - } - @Test void shouldFailOptionSetNotValid() { TrackedEntityAttribute trackedEntityAttribute = getTrackedEntityAttributeWithOptionSet();