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


Java DescribeGlobalSObjectResult类代码示例

本文整理汇总了Java中com.sforce.soap.partner.DescribeGlobalSObjectResult的典型用法代码示例。如果您正苦于以下问题:Java DescribeGlobalSObjectResult类的具体用法?Java DescribeGlobalSObjectResult怎么用?Java DescribeGlobalSObjectResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DescribeGlobalSObjectResult类属于com.sforce.soap.partner包,在下文中一共展示了DescribeGlobalSObjectResult类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fillCacheTableOfGetTables

import com.sforce.soap.partner.DescribeGlobalSObjectResult; //导入依赖的package包/类
@Override
protected void fillCacheTableOfGetTables(String catalog, String schemaPattern, String tableNamePattern,
		String[] types) throws SQLException {
	try {
		// build cache of table info
		final DescribeGlobalResult descResult = ((BlancoSfdcJdbcConnection) conn).getPartnerConnection()
				.describeGlobal();
		for (DescribeGlobalSObjectResult sobjectResult : descResult.getSobjects()) {
			if (sobjectResult.isQueryable() == false) {
				// skip because non queryable.");
				continue;
			}

			final PreparedStatement pstmt = conn.getCacheConnection()
					.prepareStatement("INSERT INTO GMETA_TABLES SET TABLE_NAME = ?, REMARKS = ?");
			try {
				pstmt.setString(1, sobjectResult.getName());
				pstmt.setString(2, sobjectResult.getLabel());
				pstmt.execute();
			} finally {
				pstmt.close();
			}
		}
	} catch (ConnectionException ex) {
		throw new SQLException(ex);
	}
}
 
开发者ID:igapyon,项目名称:blanco-sfdc-jdbc-driver,代码行数:28,代码来源:BlancoSfdcJdbcDatabaseMetaData.java

示例2: createStringArrayOfSobjectNames

import com.sforce.soap.partner.DescribeGlobalSObjectResult; //导入依赖的package包/类
private List<String> createStringArrayOfSobjectNames(
        DescribeGlobalSObjectResult[] aSobjects) {
    List<String> sObjectNameList = new ArrayList<String>();
    for (DescribeGlobalSObjectResult aSobject : aSobjects) {
        sObjectNameList.add(aSobject.getName());
    }
    return sObjectNameList;
}
 
开发者ID:jwiesel,项目名称:sfdcCommander,代码行数:9,代码来源:DatabaseHandler.java

示例3: generatePartnerOutput

import com.sforce.soap.partner.DescribeGlobalSObjectResult; //导入依赖的package包/类
public void generatePartnerOutput() throws CommanderException {
    connPool = SfdcConnectionPool.getInstance();

    // prepare XLS output folder
    File outputFolder = new File(tmpConfig.getXlsPath() + "/"
            + tmpConfig.getSourceSfdcConfig().getSystemName());
    if (outputFolder.exists()) {
        deleteDirectory(outputFolder);
    }
    outputFolder.mkdirs();

    commander.info("Generating XLS output.");

    binding = connPool.getBinding(tmpConfig.getSourceSfdcConfig());

    // run the different examples
    DescribeGlobalResult global;
    try {
        global = binding.describeGlobal();
        for (DescribeGlobalSObjectResult objectGlobalResult : global
                .getSobjects()) {
            renderObjectXls(objectGlobalResult, outputFolder);
        }
        commander.info("XLS output successfully generated.");
    } catch (RemoteException e) {
        throw new CommanderException(
                "Could not describe salesforce metadata to render object-schema as xls-file.",
                e);
    }

}
 
开发者ID:jwiesel,项目名称:sfdcCommander,代码行数:32,代码来源:XlsRenderer.java

示例4: getSchemaNames

import com.sforce.soap.partner.DescribeGlobalSObjectResult; //导入依赖的package包/类
public static List<NamedThing> getSchemaNames(PartnerConnection connection) throws IOException {
    List<NamedThing> returnList = new ArrayList<>();
    DescribeGlobalResult result = null;
    try {
        result = connection.describeGlobal();
    } catch (ConnectionException e) {
        throw new ComponentException(e);
    }
    DescribeGlobalSObjectResult[] objects = result.getSobjects();
    for (DescribeGlobalSObjectResult obj : objects) {
        LOG.debug("module label: " + obj.getLabel() + " name: " + obj.getName());
        returnList.add(new SimpleNamedThing(obj.getName(), obj.getLabel()));
    }
    return returnList;
}
 
开发者ID:Talend,项目名称:components,代码行数:16,代码来源:SalesforceRuntimeCommon.java

示例5: getSchemaNames

