Commit f9140d3a authored by Erik Leckner's avatar Erik Leckner
Browse files

file-azure

parent 1c8ea068
...@@ -16,11 +16,11 @@ ...@@ -16,11 +16,11 @@
package org.opengroup.osdu.file.provider.azure.repository; package org.opengroup.osdu.file.provider.azure.repository;
import java.sql.Timestamp;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import com.azure.cosmos.FeedOptions;
import com.azure.cosmos.SqlParameter; import com.azure.cosmos.SqlParameter;
import com.azure.cosmos.SqlParameterList; import com.azure.cosmos.SqlParameterList;
import com.azure.cosmos.SqlQuerySpec; import com.azure.cosmos.SqlQuerySpec;
...@@ -76,13 +76,13 @@ public class FileLocationEntityRepository { ...@@ -76,13 +76,13 @@ public class FileLocationEntityRepository {
// + " WHERE CreatedAt >= @time_from AND CreatedAt <= @time_to AND CreatedBy = @user_id") // + " WHERE CreatedAt >= @time_from AND CreatedAt <= @time_to AND CreatedBy = @user_id")
Page<FileLocationEntity> findFileList(@Param("time_from") Date from, @Param("time_to") Date to, Page<FileLocationEntity> findFileList(@Param("time_from") Date from, @Param("time_to") Date to,
@Param("user_id") String userID, Pageable pageable) { @Param("user_id") String userID, Pageable pageable) {
//SqlQuerySpec query = new SqlQuerySpec("SELECT * FROM FileLocationEntity f WHERE f.createdAt >= @time_from AND f.createdAt <= @time_to AND f.createdBy = '@user_id'"); Timestamp fromTimestamp = new Timestamp(from.getTime());
SqlQuerySpec query = new SqlQuerySpec("SELECT * FROM FileLocationEntity f"); Timestamp toTimestamp = new Timestamp(to.getTime());
//f WHERE f.createdBy = "@user_id""); SqlQuerySpec query = new SqlQuerySpec("SELECT * FROM FileLocationEntity f WHERE f.createdAt >= @time_from AND f.createdAt <= @time_to AND f.createdBy = @user_id");
SqlParameterList pars = query.getParameters(); SqlParameterList pars = query.getParameters();
//pars.add(new SqlParameter("@time_from", from)); pars.add(new SqlParameter("@time_from", fromTimestamp));
//pars.add(new SqlParameter("@time_to", to)); pars.add(new SqlParameter("@time_to", toTimestamp));
//pars.add(new SqlParameter("@user_id", userID)); pars.add(new SqlParameter("@user_id", userID));
List<FileLocationEntity> fileList = cosmosStore.queryItemsAsync(headers.getPartitionId(), cosmosDBName, fileLocationContainer, query, List<FileLocationEntity> fileList = cosmosStore.queryItemsAsync(headers.getPartitionId(), cosmosDBName, fileLocationContainer, query,
FileLocationEntity.class,(short)pageable.getPageSize(), pageable.getPageNumber()); FileLocationEntity.class,(short)pageable.getPageSize(), pageable.getPageNumber());
Page<FileLocationEntity> page = new PageImpl(fileList, pageable, fileList.size()); Page<FileLocationEntity> page = new PageImpl(fileList, pageable, fileList.size());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment