2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 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.openecomp.sdc.vendorsoftwareproduct.types;
23 import org.apache.commons.collections4.CollectionUtils;
24 import org.apache.commons.collections4.MapUtils;
25 import org.openecomp.sdc.logging.api.Logger;
26 import org.openecomp.sdc.logging.api.LoggerFactory;
27 import org.openecomp.sdc.common.errors.ErrorCode;
28 import org.openecomp.sdc.datatypes.error.ErrorMessage;
29 import org.openecomp.sdc.logging.types.LoggerServiceName;
30 import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
32 import java.util.Collection;
33 import java.util.List;
36 public class ValidationResponse {
37 protected static Logger logger = (Logger) LoggerFactory.getLogger(ValidationResponse.class);
38 private boolean valid = true;
39 private Collection<ErrorCode> vspErrors;
40 private Collection<ErrorCode> licensingDataErrors;
41 private Map<String, List<ErrorMessage>> uploadDataErrors;
42 private Map<String, List<ErrorMessage>> compilationErrors;
43 private QuestionnaireValidationResult questionnaireValidationResult;
45 public boolean isValid() {
49 public Collection<ErrorCode> getVspErrors() {
56 * @param vspErrors the vsp errors
57 * @param serviceName the service name
58 * @param targetServiceName the target service name
60 public void setVspErrors(Collection<ErrorCode> vspErrors, LoggerServiceName serviceName,
61 String targetServiceName) {
62 this.vspErrors = vspErrors;
63 if (CollectionUtils.isNotEmpty(vspErrors)) {
67 VendorSoftwareProductUtils.setErrorsIntoLogger(vspErrors, serviceName, targetServiceName);
70 public Collection<ErrorCode> getLicensingDataErrors() {
71 return licensingDataErrors;
75 * Sets licensing data errors.
77 * @param licensingDataErrors the licensing data errors
79 public void setLicensingDataErrors(Collection<ErrorCode> licensingDataErrors) {
80 this.licensingDataErrors = licensingDataErrors;
81 if (CollectionUtils.isNotEmpty(licensingDataErrors)) {
86 public Map<String, List<ErrorMessage>> getUploadDataErrors() {
87 return uploadDataErrors;
91 * Sets upload data errors.
93 * @param uploadDataErrors the upload data errors
94 * @param serviceName the service name
95 * @param targetServiceName the target service name
97 public void setUploadDataErrors(Map<String, List<ErrorMessage>> uploadDataErrors,
98 LoggerServiceName serviceName, String targetServiceName) {
99 this.uploadDataErrors = uploadDataErrors;
100 if (MapUtils.isNotEmpty(uploadDataErrors)) {
104 VendorSoftwareProductUtils
105 .setErrorsIntoLogger(uploadDataErrors, serviceName, targetServiceName);
108 public Map<String, List<ErrorMessage>> getCompilationErrors() {
109 return compilationErrors;
113 * Sets compilation errors.
115 * @param compilationErrors the compilation errors
116 * @param serviceName the service name
117 * @param targetServiceName the target service name
119 public void setCompilationErrors(Map<String, List<ErrorMessage>> compilationErrors,
120 LoggerServiceName serviceName, String targetServiceName) {
121 this.compilationErrors = compilationErrors;
122 if (MapUtils.isNotEmpty(compilationErrors)) {
126 VendorSoftwareProductUtils
127 .setErrorsIntoLogger(uploadDataErrors, serviceName, targetServiceName);
130 public QuestionnaireValidationResult getQuestionnaireValidationResult() {
131 return questionnaireValidationResult;
135 * Sets questionnaire validation result.
137 * @param questionnaireValidationResult the questionnaire validation result
139 public void setQuestionnaireValidationResult(
140 QuestionnaireValidationResult questionnaireValidationResult) {
141 this.questionnaireValidationResult = questionnaireValidationResult;
142 if (questionnaireValidationResult != null && !questionnaireValidationResult.isValid()) {