Package com.sforce.soap.partner

Examples of com.sforce.soap.partner.QueryResult


    if(batchSize > 2000) {
      batchSize = 2000;
      LogManager.logDetail(LogConstants.CTX_CONNECTOR, "reduced.batch.size"); //$NON-NLS-1$
    }
   
    QueryResult qr = null;
    QueryOptions qo = partnerFactory.createQueryOptions();
    qo.setBatchSize(batchSize);
    try {
      if(queryAll != null && queryAll) {
        qr = sfSoap.queryAll(queryString, sh);
View Full Code Here


  }
 
  public  QueryResult retrieve(String fieldList, String sObjectType, List<String> ids) throws ResourceException {
    try {
      List<SObject> objects = sfSoap.retrieve(fieldList, sObjectType, ids, sh);
      QueryResult result = new QueryResult();
      for (SObject sObject : objects) {
          if (sObject != null) {
          result.getRecords().add(sObject);
          }
      }
      result.setSize(result.getRecords().size());
      result.setDone(true);
      return result;     
    } catch (InvalidFieldFault e) {
      throw new ResourceException(e);
    } catch (MalformedQueryFault e) {
      throw new ResourceException(e);
View Full Code Here

  private static TranslationUtility translationUtility = new TranslationUtility(TestVisitors.exampleSalesforce());

  @Test public void testBatching() throws Exception {
    Select command = (Select)translationUtility.parseCommand("select Name from Account"); //$NON-NLS-1$
    SalesforceConnection sfc = Mockito.mock(SalesforceConnection.class);
    QueryResult qr = new QueryResult();
    SObject so = new SObject();
    so.setType("Account");
    Element elem = Mockito.mock(Element.class);
    Mockito.stub(elem.getLocalName()).toReturn("AccountName");
    so.getAny().add(elem);
    qr.getRecords().add(so);
    qr.setDone(false);
    QueryResult finalQr = new QueryResult();
    so.getAny().add(elem);
    finalQr.getRecords().add(so);
    finalQr.setDone(true);
    Mockito.stub(sfc.query("SELECT Account.AccountName FROM Account", 0, false)).toReturn(qr);
    Mockito.stub(sfc.queryMore(null, 0)).toReturn(finalQr);
    QueryExecutionImpl qei = new QueryExecutionImpl(command, sfc, Mockito.mock(RuntimeMetadata.class), Mockito.mock(ExecutionContext.class));
    qei.execute();
    assertNotNull(qei.next());
View Full Code Here

      }
 
    } else if (visitor.hasCriteria()) {
      try {
        String query = visitor.getQuery();
        QueryResult results = getConnection().query(query, context.getBatchSize(), Boolean.FALSE);
        if (null != results && results.getSize() > 0) {
          ArrayList<String> idList = new ArrayList<String>(results
              .getRecords().size());
          for (int i = 0; i < results.getRecords().size(); i++) {
            SObject sObject = results.getRecords().get(i);
            idList.add(sObject.getId());
          }
          Ids = idList.toArray(new String[0]);
        }
      } catch (ResourceException e) {
View Full Code Here

    }

    private String getFieldValueAfterOperation(String nullFieldName, Controller controller) throws Exception {
        String successFile = controller.getConfig().getStringRequired(Config.OUTPUT_SUCCESS);
        String taskId = getCsvFieldValue(successFile, "ID");
        QueryResult result = getController().getPartnerClient().query("select " + nullFieldName + " from Task where Id='" + taskId + "'");
        assertEquals(1, result.getSize());
        return (String)result.getRecords()[0].getField(nullFieldName);
    }
View Full Code Here

        reader.close();
        return fieldValue;
    }

    private String getUserId() throws Exception {
        QueryResult result = getController().getPartnerClient().query(
                "select id from user where username='" + getController().getConfig().getString(Config.USERNAME) + "'");
        assertEquals(1, result.getSize());
        return result.getRecords()[0].getId();
    }
View Full Code Here

        // make sure there're some records to test with
        upsertSfdcAccounts(10);

        // get the client and make the query call
        PartnerClient client = new PartnerClient(getController());
        QueryResult result = client.query("select id from account where " + ACCOUNT_WHERE_CLAUSE);
        SObject[] records = result.getRecords();
        assertNotNull(records);
        assertTrue(records.length > 0);

        // test query more if we have more records
        if (!result.getDone()) {
            QueryResult result2 = client.queryMore(result.getQueryLocator());

            // if we are not done, we should get some records back
            assertNotNull(result2.getRecords());
            assertTrue(records.length > 0);
        }
    }
View Full Code Here

        // make sure there're some records to get
        upsertSfdcAccounts(10);

        // get the client and make the query call
        PartnerClient client = new PartnerClient(getController());
        QueryResult result = client.query("select id from account where " + ACCOUNT_WHERE_CLAUSE);
        SObject[] records = result.getRecords();
        assertNotNull(records);
        assertTrue(records.length > 0);

        return records[0].getId();
    }
View Full Code Here

                    + extIdField
                    + "!= "
                    + (prevValue.getClass().equals(String.class) ? ("'" + prevValue + "'") : String
                            .valueOf(prevValue));
        }
        QueryResult result = client.query(soql);
        SObject[] records = result.getRecords();
        assertNotNull("Operation should return non-null values", records);
        assertTrue("Operation should return 1 or more records", records.length > 0);
        assertNotNull("Records should have non-null field: " + extIdField + " values", records[0]
                .getField(extIdField));
View Full Code Here

    @Test
    public void testDateEndingInZ() throws Exception {
        runProcess(getTestConfig(OperationInfo.insert, false), 1);

        QueryResult qr = getBinding().query("select CustomDateTime__c from Account where AccountNumber__c='ACCT_0'");
        assertEquals(1, qr.getSize());

        Date expectedDate = parseDateWithTimezone("2010-10-14T12:00:00.000GMT");
        assertEquals(expectedDate, parseDateFromPartnerApi((String)qr.getRecords()[0].getField("CustomDateTime__c")));
    }
View Full Code Here

TOP

Related Classes of com.sforce.soap.partner.QueryResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.