Closed jadzlnds closed 2 days ago
This PR refactors the CKAN mapper implementation by introducing MapStruct for object mapping, improving code organization and maintainability. The changes consolidate multiple mapping utility classes into a single MapStruct-based mapper interface, while maintaining the same functionality.
classDiagram
class CkanMapper {
<<interface>>
+RetrievedDataset map(CkanPackage ckanPackage)
+ValueLabel map(CkanValueLabel ckanValueLabel)
+ValueLabel map(CkanTag ckanTag)
+RetrievedDistribution map(CkanResource ckanResource)
+List~SearchedDataset~ map(PackagesSearchResult result)
+SearchedDataset mapToSearchedDataset(CkanPackage ckanPackage)
+OffsetDateTime map(String date)
}
class CkanMapperImpl {
+map(CkanPackage ckanPackage)
+map(CkanValueLabel ckanValueLabel)
+map(CkanTag ckanTag)
+map(CkanResource ckanResource)
+map(PackagesSearchResult result)
+mapToSearchedDataset(CkanPackage ckanPackage)
+map(String date)
}
CkanMapper <|.. CkanMapperImpl
class CkanPackage
class RetrievedDataset
class CkanValueLabel
class ValueLabel
class CkanTag
class CkanResource
class RetrievedDistribution
class PackagesSearchResult
class SearchedDataset
class OffsetDateTime
CkanMapper --> CkanPackage
CkanMapper --> RetrievedDataset
CkanMapper --> CkanValueLabel
CkanMapper --> ValueLabel
CkanMapper --> CkanTag
CkanMapper --> CkanResource
CkanMapper --> RetrievedDistribution
CkanMapper --> PackagesSearchResult
CkanMapper --> SearchedDataset
CkanMapper --> OffsetDateTime
Change | Details | Files |
---|---|---|
Introduced MapStruct for object mapping |
|
pom.xml src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/mapper/CkanMapper.java |
Consolidated mapping utilities into a single mapper interface |
|
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/utils/CkanAgentParser.java src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/utils/CkanDatetimeParser.java src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/utils/CkanTagParser.java src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/utils/CkanValueLabelParser.java src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/utils/PackageSearchMapper.java src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/utils/PackageShowMapper.java |
Updated test implementation to use new mapper |
|
src/test/java/io/github/genomicdatainfrastructure/discovery/services/PackageShowMapperTest.java |
Updated repository implementation to use new mapper |
|
src/main/java/io/github/genomicdatainfrastructure/discovery/datasets/infrastructure/ckan/persistence/CkanDatasetsRepository.java |
🚀 Pull Request Checklist
Title:
[ ]
A brief, descriptive title for the changes.Description:
[ ]
Provide a clear and concise description of your pull request, including the purpose of the changes and the approach you've taken.Context:
[ ]
Why are these changes necessary? What problem do they solve? Link any related issues.Changes:
[ ]
List the major changes you've made, ideally organized by commit or feature.Testing:
[ ]
Describe how the changes have been tested. Include any relevant details about the testing environment and the test cases.Screenshots (if applicable):
[ ]
If your changes are visual, include screenshots to help explain your changes.Additional Information:
[ ]
Add any other information that might be useful for reviewers, such as considerations, discussions, or dependencies.Checklist:
[ ]
I have checked that my code adheres to the project's style guidelines and that my code is well-commented.[ ]
I have performed self-review of my own code and corrected any misspellings.[ ]
I have made corresponding changes to the documentation (if applicable).[ ]
My changes generate no new warnings or errors.[ ]
I have added tests that prove my fix is effective or that my feature works.[ ]
New and existing unit tests pass locally with my changes.Summary by Sourcery
Refactor the CKAN mapper by replacing the existing PackageShowMapper and PackageSearchMapper with a new CkanMapper interface and its implementation. Update the CkanDatasetsRepository to use the new mapper. Add MapStruct as a dependency to support the new mapping functionality. Enhance test coverage by restructuring and adding new test cases for the mapper.
Enhancements:
Build: