当前位置: 首页>>代码示例>>Java>>正文


Java SaveResult.isSuccess方法代码示例

本文整理汇总了Java中com.sforce.soap.partner.SaveResult.isSuccess方法的典型用法代码示例。如果您正苦于以下问题:Java SaveResult.isSuccess方法的具体用法?Java SaveResult.isSuccess怎么用?Java SaveResult.isSuccess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sforce.soap.partner.SaveResult的用法示例。


在下文中一共展示了SaveResult.isSuccess方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: openDataset

import com.sforce.soap.partner.SaveResult; //导入方法依赖的package包/类
private void openDataset() throws ConnectionException, StageException {
  datasetName = conf.edgemartAliasPrefix;
  if (conf.appendTimestamp) {
    datasetName += "_" + System.currentTimeMillis();
  }

  SObject sobj = new SObject();
  sobj.setType("InsightsExternalData");
  sobj.setField("Format", "Csv");
  sobj.setField("EdgemartAlias", datasetName);
  sobj.setField("MetadataJson", conf.metadataJson.getBytes(StandardCharsets.UTF_8));
  sobj.setField("Operation", conf.operation.getLabel());
  sobj.setField("Action", "None");
  if (!StringUtils.isEmpty(conf.edgemartContainer)) {
    sobj.setField("EdgemartContainer", conf.edgemartContainer);
  }

  SaveResult[] results = connection.create(new SObject[]{sobj});
  for (SaveResult sv : results) {
    if (sv.isSuccess()) {
      datasetID = sv.getId();
      partNumber = 1;
      LOG.info("Success creating InsightsExternalData: " + datasetID);
    } else {
      for (Error e : sv.getErrors()) {
        throw new StageException(Errors.WAVE_01, e.getMessage());
      }
    }
  }
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:31,代码来源:WaveAnalyticsTarget.java

示例2: countSaveResults

import com.sforce.soap.partner.SaveResult; //导入方法依赖的package包/类
private void countSaveResults(SaveResult[] saveResults) {
    for (SaveResult saveResult : saveResults) {
        if (saveResult.isSuccess()) {
            this.numOfSuccess++;
        } else {
            this.numOfError++;
        }
    }
}
 
开发者ID:tzmfreedom,项目名称:embulk-output-salesforce,代码行数:10,代码来源:SalesforceOutputPlugin.java

示例3: processResult

import com.sforce.soap.partner.SaveResult; //导入方法依赖的package包/类
private void processResult(SaveResult[] results) throws BuildException {
	if (results!=null) {
		for (SaveResult r : results) {
			if (!r.isSuccess()) {
				List<String> errorMessages = new ArrayList<String>();
				for (com.sforce.soap.partner.Error e : r.getErrors()) {
					errorMessages.add(e.getMessage());
				}
				throw new BuildException(StringUtils.join(errorMessages, ", "));
			}
		}
	}
}
 
开发者ID:eroispaziali,项目名称:ForceFlow,代码行数:14,代码来源:InsertSingleRecordTask.java

示例4: createTestData

import com.sforce.soap.partner.SaveResult; //导入方法依赖的package包/类
public List<String> createTestData() throws ConnectionException {
    this.login(SalesforceConnectionProperties.URL);

    List<String> ids = new ArrayList<String>();
    try {
        List<SObject> contacts = new ArrayList<SObject>();

        for (Map<String, String> row : testData) {
            SObject contact = new SObject();
            contact.setType(module);
            contact.setField("FirstName", row.get("FirstName"));
            contact.setField("LastName", row.get("LastName"));
            contact.setField("Phone", row.get("Phone"));
            contacts.add(contact);
        }

        SaveResult[] results = partnerConnection.create(contacts.toArray(new SObject[0]));

        for (SaveResult result : results) {
            if (result.isSuccess()) {
                ids.add(result.getId());
            } else {
                for (int i = 0; i < result.getErrors().length; i++) {
                    com.sforce.soap.partner.Error err = result.getErrors()[i];
                    Assert.fail(err.getMessage());
                }
            }
        }
    } catch (ConnectionException ce) {
        Assert.fail(ce.getMessage());
    }
    return ids;
}
 
开发者ID:Talend,项目名称:components,代码行数:34,代码来源:SalesforceRuntimeTestUtil.java

示例5: closeDataset

import com.sforce.soap.partner.SaveResult; //导入方法依赖的package包/类
private void closeDataset() throws StageException, ConnectionException, IOException {
  // Instruct Wave to start processing the data
  SObject sobj = new SObject();
  sobj.setType("InsightsExternalData");
  sobj.setField("Action", "Process");
  sobj.setId(datasetID);

  SaveResult[] results = connection.update(new SObject[]{sobj});
  for (SaveResult sv : results) {
    if (sv.isSuccess()) {
      String rowId = sv.getId();
      LOG.info("Success updating InsightsExternalData: {}", rowId);
    } else {
      for (Error e : sv.getErrors()) {
        throw new StageException(Errors.WAVE_01, e.getMessage());
      }
    }
  }

  if (conf.useDataflow) {
    // Poll until the dataset has been processed
    boolean done = false;
    int sleepTime = 1000;
    while (!done) {
      try {
        Thread.sleep(sleepTime);
        sleepTime *= 2;
      } catch (InterruptedException ex) {
        Thread.currentThread().interrupt();
      }
      QueryResult queryResults = connection.query(
          "SELECT Status, StatusMessage FROM InsightsExternalData WHERE Id = '" + datasetID + "'");
      if (queryResults.getSize() > 0) {
        for (SObject s : queryResults.getRecords()) {
          String status = (String) s.getField("Status");
          LOG.info("Dataset status is {}", status);
          if (DONE.contains(status)) {
            done = true;
            String statusMessage = (String) s.getField("StatusMessage");
            if (statusMessage != null) {
              LOG.info("Dataset status message is {}", statusMessage);
            }
          }
        }
      } else {
        System.out.println("Can't find InsightsExternalData with Id " + datasetID);
      }
    }

    // Add the dataset to the dataflow
    ConnectorConfig config = connection.getConfig();
    String dataflowId = getDataflowId();
    String dataflowJson = getDataflowJson(dataflowId);

    LOG.info("Got dataflow json: {}", dataflowJson);

    String newDataflowJson = addDatasetToDataflow(dataflowJson);

    LOG.info("Uploading dataflow {}", newDataflowJson);

    putDataflowJson(dataflowId, newDataflowJson);

    if (conf.runDataflow) {
      LOG.info("Running dataflow {}", dataflowId);
      runDataflow(dataflowId);
    }
  }

  datasetID = null;
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:71,代码来源:WaveAnalyticsTarget.java


注:本文中的com.sforce.soap.partner.SaveResult.isSuccess方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。