c0065e2df92346bc74044a4371d068c514e77900
[dcaegen2/analytics/tca.git] / dcae-analytics-common / src / main / java / org / onap / dcae / apod / analytics / common / validation / ValidationResponse.java
1 /*
2  * ===============================LICENSE_START======================================
3  *  dcae-analytics
4  * ================================================================================
5  *    Copyright © 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.onap.dcae.apod.analytics.common.validation;
22
23 import java.util.Collection;
24 import java.util.Map;
25 import java.util.Set;
26
27 /**
28  * Validation Response contract
29  *
30  *
31  *
32  * @author Rajiv Singla . Creation Date: 10/24/2016.
33  */
34 public interface ValidationResponse {
35
36     /**
37      * Returns true if validation resulted in one or more errors
38      *
39      * @return true if validation has errors
40      */
41     boolean hasErrors();
42
43     /**
44      * Returns all field names which have error
45      *
46      * @return names of fields which have error
47      */
48     Set<String> getFieldNamesWithError();
49
50     /**
51      * Returns list of all error messages
52      *
53      * @return list of error messages
54      */
55     Collection<String> getErrorMessages();
56
57
58     /**
59      * Returns all error messages as string delimited by comma
60      *
61      * @return all error messages delimited by given delimiter
62      */
63     String getAllErrorMessage();
64
65     /**
66      * Returns all error messages as string delimited by given delimited
67      *
68      * @param delimiter delimited to be used for error message
69      * @return all error messages delimited by given delimiter
70      */
71     String getAllErrorMessage(String delimiter);
72
73     /**
74      * Adds field name and error message to the validation response
75      *
76      * @param fieldName field name which has validation error
77      * @param filedErrorMessage validation error message
78      */
79     void addErrorMessage(String fieldName, String filedErrorMessage);
80
81
82     /**
83      * Returns validation results as map containing values as keys and values
84      * as error Message
85      *
86      * @return Map containing field names and error message associated with those fields
87      */
88     Map<String, String> getValidationResultsAsMap();
89
90 }