Exemplo n.º 1
0
 public void WriteTweet(FSTweet tweet)
 {
     CellSet.Row row = TableDomainMappers.TweetToRow(tweet);
     CellSet set = new CellSet();
     set.rows.Add(row);
     HadoopContext.HBaseClient.StoreCells(HadoopContext.TweetTableName, set);
 }
Exemplo n.º 2
0
        public void WriteTweet(FSTweet tweet)
        {
            CellSet.Row row = TableDomainMappers.TweetToRow(tweet);
            CellSet     set = new CellSet();

            set.rows.Add(row);
            HadoopContext.HBaseClient.StoreCells(HadoopContext.TweetTableName, set);
        }
Exemplo n.º 3
0
 private static FSTweet InviTweetToPTTweet(ITweet t)
 {
     FSTweet ptTweet = new FSTweet();
     if (t.Coordinates != null)
     {
         ptTweet.Coordinates = t.Coordinates.Longitude.ToString() + ","
             + t.Coordinates.Latitude.ToString();
     }
     ptTweet.CreatedOn = t.CreatedAt;
     ptTweet.Id = t.Id.ToString();
     ptTweet.ReplyToId = t.InReplyToUserIdStr;
     ptTweet.Text = t.Text;
     return ptTweet;
 }
Exemplo n.º 4
0
        private static FSTweet InviTweetToPTTweet(ITweet t)
        {
            FSTweet ptTweet = new FSTweet();

            if (t.Coordinates != null)
            {
                ptTweet.Coordinates = t.Coordinates.Longitude.ToString() + ","
                                      + t.Coordinates.Latitude.ToString();
            }
            ptTweet.CreatedOn = t.CreatedAt;
            ptTweet.Id        = t.Id.ToString();
            ptTweet.ReplyToId = t.InReplyToUserIdStr;
            ptTweet.Text      = t.Text;
            return(ptTweet);
        }
Exemplo n.º 5
0
        public static CellSet.Row TweetToRow(FSTweet tweet)
        {
            // Create a row with a key
            var row = new CellSet.Row {
                key = Encoding.UTF8.GetBytes(tweet.Id)
            };

            // Add columns to the row
            row.values.Add(
                new Cell
            {
                column = Encoding.UTF8.GetBytes("d:Text"),
                data   = Encoding.UTF8.GetBytes(tweet.Text)
            });
            row.values.Add(
                new Cell
            {
                column = Encoding.UTF8.GetBytes("d:CreatedOn"),
                data   = Encoding.UTF8.GetBytes(tweet.CreatedOn.ToString())
            });
            if (tweet.ReplyToId != null)
            {
                row.values.Add(
                    new Cell
                {
                    column = Encoding.UTF8.GetBytes("d:ReplyToId"),
                    data   = Encoding.UTF8.GetBytes(tweet.ReplyToId)
                });
            }
            if (tweet.Coordinates != null)
            {
                row.values.Add(
                    new Cell
                {
                    column = Encoding.UTF8.GetBytes("d:Coordinates"),
                    data   = Encoding.UTF8.GetBytes(tweet.Coordinates)
                });
            }
            return(row);
        }
Exemplo n.º 6
0
 public static CellSet.Row TweetToRow(FSTweet tweet)
 {
     // Create a row with a key
     var row = new CellSet.Row { key = Encoding.UTF8.GetBytes(tweet.Id) };
     // Add columns to the row
     row.values.Add(
         new Cell
         {
             column = Encoding.UTF8.GetBytes("d:Text"),
             data = Encoding.UTF8.GetBytes(tweet.Text)
         });
     row.values.Add(
         new Cell
         {
             column = Encoding.UTF8.GetBytes("d:CreatedOn"),
             data = Encoding.UTF8.GetBytes(tweet.CreatedOn.ToString())
         });
     if (tweet.ReplyToId != null)
     {
         row.values.Add(
             new Cell
             {
                 column = Encoding.UTF8.GetBytes("d:ReplyToId"),
                 data = Encoding.UTF8.GetBytes(tweet.ReplyToId)
             });
     }
     if (tweet.Coordinates != null)
     {
         row.values.Add(
             new Cell
             {
                 column = Encoding.UTF8.GetBytes("d:Coordinates"),
                 data = Encoding.UTF8.GetBytes(tweet.Coordinates)
             });
     }
     return row;
 }