This commit is contained in:
Michele Artini 2022-12-15 14:40:50 +01:00
parent aca292308b
commit 2c62f11b32
3 changed files with 6 additions and 3 deletions

View File

@ -512,8 +512,7 @@ public class DsmService {
} }
public List<SimpleDsWithApis> search(final String value) { public List<SimpleDsWithApis> search(final String value) {
// TODO Auto-generated method stub return simpleDsWithApisRepository.search(value);
return null;
} }
} }

View File

@ -95,7 +95,7 @@
var url = './ajax/dsm/'; var url = './ajax/dsm/';
if ($scope.field) { url += 'searchByField/' + encodeURIComponent($scope.field) + "/0/50"; } if ($scope.field) { url += 'searchByField/' + encodeURIComponent($scope.field) + "/0/50"; }
else { url += 'search?' } else { url += 'search' }
url += '?value=' + encodeURIComponent($scope.value) + '&' + $.now(); url += '?value=' + encodeURIComponent($scope.value) + '&' + $.now();
$http.get(url).then(function successCallback(res) { $http.get(url).then(function successCallback(res) {

View File

@ -5,6 +5,7 @@ import java.util.List;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import eu.dnetlib.data.is.common.ReadOnlyRepository; import eu.dnetlib.data.is.common.ReadOnlyRepository;
@ -15,6 +16,9 @@ import eu.dnetlib.data.openaire.dsm.model.view.SimpleDsWithApis;
@ConditionalOnProperty(value = "openaire.api.enable.dsm", havingValue = "true") @ConditionalOnProperty(value = "openaire.api.enable.dsm", havingValue = "true")
public interface SimpleDsWithApisRepository extends ReadOnlyRepository<SimpleDsWithApis, String>, JpaSpecificationExecutor<SimpleDsWithApis> { public interface SimpleDsWithApisRepository extends ReadOnlyRepository<SimpleDsWithApis, String>, JpaSpecificationExecutor<SimpleDsWithApis> {
@Query(value = "select * from dsm_datasources_view where id = :value or name ilike %:value% or other_name ilike %:value%", nativeQuery = true)
List<SimpleDsWithApis> search(@Param("value") String value);
List<SimpleDsWithApis> findByType(String type); List<SimpleDsWithApis> findByType(String type);
List<SimpleDsWithApis> findByCollectedFrom(String collectdFrom); List<SimpleDsWithApis> findByCollectedFrom(String collectdFrom);