本文整理汇总了Java中com.sforce.soap.partner.GetUserInfoResult类的典型用法代码示例。如果您正苦于以下问题:Java GetUserInfoResult类的具体用法?Java GetUserInfoResult怎么用?Java GetUserInfoResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GetUserInfoResult类属于com.sforce.soap.partner包,在下文中一共展示了GetUserInfoResult类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: fetchSFDCinfo
import com.sforce.soap.partner.GetUserInfoResult; //导入依赖的package包/类
/**
* Fetching the Salesforce UserInfo along with session id.
* @return
*/
public static SFDCInfo fetchSFDCinfo() {
App.logInfo("Fetching SalesForce Data");
if(App.sfdcInfo.getSessionId() != null) return App.sfdcInfo;
try {
ConnectorConfig config = new ConnectorConfig();
config.setUsername(App.getUserName());
config.setPassword(App.getUserPassword() + App.getSecurityToken());
config.setAuthEndpoint(App.getPartnerUrl());
partnerConnection = Connector.newConnection(config);
GetUserInfoResult userInfo = partnerConnection.getUserInfo();
App.sfdcInfo.setOrg(userInfo.getOrganizationId());
App.sfdcInfo.setUserId(userInfo.getUserId());
App.sfdcInfo.setSessionId(config.getSessionId());
String sept = config.getServiceEndpoint();
sept = sept.substring(0, sept.indexOf(".com") + 4);
App.sfdcInfo.setEndpoint(sept);
App.logInfo("SDCF Info:\n" + App.sfdcInfo.toString());
return App.sfdcInfo;
} catch (ConnectionException ce) {
ce.printStackTrace();
return null;
}
}
开发者ID:sunand85,项目名称:DF14_Demo,代码行数:30,代码来源:SFDCUtil.java
示例2: setupSessionProperties
import com.sforce.soap.partner.GetUserInfoResult; //导入依赖的package包/类
/**
* Save session to target file
*
* @param connection which you want to saved information
* @throws IOException error during create or write session file
* @throws ConnectionException connection disable during get user information
*/
protected void setupSessionProperties(PartnerConnection connection) throws ConnectionException {
try {
GetUserInfoResult result = connection.getUserInfo();
File sessionFile = new File(sessionFilePath);
if (!sessionFile.exists()) {
File parentPath = sessionFile.getParentFile();
if (!parentPath.exists()) {
parentPath.mkdirs();
}
sessionFile.createNewFile();
}
FileOutputStream sessionOutput = null;
sessionOutput = new FileOutputStream(sessionFile);
Properties sessionProp = new Properties();
sessionProp.setProperty(SalesforceConstant.SESSION_ID, sessionId);
sessionProp.setProperty(SalesforceConstant.SERVICE_ENDPOINT, serviceEndPoint);
sessionProp.setProperty(SalesforceConstant.MAX_VALID_SECONDS, String.valueOf(result.getSessionSecondsValid()));
try {
sessionProp.store(sessionOutput, null);
} finally {
sessionOutput.close();
}
} catch (IOException e) {
throw new ConnectionException("Reuse session fails!", e);
}
}
开发者ID:Talend,项目名称:components,代码行数:34,代码来源:SalesforceSourceOrSink.java
示例3: setUserAttributes
import com.sforce.soap.partner.GetUserInfoResult; //导入依赖的package包/类
private void setUserAttributes(UserModel user, GetUserInfoResult info) {
// Don't want visibility into the real password, make up a dummy
user.password = ExternalAccount;
user.accountType = getAccountType();
// Get full name Attribute
user.displayName = info.getUserFullName();
// Get email address Attribute
user.emailAddress = info.getUserEmail();
}
开发者ID:warpfork,项目名称:gitblit,代码行数:12,代码来源:SalesforceUserService.java
示例4: transaction
import com.sforce.soap.partner.GetUserInfoResult; //导入依赖的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
示例5: getSimpleUsername
import com.sforce.soap.partner.GetUserInfoResult; //导入依赖的package包/类
/**
* Simple user name is the first part of the email address.
*/
private String getSimpleUsername(GetUserInfoResult info) {
String email = info.getUserEmail();
return email.split("@")[0];
}
开发者ID:warpfork,项目名称:gitblit,代码行数:9,代码来源:SalesforceUserService.java
注:本文中的com.sforce.soap.partner.GetUserInfoResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论