use of com.walmartlabs.concord.server.org.jsonstore.JsonStoreEntry in project concord by walmartlabs.
the class ConsoleService method isStorageQueryExists.
@GET
@Path("/org/{orgName}/jsonstore/{storeName}/query/{queryName}/exists")
@Produces(MediaType.APPLICATION_JSON)
@WithTimer
public boolean isStorageQueryExists(@PathParam("orgName") @ConcordKey String orgName, @PathParam("storeName") String storeName, @PathParam("queryName") String queryName) {
try {
OrganizationEntry org = orgManager.assertAccess(orgName, true);
JsonStoreEntry storage = jsonStoreAccessManager.assertAccess(org.getId(), null, storeName, ResourceAccessLevel.READER, true);
return storageQueryDao.getId(storage.id(), queryName) != null;
} catch (UnauthorizedException e) {
return false;
}
}
use of com.walmartlabs.concord.server.org.jsonstore.JsonStoreEntry in project concord by walmartlabs.
the class InventoryDataResource method get.
/**
* Returns an existing inventory data.
*
* @param orgName organization's name
* @param inventoryName inventory's name
* @param itemPath data item path
* @return
*/
@GET
@ApiOperation("Get inventory data")
@Path("/{orgName}/inventory/{inventoryName}/data/{itemPath:.*}")
@Produces(MediaType.APPLICATION_JSON)
public Object get(@ApiParam @PathParam("orgName") String orgName, @ApiParam @PathParam("inventoryName") String inventoryName, @ApiParam @PathParam("itemPath") String itemPath, @ApiParam @QueryParam("singleItem") @DefaultValue("false") boolean singleItem) {
OrganizationEntry org = orgManager.assertAccess(orgName, true);
JsonStoreEntry inventory = inventoryManager.assertAccess(org.getId(), null, inventoryName, ResourceAccessLevel.READER, true);
if (singleItem) {
return inventoryDataDao.getSingleItem(inventory.id(), itemPath);
} else {
return build(inventory.id(), itemPath);
}
}
use of com.walmartlabs.concord.server.org.jsonstore.JsonStoreEntry in project concord by walmartlabs.
the class AuditLogResource method getEffectiveJsonStoreId.
private UUID getEffectiveJsonStoreId(UUID effectiveOrgId, Map<String, String> details) {
UUID jsonStoreId = getUUID(details, "jsonStoreId");
String jsonStoreName = details.get("jsonStoreName");
if (effectiveOrgId == null && jsonStoreId == null && jsonStoreName != null) {
throw new ValidationErrorsException("'orgId' or 'orgName' is required");
}
if (jsonStoreId != null || jsonStoreName != null) {
JsonStoreEntry store = jsonStoreAccessManager.assertAccess(effectiveOrgId, jsonStoreId, jsonStoreName, ResourceAccessLevel.READER, true);
return store.id();
}
return null;
}
use of com.walmartlabs.concord.server.org.jsonstore.JsonStoreEntry in project concord by walmartlabs.
the class InventoryDataResource method delete.
/**
* Deletes inventory data
*
* @param orgName organization's name
* @param inventoryName inventory's name
* @param itemPath inventory's data path
* @return
*/
@DELETE
@ApiOperation("Delete inventory data")
@Path("/{orgName}/inventory/{inventoryName}/data/{itemPath:.*}")
@Produces(MediaType.APPLICATION_JSON)
public DeleteInventoryDataResponse delete(@ApiParam @PathParam("orgName") String orgName, @ApiParam @PathParam("inventoryName") String inventoryName, @ApiParam @PathParam("itemPath") String itemPath) {
OrganizationEntry org = orgManager.assertAccess(orgName, true);
JsonStoreEntry inventory = inventoryManager.assertAccess(org.getId(), null, inventoryName, ResourceAccessLevel.WRITER, true);
inventoryDataDao.delete(inventory.id(), itemPath);
return new DeleteInventoryDataResponse();
}
use of com.walmartlabs.concord.server.org.jsonstore.JsonStoreEntry in project concord by walmartlabs.
the class InventoryDataResource method list.
/**
* Returns all inventory data for inventory.
*
* @param orgName organization's name
* @param inventoryName inventory's name
* @return
*/
@GET
@ApiOperation("List inventory data")
@Path("/{orgName}/inventory/{inventoryName}/data")
@Produces(MediaType.APPLICATION_JSON)
public List<Map<String, Object>> list(@ApiParam @PathParam("orgName") String orgName, @ApiParam @PathParam("inventoryName") String inventoryName) {
OrganizationEntry org = orgManager.assertAccess(orgName, true);
JsonStoreEntry inventory = inventoryManager.assertAccess(org.getId(), null, inventoryName, ResourceAccessLevel.READER, true);
return inventoryDataDao.list(inventory.id());
}
Aggregations