import com.sforce.soap.partner.DescribeGlobalSObjectResult; //导入依赖的package包/类
protected List<NamedThing> getSchemaNames(PartnerConnection connection) throws IOException {
    List<NamedThing> returnList = new ArrayList<>();
    DescribeGlobalResult result = null;
    try {
        result = connection.describeGlobal();
    } catch (ConnectionException e) {
        throw new ComponentException(e);
    }
    DescribeGlobalSObjectResult[] objects = result.getSobjects();
    for (DescribeGlobalSObjectResult obj : objects) {
        LOG.debug("module label: " + obj.getLabel() + " name: " + obj.getName());
        returnList.add(new SimpleNamedThing(obj.getName(), obj.getLabel()));
    }
    return returnList;
}
 
开发者ID:Talend,项目名称:components,代码行数:16,代码来源:SalesforceSourceOrSink.java

示例6: testGetSchemaNames

import com.sforce.soap.partner.DescribeGlobalSObjectResult; //导入依赖的package包/类
@Test
public void testGetSchemaNames() throws Exception {

    DescribeGlobalResult result = new DescribeGlobalResult();

    DescribeGlobalSObjectResult sObjectResult1 = new DescribeGlobalSObjectResult();
    sObjectResult1.setName("Account");
    sObjectResult1.setLabel("Account");

    DescribeGlobalSObjectResult sObjectResult2 = new DescribeGlobalSObjectResult();
    sObjectResult2.setName("Contact");
    sObjectResult2.setLabel("Contact");

    DescribeGlobalSObjectResult sObjectResult3 = new DescribeGlobalSObjectResult();
    sObjectResult3.setName("Campaign");
    sObjectResult3.setLabel("Campaign");

    result.setSobjects(new IDescribeGlobalSObjectResult[]{
            sObjectResult1, sObjectResult2, sObjectResult3
    });

    PartnerConnection conn = mock(PartnerConnection.class);
    doReturn(result).when(conn).describeGlobal();

    List<NamedThing> schemaNames = SalesforceRuntimeCommon.getSchemaNames(conn);

    assertThat(schemaNames, containsInAnyOrder(
            (NamedThing) new SimpleNamedThing("Account", "Account"),
            new SimpleNamedThing("Contact", "Contact"),
            new SimpleNamedThing("Campaign", "Campaign")
    ));
}
 
开发者ID:Talend,项目名称:components,代码行数:33,代码来源:SalesforceRuntimeCommonTest.java

示例7: getAllAvailableObjects

