Adding UI extensibility
[aai/sparky-be.git] / src / main / java / org / onap / aai / sparky / dal / NetworkTransaction.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017 Amdocs
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  *       http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END=========================================================
20  *
21  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23 package org.onap.aai.sparky.dal;
24
25 import org.onap.aai.restclient.client.OperationResult;
26 import org.onap.aai.sparky.config.oxm.OxmEntityDescriptor;
27 import org.onap.aai.sparky.dal.rest.HttpMethod;
28
29
30 /**
31  * The Class NetworkTransaction.
32  */
33 public class NetworkTransaction {
34
35   private OperationResult operationResult;
36
37   private String entityType;
38
39   private String link;
40
41   private String queryParameters;
42
43   private HttpMethod operationType;
44
45   private OxmEntityDescriptor descriptor;
46
47   private long createdTimeStampInMs;
48
49   private long opTimeInMs;
50
51   private long taskAgeInMs;
52
53   /**
54    * Instantiates a new network transaction.
55    */
56   public NetworkTransaction() {
57     this.createdTimeStampInMs = System.currentTimeMillis();
58     this.opTimeInMs = 0L;
59   }
60
61   /**
62    * Instantiates a new network transaction.
63    *
64    * @param method the method
65    * @param entityType the entity type
66    * @param or the or
67    */
68   public NetworkTransaction(HttpMethod method, String entityType, OperationResult or) {
69     this();
70     this.operationType = method;
71     this.entityType = entityType;
72     this.operationResult = or;
73     this.opTimeInMs = 0L;
74   }
75
76   public HttpMethod getOperationType() {
77     return operationType;
78   }
79
80   public long getTaskAgeInMs() {
81     return taskAgeInMs;
82   }
83
84   /**
85    * Sets the task age in ms.
86    */
87   public void setTaskAgeInMs() {
88     this.taskAgeInMs = (System.currentTimeMillis() - createdTimeStampInMs);
89   }
90
91   public void setOperationType(HttpMethod operationType) {
92     this.operationType = operationType;
93   }
94
95   public OperationResult getOperationResult() {
96     return operationResult;
97   }
98
99   public void setOperationResult(OperationResult operationResult) {
100     this.operationResult = operationResult;
101   }
102
103   public String getEntityType() {
104     return entityType;
105   }
106
107   public void setEntityType(String entityType) {
108     this.entityType = entityType;
109   }
110
111   public String getLink() {
112     return link;
113   }
114
115   public void setLink(String link) {
116     this.link = link;
117   }
118
119   public String getQueryParameters() {
120     return queryParameters;
121   }
122
123   public void setQueryParameters(String queryParameters) {
124     this.queryParameters = queryParameters;
125   }
126
127   public long getOpTimeInMs() {
128     return opTimeInMs;
129   }
130
131   public void setOpTimeInMs(long opTimeInMs) {
132     this.opTimeInMs = opTimeInMs;
133   }
134
135   public OxmEntityDescriptor getDescriptor() {
136     return descriptor;
137   }
138
139   public void setDescriptor(OxmEntityDescriptor descriptor) {
140     this.descriptor = descriptor;
141   }
142
143   /*
144    * (non-Javadoc)
145    * 
146    * @see java.lang.Object#toString()
147    */
148   @Override
149   public String toString() {
150     return "NetworkTransaction [operationResult=" + operationResult.toString() + ", entityType="
151         + entityType + ", link=" + link + ", operationType=" + operationType + ", descriptor="
152         + descriptor.toString() + ", createdTimeStampInMs=" + createdTimeStampInMs
153         + ", taskAgeInMs=" + taskAgeInMs + "]";
154   }
155
156
157 }