Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * #%L
   * BroadleafCommerce Framework
   * %%
   * Copyright (C) 2009 - 2013 Broadleaf Commerce
   * %%
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  * 
  *       http://www.apache.org/licenses/LICENSE-2.0
  * 
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  * #L%
  */
 package org.broadleafcommerce.core.social.domain;
 
This class creates the following BLC domain object for the Spring Social User Connection. The following is the SQL that is needed for Spring Social to achieve JDBC-based persistence. http://static.springsource.org/spring-social/docs/1.0.x/reference/html/serviceprovider.html#service-providers-persisting-connections Spring Social expects the following table be created: ----------------------------------------------------- create table UserConnection (userId varchar(255) not null, providerId varchar(255) not null, providerUserId varchar(255), rank int not null, displayName varchar(255), profileUrl varchar(512), imageUrl varchar(512), accessToken varchar(255) not null, secret varchar(255), refreshToken varchar(255), expireTime bigint, primary key (userId, providerId, providerUserId)); create unique index UserConnectionRank on UserConnection(userId, providerId, rank); ------------------------------------------------------ NOTE: We are prefixing the table with "BLC_" to be consistent with the rest of the framework. The prefix is injected into JdbcUsersConnectionRepository

Author(s):
elbertbautista
See also:
org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository
 
 @Table(name = "BLC_UserConnection")
 public class UserConnectionImpl implements UserConnection {
 
     @EmbeddedId
 
     @Column(name = "rank", nullable = false)
     private Integer rank;
 
     @Column(name = "displayName")
     private String displayName;
 
     @Column(name = "profileUrl")
     private String profileUrl;
 
     @Column(name = "imageUrl")
     private String imageUrl;
 
     @Column(name = "accessToken", nullable = false)
     private String accessToken;
 
     @Column(name = "secret")
     private String secret;
 
     @Column(name = "refreshToken")
     private String refreshToken;
 
     @Column(name = "expireTime")
     private Long expireTime;
 
     @Override
     public UserConnectionPK getUserConnectionPK() {
         return ;
     }
 
     @Override
     public void setUserConnectionPK(UserConnectionPK userConnectionPK) {
         this. = userConnectionPK;
    }
    @Override
    public Integer getRank() {
        return ;
    }
    @Override
    public void setRank(Integer rank) {
        this. = rank;
    }
    @Override
    public String getDisplayName() {
        return ;
    }
    @Override
    public void setDisplayName(String displayName) {
        this. = displayName;
    }
    @Override
    public String getProfileUrl() {
        return ;
    }
    @Override
    public void setProfileUrl(String profileUrl) {
        this. = profileUrl;
    }
    @Override
    public String getImageUrl() {
        return ;
    }
    @Override
    public void setImageUrl(String imageUrl) {
        this. = imageUrl;
    }
    @Override
    public String getAccessToken() {
        return ;
    }
    @Override
    public void setAccessToken(String accessToken) {
        this. = accessToken;
    }
    @Override
    public String getSecret() {
        return ;
    }
    @Override
    public void setSecret(String secret) {
        this. = secret;
    }
    @Override
    public String getRefreshToken() {
        return ;
    }
    @Override
    public void setRefreshToken(String refreshToken) {
        this. = refreshToken;
    }
    @Override
    public Long getExpireTime() {
        return ;
    }
    @Override
    public void setExpireTime(Long expireTime) {
        this. = expireTime;
    }
    public static class UserConnectionPK implements Serializable {
        
The Constant serialVersionUID.
        private static final long serialVersionUID = 1L;
        @Column(name = "userId", nullable = false)
        private String userId;
        @Column(name = "providerId", nullable = false)
        private String providerId;
        @Column(name = "providerUserId")
        private String providerUserId;
        public String getUserId() {
            return ;
        }
        public void setUserId(String userId) {
            this. = userId;
        }
        public String getProviderId() {
            return ;
        }
        public void setProviderId(String providerId) {
            this. = providerId;
        }
        public String getProviderUserId() {
            return ;
        }
        public void setProviderUserId(String providerUserId) {
            this. = providerUserId;
        }
        @Override
        public boolean equals(Object obj) {
            if (obj == nullreturn false;
            else if (!(obj instanceof UserConnectionPK)) return false;
            return .equals(((UserConnectionPKobj).getUserId()) &&
                    .equals(((UserConnectionPKobj).getProviderId()) &&
                    .equals(((UserConnectionPKobj).getProviderUserId());
        }
        @Override
        public int hashCode() {
            return .hashCode() + .hashCode() + .hashCode();
        }
    }
New to GrepCode? Check out our FAQ X