import com.sforce.soap.partner.DescribeGlobalSObjectResult; //导入依赖的package包/类
public String[] getAllAvailableObjects(boolean OnlyQueryableObjects) throws KettleException
{
  DescribeGlobalResult dgr=null;
  List<String> objects = null;
  DescribeGlobalSObjectResult[] sobjectResults=null;
  try  {
	  // Get object
	  dgr = getBinding().describeGlobal();
	  // let's get all objects
      sobjectResults = dgr.getSobjects();
      int nrObjects= dgr.getSobjects().length;
      
      objects = new ArrayList<String>();
      
      for(int i=0; i<nrObjects; i++) {
    	  DescribeGlobalSObjectResult o= dgr.getSobjects(i);
    	  if((OnlyQueryableObjects && o.isQueryable()) || !OnlyQueryableObjects) {
    		  objects.add(o.getName());
    	  }
      }
      return  (String[]) objects.toArray(new String[objects.size()]);
   } catch(Exception e){
	   throw new KettleException(BaseMessages.getString(PKG, "SalesforceInput.Error.GettingModules"),e);
   }finally  {
	   if(dgr!=null) dgr=null;
	   if(objects!=null) {
		   objects.clear();
		   objects=null;
	   }
	   if(sobjectResults!=null) {
		   sobjectResults=null;
	   }
   }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:35,代码来源:SalesforceConnection.java

示例8: SalesforceSchema

import com.sforce.soap.partner.DescribeGlobalSObjectResult; //导入依赖的package包/类
public SalesforceSchema(String name, PartnerConnection connection) {
    _name = name;
    _connection = connection;
    _tableRef = new LazyRef<List<Table>>() {
        @Override
        protected List<Table> fetch() {
            final List<Table> result = new ArrayList<Table>();
            final DescribeGlobalResult describeGlobal;
            try {
                describeGlobal = _connection.describeGlobal();
            } catch (ConnectionException e) {
                throw SalesforceUtils.wrapException(e, "Failed to invoke describeGlobal service");
            }

            for (final DescribeGlobalSObjectResult sobject : describeGlobal.getSobjects()) {
                if (sobject.isQueryable() && sobject.isUpdateable()) {
                    final String tableName = sobject.getName();
                    final String tableLabel = sobject.getLabel();

                    final Table table = new SalesforceTable(tableName, tableLabel, SalesforceSchema.this,
                            _connection);
                    result.add(table);
                }
            }
            return result;
        }
    };
}
 
开发者ID:apache,项目名称:metamodel,代码行数:29,代码来源:SalesforceSchema.java

示例9: getAllAvailableObjects

import com.sforce.soap.partner.DescribeGlobalSObjectResult; //导入依赖的package包/类
public String[] getAllAvailableObjects( boolean OnlyQueryableObjects ) throws KettleException {
  DescribeGlobalResult dgr = null;
  List<String> objects = null;
  DescribeGlobalSObjectResult[] sobjectResults = null;
  try {
    // Get object
    dgr = getBinding().describeGlobal();
    // let's get all objects
    sobjectResults = dgr.getSobjects();
    int nrObjects = dgr.getSobjects().length;

    objects = new ArrayList<String>();

    for ( int i = 0; i < nrObjects; i++ ) {
      DescribeGlobalSObjectResult o = dgr.getSobjects()[i];
      if ( ( OnlyQueryableObjects && o.isQueryable() ) || !OnlyQueryableObjects ) {
        objects.add( o.getName() );
      }
    }
    return objects.toArray( new String[objects.size()] );
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString( PKG, "SalesforceInput.Error.GettingModules" ), e );
  } finally {
    if ( dgr != null ) {
      dgr = null;
    }
    if ( objects != null ) {
      objects.clear();
      objects = null;
    }
    if ( sobjectResults != null ) {
      sobjectResults = null;
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:36,代码来源:SalesforceConnection.java

示例10: populateFieldTrip

import com.sforce.soap.partner.DescribeGlobalSObjectResult; //导入依赖的package包/类
protected void populateFieldTrip() throws Exception {
	String fieldTripObjectName = "Field_Trip__Object_Analysis__c";
	Boolean hasFieldTrip = false;
	
	// Make the describeGlobal() call
	DescribeGlobalResult describeGlobalResult = partnerConnection.describeGlobal();

	// Get the sObjects from the describe global result
	DescribeGlobalSObjectResult[] sobjectResults = describeGlobalResult.getSobjects();
	for (DescribeGlobalSObjectResult sobjectResult : sobjectResults) {
		if(sobjectResult.getName().equals(fieldTripObjectName)) {
			hasFieldTrip = true;
			break;
		}
	}
	
	if (hasFieldTrip) {
		String objectQuery = "SELECT Field_Trip__Last_Analyzed__c,Field_Trip__Object_Label__c,Field_Trip__Object_Name__c,Id,Name FROM Field_Trip__Object_Analysis__c WHERE Field_Trip__Object_Name__c = '" +
				objectName + "' AND Field_Trip__Last_Analyzed__c != null ORDER BY Field_Trip__Last_Analyzed__c DESC NULLS LAST";
		com.sforce.soap.partner.QueryResult objectQueryResult = partnerConnection.query(objectQuery);
		com.sforce.soap.partner.sobject.SObject[] objectRecords = objectQueryResult.getRecords();
		if (objectRecords != null && objectRecords.length > 0) {
			// Use the first one
			com.sforce.soap.partner.sobject.SObject objectAnalysis = objectRecords[0];
			String objectAnalysisId = objectAnalysis.getId();
			
			String fieldQuery = "SELECT Field_Trip__Populated_On_Percent__c,Field_Trip__Populated_On__c,Id,Name FROM Field_Trip__Field_Analysis__c WHERE Field_Trip__Object_Analysis__c = '" +
					objectAnalysisId + "'";
			com.sforce.soap.partner.QueryResult fieldQueryResult = partnerConnection.query(fieldQuery);
			com.sforce.soap.partner.sobject.SObject[] fieldRecords = fieldQueryResult.getRecords();
			for (com.sforce.soap.partner.sobject.SObject fieldAnalysis : fieldRecords) {
				String fieldName = (String) fieldAnalysis.getField("Name");
				ObjectField field = objectFieldMap.get(fieldName.toLowerCase());
				if (field != null) {
					Double numberPopulated = new Double((String) fieldAnalysis.getField("Field_Trip__Populated_On__c"));
					field.numberPopulated = numberPopulated.intValue();
					Double percentPopulated = new Double((String) fieldAnalysis.getField("Field_Trip__Populated_On_Percent__c"));
					field.percentPopulated = percentPopulated.doubleValue();
				}
			}
			
			
		}
		
	}
}
 
开发者ID:YBS,项目名称:YBS-SFDC-Build,代码行数:47,代码来源:DocumentObjectFields.java


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