Skip to content
Snippets Groups Projects
Commit 004f8b6b authored by vinay yadav's avatar vinay yadav
Browse files

Merge branch 'master' intg modifyusertim

h Please enter a commit message to explain why this merge is necessary,
parents 290822fd de393d94
No related branches found
No related tags found
2 merge requests!744Upgraded packages to mitigated vulns in netty, guava, snakeyaml,!642Added modify user and time info
......@@ -613,7 +613,6 @@ The following software have components provided under the terms of this license:
- Google OAuth Client Library for Java (from https://repo1.maven.org/maven2/com/google/oauth-client/google-oauth-client)
- Hamcrest (from http://hamcrest.org/JavaHamcrest/)
- Hamcrest Core (from http://hamcrest.org/, http://hamcrest.org/JavaHamcrest/, https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core)
- Jackson module: Afterburner (from http://wiki.fasterxml.com/JacksonHome, https://github.com/FasterXML/jackson-modules-base)
- Jakarta Activation API (from https://github.com/eclipse-ee4j/jaf, https://github.com/jakartaee/jaf-api, https://repo1.maven.org/maven2/jakarta/activation/jakarta.activation-api)
- Jakarta Annotations API (from https://projects.eclipse.org/projects/ee4j.ca)
- Jakarta XML Binding API (from https://repo1.maven.org/maven2/jakarta/xml/bind/jakarta.xml.bind-api, https://repo1.maven.org/maven2/org/jboss/spec/javax/xml/bind/jboss-jaxb-api_2.3_spec)
......@@ -984,6 +983,13 @@ The following software have components provided under the terms of this license:
- HK2 Implementation Utilities (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-utils)
- ServiceLocator Default Implementation (from https://repo1.maven.org/maven2/org/glassfish/hk2/hk2-locator)
========================================================================
mit-old-style-no-advert
========================================================================
The following software have components provided under the terms of this license:
- Brave (from https://repo1.maven.org/maven2/io/zipkin/brave/brave)
========================================================================
public-domain
========================================================================
......
......@@ -33,8 +33,7 @@
<azure.appservice.plan />
<azure.appservice.appname />
<azure.appservice.subscription />
<!-- below corelibazure version will be updated to a release candidate once the associated MR is merged -->
<osdu.corelibazure.version>0.19.0-rc5</osdu.corelibazure.version>
<osdu.corelibazure.version>0.20.0-rc6</osdu.corelibazure.version>
<osdu.storage-core.version>0.20.0-SNAPSHOT</osdu.storage-core.version>
<junit.version>4.12</junit.version>
<mockito.version>1.10.19</mockito.version>
......
......@@ -116,7 +116,7 @@ public class QueryRepository implements IQueryRepository {
}
@Override
public DatastoreQueryResult getAllRecordIdsFromKind(String kind, Integer limit, String hashedCursorKey, Optional<CollaborationContext> collaborationContext) {
public DatastoreQueryResult getAllRecordIdsFromKind(String kind, Integer limit, String cursor, Optional<CollaborationContext> collaborationContext) {
Assert.notNull(kind, "kind must not be null");
boolean paginated = false;
......@@ -126,16 +126,8 @@ public class QueryRepository implements IQueryRepository {
paginated = true;
}
String cursor = null;
if (hashedCursorKey != null && !hashedCursorKey.isEmpty()) {
if (cursor != null && !cursor.isEmpty()) {
paginated = true;
try {
cursor = this.cursorCache.get(hashedCursorKey);
} catch (RedisException ex) {
this.logger.error(String.format("Error getting key %s from redis: %s", hashedCursorKey, ex.getMessage()), ex);
}
if (Strings.isNullOrEmpty(cursor)) throw this.getInvalidCursorException();
}
String status = RecordState.active.toString();
DatastoreQueryResult dqr = new DatastoreQueryResult();
......@@ -169,11 +161,8 @@ public class QueryRepository implements IQueryRepository {
} while (!Strings.isNullOrEmpty(continuation) && ids.size() < numRecords);
// Hash the continuationToken
if (!Strings.isNullOrEmpty(continuation)) {
String hashedCursor = Crc32c.hashToBase64EncodedString(continuation);
this.cursorCache.put(hashedCursor, continuation);
dqr.setCursor(hashedCursor);
dqr.setCursor(continuation);
}
} else {
......
......@@ -196,7 +196,9 @@ public class RecordMetadataRepository extends SimpleCosmosStoreRepository<Record
Assert.notNull(kind, "kind must not be null");
Assert.notNull(status, "status must not be null");
SqlQuerySpec query = getIdsByMetadata_kindAndMetada_statusQuery(kind, status, collaborationContext);
return this.find(pageable, headers.getPartitionId(), cosmosDBName, recordMetadataCollection, query);
CosmosQueryRequestOptions queryOptions = new CosmosQueryRequestOptions();
queryOptions.setResponseContinuationTokenLimitInKb(1);
return this.find(pageable, headers.getPartitionId(), cosmosDBName, recordMetadataCollection, query, queryOptions);
}
public int getMetadataDocumentCountForBlob(String path) {
......
......@@ -105,6 +105,11 @@ public class SimpleCosmosStoreRepository<T> implements CosmosStoreRepository<T>
return this.operation.queryItemsPage(dataPartitionId, cosmosDBName, collection, query, clazz, pageSize, continuationToken);
}
@Override
public <T> Page<T> queryItemsPage(String dataPartitionId, String cosmosDBName, String collection, SqlQuerySpec query, Class<T> clazz, int pageSize, String continuationToken, CosmosQueryRequestOptions options) {
return this.operation.queryItemsPage(dataPartitionId, cosmosDBName, collection, query, clazz, pageSize, continuationToken, options);
}
@Override
public void createItem(String dataPartitionId, String cosmosDBName, String collection, @NonNull String partitionKey, T item) {
Assert.notNull(item, ENTITY_MUST_NOT_BE_NULL);
......@@ -258,13 +263,17 @@ public class SimpleCosmosStoreRepository<T> implements CosmosStoreRepository<T>
}
public Page<T> find(@NonNull Pageable pageable, String dataPartitionId, String cosmosDBName, String collectionName, SqlQuerySpec query) {
return this.find(pageable, dataPartitionId, cosmosDBName, collectionName, query, new CosmosQueryRequestOptions());
}
public Page<T> find(@NonNull Pageable pageable, String dataPartitionId, String cosmosDBName, String collectionName, SqlQuerySpec query, CosmosQueryRequestOptions queryOptions) {
Assert.notNull(pageable, PAGEABLE_MUST_NOT_BE_NULL);
CosmosStoreQuery cosmosQuery = (new CosmosStoreQuery()).with(query.getQueryText());
if (pageable.getSort().isSorted()) {
cosmosQuery.with(pageable.getSort());
}
SqlQuerySpec sqlQuerySpec = (new FindQuerySpecGenerator()).generateCosmosWithQueryText(cosmosQuery, cosmosQuery.getQuery());
return this.paginationQuery(pageable, sqlQuerySpec, domainClass, dataPartitionId, cosmosDBName, collectionName);
return this.paginationQuery(pageable, sqlQuerySpec, domainClass, dataPartitionId, cosmosDBName, collectionName, queryOptions);
}
@Override
......@@ -282,6 +291,10 @@ public class SimpleCosmosStoreRepository<T> implements CosmosStoreRepository<T>
}
public Page<T> paginationQuery(Pageable pageable, SqlQuerySpec query, Class<T> domainClass, String dataPartitionId, String cosmosDBName, String collectionName) {
return this.paginationQuery(pageable, query, domainClass, dataPartitionId, cosmosDBName, collectionName, new CosmosQueryRequestOptions());
}
public Page<T> paginationQuery(Pageable pageable, SqlQuerySpec query, Class<T> domainClass, String dataPartitionId, String cosmosDBName, String collectionName, CosmosQueryRequestOptions queryOptions) {
Assert.isTrue(pageable.getPageSize() > 0, "pageable should have page size larger than 0");
Assert.hasText(collectionName, "collection should not be null, empty or only whitespaces");
String continuationToken = null;
......@@ -289,7 +302,7 @@ public class SimpleCosmosStoreRepository<T> implements CosmosStoreRepository<T>
continuationToken = ((CosmosStorePageRequest)pageable).getRequestContinuation();
}
int pageSize = pageable.getPageSize();
return this.queryItemsPage(dataPartitionId, cosmosDBName, collectionName, query, domainClass, pageSize, continuationToken);
return this.queryItemsPage(dataPartitionId, cosmosDBName, collectionName, query, domainClass, pageSize, continuationToken, queryOptions);
}
protected BulkImportResponse bulkInsert(String dataPartitionId, String cosmosDBName, String collectionName, Collection<T> docs){
......
......@@ -58,5 +58,7 @@ public interface CosmosStoreRepository<T> extends PagingAndSortingRepository<T>
<T> Page<T> queryItemsPage(String dataPartitionId, String cosmosDBName, String collection, SqlQuerySpec query, Class<T> clazz,
int pageSize, String continuationToken);
<T> Page<T> queryItemsPage(String dataPartitionId, String cosmosDBName, String collection, SqlQuerySpec query, Class<T> clazz, int pageSize, String continuationToken, CosmosQueryRequestOptions options);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment