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.openecomp.sparky.dal;
25 import org.openecomp.sparky.config.oxm.OxmEntityDescriptor;
26 import org.openecomp.sparky.dal.rest.HttpMethod;
27 import org.openecomp.sparky.dal.rest.OperationResult;
30 * The Class NetworkTransaction.
32 public class NetworkTransaction {
34 private OperationResult operationResult;
36 private String entityType;
40 private HttpMethod operationType;
42 private OxmEntityDescriptor descriptor;
44 private long createdTimeStampInMs;
46 private long taskAgeInMs;
49 * Instantiates a new network transaction.
51 public NetworkTransaction() {
52 this.createdTimeStampInMs = System.currentTimeMillis();
56 * Instantiates a new network transaction.
58 * @param method the method
59 * @param entityType the entity type
62 public NetworkTransaction(HttpMethod method, String entityType, OperationResult or) {
64 this.operationType = method;
65 this.entityType = entityType;
66 this.operationResult = or;
69 public HttpMethod getOperationType() {
73 public long getTaskAgeInMs() {
78 * Sets the task age in ms.
80 public void setTaskAgeInMs() {
81 this.taskAgeInMs = (System.currentTimeMillis() - createdTimeStampInMs);
84 public void setOperationType(HttpMethod operationType) {
85 this.operationType = operationType;
88 public OperationResult getOperationResult() {
89 return operationResult;
92 public void setOperationResult(OperationResult operationResult) {
93 this.operationResult = operationResult;
96 public String getEntityType() {
100 public void setEntityType(String entityType) {
101 this.entityType = entityType;
104 public String getLink() {
108 public void setLink(String link) {
112 public OxmEntityDescriptor getDescriptor() {
116 public void setDescriptor(OxmEntityDescriptor descriptor) {
117 this.descriptor = descriptor;
121 * @see java.lang.Object#toString()
124 public String toString() {
125 return "NetworkTransaction [operationResult=" + operationResult.toString() + ", entityType="
126 + entityType + ", link=" + link + ", operationType=" + operationType + ", descriptor="
127 + descriptor.toString() + ", createdTimeStampInMs=" + createdTimeStampInMs
128 + ", taskAgeInMs=" + taskAgeInMs + "]";