use of com.walmartlabs.concord.server.OperationResult in project concord by walmartlabs.
the class InventoryResource method createOrUpdate.
/**
* Create or update a inventory.
*
* @param orgName organization's name
* @param entry inventory's data
* @return
*/
@POST
@ApiOperation("Create or update inventory")
@Path("/{orgName}/inventory")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@Validate
public CreateInventoryResponse createOrUpdate(@ApiParam @PathParam("orgName") String orgName, @ApiParam @Valid InventoryEntry entry) {
OrganizationEntry org = orgManager.assertAccess(orgName, true);
OperationResult result = storageManager.createOrUpdate(orgName, JsonStoreRequest.builder().id(entry.getId()).name(entry.getName()).owner(toOwner(entry.getOwner())).visibility(entry.getVisibility() != null ? entry.getVisibility() : JsonStoreVisibility.PUBLIC).build());
UUID id = storageDao.getId(org.getId(), entry.getName());
return new CreateInventoryResponse(result, id);
}
Aggregations