public <R> RequestExecution asyncGet(final Callback<OperationResult<Organization>, R> callback) { final JerseyRequest<Organization> request = buildRequest(); RequestExecution task = new RequestExecution( new Runnable() { @Override public void run() { callback.execute(request.get()); } }); ThreadPoolUtil.runAsynchronously(task); return task; }
public <R> RequestExecution asyncDetails( final Callback<OperationResult<ClientResource>, R> callback) { final JerseyRequest<ClientResource> request = prepareDetailsRequest(); RequestExecution task = new RequestExecution( new Runnable() { @Override public void run() { callback.execute(request.get()); } }); ThreadPoolUtil.runAsynchronously(task); return task; }
public <R> RequestExecution asyncDelete(final Callback<OperationResult, R> callback) { final JerseyRequest request = buildRequest(sessionStorage, Object.class, new String[] {"/resources", resourceUri}); RequestExecution task = new RequestExecution( new Runnable() { @Override public void run() { callback.execute(request.delete()); } }); ThreadPoolUtil.runAsynchronously(task); return task; }
public <R> RequestExecution asyncCreateNew( final ClientResource resource, final Callback<OperationResult<ClientResource>, R> callback) { final JerseyRequest<ClientResource> request = prepareCreateOrUpdateRequest(resource); RequestExecution task = new RequestExecution( new Runnable() { @Override public void run() { callback.execute(request.post(resource)); } }); ThreadPoolUtil.runAsynchronously(task); return task; }
public <R> RequestExecution asyncUpdate( Organization clientTenant, final Callback<OperationResult<Organization>, R> callback) { final JerseyRequest<Organization> request = buildRequest(); final String json = prepareJsonForUpdate(clientTenant); RequestExecution task = new RequestExecution( new Runnable() { @Override public void run() { callback.execute(request.put(json)); } }); ThreadPoolUtil.runAsynchronously(task); return task; }
public <R> RequestExecution asyncDelete(final Callback<OperationResult, R> callback) { final JerseyRequest request = getBuilder(Object.class); RequestExecution task = new RequestExecution( new Runnable() { @Override public void run() { callback.execute(request.delete()); } }); ThreadPoolUtil.runAsynchronously(task); return task; }
public <ResourceType extends ClientResource, R> RequestExecution asyncPatchResource( final Class<ResourceType> resourceTypeClass, final PatchDescriptor descriptor, final Callback<OperationResult<ResourceType>, R> callback) { final JerseyRequest request = preparePatchResourceRequest(resourceTypeClass); RequestExecution task = new RequestExecution( new Runnable() { @Override public void run() { callback.execute(request.post(descriptor)); } }); ThreadPoolUtil.runAsynchronously(task); return task; }
public <R> RequestExecution asyncSearch( final Callback<OperationResult<ClientResourceListWrapper>, R> callback) { final JerseyRequest<ClientResourceListWrapper> request = getBuilder(ClientResourceListWrapper.class); RequestExecution task = new RequestExecution( new Runnable() { @Override public void run() { callback.execute(request.get()); } }); ThreadPoolUtil.runAsynchronously(task); return task; }
public <R> RequestExecution asyncUploadFile( final File fileContent, final ClientFile.FileType fileType, final String label, final String description, final Callback<OperationResult<ClientFile>, R> callback) { final FormDataMultiPart form = prepareUploadForm(fileContent, fileType, label, description); final JerseyRequest<ClientFile> request = prepareUploadFileRequest(); RequestExecution task = new RequestExecution( new Runnable() { @Override public void run() { callback.execute(request.post(form)); } }); ThreadPoolUtil.runAsynchronously(task); return task; }
public <R> RequestExecution asyncCopyOrMove( final boolean moving, final String fromUri, final Callback<OperationResult<ClientResource>, R> callback) { final JerseyRequest<ClientResource> request = prepareCopyOrMoveRequest(fromUri); RequestExecution task = new RequestExecution( new Runnable() { @Override public void run() { OperationResult<ClientResource> result; if (moving) { result = request.put(""); } else { result = request.post(null); } callback.execute(result); } }); ThreadPoolUtil.runAsynchronously(task); return task; }