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;
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, targetServiceName);
71 public Collection<ErrorCode> getLicensingDataErrors() {
72 return licensingDataErrors;
76 * Sets licensing data errors.
78 * @param licensingDataErrors the licensing data errors
80 public void setLicensingDataErrors(Collection<ErrorCode> licensingDataErrors) {
81 this.licensingDataErrors = licensingDataErrors;
82 if (CollectionUtils.isNotEmpty(licensingDataErrors)) {
87 public Map<String, List<ErrorMessage>> getUploadDataErrors() {
88 return uploadDataErrors;
92 * Sets upload data errors.
94 * @param uploadDataErrors the upload data errors
95 * @param serviceName the service name
96 * @param targetServiceName the target service name
98 public void setUploadDataErrors(Map<String, List<ErrorMessage>> uploadDataErrors,
99 LoggerServiceName serviceName, String targetServiceName) {
100 this.uploadDataErrors = uploadDataErrors;
101 if (MapUtils.isNotEmpty(uploadDataErrors)) {
105 VendorSoftwareProductUtils
106 .setErrorsIntoLogger(uploadDataErrors, targetServiceName);
109 public Map<String, List<ErrorMessage>> getCompilationErrors() {
110 return compilationErrors;
114 * Sets compilation errors.
116 * @param compilationErrors the compilation errors
117 * @param serviceName the service name
118 * @param targetServiceName the target service name
120 public void setCompilationErrors(Map<String, List<ErrorMessage>> compilationErrors,
121 LoggerServiceName serviceName, String targetServiceName) {
122 this.compilationErrors = compilationErrors;
123 if (MapUtils.isNotEmpty(compilationErrors)) {
127 VendorSoftwareProductUtils
128 .setErrorsIntoLogger(uploadDataErrors, targetServiceName);
131 public QuestionnaireValidationResult getQuestionnaireValidationResult() {
132 return questionnaireValidationResult;
136 * Sets questionnaire validation result.
138 * @param questionnaireValidationResult the questionnaire validation result
140 public void setQuestionnaireValidationResult(
141 QuestionnaireValidationResult questionnaireValidationResult) {
142 this.questionnaireValidationResult = questionnaireValidationResult;
143 if (questionnaireValidationResult != null && !questionnaireValidationResult.isValid()) {