summaryrefslogtreecommitdiffstats
path: root/wso2/logging-sdk/src/main/java/org/openo/log/api/OperLogMessage.java
blob: 567cfd071dfd43aa839668096fb94696c6e4f7f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
/**
 * Copyright 2017 ZTE Corporation.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.openo.log.api;

import java.util.Date;

import org.openo.log.impl.Facitility;
import org.openo.log.impl.LogConst;



public class OperLogMessage extends LogMessage {
  private static final long serialVersionUID = 200408041704009L;


  public OperLogMessage() {
    super();
    this.setLogType(LogConst.OPERLOG_TYPE);
  }


  public OperLogMessage(String userName, String operation, String descriptionInfo, String hostname,
      String operateResult, String rank, Date logStartDate, Date logEndDate, String detail) {
    super();
    this.setLogType(LogConst.OPERLOG_TYPE);

    this.userName = userName;
    this.set("userName", userName);

    this.descriptionInfo = descriptionInfo;
    this.setLocale("descriptionInfo", descriptionInfo);

    this.operation = operation;
    this.setLocale("operation", operation);

    this.logStartDate = logStartDate;
    this.set("logStartDate", Facitility.dateFormat(logStartDate));

    this.logEndDate = logEndDate;
    this.set("logEndDate", Facitility.dateFormat(logEndDate));

    this.hostname = hostname;
    this.set("hostname", hostname);

    this.operateResult = operateResult;
    this.set("operateResult", operateResult);

    this.rank = rank;
    this.set("rank", rank);

    this.detail = detail;
    this.setLocale("detail", detail);
  }


  protected String userName = "";


  protected String operation = null;


  protected String descriptionInfo = null;


  private String operationType = "other";

  protected String failReason = null;


  protected String operateResult = LogService.OPERLOG_SUCCESS;


  protected String connectMode = LogService.CONNECT_TYPE_WEB;


  protected String[] resourceIP;


  protected Date logStartDate = null;


  protected Date logEndDate = null;


  protected long linkId = -100;

  protected int isDisplay = LogService.LOG_DISPLAY;

  protected String mac = "";

  /**
   * name(id)|name(id)
   */
  private String[] operateResource = null;


  protected String rank = LogService.OPERLOG_RANK_NORMAL;

  public String getMac() {
    return mac;
  }

  public OperLogMessage setMac(String mac) {
    this.set("mac", mac);
    this.mac = mac;
    return this;
  }


  public String getUserName() {
    return userName;
  }

  public OperLogMessage setUserName(String name) {
    this.userName = name;
    this.set("userName", name);
    return this;
  }

  public String getFailReason() {
    return failReason;
  }

  public OperLogMessage setFailReason(String reason) {
    this.setLocale("failReason", reason);
    this.failReason = reason;
    return this;
  }

  public String getConnectMode() {
    return connectMode;

  }

  public OperLogMessage setConnectMode(String mode) {
    this.set("connectMode", mode);
    this.connectMode = mode;
    return this;
  }

  public long getLinkId() {
    return linkId;
  }

  public OperLogMessage setLinkId(long linkId) {
    this.set("linkId", linkId);
    this.linkId = linkId;
    return this;
  }

  public String getOperateResult() {
    return operateResult;
  }

  public OperLogMessage setOperateResult(String operateResult) {
    this.set("operateResult", operateResult);
    this.operateResult = operateResult;
    return this;
  }

  public String getRank() {
    return rank;
  }

  public OperLogMessage setRank(String rank) {
    this.set("rank", rank);
    this.rank = rank;
    return this;
  }

  public String getDescriptionInfo() {
    return descriptionInfo;
  }

  public OperLogMessage setDescriptionInfo(String desc) {
    this.setLocale("descriptionInfo", desc);
    descriptionInfo = desc;
    return this;
  }

  public String getOperation() {
    return operation;
  }

  public OperLogMessage setOperation(String operation) {
    this.setLocale("operation", operation);
    this.operation = operation;
    return this;
  }

  public String[] getResourceIP() {
    return resourceIP;
  }

  public OperLogMessage setResourceIP(String[] resourceIP) {
    this.set("resourceIP", resourceIP);
    this.resourceIP = resourceIP;
    return this;
  }

  public Date getLogStartDate() {
    return logStartDate;
  }

  public OperLogMessage setLogStartDate(Date logStartDate) {
    this.set("logStartDate", Facitility.dateFormat(logStartDate));
    this.logStartDate = logStartDate;
    return this;
  }

  public Date getLogEndDate() {
    return logEndDate;
  }

  public OperLogMessage setLogEndDate(Date logEndDate) {
    this.set("logEndDate", Facitility.dateFormat(logEndDate));
    this.logEndDate = logEndDate;
    return this;
  }

  public int getIsDisplay() {
    return isDisplay;
  }

  public OperLogMessage setIsDisplay(int isDisplay) {
    this.set("isDisplay", isDisplay);
    this.isDisplay = isDisplay;
    return this;
  }

  public String[] getOperateResource() {
    return operateResource;
  }

  public OperLogMessage setOperateResource(String[] operateResource) {
    this.set("operateResource", operateResource);
    this.operateResource = operateResource;
    return this;
  }

  public String getOperationType() {
    return operationType;
  }

  public OperLogMessage setOperationType(String operationType) {

    this.operationType = operationType;
    return this;
  }



  public OperLogMessage setHostname(String hostname) {
    this.set("hostname", hostname);
    this.hostname = hostname;
    return this;
  }


  public LogMessage setId(long id) {
    this.set("id", id);
    this.id = id;
    return this;
  }


  public LogMessage setDetail(String detail) {
    this.detail = detail;
    this.setLocale("detail", detail);
    return this;
  }

}