コード例 #1
0
 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;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 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;
 }
コード例 #5
0
 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;
 }
コード例 #6
0
  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;
  }
コード例 #7
0
 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;
 }
コード例 #8
0
  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;
  }
コード例 #9
0
 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;
 }
コード例 #10
0
  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;
  }