import org.openecomp.sdc.logging.api.LoggerFactory;
import org.openecomp.sdc.logging.api.annotations.Metrics;
import org.openecomp.sdc.logging.context.impl.MdcDataDebugMessage;
-import org.openecomp.sdc.logging.types.LoggerServiceName;
import org.openecomp.sdc.logging.types.LoggerTragetServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.OrchestrationTemplateCandidateManager;
import org.openecomp.sdc.vendorsoftwareproduct.dao.VendorSoftwareProductInfoDao;
if (CollectionUtils.isNotEmpty(errorMessages)) {
Map<String, List<ErrorMessage>> errorsMap = new HashMap<>();
errorsMap.put(SdcCommon.UPLOAD_FILE, errorMessages);
- response.setUploadDataErrors(errorsMap, LoggerServiceName.Update_Manifest,
- LoggerTragetServiceName.VALIDATE_FILE_DATA_STRUCTURE);
+ response.setUploadDataErrors(errorsMap,
+ LoggerTragetServiceName.VALIDATE_FILE_DATA_STRUCTURE);
MDC_DATA_DEBUG_MESSAGE.debugExitMessage(VSP_ID, vspId);
return response;
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.vendorsoftwareproduct.types;
import org.apache.commons.collections4.MapUtils;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.datatypes.error.ErrorMessage;
-import org.openecomp.sdc.logging.api.Logger;
-import org.openecomp.sdc.logging.api.LoggerFactory;
-import org.openecomp.sdc.logging.types.LoggerServiceName;
import org.openecomp.sdc.vendorsoftwareproduct.utils.VendorSoftwareProductUtils;
import java.util.Collection;
import java.util.Map;
public class ValidationResponse {
- protected static Logger logger = (Logger) LoggerFactory.getLogger(ValidationResponse.class);
private boolean valid = true;
private Collection<ErrorCode> vspErrors;
private Collection<ErrorCode> licensingDataErrors;
private Map<String, List<ErrorMessage>> uploadDataErrors;
- private Map<String, List<ErrorMessage>> compilationErrors;
private QuestionnaireValidationResult questionnaireValidationResult;
public boolean isValid() {
/**
* Sets vsp errors.
- *
- * @param vspErrors the vsp errors
- * @param serviceName the service name
+ * @param vspErrors the vsp errors
* @param targetServiceName the target service name
*/
- public void setVspErrors(Collection<ErrorCode> vspErrors, LoggerServiceName serviceName,
+ public void setVspErrors(Collection<ErrorCode> vspErrors,
String targetServiceName) {
this.vspErrors = vspErrors;
if (CollectionUtils.isNotEmpty(vspErrors)) {
/**
* Sets upload data errors.
- *
- * @param uploadDataErrors the upload data errors
- * @param serviceName the service name
+ * @param uploadDataErrors the upload data errors
* @param targetServiceName the target service name
*/
public void setUploadDataErrors(Map<String, List<ErrorMessage>> uploadDataErrors,
- LoggerServiceName serviceName, String targetServiceName) {
+ String targetServiceName) {
this.uploadDataErrors = uploadDataErrors;
if (MapUtils.isNotEmpty(uploadDataErrors)) {
valid = false;
.setErrorsIntoLogger(uploadDataErrors, targetServiceName);
}
- public Map<String, List<ErrorMessage>> getCompilationErrors() {
- return compilationErrors;
- }
-
- /**
- * Sets compilation errors.
- *
- * @param compilationErrors the compilation errors
- * @param serviceName the service name
- * @param targetServiceName the target service name
- */
- public void setCompilationErrors(Map<String, List<ErrorMessage>> compilationErrors,
- LoggerServiceName serviceName, String targetServiceName) {
- this.compilationErrors = compilationErrors;
- if (MapUtils.isNotEmpty(compilationErrors)) {
- valid = false;
- }
-
- VendorSoftwareProductUtils
- .setErrorsIntoLogger(uploadDataErrors, targetServiceName);
- }
-
public QuestionnaireValidationResult getQuestionnaireValidationResult() {
return questionnaireValidationResult;
}
-/*-
- * ============LICENSE_START=======================================================
- * SDC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
+/*
+ * Copyright © 2016-2017 European Support Limited
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- * ============LICENSE_END=========================================================
*/
package org.openecomp.sdc.vendorsoftwareproduct.utils;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
+import java.util.EnumMap;
import java.util.List;
import java.util.Map;
public class VendorSoftwareProductUtils {
- protected static Logger logger =
- LoggerFactory.getLogger(VendorSoftwareProductUtils.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(VendorSoftwareProductUtils.class);
+
+ private VendorSoftwareProductUtils(){
+
+ }
/**
* Add file names to upload file response.
}
uploadFileResponse.removeFileFromList(SdcCommon.MANIFEST_NAME);
}
-
-
/**
* Validate content zip data.
*
*/
public static Map<MonitoringUploadType, String> mapArtifactsByType(
Collection<ComponentMonitoringUploadEntity> artifacts) {
- Map<MonitoringUploadType, String> artifactTypeToFilename = new HashMap<>();
+ Map<MonitoringUploadType, String> artifactTypeToFilename
+ = new EnumMap<>(MonitoringUploadType.class);
for (ComponentMonitoringUploadEntity entity : artifacts) {
artifactTypeToFilename.put(entity.getType(), entity.getArtifactName());
for (Map.Entry<String, List<ErrorMessage>> listEntry : errors.entrySet()) {
List<ErrorMessage> errorList = listEntry.getValue();
for (ErrorMessage message : errorList) {
- logger.error(message.getMessage());
+ LOGGER.error(message.getMessage());
}
}
}
}
for (ErrorCode error : errors) {
- logger.error(error.message());
+ LOGGER.error(error.message());
}
}
}