本文整理汇总了Java中com.sforce.soap.partner.DescribeGlobalResult.getSobjects方法的典型用法代码示例。如果您正苦于以下问题:Java DescribeGlobalResult.getSobjects方法的具体用法?Java DescribeGlobalResult.getSobjects怎么用?Java DescribeGlobalResult.getSobjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sforce.soap.partner.DescribeGlobalResult
的用法示例。
在下文中一共展示了DescribeGlobalResult.getSobjects方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillCacheTableOfGetTables
import com.sforce.soap.partner.DescribeGlobalResult; //导入方法依赖的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);
}
}
示例2: generatePartnerOutput
import com.sforce.soap.partner.DescribeGlobalResult; //导入方法依赖的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);
}
}
示例3: getSchemaNames
import com.sforce.soap.partner.DescribeGlobalResult; //导入方法依赖的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;
}
示例4: getSchemaNames
import com.sforce.soap.partner.DescribeGlobalResult; //导入方法依赖的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;
}
示例5: getAllAvailableObjects
import com.sforce.soap.partner.DescribeGlobalResult; //导入方法依赖的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;
}
}
}
示例6: getAllAvailableObjects
import com.sforce.soap.partner.DescribeGlobalResult; //导入方法依赖的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;
}
}
}
示例7: populateFieldTrip
import com.sforce.soap.partner.DescribeGlobalResult; //导入方法依赖的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();
}
}
}
}
}