2 * ===============================LICENSE_START======================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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===========================================
21 package org.onap.dcae.apod.analytics.common.validation;
23 import java.util.Collection;
28 * Validation Response contract
30 * @param <T> Entity class type which is being validated
32 * @author Rajiv Singla . Creation Date: 10/24/2016.
34 public interface ValidationResponse<T> {
37 * Returns true if validation resulted in one or more errors
39 * @return true if validation has errors
44 * Returns all field names which have error
46 * @return names of fields which have error
48 Set<String> getFieldNamesWithError();
51 * Returns list of all error messages
53 * @return list of error messages
55 Collection<String> getErrorMessages();
59 * Returns all error messages as string delimited by comma
61 * @return all error messages delimited by given delimiter
63 String getAllErrorMessage();
66 * Returns all error messages as string delimited by given delimited
68 * @param delimiter delimited to be used for error message
69 * @return all error messages delimited by given delimiter
71 String getAllErrorMessage(String delimiter);
74 * Adds field name and error message to the validation response
76 * @param fieldName field name which has validation error
77 * @param filedErrorMessage validation error message
79 void addErrorMessage(String fieldName, String filedErrorMessage);
83 * Returns validation results as map containing values as keys and values
86 * @return Map containing field names and error message associated with those fields
88 Map<String, String> getValidationResultsAsMap();