Standalone TCA with EELF Logger
[dcaegen2/analytics/tca-gen2.git] / dcae-analytics / dcae-analytics-web / src / main / java / org / onap / dcae / analytics / web / validation / ValidationResponse.java
1 /*
2  * ================================================================================
3  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
4  * ================================================================================
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  * ============LICENSE_END=========================================================
17  *
18  */
19
20 package org.onap.dcae.analytics.web.validation;
21
22 import java.util.Collection;
23 import java.util.Map;
24 import java.util.Set;
25
26 /**
27  * Validation Response
28  *
29  * @author Rajiv Singla
30  */
31 public interface ValidationResponse {
32
33     /**
34      * Returns true if validation resulted in one or more errors
35      *
36      * @return true if validation has errors
37      */
38     boolean hasErrors();
39
40     /**
41      * Returns all field names which have error
42      *
43      * @return names of fields which have error
44      */
45     Set<String> getFieldNamesWithError();
46
47     /**
48      * Returns list of all error messages
49      *
50      * @return list of error messages
51      */
52     Collection<String> getErrorMessages();
53
54
55     /**
56      * Returns all error messages as string delimited by comma
57      *
58      * @return all error messages delimited by given delimiter
59      */
60     String getAllErrorMessage();
61
62     /**
63      * Returns all error messages as string delimited by given delimited
64      *
65      * @param delimiter delimited to be used for error message
66      *
67      * @return all error messages delimited by given delimiter
68      */
69     String getAllErrorMessage(String delimiter);
70
71     /**
72      * Adds field name and error message to the validation response
73      *
74      * @param fieldName field name which has validation error
75      * @param filedErrorMessage validation error message
76      */
77     void addErrorMessage(String fieldName, String filedErrorMessage);
78
79
80     /**
81      * Returns validation results as map containing values as keys and values
82      * as error Message
83      *
84      * @return Map containing field names and error message associated with those fields
85      */
86     Map<String, String> getValidationResultsAsMap();
87
88 }