001/**
002 * Copyright 2014 Tampere University of Technology, Pori Department
003 * 
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 * 
008 *   http://www.apache.org/licenses/LICENSE-2.0
009 * 
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package service.tut.pori.users.twitter;
017
018import java.util.Date;
019
020import core.tut.pori.users.UserIdentity;
021
022/**
023 * Twitter OAuth request token.
024 */
025public class RequestToken {
026  private String _redirectUri = null;
027  private String _secret = null;
028  private String _token = null;
029  private Date _updated = null;
030  private UserIdentity _userId = null;
031  private String _verifier = null;
032  
033  /**
034   * 
035   */
036  public RequestToken(){
037    // nothing needed
038  }
039  
040  /**
041   * 
042   * @param redirectUri
043   * @param token
044   * @param tokenSecret
045   * @param userId
046   */
047  public RequestToken(String redirectUri, String token, String tokenSecret, UserIdentity userId){
048    _redirectUri = redirectUri;
049    _token = token;
050    _secret = tokenSecret;
051    _userId = userId;
052  }
053
054  /**
055   * @return the requestToken
056   */
057  public String getToken() {
058    return _token;
059  }
060
061  /**
062   * @param requestToken the requestToken to set
063   */
064  public void setToken(String requestToken) {
065    _token = requestToken;
066  }
067
068  /**
069   * @return the requestTokenSecret
070   */
071  public String getSecret() {
072    return _secret;
073  }
074
075  /**
076   * @param requestTokenSecret the requestTokenSecret to set
077   */
078  public void setSecret(String requestTokenSecret) {
079    _secret = requestTokenSecret;
080  }
081
082  /**
083   * @return the redirectUri
084   */
085  public String getRedirectUri() {
086    return _redirectUri;
087  }
088
089  /**
090   * @param redirectUri the redirectUri to set
091   */
092  public void setRedirectUri(String redirectUri) {
093    _redirectUri = redirectUri;
094  }
095
096  /**
097   * @return the updated
098   */
099  public Date getUpdated() {
100    return _updated;
101  }
102
103  /**
104   * @param updated the updated to set
105   */
106  public void setUpdated(Date updated) {
107    _updated = updated;
108  }
109
110  /**
111   * @return the userId
112   */
113  public UserIdentity getUserId() {
114    return _userId;
115  }
116
117  /**
118   * @param userId the userId to set
119   */
120  public void setUserId(UserIdentity userId) {
121    _userId = userId;
122  }
123  
124  /**
125   * 
126   * @return user id value or null if no user id given
127   */
128  public Long getUserIdValue(){
129    return (UserIdentity.isValid(_userId) ? _userId.getUserId() : null);
130  }
131
132  /**
133   * @return the tokenVerifier
134   */
135  public String getVerifier() {
136    return _verifier;
137  }
138
139  /**
140   * @param tokenVerifier the tokenVerifier to set
141   */
142  public void setVerifier(String tokenVerifier) {
143    _verifier = tokenVerifier;
144  }
145}