@Override public String getEntityName() { return getType(); }
@Override public String getEntityName() { return getType(); }
/** * Checks if a dataset type exists. * * @param type the dataset type to check * @return true if the dataset type exists * @throws IOException if a network error occurred * @throws UnauthenticatedException if the request is not authorized successfully in the gateway server */ public boolean exists(DatasetTypeId type) throws DatasetTypeNotFoundException, IOException, UnauthenticatedException, UnauthorizedException { URL url = config.resolveNamespacedURLV3(type.getParent(), String.format("data/types/%s", type.getType())); HttpResponse response = restClient.execute(HttpMethod.GET, url, config.getAccessToken(), HttpURLConnection.HTTP_NOT_FOUND); return response.getResponseCode() != HttpURLConnection.HTTP_NOT_FOUND; } }
/** * Gets information about a dataset type. * * @param type the dataset type * @return {@link DatasetTypeMeta} of the dataset type * @throws DatasetTypeNotFoundException if the dataset type could not be found * @throws IOException if a network error occurred * @throws UnauthenticatedException if the request is not authorized successfully in the gateway server */ public DatasetTypeMeta get(DatasetTypeId type) throws DatasetTypeNotFoundException, IOException, UnauthenticatedException, UnauthorizedException { URL url = config.resolveNamespacedURLV3(type.getParent(), String.format("data/types/%s", type.getType())); HttpResponse response = restClient.execute(HttpMethod.GET, url, config.getAccessToken(), HttpURLConnection.HTTP_NOT_FOUND); if (response.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) { throw new DatasetTypeNotFoundException(type); } return ObjectResponse.fromJsonBody(response, DatasetTypeMeta.class).getResponseObject(); }
String.format("Expected %s to not exist", nonExistingInstance)); assertAuthorizationFailure( () -> dsFramework.addInstance(nonExistingType.getType(), nonExistingInstance, DatasetProperties.EMPTY), "Alice needs to have READ/ADMIN on the dataset type to create the dataset"); assertNotFound(() -> dsFramework.deleteModule(nonExistingModule),
Assert.assertNotNull(dsFramework.getTypeInfo(type1x)); dsFramework.addInstance(type1x.getType(), datasetId, DatasetProperties.EMPTY); () -> dsFramework.addInstance(type1.getType(), NamespaceId.DEFAULT.dataset("fail"), DatasetProperties.EMPTY), String.format("Creating an instance of a type from %s should fail as %s does not have any privileges on it.", module1, BOB)); () -> dsFramework.addInstance(type2.getType(), NamespaceId.DEFAULT.dataset("fail"), DatasetProperties.EMPTY), String.format("Creating an instance of a type from %s should fail as %s does not have any privileges on it.", module2, ALICE));