本文整理汇总了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());
}
}
}
}
示例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++;
}
}
}
示例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, ", "));
}
}
}
}
示例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;
}
示例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;
}