2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * Copyright © 2017-2018 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
12 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.aai.sparky.dal;
23 import org.onap.aai.restclient.client.OperationResult;
24 import org.onap.aai.sparky.config.oxm.OxmEntityDescriptor;
25 import org.onap.aai.sparky.dal.rest.HttpMethod;
29 * The Class NetworkTransaction.
31 public class NetworkTransaction {
33 private OperationResult operationResult;
35 private String entityType;
39 private String queryParameters;
41 private HttpMethod operationType;
43 private OxmEntityDescriptor descriptor;
45 private long createdTimeStampInMs;
47 private long opTimeInMs;
49 private long taskAgeInMs;
52 * Instantiates a new network transaction.
54 public NetworkTransaction() {
55 this.createdTimeStampInMs = System.currentTimeMillis();
60 * Instantiates a new network transaction.
62 * @param method the method
63 * @param entityType the entity type
66 public NetworkTransaction(HttpMethod method, String entityType, OperationResult or) {
68 this.operationType = method;
69 this.entityType = entityType;
70 this.operationResult = or;
74 public HttpMethod getOperationType() {
78 public long getTaskAgeInMs() {
83 * Sets the task age in ms.
85 public void setTaskAgeInMs() {
86 this.taskAgeInMs = (System.currentTimeMillis() - createdTimeStampInMs);
89 public void setOperationType(HttpMethod operationType) {
90 this.operationType = operationType;
93 public OperationResult getOperationResult() {
94 return operationResult;
97 public void setOperationResult(OperationResult operationResult) {
98 this.operationResult = operationResult;
101 public String getEntityType() {
105 public void setEntityType(String entityType) {
106 this.entityType = entityType;
109 public String getLink() {
113 public void setLink(String link) {
117 public String getQueryParameters() {
118 return queryParameters;
121 public void setQueryParameters(String queryParameters) {
122 this.queryParameters = queryParameters;
125 public long getOpTimeInMs() {
129 public void setOpTimeInMs(long opTimeInMs) {
130 this.opTimeInMs = opTimeInMs;
133 public OxmEntityDescriptor getDescriptor() {
137 public void setDescriptor(OxmEntityDescriptor descriptor) {
138 this.descriptor = descriptor;
144 * @see java.lang.Object#toString()
147 public String toString() {
148 return "NetworkTransaction [operationResult=" + operationResult.toString() + ", entityType="
149 + entityType + ", link=" + link + ", operationType=" + operationType + ", descriptor="
150 + descriptor.toString() + ", createdTimeStampInMs=" + createdTimeStampInMs
151 + ", taskAgeInMs=" + taskAgeInMs + "]";