Data Storage Service (java)

Wrapper for the '/datastorage' API. Each datastorage can contain data with the custom fields.

List of all options:

  • Get all
  • Create/get one/update/delete data storage
  • Get and update data from data storage

Initialize service

TrivoreID sdk = TrivoreID.mgmtApiClient();

DataStorageServiceImpl dataStorageService = new DataStorageServiceImpl(sdk.dataStorageService());

Data storage management

// get all DataStorages from the all accessible namespaces
List<DataStorage> storages = dataStorageService.getAll();

// this will query data storages by the storage configurations and contained data.
Filter storageFilter = Filter.contains("name", "example");
Filter dataFilter = Filter.equal("key", "value");
List<DataStorage> storages2 = dataStorageService.getAll(new Criteria(storageFilter), dataFilter);

// create new data storage
DataStorage storage = new DataStorage();
storage.setId("exampleUniqueId");
storage.setName("exampleName");

dataStorageService.create(storage);

String dsId = storage.getId();

// get and update data storage
DataStorage storage2 = dataStorageService.get(dsId);
storage2.setDescription("Example Data Storage.");
dataStorageService.update(storage2);

// get and update datastorage data
ExampleObject data = dataStorageService.getData(dsId, ExampleObject.class);
data.setAttribute("value");

dataStorageService.setData(dsId, data);

// operations with the single data value
String value = dataStorageService.getValue(dsId, "attribute", String.class);
dataStorageService.setValue(dsId, "attribute", "new value");
dataStorageService.deleteValue(dsId, "attribute");

// delete datastorage
dataStorageService.delete(dsId);

Data Storage Service Models

/wiki/spaces/TISpubdoc/pages/20515247