private void waitForDonePreparing(long topicId) throws UserException, ServerException, PublicInterfaceNotFoundException { for (int i = 0; i < 10; i++) { SLongActionState progress = bimServerClient.getRegistry().getProgress(topicId); if (progress != null) { if (progress.getTitle() != null && progress.getTitle().equals("Done preparing")) { break; } else if (progress.getState() == SActionState.AS_ERROR) { throw new UserException(Joiner.on(", ").join(progress.getErrors())); } } try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } } }
public void download(long roid, long serializerOid, OutputStream outputStream) throws BimServerClientException { try { Long topicId = getServiceInterface().download(Collections.singleton(roid), DefaultQueries.allAsString(), serializerOid, false); SLongActionState progress = getNotificationRegistryInterface().getProgress(topicId); if (progress != null && progress.getState() == SActionState.AS_ERROR) { throw new BimServerClientException(Joiner.on(", ").join(progress.getErrors())); } else { InputStream inputStream = getDownloadData(topicId); try { IOUtils.copy(inputStream, outputStream); getServiceInterface().cleanupLongAction(topicId); } finally { inputStream.close(); } } } catch (ServerException e) { LOGGER.error("", e); } catch (UserException e) { LOGGER.error("", e); } catch (IOException e) { LOGGER.error("", e); } catch (PublicInterfaceNotFoundException e) { LOGGER.error("", e); } }
return getState();
public LongActionState convertFromSObject(SLongActionState input, LongActionState result, DatabaseSession session) throws BimserverDatabaseException { if (input == null) { return null; } if (input instanceof SLongCheckinActionState) { return convertFromSObject((SLongCheckinActionState)input, session); } result.setStart(input.getStart()); result.setEnd(input.getEnd()); result.setProgress(input.getProgress()); result.setState(ActionState.values()[input.getState().ordinal()]); result.setTitle(input.getTitle()); result.setStage(input.getStage()); result.getErrors().addAll(input.getErrors()); result.getWarnings().addAll(input.getWarnings()); result.getInfos().addAll(input.getInfos()); result.setTopicId(input.getTopicId()); return result; } public SServerState convertToSObject(ServerState input) {