Refactoring Consolidation Service
[sdc.git] / catalog-dao / src / main / java / org / openecomp / sdc / be / dao / model / GetMultipleDataResult.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.sdc.be.dao.model;
22
23 import java.io.Serializable;
24
25 /**
26  * Result for a multiple data query.
27  * 
28  * @author luc boutier
29  */
30 @SuppressWarnings("PMD.UnusedPrivateField")
31 public class GetMultipleDataResult<T> implements Serializable {
32         public String[] getTypes() {
33                 return types;
34         }
35
36         public T[] getData() {
37                 return data;
38         }
39
40         public void setTypes(String[] types) {
41                 this.types = types.clone();
42         }
43
44         public void setData(T[] data) {
45                 this.data = data.clone();
46         }
47
48         public void setQueryDuration(long queryDuration) {
49                 this.queryDuration = queryDuration;
50         }
51
52         public void setTotalResults(long totalResults) {
53                 this.totalResults = totalResults;
54         }
55
56         public void setFrom(int from) {
57                 this.from = from;
58         }
59
60         public void setTo(int to) {
61                 this.to = to;
62         }
63
64         public long getQueryDuration() {
65                 return queryDuration;
66         }
67
68         public long getTotalResults() {
69                 return totalResults;
70         }
71
72         public int getFrom() {
73                 return from;
74         }
75
76         public int getTo() {
77                 return to;
78         }
79
80         private static final long serialVersionUID = 1L;
81
82         private String[] types;
83         private T[] data;
84         private long queryDuration;
85         private long totalResults;
86         private int from;
87         private int to;
88
89         /**
90          * Construct an object only with data and types
91          * 
92          * @param types
93          * @param data
94          */
95         public GetMultipleDataResult(String[] types, T[] data) {
96                 this.types = types.clone();
97                 this.data = data.clone();
98         }
99
100         public GetMultipleDataResult(String[] types, Object[] data, long queryDuration, long totalResults, int from,
101                         int to) {
102
103                 this.types = types.clone();
104                 this.data = (T[]) data.clone();
105                 this.queryDuration = queryDuration;
106                 this.totalResults = totalResults;
107                 this.from = from;
108                 this.to = to;
109         }
110
111         public GetMultipleDataResult() {
112         }
113 }