Examples of JobResult


Examples of com.google.api.ads.adwords.axis.v201306.cm.JobResult

          + ((RETRIES_COUNT - 1) * RETRY_INTERVAL) + " seconds.");
    }

    // Status must be COMPLETED.
    // Get the job result. Here we re-use the same selector.
    JobResult result = mutateJobService.getResult(selector);

    // Output results.
    int i = 0;
    for (Operand operand : result.getSimpleMutateResult().getResults()) {
      String outcome = operand.getPlaceHolder() == null ? "SUCCESS" : "FAILED";
      System.out.printf("Operation [%d] - %s\n", i++, outcome);
    }

    // Output errors.
    for (ApiError error : result.getSimpleMutateResult().getErrors()) {
      int index = getOperationIndex(error.getFieldPath());
      String reason = error.getErrorString();
      System.out.printf("ERROR - keyword '%s' failed due to '%s'\n",
          ((Keyword) operations.get(index).getOperand().getCriterion()).getText(), reason);
    }
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201309.cm.JobResult

          + ((RETRIES_COUNT - 1) * RETRY_INTERVAL) + " seconds.");
    }

    // Status must be COMPLETED.
    // Get the job result. Here we re-use the same selector.
    JobResult result = mutateJobService.getResult(selector);

    // Output results.
    int i = 0;
    for (Operand operand : result.getSimpleMutateResult().getResults()) {
      String outcome = operand.getPlaceHolder() == null ? "SUCCESS" : "FAILED";
      System.out.printf("Operation [%d] - %s\n", i++, outcome);
    }

    // Output errors.
    for (ApiError error : result.getSimpleMutateResult().getErrors()) {
      int index = getOperationIndex(error.getFieldPath());
      String reason = error.getErrorString();
      System.out.printf("ERROR - keyword '%s' failed due to '%s'\n",
          ((Keyword) operations.get(index).getOperand().getCriterion()).getText(), reason);
    }
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201402.cm.JobResult

          + ((RETRIES_COUNT - 1) * RETRY_INTERVAL) + " seconds.");
    }

    // Status must be COMPLETED.
    // Get the job result. Here we re-use the same selector.
    JobResult result = mutateJobService.getResult(selector);

    // Output results.
    int i = 0;
    for (Operand operand : result.getSimpleMutateResult().getResults()) {
      String outcome = operand.getPlaceHolder() == null ? "SUCCESS" : "FAILED";
      System.out.printf("Operation [%d] - %s\n", i++, outcome);
    }

    // Output errors.
    for (ApiError error : result.getSimpleMutateResult().getErrors()) {
      int index = getOperationIndex(error.getFieldPath());
      String reason = error.getErrorString();
      System.out.printf("ERROR - keyword '%s' failed due to '%s'\n",
          ((Keyword) operations.get(index).getOperand().getCriterion()).getText(), reason);
    }
View Full Code Here

Examples of com.google.api.ads.adwords.axis.v201406.cm.JobResult

          + ((RETRIES_COUNT - 1) * RETRY_INTERVAL) + " seconds.");
    }

    // Status must be COMPLETED.
    // Get the job result. Here we re-use the same selector.
    JobResult result = mutateJobService.getResult(selector);

    // Output results.
    int i = 0;
    for (Operand operand : result.getSimpleMutateResult().getResults()) {
      String outcome = operand.getPlaceHolder() == null ? "SUCCESS" : "FAILED";
      System.out.printf("Operation [%d] - %s\n", i++, outcome);
    }

    // Output errors.
    for (ApiError error : result.getSimpleMutateResult().getErrors()) {
      int index = getOperationIndex(error.getFieldPath());
      String reason = error.getErrorString();
      System.out.printf("ERROR - keyword '%s' failed due to '%s'\n",
          ((Keyword) operations.get(index).getOperand().getCriterion()).getText(), reason);
    }
View Full Code Here

