2 * ============LICENSE_START=======================================================
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
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 * ECOMP is a trademark and service mark of AT&T Intellectual Property.
23 package org.onap.aai.sparky.dal;
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;
31 * The Class NetworkTransaction.
33 public class NetworkTransaction {
35 private OperationResult operationResult;
37 private String entityType;
41 private String queryParameters;
43 private HttpMethod operationType;
45 private OxmEntityDescriptor descriptor;
47 private long createdTimeStampInMs;
49 private long opTimeInMs;
51 private long taskAgeInMs;
54 * Instantiates a new network transaction.
56 public NetworkTransaction() {
57 this.createdTimeStampInMs = System.currentTimeMillis();
62 * Instantiates a new network transaction.
64 * @param method the method
65 * @param entityType the entity type
68 public NetworkTransaction(HttpMethod method, String entityType, OperationResult or) {
70 this.operationType = method;
71 this.entityType = entityType;
72 this.operationResult = or;
76 public HttpMethod getOperationType() {
80 public long getTaskAgeInMs() {
85 * Sets the task age in ms.
87 public void setTaskAgeInMs() {
88 this.taskAgeInMs = (System.currentTimeMillis() - createdTimeStampInMs);
91 public void setOperationType(HttpMethod operationType) {
92 this.operationType = operationType;
95 public OperationResult getOperationResult() {
96 return operationResult;
99 public void setOperationResult(OperationResult operationResult) {
100 this.operationResult = operationResult;
103 public String getEntityType() {
107 public void setEntityType(String entityType) {
108 this.entityType = entityType;
111 public String getLink() {
115 public void setLink(String link) {
119 public String getQueryParameters() {
120 return queryParameters;
123 public void setQueryParameters(String queryParameters) {
124 this.queryParameters = queryParameters;
127 public long getOpTimeInMs() {
131 public void setOpTimeInMs(long opTimeInMs) {
132 this.opTimeInMs = opTimeInMs;
135 public OxmEntityDescriptor getDescriptor() {
139 public void setDescriptor(OxmEntityDescriptor descriptor) {
140 this.descriptor = descriptor;
146 * @see java.lang.Object#toString()
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 + "]";