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
9 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
20 package org.onap.dcae.analytics.web.validation;
22 import java.util.Collection;
29 * @author Rajiv Singla
31 public interface ValidationResponse {
34 * Returns true if validation resulted in one or more errors
36 * @return true if validation has errors
41 * Returns all field names which have error
43 * @return names of fields which have error
45 Set<String> getFieldNamesWithError();
48 * Returns list of all error messages
50 * @return list of error messages
52 Collection<String> getErrorMessages();
56 * Returns all error messages as string delimited by comma
58 * @return all error messages delimited by given delimiter
60 String getAllErrorMessage();
63 * Returns all error messages as string delimited by given delimited
65 * @param delimiter delimited to be used for error message
67 * @return all error messages delimited by given delimiter
69 String getAllErrorMessage(String delimiter);
72 * Adds field name and error message to the validation response
74 * @param fieldName field name which has validation error
75 * @param filedErrorMessage validation error message
77 void addErrorMessage(String fieldName, String filedErrorMessage);
81 * Returns validation results as map containing values as keys and values
84 * @return Map containing field names and error message associated with those fields
86 Map<String, String> getValidationResultsAsMap();