當前位置: 首頁>>代碼示例>>Java>>正文


Java Connection.createData方法代碼示例

本文整理匯總了Java中org.springframework.social.connect.Connection.createData方法的典型用法代碼示例。如果您正苦於以下問題:Java Connection.createData方法的具體用法?Java Connection.createData怎麽用?Java Connection.createData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.social.connect.Connection的用法示例。


在下文中一共展示了Connection.createData方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: connectionToUserSocialConnection

import org.springframework.social.connect.Connection; //導入方法依賴的package包/類
private SocialUserConnection connectionToUserSocialConnection(final Connection<?> connection,
                                                              final Long rank) {
    final ConnectionData connectionData = connection.createData();

    return SocialUserConnection.builder()
            .userId(userId)
            .providerId(connection.getKey().getProviderId())
            .providerUserId(connection.getKey().getProviderUserId())
            .rank(rank)
            .displayName(connection.getDisplayName())
            .profileURL(connection.getProfileUrl())
            .imageURL(connection.getImageUrl())
            .accessToken(connectionData.getAccessToken())
            .secret(connectionData.getSecret())
            .refreshToken(connectionData.getRefreshToken())
            .expireTime(connectionData.getExpireTime())
            .build();
}
 
開發者ID:vlsidlyarevich,項目名稱:unity,代碼行數:19,代碼來源:CustomSocialConnectionRepository.java

示例2: updateConnection

import org.springframework.social.connect.Connection; //導入方法依賴的package包/類
public void updateConnection(Connection<?> connection) {
	ConnectionData data = connection.createData();
	SQLiteDatabase db = repositoryHelper.getWritableDatabase();
	ContentValues values = new ContentValues();
	values.put("displayName", data.getDisplayName());
	values.put("profileUrl", data.getProfileUrl());
	values.put("imageUrl", data.getImageUrl());
	values.put("accessToken", encrypt(data.getAccessToken()));
	values.put("secret", encrypt(data.getSecret()));
	values.put("refreshToken", encrypt(data.getRefreshToken()));
	values.put("expireTime", data.getExpireTime());
	final String whereClause = "userId = ? and providerId = ? and providerUserId = ?";
	final String[] whereArgs = { userId, data.getProviderId(), data.getProviderUserId() };
	db.update("UserConnection", values, whereClause, whereArgs);
	db.close();
}
 
開發者ID:bestarandyan,項目名稱:ShoppingMall,代碼行數:17,代碼來源:SQLiteConnectionRepository.java

示例3: updateConnectionAccessFields

