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


Java QueryResult.getSize方法代码示例

本文整理汇总了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());
	}
}
 
开发者ID:eroispaziali,项目名称:ForceFlow,代码行数:23,代码来源:RecordTypeId.java

示例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);
	}
}
 
开发者ID:eroispaziali,项目名称:ForceFlow,代码行数:28,代码来源:DeleteAllRecordsTask.java

示例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;
}
 
开发者ID:kenweezy,项目名称:teiid,代码行数:30,代码来源:AbstractUpdateExecution.java

示例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;
}
 
开发者ID:sunand85,项目名称:DF14_Demo,代码行数:20,代码来源:SFDCUtil.java

示例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;
}
 
开发者ID:streamsets,项目名称:datacollector,代码行数:71,代码来源:WaveAnalyticsTarget.java


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