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


Java ConnectorConfig.getSessionId方法代码示例

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


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

示例1: doConnection

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
/**
 * Create a connection with specified connector configuration
 *
 * @param config connector configuration with endpoint/userId/password
 * @param openNewSession whether need to create new session
 * @return PartnerConnection object with correct session id
 * @throws ConnectionException create connection fails
 */
protected PartnerConnection doConnection(ConnectorConfig config, boolean openNewSession) throws ConnectionException {
    if (!openNewSession) {
        config.setSessionId(this.sessionId);
        config.setServiceEndpoint(this.serviceEndPoint);
    } else {
        SalesforceConnectionProperties connProps = getConnectionProperties();
        String endpoint = connProps.endpoint.getStringValue();
        endpoint = StringUtils.strip(endpoint, "\"");
        if (SalesforceConnectionProperties.LoginType.OAuth.equals(connProps.loginType.getValue())) {
            SalesforceOAuthConnection oauthConnection = new SalesforceOAuthConnection(connProps, endpoint,
                    connProps.apiVersion.getValue());
            oauthConnection.login(config);
        } else {
            config.setAuthEndpoint(endpoint);
        }
    }

    config.setManualLogin(true);
    // Creating connection and not login there.
    PartnerConnection connection = new PartnerConnection(config);
    // Need to discard manual login parameter in configs to avoid execution errors.
    config.setManualLogin(false);
    if (null == config.getSessionId()) {
        performLogin(config, connection);
    }

    if (openNewSession && isReuseSession()) {
        this.sessionId = config.getSessionId();
        this.serviceEndPoint = config.getServiceEndpoint();
        if (this.sessionId != null && this.serviceEndPoint != null) {
            // update session file with current sessionId/serviceEndPoint
            setupSessionProperties(connection);
        }
    }
    return connection;
}
 
开发者ID:Talend,项目名称:components,代码行数:45,代码来源:SalesforceSourceOrSink.java

示例2: executeAnonymous

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public ExecuteAnonymousResultExt executeAnonymous(String code, LogInfo[] logInfo, Connection connection,
        int readTimeout) {
    ConnectorConfig connectorConfig = connection.getConnectorConfig();
    
    boolean orig_traceMsg = connectorConfig.isTraceMessage();
    boolean orig_prettyPrintXml = connectorConfig.isPrettyPrintXml();
    String orig_sessionId = connectorConfig.getSessionId();
    String orig_serviceEndpoint = connectorConfig.getServiceEndpoint();
    int orig_readTimeout = connectorConfig.getReadTimeout();
    
    connectorConfig.setTraceMessage(true);
    connectorConfig.setPrettyPrintXml(true);
    connectorConfig.setSessionId(connection.getSessionId());
    connectorConfig.setServiceEndpoint(connection.getApexServiceEndpoint(connection.getServiceEndpoint()));
    connectorConfig.setReadTimeout(readTimeout);
    
    SoapConnection apex = null;
    try {
        apex = Connector.newConnection(connectorConfig);
        apex.setDebuggingHeader(logInfo, LogType.None);
        return new ExecuteAnonymousResultExt(apex.executeAnonymous(code), apex.getDebuggingInfo());
    } catch (ConnectionException e) {
        ExecuteAnonymousResult er = errorExecuteAnonymousResult(connectorConfig, e);
        ExecuteAnonymousResultExt erx = new ExecuteAnonymousResultExt(er, null == apex ? null : apex.getDebuggingInfo());
        DebuggingInfo_element dbi = new DebuggingInfo_element();
        dbi.setDebugLog(e.getMessage());
        erx.setDebugInfo(dbi);
        return erx;
    } finally {
        connectorConfig.setTraceMessage(orig_traceMsg);
        connectorConfig.setPrettyPrintXml(orig_prettyPrintXml);
        connectorConfig.setSessionId(orig_sessionId);
        connectorConfig.setServiceEndpoint(orig_serviceEndpoint);
        connectorConfig.setReadTimeout(orig_readTimeout);
    }
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:37,代码来源:ApexService.java

示例3: setSessionIdFromConnectorConfig

import com.sforce.ws.ConnectorConfig; //导入方法依赖的package包/类
public void setSessionIdFromConnectorConfig(ConnectorConfig config) {
	sessionIdFromConnectorConfig = config.getSessionId();
}
 
开发者ID:forcedotcom,项目名称:ApexUnit,代码行数:4,代码来源:ConnectionHandler.java


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