import org.springframework.social.connect.Connection; //導入方法依賴的package包/類
@Test
public void updateConnectionAccessFields() {
    insertFacebookConnection();
    Connection<TestFacebookApi> facebook = connectionRepository.getPrimaryConnection(TestFacebookApi.class);
    assertEquals("234567890", facebook.getApi().getAccessToken());
    facebook.refresh();
    connectionRepository.updateConnection(facebook);
    Connection<TestFacebookApi> facebook2 = connectionRepository.getPrimaryConnection(TestFacebookApi.class);
    assertEquals("765432109", facebook2.getApi().getAccessToken());
    ConnectionData data = facebook.createData();
    assertEquals("654321098", data.getRefreshToken());
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:13,代碼來源:CustomSocialUsersConnectionRepositoryIntTest.java

示例4: signIn

import org.springframework.social.connect.Connection; //導入方法依賴的package包/類
@Override
  public String signIn(String localUserId, Connection<?> connection, NativeWebRequest request) {
     User user = userRepository.findByUsername(localUserId);
ConnectionData connectionData =  connection.createData();
SignInUtils.authorizeUser(user);
SignInUtils.setUserConnection(request, connectionData);
      return null;
  }
 
開發者ID:mintster,項目名稱:nixmash-blog,代碼行數:9,代碼來源:SocialSignInAdapter.java

示例5: connectionToAuth

import org.springframework.social.connect.Connection; //導入方法依賴的package包/類
public static SocialAuthentication connectionToAuth(Connection<?> connection) {
    SocialAuthentication auth = new SocialAuthentication();
    ConnectionData data = connection.createData();
    auth.setProviderId(data.getProviderId());
    auth.setToken(data.getAccessToken());
    auth.setRefreshToken(data.getRefreshToken());
    auth.setSecret(data.getSecret());
    auth.setProviderUserId(data.getProviderUserId());
    return auth;
}
 
開發者ID:Glamdring,項目名稱:scientific-publishing,代碼行數:11,代碼來源:JpaConnectionRepository.java

示例6: addConnection

import org.springframework.social.connect.Connection; //導入方法依賴的package包/類
public void addConnection(Connection<?> connection) {
	try {
		ConnectionData data = connection.createData();
		SQLiteDatabase db = repositoryHelper.getWritableDatabase();

		// generate rank
		final String sql = "select coalesce(max(rank) + 1, 1) as rank from UserConnection where userId = ? and providerId = ?";
		final String[] selectionArgs = { userId, data.getProviderId() };
		Cursor c = db.rawQuery(sql, selectionArgs);
		c.moveToFirst();
		int rank = c.getInt(c.getColumnIndex("rank"));
		c.close();

		// insert connection
		ContentValues values = new ContentValues();
		values.put("userId", userId);
		values.put("providerId", data.getProviderId());
		values.put("providerUserId", data.getProviderUserId());
		values.put("rank", rank);
		values.put("displayName", data.getDisplayName());
		values.put("profileUrl", data.getProfileUrl());
		values.put("imageUrl", data.getImageUrl());
		values.put("accessToken", encrypt(data.getAccessToken()));
		values.put("secret", encrypt(data.getSecret()));
		values.put("refreshToken", encrypt(data.getRefreshToken()));
		values.put("expireTime", data.getExpireTime());
		db.insertOrThrow("UserConnection", null, values);
		db.close();
	} catch (SQLiteConstraintException e) {
		throw new DuplicateConnectionException(connection.getKey());
	}
}
 
開發者ID:bestarandyan,項目名稱:ShoppingMall,代碼行數:33,代碼來源:SQLiteConnectionRepository.java

示例7: connectionToUserSocialConnection

import org.springframework.social.connect.Connection; //導入方法依賴的package包/類
private SocialUserConnection connectionToUserSocialConnection(Connection<?> connection, Long rank) {
  ConnectionData connectionData = connection.createData();
  return new SocialUserConnection(userId, connection.getKey().getProviderId(), connection.getKey().getProviderUserId(),
    rank, connection.getDisplayName(), connection.getProfileUrl(), connection.getImageUrl(), connectionData.getAccessToken(),
    connectionData.getSecret(), connectionData.getRefreshToken(), connectionData.getExpireTime()
  );
}
 
開發者ID:priitl,項目名稱:p2p-webtv,代碼行數:8,代碼來源:CustomSocialConnectionRepository.java

示例8: updateConnectionAccessFields

import org.springframework.social.connect.Connection; //導入方法依賴的package包/類
@Test
public void updateConnectionAccessFields() {
  insertFacebookConnection();
  Connection<TestFacebookApi> facebook = connectionRepository.getPrimaryConnection(TestFacebookApi.class);
  assertEquals("234567890", facebook.getApi().getAccessToken());
  facebook.refresh();
  connectionRepository.updateConnection(facebook);
  Connection<TestFacebookApi> facebook2 = connectionRepository.getPrimaryConnection(TestFacebookApi.class);
  assertEquals("765432109", facebook2.getApi().getAccessToken());
  ConnectionData data = facebook.createData();
  assertEquals("654321098", data.getRefreshToken());
}
 
開發者ID:priitl,項目名稱:p2p-webtv,代碼行數:13,代碼來源:CustomSocialUsersConnectionRepositoryTest.java

示例9: ProviderSignInAttempt

import org.springframework.social.connect.Connection; //導入方法依賴的package包/類
public ProviderSignInAttempt(Connection<?> connection) {
    this.connectionData = connection.createData();
}
 
開發者ID:xm-online,項目名稱:xm-uaa,代碼行數:4,代碼來源:ProviderSignInAttempt.java


注:本文中的org.springframework.social.connect.Connection.createData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。