Commit 424a8143 authored by Erik Leckner's avatar Erik Leckner
Browse files

file-azure

parent 307a2a30
Pipeline #6325 passed with stage
in 5 minutes and 23 seconds
......@@ -16,11 +16,11 @@
package org.opengroup.osdu.file.provider.azure.repository;
import java.sql.Timestamp;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import com.azure.cosmos.FeedOptions;
import com.azure.cosmos.SqlParameter;
import com.azure.cosmos.SqlParameterList;
import com.azure.cosmos.SqlQuerySpec;
......@@ -76,13 +76,13 @@ public class FileLocationEntityRepository {
// + " 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,
@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'");
SqlQuerySpec query = new SqlQuerySpec("SELECT * FROM FileLocationEntity f");
//f WHERE f.createdBy = "@user_id"");
Timestamp fromTimestamp = new Timestamp(from.getTime());
Timestamp toTimestamp = new Timestamp(to.getTime());
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();
//pars.add(new SqlParameter("@time_from", from));
//pars.add(new SqlParameter("@time_to", to));
//pars.add(new SqlParameter("@user_id", userID));
pars.add(new SqlParameter("@time_from", fromTimestamp));
pars.add(new SqlParameter("@time_to", toTimestamp));
pars.add(new SqlParameter("@user_id", userID));
List<FileLocationEntity> fileList = cosmosStore.queryItemsAsync(headers.getPartitionId(), cosmosDBName, fileLocationContainer, query,
FileLocationEntity.class,(short)pageable.getPageSize(), pageable.getPageNumber());
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