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