use of org.bimserver.shared.exceptions.PublicInterfaceNotFoundException in project BIMserver by opensourceBIM.
the class TestSceneJsDownload method start.
private void start() {
try {
BimServerClientInterface bimServerClient = LocalDevSetup.setupJson("http://localhost:8080");
bimServerClient.getAuthInterface().login("admin@bimserver.org", "admin");
SSerializerPluginConfiguration serializerByContentType = bimServerClient.getServiceInterface().getSerializerByContentType("application/json");
List<SProject> projects = bimServerClient.getServiceInterface().getProjectsByName("test");
if (!projects.isEmpty()) {
SProject project = projects.get(0);
if (project.getLastRevisionId() != -1) {
long start = System.nanoTime();
Long download = bimServerClient.getServiceInterface().download(Collections.singleton(project.getLastRevisionId()), DefaultQueries.allAsString(), serializerByContentType.getOid(), true);
System.out.println(((System.nanoTime() - start) / 1000000) + " ms");
start = System.nanoTime();
InputStream inputStream = bimServerClient.getDownloadData(download);
FileOutputStream fileOutputStream = new FileOutputStream(Paths.get("test.json").toFile());
IOUtils.copy(inputStream, fileOutputStream);
fileOutputStream.close();
System.out.println(((System.nanoTime() - start) / 1000000) + " ms");
}
}
} catch (ServerException e) {
e.printStackTrace();
} catch (UserException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (PublicInterfaceNotFoundException e) {
e.printStackTrace();
}
}
Aggregations