2 * ============LICENSE_START===================================================
3 * SPARKY (AAI UI service)
4 * ============================================================================
5 * Copyright © 2017 AT&T Intellectual Property.
6 * Copyright © 2017 Amdocs
8 * ============================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END=====================================================
22 * ECOMP and OpenECOMP are trademarks
23 * and service marks of AT&T Intellectual Property.
26 package org.openecomp.sparky.dal;
28 import org.openecomp.sparky.config.oxm.OxmEntityDescriptor;
29 import org.openecomp.sparky.dal.rest.HttpMethod;
30 import org.openecomp.sparky.dal.rest.OperationResult;
33 * The Class NetworkTransaction.
35 public class NetworkTransaction {
37 private OperationResult operationResult;
39 private String entityType;
43 private HttpMethod operationType;
45 private OxmEntityDescriptor descriptor;
47 private long createdTimeStampInMs;
49 private long taskAgeInMs;
52 * Instantiates a new network transaction.
54 public NetworkTransaction() {
55 this.createdTimeStampInMs = System.currentTimeMillis();
59 * Instantiates a new network transaction.
61 * @param method the method
62 * @param entityType the entity type
65 public NetworkTransaction(HttpMethod method, String entityType, OperationResult or) {
67 this.operationType = method;
68 this.entityType = entityType;
69 this.operationResult = or;
72 public HttpMethod getOperationType() {
76 public long getTaskAgeInMs() {
81 * Sets the task age in ms.
83 public void setTaskAgeInMs() {
84 this.taskAgeInMs = (System.currentTimeMillis() - createdTimeStampInMs);
87 public void setOperationType(HttpMethod operationType) {
88 this.operationType = operationType;
91 public OperationResult getOperationResult() {
92 return operationResult;
95 public void setOperationResult(OperationResult operationResult) {
96 this.operationResult = operationResult;
99 public String getEntityType() {
103 public void setEntityType(String entityType) {
104 this.entityType = entityType;
107 public String getLink() {
111 public void setLink(String link) {
115 public OxmEntityDescriptor getDescriptor() {
119 public void setDescriptor(OxmEntityDescriptor descriptor) {
120 this.descriptor = descriptor;
124 * @see java.lang.Object#toString()
127 public String toString() {
128 return "NetworkTransaction [operationResult=" + operationResult.toString() + ", entityType="
129 + entityType + ", link=" + link + ", operationType=" + operationType + ", descriptor="
130 + descriptor.toString() + ", createdTimeStampInMs=" + createdTimeStampInMs
131 + ", taskAgeInMs=" + taskAgeInMs + "]";