yasithdev opened a new pull request, #651: URL: https://github.com/apache/airavata/pull/651
## Summary Registering a data product through the gRPC `DataProductService` and reading it back did not round-trip, which breaks the storage / data-product flow the Django portal depends on (and any gRPC client that registers a data product). Three related defects, all introduced by the Thrift→proto migration of `ResearchMapper` / `DataProductRepository`: 1. **Top-level (parentless) registration always failed.** `DataProductRepository.saveDataProduct` guarded the parent-Collection check with only `getParentProductUri() != null`. A proto3 string field defaults to `""` (not `null`), so the check ran for every parentless product, looked up the non-existent `""` parent, and threw *"Parent product does not exist or parent type is not Collection"*. The legacy Thrift model had `parentProductUri == null`, so the check was skipped. Fix: treat an empty parent URI the same as null. 2. **Reading any data product threw `UnsupportedOperationException`.** The MapStruct-generated `dataProductToModel` did `builder.getProductMetadata().putAll(map)`, but a protobuf `Builder`'s map getter returns an **immutable** view, so `putAll` throws — surfaced to clients as gRPC `INTERNAL` *"Failed to get entity"*. The generated mapper also silently dropped the repeated `replicaLocations`. 3. **Registration persisted no replica.** `dataProductToEntity` likewise dropped `replicaLocations`, so a registered product was saved with no replica — losing its file path entirely. ## Fix Hand-write `dataProductToModel`, `dataProductToEntity`, and `dataReplicaToModel` as `default` interface methods that use the proto `Builder`'s `putAll*` accessors and map the nested `replicaLocations` explicitly. This matches the existing hand-written proto mappers already in `ResearchMapper` (e.g. `appDeploymentToModel`), which are hand-written for exactly this proto-builder reason. ## Validation - **Live, against the running server (gRPC):** `upload_file` → `register_data_product` → `get_data_product` now round-trips `productName`/`ownerName`/`dataProductType`/`productMetadata` **and** the replica (`filePath`, category, persistent type, storage resource id); `download_file` streams the original bytes back. - **Unit tests:** `mvn test -pl airavata-api/research-service` → 53 pass, 0 failures. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
