Package com.sforce.soap.partner

Examples of com.sforce.soap.partner.DescribeSObjectResult


    }
    return result;
  }

  private void addTable(DescribeGlobalSObjectResult object) throws TranslatorException {
    DescribeSObjectResult objectMetadata = null;
    try {
      objectMetadata = connection.getObjectMetaData(object.getName());
    } catch (ResourceException e) {
      throw new TranslatorException(e);
    }
   
    String name = NameUtil.normalizeName(objectMetadata.getName());
    Table table = metadataFactory.addTable(name);
   
    table.setNameInSource(objectMetadata.getName());
    tableMap.put(name, table);
    getRelationships(objectMetadata);

    table.setProperty(TABLE_CUSTOM, String.valueOf(objectMetadata.isCustom()));
    table.setProperty(TABLE_SUPPORTS_CREATE, String.valueOf(objectMetadata.isCreateable()));
    table.setProperty(TABLE_SUPPORTS_DELETE, String.valueOf(objectMetadata.isDeletable()));
    table.setProperty(TABLE_SUPPORTS_MERGE, String.valueOf(objectMetadata.isMergeable()));
    table.setProperty(TABLE_SUPPORTS_QUERY, String.valueOf(objectMetadata.isQueryable()));
    table.setProperty(TABLE_SUPPORTS_REPLICATE, String.valueOf(objectMetadata.isReplicateable()));
    table.setProperty(TABLE_SUPPORTS_RETRIEVE, String.valueOf(objectMetadata.isRetrieveable()));
    table.setProperty(TABLE_SUPPORTS_SEARCH, String.valueOf(objectMetadata.isSearchable()));

    hasUpdateableColumn = false;
    addColumns(objectMetadata, table);
   
    // Some SF objects return true for isUpdateable() but have no updateable columns.
    if(hasUpdateableColumn && objectMetadata.isUpdateable()) {
      table.setSupportsUpdate(true);
    }
  }
View Full Code Here


        assertTrue(client.getEntityDescribeMap().isEmpty());
        client.setEntityDescribes();

        int numDescribes = 0;
        for (String objectType : client.getDescribeGlobalResults().keySet()){
            DescribeSObjectResult describeResult = client.describeSObject(objectType);
            numDescribes++;
            assertNotNull(describeResult);
            assertEquals(objectType, describeResult.getName());
            assertEquals(numDescribes, client.getEntityDescribeMap().size());
        }
    }
View Full Code Here

    @Test
    public void testGetSforceField() throws Exception {
        // test for account name as a default test case
        PartnerClient client = new PartnerClient(getController());
        DescribeSObjectResult forceFields = client.describeSObject("account");
        Field[] fields = forceFields.getFields();
        assertNotNull(fields);
        boolean hasName = false;
        for (Field field : fields) {
            Field f = field;
            if (f.getName().equals("Name")) {
View Full Code Here

        extIdFieldCombo.setEnabled(true);

        // entity is known at this time, set the correct combo label
        labelExtId.setText(Labels.getFormattedString("ExternalIdPage.externalIdComboText", controller.getConfig().getString(Config.ENTITY))); //$NON-NLS-1$

        DescribeSObjectResult fieldTypes = controller.getFieldTypes();
        Field[] fields = fieldTypes.getFields();
        ArrayList<String> extIdFields = new ArrayList<String>();
        for(Field field : fields) {
            // salesforce id can be used for upsert in addition to external id fields
            if("id".equals(field.getName().toLowerCase())) {
                extIdFields.add(field.getName());
View Full Code Here

        _connection = connection;
        _columnRef = new LazyRef<List<Column>>() {
            @Override
            protected List<Column> fetch() {
                final List<Column> result = new ArrayList<Column>();
                final DescribeSObjectResult describeSObject;
                try {
                    describeSObject = _connection.describeSObject(_name);
                } catch (ConnectionException e) {
                    throw SalesforceUtils.wrapException(e, "Failed to invoke describeSObject service");
                }
                final Field[] fields = describeSObject.getFields();

                int i = 0;
                for (final Field field : fields) {
                    final String columnName = field.getName();
                    final String columnLabel = field.getLabel();
View Full Code Here

*/
public class FieldCombinationFilterTest {

    @Test
    public void testBasicCombinationFilter() {
        DescribeSObjectResult dsr = new DescribeSObjectResult();
        dsr.setName("Object_Name__c");
       
        Field idField = new Field();
        idField.setName("Id");
        idField.setType(FieldType.id);
       
        Field nameField = new Field();
        nameField.setName("Name");
        nameField.setType(FieldType.string);
       
        Field customField = new Field();
        customField.setName("customField");
        customField.setType(FieldType.string);
       
        dsr.setFields(new Field[] { idField, nameField, customField });
       
        List<Field> filteredFields = new FieldCombinationFilter()
            .addFilter(new FieldNameTestFilter("Name")).addFilter(new FieldNameTestFilter("Id")).filter(dsr);
       
        assertNotNull(filteredFields, "A combination filter of a non-null value should be non-null");
View Full Code Here

        assertNull(new ObjectNoOpFilter().filter(null), "A no op filter of a null value should be null");
    }
   
    @Test
    public void testFilterWithNonNullValue() {
        DescribeSObjectResult dsr = new DescribeSObjectResult();
        dsr.setName("Object_Name__c");
       
        List<DescribeSObjectResult> dsrs =
            new ObjectNoOpFilter().filter(Collections.<DescribeSObjectResult>singletonList(dsr));
       
        assertNotNull(dsrs, "A no op filter of a non-null value should be non-null");
View Full Code Here

        PartnerConnection conn = getPartnerConnection();
        String ns = getNamespaceFromCtx();
        if (ns != null && ns != "") {
            sObject = ns + NAME_SEPARATOR + sObject;
        }
        DescribeSObjectResult describeSObjectResult = conn.describeSObject(sObject);
        com.sforce.soap.partner.Field[] fields = describeSObjectResult.getFields();
        Assert.assertEquals(fields.length, expectedFieldNames.length, "Unexpected number of fields on object " + sObject);
        ArrayList<String> fieldNames = new ArrayList<String>();
        for (com.sforce.soap.partner.Field field : fields) {
            if (field.isCustom() && ns != null && ns != "") {
                String fn = field.getName();
View Full Code Here

     * in the underlying salesforce custom object.
     */
    private void verifyFieldPrecisions(String sObject,
            Map<String, PrecisionScale> expectedFieldMetadata) throws Exception {
        PartnerConnection conn = getPartnerConnection();
        DescribeSObjectResult describeSObjectResult = conn.describeSObject(sObject);
        com.sforce.soap.partner.Field[] fields = describeSObjectResult.getFields();

        for (int i = 0; i < fields.length; i++) {
            if (expectedFieldMetadata.containsKey(fields[i].getName())) {
                Assert.assertEquals(
                        fields[i].getPrecision(),
View Full Code Here

    @Test
    public void testBasicInjection() {
        GetUserInfoResult userInfo = new GetUserInfoResult();
        userInfo.setOrganizationName("testBasicSelect UserInfo");
       
        DescribeSObjectResult dsr = new DescribeSObjectResult();
        dsr.setName("testBasicSelect DescribeSObjectResult");
       
        Field field = new Field();
        field.setName("Field__c");
       
        StringTemplateWrapper template =
View Full Code Here

TOP

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

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.