Пример #1
0
  /**
   * SOQL クエリを実行する。
   *
   * @param service {@link SalesforceService}。null 不可。
   * @param query SOQL クエリ。
   * @param force ユーザに確認せずに処理を実行する場合は true、それ以外は false。
   * @throws CommandException
   * @throws SalesforceServiceException
   */
  public void update(final SalesforceService service, final String query, final boolean force)
      throws CommandException, SalesforceServiceException {
    if (service == null) {
      throw new NullPointerException("service");
    }

    if (LOG.isDebugEnabled()) {
      LOG.debug("in Update#update() : service=" + service);
      LOG.debug("in Update#update() : query=" + query);
      LOG.debug("in Update#update() : force=" + force);
    }

    // ユーザに確認。
    if (!force
        && !ConsoleUtil.confirmToContinue(
            SalesforceResource.getInstance()
                .getResourceString(this.getClass(), "message.confirm.update"))) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("User cancelled.");
      }
      return;
    }

    UpdateMonitor monitor = new MyUpdateMonitor();
    service.update(query, monitor);

    if (LOG.isDebugEnabled()) {
      LOG.debug("out Update#update()");
    }
  }
Пример #2
0
 public void retrieving(final int numberOfRetrieved) {
   if (this.message != null) {
     ConsoleUtil.clearStdout(this.message);
   }
   this.message =
       SalesforceResource.getInstance()
           .getResourceString(this.getClass(), "monitor.retrieving", "" + numberOfRetrieved);
   ConsoleUtil.printToStdout(this.message);
 }
Пример #3
0
 public void endUpdating(final SaveResult[] saveResults) {
   ConsoleUtil.printlnToStdout();
   ConsoleUtil.printlnToStdout(
       SalesforceResource.getInstance()
           .getResourceString(
               this.getClass(),
               "monitor.endupdating",
               "" + (saveResults != null ? saveResults.length : 0)));
   if (saveResults != null) {
     for (SaveResult saveResult : saveResults) {
       if (saveResult == null) {
         continue;
       }
       if (!saveResult.getSuccess()) {
         jp.co.codeya.salesforcecli.service.partner.Error[] errors = saveResult.getErrors();
         if (errors != null) {
           for (Error error : errors) {
             ConsoleUtil.printlnToStdout(error.getStatusCode() + " : " + error.getMessage());
           }
         }
       }
     }
   }
 }
Пример #4
0
 public void startRetrieving(final String query) {
   ConsoleUtil.printlnToStdout(
       SalesforceResource.getInstance()
           .getResourceString(this.getClass(), "monitor.startretrieving", query));
 }
Пример #5
0
 public void endRetrieving(final int numberOfRetrieved) {
   ConsoleUtil.printlnToStdout();
   ConsoleUtil.printlnToStdout(
       SalesforceResource.getInstance()
           .getResourceString(this.getClass(), "monitor.endretrieving", "" + numberOfRetrieved));
 }