Examples of com.google.api.adwords.v201306.cm.JobResult

            + ((RETRIES_COUNT - 1) * RETRY_INTERVAL) + " seconds.");
      }

      // Status must be COMPLETED.
      // Get the job result. Here we re-use the same selector.
      JobResult result = mutateJobService.getResult(selector);

      // Output results.
      int i = 0;
      for (Operand operand : result.getSimpleMutateResult().getResults()) {
        String outcome = operand.getPlaceHolder() == null ? "SUCCESS" : "FAILED";
        System.out.printf("Operation [%d] - %s\n", i++, outcome);
      }

      // Output errors.
      if (result.getSimpleMutateResult().getErrors() != null) {
        for (ApiError error : result.getSimpleMutateResult().getErrors()) {
          int index = getOperationIndex(error.getFieldPath());
          String reason = error.getErrorString();
          System.out.printf("ERROR - keyword '%s' failed due to '%s'\n",
              ((Keyword) operations.get(index).getOperand().getCriterion()).getText(), reason);
        }
View Full Code Here

Examples of com.google.api.adwords.v201306.cm.JobResult

            + ((RETRIES_COUNT - 1) * RETRY_INTERVAL) + " seconds.");
      }

      // Status must be COMPLETED.
      // Get the job result. Here we re-use the same selector.
      JobResult result = mutateJobService.getResult(selector);

      // Output results.
      int i = 0;
      for (Operand operand : result.getSimpleMutateResult().getResults()) {
        String outcome = operand.getPlaceHolder() == null ? "SUCCESS" : "FAILED";
        System.out.printf("Operation [%d] - %s\n", i++, outcome);
      }

      // Output errors.
      if (result.getSimpleMutateResult().getErrors() != null) {
        for (ApiError error : result.getSimpleMutateResult().getErrors()) {
          int index = getOperationIndex(error.getFieldPath());
          String reason = error.getErrorString();
          System.out.printf("ERROR - placement '%s' failed due to '%s'\n",
              ((Placement) operations.get(index).getOperand().getCriterion()).getUrl(), reason);
        }
View Full Code Here

Examples of com.google.api.adwords.v201309.cm.JobResult

            + ((RETRIES_COUNT - 1) * RETRY_INTERVAL) + " seconds.");
      }

      // Status must be COMPLETED.
      // Get the job result. Here we re-use the same selector.
      JobResult result = mutateJobService.getResult(selector);

      // Output results.
      int i = 0;
      for (Operand operand : result.getSimpleMutateResult().getResults()) {
        String outcome = operand.getPlaceHolder() == null ? "SUCCESS" : "FAILED";
        System.out.printf("Operation [%d] - %s\n", i++, outcome);
      }

      // Output errors.
      if (result.getSimpleMutateResult().getErrors() != null) {
        for (ApiError error : result.getSimpleMutateResult().getErrors()) {
          int index = getOperationIndex(error.getFieldPath());
          String reason = error.getErrorString();
          System.out.printf("ERROR - keyword '%s' failed due to '%s'\n",
              ((Keyword) operations.get(index).getOperand().getCriterion()).getText(), reason);
        }
View Full Code Here

Examples of com.google.api.adwords.v201309.cm.JobResult

            + ((RETRIES_COUNT - 1) * RETRY_INTERVAL) + " seconds.");
      }

      // Status must be COMPLETED.
      // Get the job result. Here we re-use the same selector.
      JobResult result = mutateJobService.getResult(selector);

      // Output results.
      int i = 0;
      for (Operand operand : result.getSimpleMutateResult().getResults()) {
        String outcome = operand.getPlaceHolder() == null ? "SUCCESS" : "FAILED";
        System.out.printf("Operation [%d] - %s\n", i++, outcome);
      }

      // Output errors.
      if (result.getSimpleMutateResult().getErrors() != null) {
        for (ApiError error : result.getSimpleMutateResult().getErrors()) {
          int index = getOperationIndex(error.getFieldPath());
          String reason = error.getErrorString();
          System.out.printf("ERROR - placement '%s' failed due to '%s'\n",
              ((Placement) operations.get(index).getOperand().getCriterion()).getUrl(), reason);
        }
View Full Code Here

Examples of org.apache.stanbol.commons.jobs.api.JobResult

                    try {
                        //log.debug("Process " + Integer.toString(num) + " is working");
                        Thread.sleep(jst);
                    } catch (InterruptedException ie) {}
                }
                JobResult r = new JobResult(){

                    @Override
                    public String getMessage() {
                        return "This is process " + Integer.toString(num);
                    }
View Full Code Here

Examples of org.apache.stanbol.commons.jobs.api.JobResult

                     */
                    Object o;
                    try {
                        o = f.get();
                        if(o instanceof JobResult){
                            JobResult result = (JobResult) o;
                            return Response.ok(result.getMessage()).build();
                        }else{
                            log.error("Job {} is not a test job", jid);
                            throw new WebApplicationException(Response.Status.NOT_FOUND);
                        }
                    } catch (InterruptedException e) {
                        log.error("Error: ",e);
                        throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
                    } catch (ExecutionException e) {
                        log.error("Error: ",e);
                        throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
                    }
                   
                }else{
                    /**
                     * We return 404 with additional info (Content-Location, the related job resource)
                     *
                     * TODO
                     * Change into json representations
                     */
                    String location = getPublicBaseUri() + "jobs/" + jid;
                    String info = new StringBuilder().append("Result not ready.\n").append("Job Location: ").append(location).toString();
                    return Response.status(404).header("Content-Location", location).header("Content-type","text/plain").entity(info).build();
                }
            }else {
                log.info("No job found with id {}", jid);
                return Response.status(Response.Status.NOT_FOUND).build();
            }
        }else{
            // No id have been provided, we create a new test job
            JobManager m = getJobManager();
            String id = m.execute(new Job() {
                @Override
                public JobResult call() throws Exception {
                    for (int i = 0; i < 30; i++) {
                        try {
                            log.info("Test Process is working");
                            Thread.sleep(1000);
                        } catch (InterruptedException ie) {}
                    }
                    return new JobResult(){
   
                        @Override
                        public String getMessage() {
                            return "This is a test job";
                        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.