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


Java DescribeSObjectResult.getFields方法代码示例

本文整理汇总了Java中com.sforce.soap.partner.DescribeSObjectResult.getFields方法的典型用法代码示例。如果您正苦于以下问题:Java DescribeSObjectResult.getFields方法的具体用法?Java DescribeSObjectResult.getFields怎么用?Java DescribeSObjectResult.getFields使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sforce.soap.partner.DescribeSObjectResult的用法示例。


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

示例1: getObjectFields

import com.sforce.soap.partner.DescribeSObjectResult; //导入方法依赖的package包/类
public Field[] getObjectFields(String objectName) throws KettleException
{
 DescribeSObjectResult describeSObjectResult=null;
 try  {
  // Get object
     describeSObjectResult = getBinding().describeSObject(objectName);
     if(describeSObjectResult==null) return null;
   
   if(!describeSObjectResult.isQueryable()){
		throw new KettleException(BaseMessages.getString(PKG, "SalesforceInputDialog.ObjectNotQueryable",this.module));
   }else{
        // we can query this object
          return  describeSObjectResult.getFields();
   }
  } catch(Exception e){
   throw new KettleException(BaseMessages.getString(PKG, "SalesforceInput.Error.GettingModuleFields", this.module),e);
  }finally  {
   if(describeSObjectResult!=null) describeSObjectResult=null;
  }
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:21,代码来源:SalesforceConnection.java

示例2: getObjectFields

import com.sforce.soap.partner.DescribeSObjectResult; //导入方法依赖的package包/类
public Field[] getObjectFields( String objectName ) throws KettleException {
  DescribeSObjectResult describeSObjectResult = null;
  try {
    // Get object
    describeSObjectResult = getBinding().describeSObject( objectName );
    if ( describeSObjectResult == null ) {
      return null;
    }

    if ( !describeSObjectResult.isQueryable() ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "SalesforceInputDialog.ObjectNotQueryable", this.module ) );
    } else {
      // we can query this object
      return describeSObjectResult.getFields();
    }
  } catch ( Exception e ) {
    throw new KettleException( BaseMessages.getString(
      PKG, "SalesforceInput.Error.GettingModuleFields", this.module ), e );
  } finally {
    if ( describeSObjectResult != null ) {
      describeSObjectResult = null;
    }
  }
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:26,代码来源:SalesforceConnection.java

示例3: transaction

import com.sforce.soap.partner.DescribeSObjectResult; //导入方法依赖的package包/类
@Override
public ConfigDiff transaction(ConfigSource config,
        Schema schema, int taskCount,
        OutputPlugin.Control control)
{
    PluginTask task = config.loadConfig(PluginTask.class);
    logger = Exec.getLogger(getClass());
    
    if (task.getResultDir().isPresent() && task.getResultDir().get() != null) {
        File resultDir = new File(task.getResultDir().get());
        if (!resultDir.exists() || !resultDir.isDirectory()) {
            logger.error("{} is not exist or is not directory.", task.getResultDir().get());
            throw new RuntimeException(task.getResultDir().get() + " is not exist or is not directory.");
        }
    }
    
    final String username = task.getUsername();
    final String password = task.getPassword();
    final String loginEndpoint = task.getLoginEndpoint().get();
    try {
        if (client == null) {
            ConnectorConfig connectorConfig = new ConnectorConfig();
            connectorConfig.setUsername(username);
            connectorConfig.setPassword(password);
            connectorConfig.setAuthEndpoint(loginEndpoint + "/services/Soap/u/" +task.getVersion().get() + "/");

            client = Connector.newConnection(connectorConfig);
            GetUserInfoResult userInfo = client.getUserInfo();
            logger.info("login successful with {}", userInfo.getUserName());
            externalIdToObjectNameMap = new HashMap<>();
            DescribeSObjectResult describeResult = client.describeSObject(task.getSObject());
            for (Field field : describeResult.getFields()) {
                if (field.getType() == FieldType.reference) {
                    externalIdToObjectNameMap.put(field.getRelationshipName(), field.getReferenceTo()[0]);
                }
            }
        }
    } catch(ConnectionException ex) {
        logger.error("Login error. Please check your credentials.");
        throw new RuntimeException(ex);
    }
        
    control.run(task.dump());
    return Exec.newConfigDiff();
}
 
开发者ID:tzmfreedom,项目名称:embulk-output-salesforce,代码行数:46,代码来源:SalesforceOutputPlugin.java

示例4: processDocumentObjectFields

import com.sforce.soap.partner.DescribeSObjectResult; //导入方法依赖的package包/类
/**
 * Document the Object Fields.
 */
protected void processDocumentObjectFields()
{
	try
	{
		initSalesforceConnection();
		
		DescribeSObjectResult[] describeSObjectResults = partnerConnection.describeSObjects(new String[] {objectName});
		if (describeSObjectResults != null && describeSObjectResults.length > 0) {
			DescribeSObjectResult describeSObjectResult = describeSObjectResults[0];
			Field[] fields = describeSObjectResult.getFields();
			for (int i = 0; i < fields.length; i++) {
				Field describeField = fields[i];
				
				String fieldApiName = describeField.getName();
				ObjectField field = new ObjectField();
				objectFieldMap.put(fieldApiName.toLowerCase(), field);
				
				field.fieldApiName = fieldApiName;
				field.fieldLabel = describeField.getLabel();
				field.dataType = describeField.getType().toString();
				field.formula = describeField.getCalculatedFormula();
				field.helpText = describeField.getInlineHelpText();
				if (describeField.isUnique()) {
					if (describeField.isCaseSensitive()) {
						field.unique = "Case Sensitive";
					} else {
						field.unique = "Case Insensitive";
					}
				}
				field.externalId = describeField.isExternalId();
			}
		}
		
		populateMetadataValues();
		populateCreatedDate();
		populateLayouts();
		populateFieldTrip();
		
		writeCSV();
	}
	catch (Exception ex)
	{
		String error = "Error trying to document object fields\n";
		error += ex.getMessage();
		ex.printStackTrace();
		throw new BuildException(error, ex);
	}
}
 
开发者ID:YBS,项目名称:YBS-SFDC-Build,代码行数:52,代码来源:DocumentObjectFields.java


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