Skip to content
Snippets Groups Projects
Commit 741ae429 authored by Rustam Lotsmanenko (EPAM)'s avatar Rustam Lotsmanenko (EPAM)
Browse files

Batch OSM API for Community Implemenation

parent 23d90c11
No related branches found
No related tags found
1 merge request!933Batch OSM API for Community Implemenation
......@@ -208,7 +208,7 @@ download_plugins:
stage: build
variables:
OSM_PACKAGE_REGISTRY_URL: "https://community.opengroup.org/api/v4/projects/1448/packages/maven"
OSM_VERSION: "0.26.0"
OSM_VERSION: "0.27.0-rc4"
OBM_PACKAGE_REGISTRY_URL: "https://community.opengroup.org/api/v4/projects/1441/packages/maven"
OBM_VERSION: "0.26.1"
OQM_PACKAGE_REGISRTY_URL: "https://community.opengroup.org/api/v4/projects/1450/packages/maven"
......
......@@ -470,9 +470,18 @@ You will need to have the following environment variables defined.
**Entitlements configuration for integration accounts**
| INTEGRATION_TESTER | NO_DATA_ACCESS_TESTER | DATA_ROOT_TESTER |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------|-----------------------------------------------------------------------------------------|
| users<br/>service.entitlements.user<br/>service.storage.admin<br/>service.storage.creator<br/>service.storage.viewer<br/>service.legal.admin<br/>service.legal.editor<br/>data.test1<br/>data.integration.test | users<br/>service.entitlements.user<br/>service.storage.admin | users<br/>users.data.root<br/>service.entitlements.user<br/>service.storage.viewer<br/> |
| INTEGRATION_TESTER | NO_DATA_ACCESS_TESTER | DATA_ROOT_TESTER |
|---------------------------|---------------------------|---------------------------|
| users | users | users |
| service.entitlements.user | service.storage.admin | users.data.root | |
| service.storage.admin | service.entitlements.user | service.entitlements.user |
| service.storage.creator | | service.storage.viewer |
| service.storage.viewer | | |
| service.legal.admin | | |
| service.legal.editor | | |
| data.test1 | | |
| data.integration.test | | |
Execute following command to build code and run all the integration tests:
......
......@@ -78,7 +78,7 @@
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-osm-core</artifactId>
<version>0.26.0</version>
<version>0.27.0-rc4</version>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
......
......@@ -18,6 +18,7 @@
package org.opengroup.osdu.storage.provider.gcp.web.repository;
import com.github.fge.jsonpatch.JsonPatch;
import java.util.Map.Entry;
import lombok.RequiredArgsConstructor;
import lombok.extern.java.Log;
import org.opengroup.osdu.core.common.model.http.CollaborationContext;
......@@ -65,19 +66,13 @@ public class OsmRecordsMetadataRepository implements IRecordsMetadataRepository<
public static final String STATUS = "status";
@Override
public List<RecordMetadata> createOrUpdate(List<RecordMetadata> recordsMetadata, Optional<CollaborationContext> collaborationContext) {
if (recordsMetadata != null) {
Transaction txn = context.beginTransaction(getDestination());
try {
for (RecordMetadata recordMetadata : recordsMetadata) {
context.upsert(recordMetadata, getDestination());
}
txn.commitIfActive();
} finally {
txn.rollbackIfActive();
}
}
return recordsMetadata;
public List<RecordMetadata> createOrUpdate(List<RecordMetadata> recordsMetadata,
Optional<CollaborationContext> collaborationContext) {
if (recordsMetadata != null) {
RecordMetadata[] metadata = recordsMetadata.toArray(RecordMetadata[]::new);
context.upsert(getDestination(), metadata);
}
return recordsMetadata;
}
@Override
......@@ -132,18 +127,14 @@ public class OsmRecordsMetadataRepository implements IRecordsMetadataRepository<
Map<RecordMetadata, JsonPatch> jsonPatchPerRecord,
Optional<CollaborationContext> collaborationContext) {
if (Objects.nonNull(jsonPatchPerRecord)) {
Transaction txn = context.beginTransaction(getDestination());
try {
for (RecordMetadata recordMetadata : jsonPatchPerRecord.keySet()) {
JsonPatch jsonPatch = jsonPatchPerRecord.get(recordMetadata);
RecordMetadata newRecordMetadata =
JsonPatchUtil.applyPatch(jsonPatch, RecordMetadata.class, recordMetadata);
context.upsert(newRecordMetadata, getDestination());
}
txn.commitIfActive();
} finally {
txn.rollbackIfActive();
RecordMetadata[] newRecordMetadata = new RecordMetadata[jsonPatchPerRecord.size()];
int count = 0;
for (Entry<RecordMetadata, JsonPatch> entry : jsonPatchPerRecord.entrySet()) {
JsonPatch jsonPatch = entry.getValue();
newRecordMetadata[count] = JsonPatchUtil.applyPatch(jsonPatch, RecordMetadata.class, entry.getKey());
count++;
}
context.upsert(getDestination(), newRecordMetadata);
}
return new HashMap<>();
}
......
......@@ -53,7 +53,7 @@ public class OsmSchemaRepository implements ISchemaRepository {
txn.rollbackIfActive();
throw new IllegalArgumentException("A schema for the specified kind has already been registered.");
} else {
context.create(schema, getDestination());
context.create(getDestination(), schema);
txn.commitIfActive();
}
} finally {
......
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