/** * Exports wavelet deltas history. * * @param waveId the id of the wave to export. * @param waveletId the id of the wavelet to export. * @param rpcServerUrl the URL of the JSON-RPC request handler. * @return WaveletSnapshot in Json. * @throws IOException if there is a problem fetching the wavelet. */ public String exportRawSnapshot(WaveId waveId, WaveletId waveletId, String rpcServerUrl) throws IOException { OperationQueue opQueue = new OperationQueue(); opQueue.exportSnapshot(waveId, waveletId); Map<ParamsProperty, Object> response = makeSingleOperationRpc(opQueue, rpcServerUrl); return (String)response.get(ParamsProperty.RAW_SNAPSHOT); }
/** * Exports attachment. * * @param attachmentId the id of attachment. * @param rpcServerUrl the URL of the JSON-RPC request handler. * @return the data of attachment. * @throws IOException if there is a problem fetching the wavelet. */ public RawAttachmentData exportAttachment(AttachmentId attachmentId, String rpcServerUrl) throws IOException { OperationQueue opQueue = new OperationQueue(); opQueue.exportAttachment(attachmentId); Map<ParamsProperty, Object> response = makeSingleOperationRpc(opQueue, rpcServerUrl); return (RawAttachmentData)response.get(ParamsProperty.ATTACHMENT_DATA); }
/** * Imports deltas to wavelet. * * @param waveId the id of the wave to import. * @param waveletId the id of the wavelet to import. * @param history the history of deltas. * @param rpcServerUrl the URL of the JSON-RPC request handler. * @return the version from which importing started. * @throws IOException if there is a problem fetching the wavelet. */ public long importRawDeltas(WaveId waveId, WaveletId waveletId, List<byte[]> history, String rpcServerUrl) throws IOException { OperationQueue opQueue = new OperationQueue(); opQueue.importRawDeltas(waveId, waveletId, history); Map<ParamsProperty, Object> response = makeSingleOperationRpc(opQueue, rpcServerUrl); return (Long)response.get(ParamsProperty.IMPORTED_FROM_VERSION); }
/** * Requests SearchResult for a query. * * @param query the query to execute. * @param index the index from which to return results. * @param numresults the number of results to return. * @param rpcServerUrl the active gateway. * * @throws IOException if remote server returns error. */ public SearchResult search(String query, Integer index, Integer numResults, String rpcServerUrl) throws IOException { OperationQueue opQueue = new OperationQueue(); opQueue.search(query, index, numResults); Map<ParamsProperty, Object> response = makeSingleOperationRpc(opQueue, rpcServerUrl); return (SearchResult) response.get(ParamsProperty.SEARCH_RESULTS); }
/** * Retrieves wavelets ids of the specified wave. * * @param waveId the id of the wave. * @param rpcServerUrl the URL of the JSON-RPC request handler. * @return list of wavelets ids. * @throws IOException if there is a problem fetching the wavelet. */ public List<WaveletId> retrieveWaveletIds(WaveId waveId, String rpcServerUrl) throws IOException { OperationQueue opQueue = new OperationQueue(); opQueue.retrieveWaveletIds(waveId); Map<ParamsProperty, Object> response = makeSingleOperationRpc(opQueue, rpcServerUrl); @SuppressWarnings("unchecked") List<WaveletId> list = (List<WaveletId>)response.get(ParamsProperty.WAVELET_IDS); return list; }
/** * Imports attachment. * * @param waveId the id of the wave to import. * @param waveletId the id of the wavelet to import. * @param attachmentId the id of attachment. * @param attachmentData the data of attachment. * @param rpcServerUrl the URL of the JSON-RPC request handler. * @throws IOException if there is a problem fetching the wavelet. */ public void importAttachment(WaveId waveId, WaveletId waveletId, AttachmentId attachmentId, RawAttachmentData attachmentData, String rpcServerUrl) throws IOException { OperationQueue opQueue = new OperationQueue(); opQueue.importAttachment(waveId, waveletId, attachmentId, attachmentData); makeSingleOperationRpc(opQueue, rpcServerUrl); }
/** * Exports wavelet deltas history. * * @param waveId the id of the wave to export. * @param waveletId the id of the wavelet to export. * @param fromVersion start ProtocolHashedVersion. * @param toVersion end ProtocolHashedVersion. * @param rpcServerUrl the URL of the JSON-RPC request handler. * @return history of deltas. * @throws IOException if there is a problem fetching the deltas. */ public void exportRawDeltas(WaveId waveId, WaveletId waveletId, byte[] fromVersion, byte[] toVersion, String rpcServerUrl, RawDeltasListener listener) throws IOException { OperationQueue opQueue = new OperationQueue(); opQueue.exportRawDeltas(waveId, waveletId, fromVersion, toVersion); Map<ParamsProperty, Object> response = makeSingleOperationRpc(opQueue, rpcServerUrl); @SuppressWarnings("unchecked") List<byte[]> rawHistory = (List<byte[]>)response.get(ParamsProperty.RAW_DELTAS); byte[] rawTargetVersion = (byte[])response.get(ParamsProperty.TARGET_VERSION); listener.onSuccess(rawHistory, rawTargetVersion); }
opQueue.fetchWavelet(waveId, waveletId); Map<ParamsProperty, Object> response = makeSingleOperationRpc(opQueue, rpcServerUrl);