f2f20579b449f56019e7c6a3d94b49677aca80b5
[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 import org.iotivity.base.OcRepresentation;
25
26 /**
27   * @class   Message
28   * @brief   This class provides implementation of Notification Message object.
29   */
30 public class Message
31 {
32     private static final String LOG_TAG = "NotificationService_Message";
33
34     public enum MessageType
35     {
36         ALERT(1),
37         NOTICE(2),
38         EVENT(3),
39         INFO(4),
40         WARNING(5);
41         private int type;
42
43         private MessageType(int type)
44         {
45             this.type = type;
46         }
47
48         public int getMessageType()
49         {
50             return this.type;
51         }
52     };
53     public long mMessageId                     = 0;
54     public String mProviderId                  = null;
55
56     public String mSourceName                  = null;
57     public MessageType mType                   = MessageType.ALERT;
58     public String mTime                        = null;
59     public long mTTL                           = 0;
60     public String mTitle                       = null;
61     public String mContentText                 = null;
62     public MediaContents mMediaContents        = null;
63     public String mTopic                       = null;
64     public OcRepresentation mExtraInfo         = null;
65
66     private long mNativeHandle                 = 0;
67
68     public Message(String title, String contentText, String sourceName)
69     {
70         Log.i (LOG_TAG, "Message()");
71
72         mTitle = title;
73         mContentText = contentText;
74         mSourceName = sourceName;
75     }
76
77     public long getMessageId()
78     {
79         return mMessageId;
80     }
81
82     public String getProviderId()
83     {
84         return mProviderId;
85     }
86
87     public String getSourceName ()
88     {
89         return mSourceName;
90     }
91
92     public MessageType getType()
93     {
94         return mType;
95     }
96
97     public String getTime()
98     {
99         return mTime;
100     }
101
102     public long getTTL()
103     {
104         return mTTL;
105     }
106
107     public String getTitle()
108     {
109         return mTitle;
110     }
111
112     public String getContentText()
113     {
114         return mContentText;
115     }
116
117     public MediaContents getMediaContents()
118     {
119         return mMediaContents;
120     }
121
122     public String getTopic()
123     {
124         return mTopic;
125     }
126
127     public OcRepresentation getExtraInfo()
128     {
129         return mExtraInfo;
130     }
131
132     public void setSourceName (String sourceName)
133     {
134         mSourceName = sourceName;
135     }
136
137     public void setType(MessageType type)
138     {
139         mType = type;
140     }
141
142     public void setTime(String time)
143     {
144         mTime = time;
145     }
146
147     public void setTTL(long ttl)
148     {
149         mTTL = ttl;
150     }
151
152     public void setTitle(String title)
153     {
154         mTitle = title;
155     }
156
157     public void setContentText(String contextText)
158     {
159         mContentText = contextText;
160     }
161
162     public void setMediaContents(MediaContents mediaContents)
163     {
164         mMediaContents = mediaContents;
165     }
166
167     public void setTopic(String topic)
168     {
169         mTopic = topic;
170     }
171
172     public void setExtraInfo(OcRepresentation extraInfo)
173     {
174         mExtraInfo = extraInfo;
175     }
176 }