import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
-import org.openecomp.core.enrichment.types.ArtifactType;
+import org.openecomp.core.enrichment.types.MonitoringUploadType;
import org.openecomp.core.utilities.file.FileContentHandler;
import org.openecomp.sdc.common.errors.ErrorCode;
import org.openecomp.sdc.common.errors.Messages;
import org.openecomp.sdc.logging.types.LoggerConstants;
import org.openecomp.sdc.logging.types.LoggerErrorDescription;
import org.openecomp.sdc.logging.types.LoggerServiceName;
-import org.openecomp.sdc.vendorsoftwareproduct.dao.type.MibEntity;
+import org.openecomp.sdc.vendorsoftwareproduct.dao.type.ComponentMonitoringUploadEntity;
import org.openecomp.sdc.vendorsoftwareproduct.types.OrchestrationTemplateActionResponse;
import org.slf4j.MDC;
import java.util.Map;
public class VendorSoftwareProductUtils {
+
+ private static final String MANUAL = "Manual";
protected static Logger logger =
(Logger) LoggerFactory.getLogger(VendorSoftwareProductUtils.class);
public static void validateContentZipData(FileContentHandler contentMap,
Map<String, List<ErrorMessage>> errors) {
MDC.put(LoggerConstants.ERROR_DESCRIPTION, LoggerErrorDescription.INVALID_ZIP);
- if (contentMap == null) {
- ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors).add(
- new ErrorMessage(ErrorLevel.ERROR,
- Messages.ZIP_SHOULD_NOT_CONTAIN_FOLDERS.getErrorMessage()));
-
- } else if (contentMap.getFileList().size() == 0) {
+ if (contentMap.getFileList().size() == 0) {
ErrorMessage.ErrorMessageUtil.addMessage(SdcCommon.UPLOAD_FILE, errors)
.add(new ErrorMessage(ErrorLevel.ERROR, Messages.INVALID_ZIP_FILE.getErrorMessage()));
}
/**
- * Filter non trap or poll artifacts map.
+ * Maps all artifacts by type.
*
* @param artifacts the artifacts
* @return the map
*/
- public static Map<ArtifactType, String> filterNonTrapOrPollArtifacts(
- Collection<MibEntity> artifacts) {
- Map<ArtifactType, String> artifactTypeToFilename = new HashMap<>();
+ public static Map<MonitoringUploadType, String> mapArtifactsByType(
+ Collection<ComponentMonitoringUploadEntity> artifacts) {
+ Map<MonitoringUploadType, String> artifactTypeToFilename = new HashMap<>();
- for (MibEntity entity : artifacts) {
- if (isTrapOrPoll(entity.getType())) {
- artifactTypeToFilename.put(entity.getType(), entity.getArtifactName());
- }
+ for (ComponentMonitoringUploadEntity entity : artifacts) {
+ artifactTypeToFilename.put(entity.getType(), entity.getArtifactName());
}
return artifactTypeToFilename;
}
- private static boolean isTrapOrPoll(ArtifactType type) {
- return type.equals(ArtifactType.SNMP_POLL) || type.equals(ArtifactType.SNMP_TRAP);
+ private static boolean isTrapOrPoll(MonitoringUploadType type) {
+ return type.equals(MonitoringUploadType.SNMP_POLL) ||
+ type.equals(MonitoringUploadType.SNMP_TRAP);
}
}
}
+ /*public static boolean isManual(String vspId, Version version, VendorSoftwareProductInfoDao
+ vspInfoDao) {
+ String onboardingMethod = vspInfoDao.get(new VspDetails(vspId, version)).getOnboardingMethod();
+ if (MANUAL.equals(onboardingMethod)) {
+ return true;
+ }
+ return false;
+ }*/
+
}