Add Logging sdk
[vfc/nfvo/wfengine.git] / logging-sdk / src / main / java / org / openo / log / api / OperLogMessage.java
1 /**
2  * Copyright 2017 ZTE Corporation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.openo.log.api;
17
18 import java.util.Date;
19
20 import org.openo.log.impl.Facitility;
21 import org.openo.log.impl.LogConst;
22
23
24
25 public class OperLogMessage extends LogMessage {
26   private static final long serialVersionUID = 200408041704009L;
27
28
29   public OperLogMessage() {
30     super();
31     this.setLogType(LogConst.OPERLOG_TYPE);
32   }
33
34
35   public OperLogMessage(String userName, String operation, String descriptionInfo, String hostname,
36       String operateResult, String rank, Date logStartDate, Date logEndDate, String detail) {
37     super();
38     this.setLogType(LogConst.OPERLOG_TYPE);
39
40     this.userName = userName;
41     this.set("userName", userName);
42
43     this.descriptionInfo = descriptionInfo;
44     this.setLocale("descriptionInfo", descriptionInfo);
45
46     this.operation = operation;
47     this.setLocale("operation", operation);
48
49     this.logStartDate = logStartDate;
50     this.set("logStartDate", Facitility.dateFormat(logStartDate));
51
52     this.logEndDate = logEndDate;
53     this.set("logEndDate", Facitility.dateFormat(logEndDate));
54
55     this.hostname = hostname;
56     this.set("hostname", hostname);
57
58     this.operateResult = operateResult;
59     this.set("operateResult", operateResult);
60
61     this.rank = rank;
62     this.set("rank", rank);
63
64     this.detail = detail;
65     this.setLocale("detail", detail);
66   }
67
68
69   protected String userName = "";
70
71
72   protected String operation = null;
73
74
75   protected String descriptionInfo = null;
76
77
78   private String operationType = "other";
79
80   protected String failReason = null;
81
82
83   protected String operateResult = LogService.OPERLOG_SUCCESS;
84
85
86   protected String connectMode = LogService.CONNECT_TYPE_WEB;
87
88
89   protected String[] resourceIP;
90
91
92   protected Date logStartDate = null;
93
94
95   protected Date logEndDate = null;
96
97
98   protected long linkId = -100;
99
100   protected int isDisplay = LogService.LOG_DISPLAY;
101
102   protected String mac = "";
103
104   /**
105    * name(id)|name(id)
106    */
107   private String[] operateResource = null;
108
109
110   protected String rank = LogService.OPERLOG_RANK_NORMAL;
111
112   public String getMac() {
113     return mac;
114   }
115
116   public OperLogMessage setMac(String mac) {
117     this.set("mac", mac);
118     this.mac = mac;
119     return this;
120   }
121
122
123   public String getUserName() {
124     return userName;
125   }
126
127   public OperLogMessage setUserName(String name) {
128     this.userName = name;
129     this.set("userName", name);
130     return this;
131   }
132
133   public String getFailReason() {
134     return failReason;
135   }
136
137   public OperLogMessage setFailReason(String reason) {
138     this.setLocale("failReason", reason);
139     this.failReason = reason;
140     return this;
141   }
142
143   public String getConnectMode() {
144     return connectMode;
145
146   }
147
148   public OperLogMessage setConnectMode(String mode) {
149     this.set("connectMode", mode);
150     this.connectMode = mode;
151     return this;
152   }
153
154   public long getLinkId() {
155     return linkId;
156   }
157
158   public OperLogMessage setLinkId(long linkId) {
159     this.set("linkId", linkId);
160     this.linkId = linkId;
161     return this;
162   }
163
164   public String getOperateResult() {
165     return operateResult;
166   }
167
168   public OperLogMessage setOperateResult(String operateResult) {
169     this.set("operateResult", operateResult);
170     this.operateResult = operateResult;
171     return this;
172   }
173
174   public String getRank() {
175     return rank;
176   }
177
178   public OperLogMessage setRank(String rank) {
179     this.set("rank", rank);
180     this.rank = rank;
181     return this;
182   }
183
184   public String getDescriptionInfo() {
185     return descriptionInfo;
186   }
187
188   public OperLogMessage setDescriptionInfo(String desc) {
189     this.setLocale("descriptionInfo", desc);
190     descriptionInfo = desc;
191     return this;
192   }
193
194   public String getOperation() {
195     return operation;
196   }
197
198   public OperLogMessage setOperation(String operation) {
199     this.setLocale("operation", operation);
200     this.operation = operation;
201     return this;
202   }
203
204   public String[] getResourceIP() {
205     return resourceIP;
206   }
207
208   public OperLogMessage setResourceIP(String[] resourceIP) {
209     this.set("resourceIP", resourceIP);
210     this.resourceIP = resourceIP;
211     return this;
212   }
213
214   public Date getLogStartDate() {
215     return logStartDate;
216   }
217
218   public OperLogMessage setLogStartDate(Date logStartDate) {
219     this.set("logStartDate", Facitility.dateFormat(logStartDate));
220     this.logStartDate = logStartDate;
221     return this;
222   }
223
224   public Date getLogEndDate() {
225     return logEndDate;
226   }
227
228   public OperLogMessage setLogEndDate(Date logEndDate) {
229     this.set("logEndDate", Facitility.dateFormat(logEndDate));
230     this.logEndDate = logEndDate;
231     return this;
232   }
233
234   public int getIsDisplay() {
235     return isDisplay;
236   }
237
238   public OperLogMessage setIsDisplay(int isDisplay) {
239     this.set("isDisplay", isDisplay);
240     this.isDisplay = isDisplay;
241     return this;
242   }
243
244   public String[] getOperateResource() {
245     return operateResource;
246   }
247
248   public OperLogMessage setOperateResource(String[] operateResource) {
249     this.set("operateResource", operateResource);
250     this.operateResource = operateResource;
251     return this;
252   }
253
254   public String getOperationType() {
255     return operationType;
256   }
257
258   public OperLogMessage setOperationType(String operationType) {
259
260     this.operationType = operationType;
261     return this;
262   }
263
264
265
266   public OperLogMessage setHostname(String hostname) {
267     this.set("hostname", hostname);
268     this.hostname = hostname;
269     return this;
270   }
271
272
273   public LogMessage setId(long id) {
274     this.set("id", id);
275     this.id = id;
276     return this;
277   }
278
279
280   public LogMessage setDetail(String detail) {
281     this.detail = detail;
282     this.setLocale("detail", detail);
283     return this;
284   }
285
286 }