com.ahuralab.mozaic.db.Message.java Source code

Java tutorial

Introduction

Here is the source code for com.ahuralab.mozaic.db.Message.java

Source

/* 
 Copyright (c) 2013, Panteha Saeedi All rights reserved.
     
   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.
*/

package com.ahuralab.mozaic.db;

import java.util.Date;

import twitter4j.Status;
import twitter4j.User;

/**
 * @author pani
 *
 */
public class Message {

    private final String content;
    private final Date creationDate;
    private final long retweetCount;

    private final long userId;
    private final String userName;
    private final String userScreenName;
    private final String userLocation;
    private final String userDescription;
    private final String userHtmlImage;
    private final long userStatusId;
    private final long originalStatusId;
    private final int hasConversation;
    private final int numberOfFollowers;
    private final int numberOfTweetSent;

    public static Message create(Status status) {

        User user = status.getUser();

        return new Message(status.getText(), status.getCreatedAt(), status.getRetweetCount(), user.getId(),
                user.getName(), user.getScreenName(), user.getLocation(), user.getDescription(),
                user.getProfileImageURL(), status.getId(), 0, 0, user.getFollowersCount(), user.getStatusesCount());
    }

    public Message(String content, Date creationDate, long retweetCount, long userId, String userName,
            String userScreenName, String userLocation, String userDescription, String userHtmlImage,
            long userStatusId, long originalStatusId, int hasConversation, int numberOfFollowers,
            int numberOfTweetSent) {
        this.content = content;
        this.creationDate = creationDate;
        this.retweetCount = retweetCount;
        this.userId = userId;
        this.userName = userName;
        this.userScreenName = userScreenName;
        this.userLocation = userLocation;
        this.userDescription = userDescription;
        this.userHtmlImage = userHtmlImage;
        this.userStatusId = userStatusId;
        this.originalStatusId = originalStatusId;
        this.hasConversation = hasConversation;
        this.numberOfFollowers = numberOfFollowers;
        this.numberOfTweetSent = numberOfTweetSent;
    }

    public String getContent() {
        return content;
    }

    public Date getCreationDate() {
        return creationDate;
    }

    public long getRetweetCount() {
        return retweetCount;
    }

    public long getUserId() {
        return userId;
    }

    public String getUserName() {
        return userName;
    }

    public String getUserScreenName() {
        return userScreenName;
    }

    public String getUserLocation() {
        return userLocation;
    }

    public String getUserDescription() {
        return userDescription;
    }

    public String getUserImage() {
        return userHtmlImage;
    }

    public long getUserTweetId() {
        return userStatusId;
    }

    public long getOriginalStatusId() {
        return originalStatusId;
    }

    public int getIfHasConversation() {
        return hasConversation;
    }

    public int getNumberOfTweets() {
        return numberOfTweetSent;
    }

    public int getNumberOfFollowers() {
        return numberOfFollowers;
    }

}