Merge remote-tracking branch 'origin/master' into notification-service
[platform/upstream/iotivity.git] / service / notification / android / notification-service / src / main / java / org / iotivity / service / ns / common / Message.java
1 //******************************************************************
2 //
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 package org.iotivity.service.ns.common;
22
23 import android.util.Log;
24
25 /**
26   * @class   Message
27   * @brief   This class provides implementation of Notification Message object.
28   */
29 public class Message
30 {
31     private static final String LOG_TAG = "NotificationService_Message";
32
33     public enum MessageType
34     {
35         ALERT(0),
36         NOTICE(1),
37         EVENT(2),
38         INFO(3);
39         private int type;
40
41         private MessageType(int type)
42     {
43         this.type = type;
44     }
45
46     public int getMessageType()
47     {
48         return this.type;
49     }
50     };
51     public long mMessageId                     = 0;
52     public String mProviderId                  = null;
53
54     public String mSourceName                  = null;
55     public MessageType mType                   = MessageType.ALERT;
56     public String mTime                        = null;
57     public long mTTL                           = 0;
58     public String mTitle                       = null;
59     public String mContentText                 = null;
60     public MediaContents mMediaContents        = null;
61
62     private long mNativeHandle                 = 0;
63
64     public Message(String title, String contentText, String sourceName)
65     {
66         Log.i (LOG_TAG, "Message()");
67
68         mTitle = title;
69         mContentText = contentText;
70         mSourceName = sourceName;
71     }
72
73     public long getMessageId()
74     {
75         return mMessageId;
76     }
77
78     public String getProviderId()
79     {
80         return mProviderId;
81     }
82
83     public String getSourceName ()
84     {
85         return mSourceName;
86     }
87
88     public MessageType getType()
89     {
90         return mType;
91     }
92
93     public String getTime()
94     {
95         return mTime;
96     }
97
98     public long getTTL()
99     {
100         return mTTL;
101     }
102
103     public String getTitle()
104     {
105         return mTitle;
106     }
107
108     public String getContentText()
109     {
110         return mContentText;
111     }
112
113     public MediaContents getMediaContents()
114     {
115         return mMediaContents;
116     }
117
118     public void setSourceName (String sourceName)
119     {
120         mSourceName = sourceName;
121     }
122
123     public void setType(MessageType type)
124     {
125         mType = type;
126     }
127
128     public void setTime(String time)
129     {
130         mTime = time;
131     }
132
133     public void setTTL(long ttl)
134     {
135         mTTL = ttl;
136     }
137
138     public void setTitle(String title)
139     {
140         mTitle = title;
141     }
142
143     public void setContentText(String contextText)
144     {
145         mContentText = contextText;
146     }
147
148     public void setMediaContents(MediaContents mediaContents)
149     {
150         mMediaContents = mediaContents;
151     }
152 }