PNF WF post instantiation configuration
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / data / repository / PnfCustomizationRepository.java
index 7527a79..f64311a 100644 (file)
 
 package org.onap.so.db.catalog.data.repository;
 
+import java.util.List;
 import org.onap.so.db.catalog.beans.PnfResourceCustomization;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+import org.springframework.data.repository.query.Param;
 import org.springframework.data.rest.core.annotation.RepositoryRestResource;
 
 @RepositoryRestResource(collectionResourceRel = "pnfResourceCustomization", path = "pnfResourceCustomization")
 public interface PnfCustomizationRepository extends JpaRepository<PnfResourceCustomization, String> {
 
+    /**
+     * Used to fetch the @{link PnfResourceCustomization} by the Model UUID.
+     *
+     * This operation is required by {@link org.onap.so.db.catalog.client.CatalogDbClient} to provide PnfResourceCustomization based on model UUID without projection.
+     *
+     * @param serviceModelUuid model UUID
+     * @return List of PnfResourceCustomization
+     */
+    @Query(value = "select b.* from pnf_resource_customization_to_service a join pnf_resource_customization b where a.RESOURCE_MODEL_CUSTOMIZATION_UUID = b.MODEL_CUSTOMIZATION_UUID and a.SERVICE_MODEL_UUID = ?1", nativeQuery = true)
+    List<PnfResourceCustomization> findPnfResourceCustomizationByModelUuid(
+        @Param("SERVICE_MODEL_UUID") String serviceModelUuid);
 }
\ No newline at end of file