Changing the license and trademark
[aai/sparky-be.git] / src / main / java / org / openecomp / 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.openecomp.sparky.dal;
24
25 import org.openecomp.sparky.config.oxm.OxmEntityDescriptor;
26 import org.openecomp.sparky.dal.rest.HttpMethod;
27 import org.openecomp.sparky.dal.rest.OperationResult;
28
29 /**
30  * The Class NetworkTransaction.
31  */
32 public class NetworkTransaction {
33
34   private OperationResult operationResult;
35
36   private String entityType;
37
38   private String link;
39
40   private HttpMethod operationType;
41
42   private OxmEntityDescriptor descriptor;
43
44   private long createdTimeStampInMs;
45
46   private long taskAgeInMs;
47
48   /**
49    * Instantiates a new network transaction.
50    */
51   public NetworkTransaction() {
52     this.createdTimeStampInMs = System.currentTimeMillis();
53   }
54
55   /**
56    * Instantiates a new network transaction.
57    *
58    * @param method the method
59    * @param entityType the entity type
60    * @param or the or
61    */
62   public NetworkTransaction(HttpMethod method, String entityType, OperationResult or) {
63     this();
64     this.operationType = method;
65     this.entityType = entityType;
66     this.operationResult = or;
67   }
68
69   public HttpMethod getOperationType() {
70     return operationType;
71   }
72
73   public long getTaskAgeInMs() {
74     return taskAgeInMs;
75   }
76
77   /**
78    * Sets the task age in ms.
79    */
80   public void setTaskAgeInMs() {
81     this.taskAgeInMs = (System.currentTimeMillis() - createdTimeStampInMs);
82   }
83
84   public void setOperationType(HttpMethod operationType) {
85     this.operationType = operationType;
86   }
87
88   public OperationResult getOperationResult() {
89     return operationResult;
90   }
91
92   public void setOperationResult(OperationResult operationResult) {
93     this.operationResult = operationResult;
94   }
95
96   public String getEntityType() {
97     return entityType;
98   }
99
100   public void setEntityType(String entityType) {
101     this.entityType = entityType;
102   }
103
104   public String getLink() {
105     return link;
106   }
107
108   public void setLink(String link) {
109     this.link = link;
110   }
111
112   public OxmEntityDescriptor getDescriptor() {
113     return descriptor;
114   }
115
116   public void setDescriptor(OxmEntityDescriptor descriptor) {
117     this.descriptor = descriptor;
118   }
119
120   /* (non-Javadoc)
121    * @see java.lang.Object#toString()
122    */
123   @Override
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 + "]";
129   }
130
131
132 }