NIMSDK-AOS  10.5.0
MsgDeleteSelfOption.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.msg.model;
2 
3 import com.netease.nimlib.SDKCacheUI;
4 import com.netease.nimlib.biz.constant.ITalkService;
5 import com.netease.nimlib.push.packet.marshal.Property;
7 
8 public class MsgDeleteSelfOption {
10  private SessionTypeEnum type;
11 
13  private String from;
14 
16  private String to;
17 
19  private String deleteMsgServerId;
20 
22  private String deleteMsgClientId;
23 
25  private long deleteMsgCreateTime;
26 
28  private long time;
29 
31  private String ext;
32 
34  public static final int SESSION_TYPE_P2P = 1;
35 
37  public static final int SESSION_TYPE_TEAM = 2;
38 
40  }
41 
42  public MsgDeleteSelfOption(SessionTypeEnum type, String from, String to, String deleteMsgServerId, String deleteMsgClientId, long deleteMsgCreateTime) {
43  this(type, from, to, deleteMsgServerId, deleteMsgClientId, deleteMsgCreateTime, 0, "");
44  }
45 
46  public MsgDeleteSelfOption(SessionTypeEnum type, String from, String to, String deleteMsgServerId, String deleteMsgClientId, long deleteMsgCreateTime, String ext) {
47  this(type, from, to, deleteMsgServerId, deleteMsgClientId, deleteMsgCreateTime, 0, ext);
48  }
49 
50  public MsgDeleteSelfOption(SessionTypeEnum type, String from, String to, String deleteMsgServerId, String deleteMsgClientId, long deleteMsgCreateTime, long time, String ext) {
51  this.type = type;
52  this.from = from;
53  this.to = to;
54  this.deleteMsgServerId = deleteMsgServerId;
55  this.deleteMsgClientId = deleteMsgClientId;
56  this.deleteMsgCreateTime = deleteMsgCreateTime;
57  this.time = time;
58  this.ext = ext;
59  }
60 
62  return type;
63  }
64 
65  public void setType(SessionTypeEnum type) {
66  this.type = type;
67  }
68 
69  public void setType(int type) {
70  switch (type) {
71  case SESSION_TYPE_P2P:
72  this.type = SessionTypeEnum.P2P;
73  break;
74  case SESSION_TYPE_TEAM:
75  this.type = SessionTypeEnum.Team;
76  break;
77  default:
78  this.type = SessionTypeEnum.None;
79  break;
80  }
81  }
82 
83  public MsgDeleteSelfOption(Property property) {
84  setType(property.getInteger(ITalkService.MsgDeleteSelfTag.type));
85  from = property.get(ITalkService.MsgDeleteSelfTag.from);
86  to = property.get(ITalkService.MsgDeleteSelfTag.to);
87  deleteMsgServerId = property.get(ITalkService.MsgDeleteSelfTag.deleteMsgServerId);
88  deleteMsgClientId = property.get(ITalkService.MsgDeleteSelfTag.deleteMsgClientId);
89  deleteMsgCreateTime = property.getLong(ITalkService.MsgDeleteSelfTag.deleteMsgCreateTime);
90  time = property.getLong(ITalkService.MsgDeleteSelfTag.time);
91  ext = property.get(ITalkService.MsgDeleteSelfTag.ext);
92  }
93 
94  public String getFrom() {
95  return from;
96  }
97 
98  public void setFrom(String from) {
99  this.from = from;
100  }
101 
102  public String getTo() {
103  return to;
104  }
105 
106  public void setTo(String to) {
107  this.to = to;
108  }
109 
110  public String getDeleteMsgServerId() {
111  return deleteMsgServerId;
112  }
113 
114  public void setDeleteMsgServerId(String deleteMsgServerId) {
115  this.deleteMsgServerId = deleteMsgServerId;
116  }
117 
118  public String getDeleteMsgClientId() {
119  return deleteMsgClientId;
120  }
121 
122  public void setDeleteMsgClientId(String deleteMsgClientId) {
123  this.deleteMsgClientId = deleteMsgClientId;
124  }
125 
126  public long getDeleteMsgCreateTime() {
127  return deleteMsgCreateTime;
128  }
129 
130  public void setDeleteMsgCreateTime(long deleteMsgCreateTime) {
131  this.deleteMsgCreateTime = deleteMsgCreateTime;
132  }
133 
134  public long getTime() {
135  return time;
136  }
137 
138  public void setTime(long time) {
139  this.time = time;
140  }
141 
142  public String getExt() {
143  return ext;
144  }
145 
146  public void setExt(String ext) {
147  this.ext = ext;
148  }
149 
150  public String getSessionId() {
151  final String account = SDKCacheUI.getAccount();
152  if (account == null) {
153  return null;
154  }
155  return account.equals(to) ? from : to;
156  }
157 
158  @Override
159  public String toString() {
160  return "MsgDeleteSelfOption{" +
161  "type=" + type +
162  ", from='" + from + '\'' +
163  ", to='" + to + '\'' +
164  ", deleteMsgServerId='" + deleteMsgServerId + '\'' +
165  ", deleteMsgClientId='" + deleteMsgClientId + '\'' +
166  ", deleteMsgCreateTime=" + deleteMsgCreateTime +
167  ", time=" + time +
168  ", ext='" + ext + '\'' +
169  '}';
170  }
171 }
MsgDeleteSelfOption(SessionTypeEnum type, String from, String to, String deleteMsgServerId, String deleteMsgClientId, long deleteMsgCreateTime, long time, String ext)
MsgDeleteSelfOption(SessionTypeEnum type, String from, String to, String deleteMsgServerId, String deleteMsgClientId, long deleteMsgCreateTime, String ext)
MsgDeleteSelfOption(SessionTypeEnum type, String from, String to, String deleteMsgServerId, String deleteMsgClientId, long deleteMsgCreateTime)