-
Notifications
You must be signed in to change notification settings - Fork 1
TEDEFO-4319 Add privacy settings and data types #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+263
−11
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
src/main/java/eu/europa/ted/eforms/sdk/entity/SdkDataType.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| /* | ||
| * Copyright 2026 European Union | ||
| * | ||
| * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European | ||
| * Commission – subsequent versions of the EUPL (the "Licence"); You may not use this work except in | ||
| * compliance with the Licence. You may obtain a copy of the Licence at: | ||
| * https://joinup.ec.europa.eu/software/page/eupl | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the Licence | ||
| * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
| * or implied. See the Licence for the specific language governing permissions and limitations under | ||
| * the Licence. | ||
| */ | ||
| package eu.europa.ted.eforms.sdk.entity; | ||
|
|
||
| import java.util.Objects; | ||
|
|
||
| /** | ||
| * Represents an eForms SDK data type. | ||
| * | ||
| * Each field in the SDK has a type (e.g., "text", "date", "amount"). This entity captures | ||
| * type-level metadata such as the privacy masking value. Currently hardcoded; will be loaded from | ||
| * data-types.json when it is added to the SDK. | ||
| */ | ||
| public class SdkDataType { | ||
| private final String id; | ||
| private final String privacyMask; | ||
|
|
||
| @SuppressWarnings("unused") | ||
| private SdkDataType() { | ||
| throw new UnsupportedOperationException(); | ||
| } | ||
|
|
||
| public SdkDataType(final String id, final String privacyMask) { | ||
| this.id = id; | ||
| this.privacyMask = privacyMask; | ||
| } | ||
|
|
||
| public String getId() { | ||
| return this.id; | ||
| } | ||
|
|
||
| public String getPrivacyMask() { | ||
| return this.privacyMask; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) { | ||
| return true; | ||
| } | ||
| if (obj == null || getClass() != obj.getClass()) { | ||
| return false; | ||
| } | ||
| SdkDataType other = (SdkDataType) obj; | ||
| return Objects.equals(this.id, other.id); | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| return Objects.hash(this.id); | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return this.id; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/eu/europa/ted/eforms/sdk/repository/SdkDataTypeRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /* | ||
| * Copyright 2026 European Union | ||
| * | ||
| * Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European | ||
| * Commission – subsequent versions of the EUPL (the "Licence"); You may not use this work except in | ||
| * compliance with the Licence. You may obtain a copy of the Licence at: | ||
| * https://joinup.ec.europa.eu/software/page/eupl | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software distributed under the Licence | ||
| * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | ||
| * or implied. See the Licence for the specific language governing permissions and limitations under | ||
| * the Licence. | ||
| */ | ||
| package eu.europa.ted.eforms.sdk.repository; | ||
|
|
||
| import java.util.HashMap; | ||
| import eu.europa.ted.eforms.sdk.entity.SdkDataType; | ||
|
|
||
| /** | ||
| * Repository of SDK data types. | ||
| * | ||
| * Currently uses hardcoded type definitions. When data-types.json is added to the SDK, this class | ||
| * will be updated to load type metadata from JSON. | ||
| */ | ||
| public class SdkDataTypeRepository extends HashMap<String, SdkDataType> { | ||
| private static final long serialVersionUID = 1L; | ||
|
|
||
| /** | ||
| * Creates a repository with the default set of SDK data types and their privacy masks. This is a | ||
| * temporary approach until data-types.json is available in the SDK. | ||
| */ | ||
| public static SdkDataTypeRepository createDefault() { | ||
| SdkDataTypeRepository repository = new SdkDataTypeRepository(); | ||
|
|
||
| repository.addType("text", "unpublished"); | ||
| repository.addType("text-multilingual", "unpublished"); | ||
| repository.addType("code", "unpublished"); | ||
| repository.addType("internal-code", "unpublished"); | ||
| repository.addType("id", "unpublished"); | ||
| repository.addType("id-ref", "unpublished"); | ||
| repository.addType("phone", "unpublished"); | ||
| repository.addType("email", "unpublished"); | ||
| repository.addType("url", "unpublished"); | ||
| repository.addType("date", "1970-01-01Z"); | ||
| repository.addType("zoned-date", "1970-01-01Z"); | ||
| repository.addType("time", "00:00:00Z"); | ||
| repository.addType("zoned-time", "00:00:00Z"); | ||
| repository.addType("indicator", "0"); | ||
| repository.addType("integer", "-1"); | ||
| repository.addType("number", "-1"); | ||
| repository.addType("amount", "-1"); | ||
| repository.addType("measure", "-1"); | ||
|
|
||
| return repository; | ||
| } | ||
|
|
||
| private void addType(String id, String privacyMask) { | ||
| this.put(id, new SdkDataType(id, privacyMask)); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.