2 * ===============================LICENSE_START======================================
\r
4 * ================================================================================
\r
5 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============================LICENSE_END===========================================
\r
21 package org.openecomp.dcae.apod.analytics.common.validation;
\r
23 import java.util.Collection;
\r
24 import java.util.Map;
\r
25 import java.util.Set;
\r
28 * Validation Response contract
\r
30 * @param <T> Entity class type which is being validated
\r
32 * @author Rajiv Singla . Creation Date: 10/24/2016.
\r
34 public interface ValidationResponse<T> {
\r
37 * Returns true if validation resulted in one or more errors
\r
39 * @return true if validation has errors
\r
41 boolean hasErrors();
\r
44 * Returns all field names which have error
\r
46 * @return names of fields which have error
\r
48 Set<String> getFieldNamesWithError();
\r
51 * Returns list of all error messages
\r
53 * @return list of error messages
\r
55 Collection<String> getErrorMessages();
\r
59 * Returns all error messages as string delimited by comma
\r
61 * @return all error messages delimited by given delimiter
\r
63 String getAllErrorMessage();
\r
66 * Returns all error messages as string delimited by given delimited
\r
68 * @param delimiter delimited to be used for error message
\r
69 * @return all error messages delimited by given delimiter
\r
71 String getAllErrorMessage(String delimiter);
\r
74 * Adds field name and error message to the validation response
\r
76 * @param fieldName field name which has validation error
\r
77 * @param filedErrorMessage validation error message
\r
79 void addErrorMessage(String fieldName, String filedErrorMessage);
\r
83 * Returns validation results as map containing values as keys and values
\r
86 * @return Map containing field names and error message associated with those fields
\r
88 Map<String, String> getValidationResultsAsMap();
\r