本文整理汇总了Java中com.sforce.soap.partner.QueryResult.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java QueryResult.getSize方法的具体用法?Java QueryResult.getSize怎么用?Java QueryResult.getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sforce.soap.partner.QueryResult
的用法示例。
在下文中一共展示了QueryResult.getSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: execute
import com.sforce.soap.partner.QueryResult; //导入方法依赖的package包/类
@Override
public void execute() throws BuildException {
checkAttributes();
// prepare where clause
try {
SalesforceConfig conf = getConfig();
PartnerConnection connection = ConnectionFactory.getPartnerConnection(conf);
log(String.format("Getting RecordTypeId: %s.%s", object, developerName));
QueryResult result = connection.query(getCompiledQuery());
if (result.getSize() == 1) {
String value = (String) result.getRecords()[0].getField("Id");
getProject().setNewProperty(propertyRef, value);
} else {
throw new BuildException("Unable to find a unique result");
}
} catch (ConnectionException e) {
throw new BuildException(e.getLocalizedMessage());
}
}
示例2: execute
import com.sforce.soap.partner.QueryResult; //导入方法依赖的package包/类
@Override
public void execute() throws BuildException {
try {
PartnerConnection pc = ConnectionFactory.getPartnerConnection(getConfig());
String soql = String.format(FORMAT_SOQL, objectApiName);
QueryResult qr = pc.query(soql);
Boolean done = false;
log(String.format(FORMAT_DELETE_MSG, qr.getSize(), objectApiName));
if (qr.getSize() > 0) {
while (!done) {
com.sforce.soap.partner.sobject.SObject[] records = qr.getRecords();
String[] ids = new String[records.length];
for (int i = 0; i<records.length; ++i) {
ids[i] = (String)records[i].getField("Id");
}
pc.delete(ids);
if (qr.isDone()) {
done = true;
} else {
qr = pc.queryMore(qr.getQueryLocator());
}
}
}
} catch (ConnectionException e) {
handleException(e);
}
}
示例3: getIDs
import com.sforce.soap.partner.QueryResult; //导入方法依赖的package包/类
String[] getIDs(Condition criteria, IQueryProvidingVisitor visitor) throws TranslatorException {
String[] Ids = null;
if (visitor.hasOnlyIDCriteria()) {
try {
String Id = ((Comparison)criteria).getRightExpression().toString();
Id = Util.stripQutes(Id);
Ids = new String[] { Id };
} catch (ClassCastException cce) {
throw new RuntimeException(SalesForcePlugin.Util.gs(SalesForcePlugin.Event.TEIID13008));
}
} else if (visitor.hasCriteria()) {
try {
String query = visitor.getQuery();
QueryResult results = getConnection().query(query, context.getBatchSize(), Boolean.FALSE);
if (results != null && results.getSize() > 0) {
ArrayList<String> idList = new ArrayList<String>(results.getRecords().length);
for (int i = 0; i < results.getRecords().length; i++) {
SObject sObject = results.getRecords()[i];
idList.add(sObject.getId());
}
Ids = idList.toArray(new String[0]);
}
} catch (ResourceException e) {
throw new TranslatorException(e);
}
}
return Ids;
}
示例4: getRecordCount
import com.sforce.soap.partner.QueryResult; //导入方法依赖的package包/类
/**
* Method to return the number of records that the query has returned.
* @param query - SOQL query
* @return count - Returns the number of records that the query as queried.
*/
public static int getRecordCount(String query) {
int count = 0;
if(fetchSFDCinfo() != null) {
try{
QueryResult result = partnerConnection.queryAll(query);
count = result.getSize();
} catch(Exception e) {
App.logInfo(e.getLocalizedMessage());
}
App.logInfo("No of records : " +count);
}
return count;
}
示例5: closeDataset
import com.sforce.soap.partner.QueryResult; //导入方法依赖的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;
}