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.common.errors.ErrorCode;
26 import org.openecomp.sdc.datatypes.error.ErrorMessage;
27 import org.openecomp.sdc.logging.api.Logger;
28 import org.openecomp.sdc.logging.api.LoggerFactory;
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;
44 private ComponentValidationResult componentValidationResult;
45 private DeploymentFlavorValidationResult deploymentFlavorValidationResult;
48 public boolean isValid() {
52 public Collection<ErrorCode> getVspErrors() {
59 * @param vspErrors the vsp errors
60 * @param serviceName the service name
61 * @param targetServiceName the target service name
63 public void setVspErrors(Collection<ErrorCode> vspErrors, LoggerServiceName serviceName,
64 String targetServiceName) {
65 this.vspErrors = vspErrors;
66 if (CollectionUtils.isNotEmpty(vspErrors)) {
70 VendorSoftwareProductUtils.setErrorsIntoLogger(vspErrors, serviceName, targetServiceName);
74 public Collection<ErrorCode> getLicensingDataErrors() {
75 return licensingDataErrors;
79 * Sets licensing data errors.
81 * @param licensingDataErrors the licensing data errors
83 public void setLicensingDataErrors(Collection<ErrorCode> licensingDataErrors) {
84 this.licensingDataErrors = licensingDataErrors;
85 if (CollectionUtils.isNotEmpty(licensingDataErrors)) {
90 public Map<String, List<ErrorMessage>> getUploadDataErrors() {
91 return uploadDataErrors;
95 * Sets upload data errors.
97 * @param uploadDataErrors the upload data errors
98 * @param serviceName the service name
99 * @param targetServiceName the target service name
101 public void setUploadDataErrors(Map<String, List<ErrorMessage>> uploadDataErrors,
102 LoggerServiceName serviceName, String targetServiceName) {
103 this.uploadDataErrors = uploadDataErrors;
104 if (MapUtils.isNotEmpty(uploadDataErrors)) {
108 VendorSoftwareProductUtils
109 .setErrorsIntoLogger(uploadDataErrors, serviceName, targetServiceName);
112 public Map<String, List<ErrorMessage>> getCompilationErrors() {
113 return compilationErrors;
117 * Sets compilation errors.
119 * @param compilationErrors the compilation errors
120 * @param serviceName the service name
121 * @param targetServiceName the target service name
123 public void setCompilationErrors(Map<String, List<ErrorMessage>> compilationErrors,
124 LoggerServiceName serviceName, String targetServiceName) {
125 this.compilationErrors = compilationErrors;
126 if (MapUtils.isNotEmpty(compilationErrors)) {
130 VendorSoftwareProductUtils
131 .setErrorsIntoLogger(uploadDataErrors, serviceName, targetServiceName);
134 public QuestionnaireValidationResult getQuestionnaireValidationResult() {
135 return questionnaireValidationResult;
139 * Sets questionnaire validation result.
141 * @param questionnaireValidationResult the questionnaire validation result
143 public void setQuestionnaireValidationResult(
144 QuestionnaireValidationResult questionnaireValidationResult) {
145 this.questionnaireValidationResult = questionnaireValidationResult;
146 if (questionnaireValidationResult != null && !questionnaireValidationResult.isValid()) {
152 public ComponentValidationResult getComponentValidationResult() {
153 return componentValidationResult;
157 * Sets Component validation result.
159 * @param componentValidationResult the Component validation result
161 public void setComponentValidationResult(
162 ComponentValidationResult componentValidationResult) {
163 this.componentValidationResult = componentValidationResult;
164 if (componentValidationResult != null && !componentValidationResult.isValid()) {
170 public DeploymentFlavorValidationResult getDeploymentFlavorValidationResult() {
171 return deploymentFlavorValidationResult;
175 * Sets Deployment validation result.
177 * @param deploymentFlavorValidationResult the Deployment validation result
179 public void setDeploymentFlavorValidationResult(
180 DeploymentFlavorValidationResult deploymentFlavorValidationResult) {
181 this.deploymentFlavorValidationResult = deploymentFlavorValidationResult;
182 if (deploymentFlavorValidationResult != null && !deploymentFlavorValidationResult.isValid()) {