this.artifactsBusinessLogic = artifactsManager;
}
- public ApplicationDataTypeCache getApplicationDataTypeCache() {
- return applicationDataTypeCache;
- }
-
@Autowired
@Override
public void setApplicationDataTypeCache(ApplicationDataTypeCache applicationDataTypeCache) {
validateLifecycleState(oldResource, user);
String lockedResourceId = oldResource.getUniqueId();
List<ArtifactDefinition> createdArtifacts = new ArrayList<>();
- CsarInfo csarInfo = csarBusinessLogic.getCsarInfo(newResource, oldResource, user, csarUIPayload, csarUUID);
+ CsarInfo csarInfo = csarBusinessLogic.getCsarInfo(newResource, oldResource, user, csarUIPayload, csarUUID, null);
lockComponent(lockedResourceId, oldResource, "update Resource From Csar");
Map<String, NodeTypeInfo> nodeTypesInfo = csarInfo.extractTypesInfo();
Either<Map<String, EnumMap<ArtifactOperationEnum, List<ArtifactDefinition>>>, ResponseFormat> findNodeTypesArtifactsToHandleRes = findNodeTypesArtifactsToHandle(
loggerSupportability
.log(LoggerSupportabilityActions.CREATE_RESOURCE_FROM_YAML, StatusCode.STARTED, "Starting to create Resource From Csar by user {}",
user.getUserId());
- OnboardedCsarInfo csarInfo = csarBusinessLogic.getCsarInfo(resource, null, user, csarUIPayload, csarUUID);
+ OnboardedCsarInfo csarInfo = csarBusinessLogic.getCsarInfo(resource, null, user, csarUIPayload, csarUUID, null);
Map<String, NodeTypeInfo> nodeTypesInfo = csarInfo.extractTypesInfo();
final String model = resource.getModel();
Function<Resource, Boolean> validator = resource -> validateResourceCreationFromNodeType(resource, creator);
return resourceImportManager
.importCertifiedResource(nodeTypeYaml, resourceMetaData, creator, validator, lifecycleChangeInfo, isInTransaction, true, needLock,
- nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts, forceCertificationAllowed, csarInfo, nodeName, isNested);
+ nodeTypeArtifactsToHandle, nodeTypesNewCreatedArtifacts, forceCertificationAllowed, csarInfo, nodeName, isNested, null);
}
/**
resourceMetaData.setIcon(ImportUtils.Constants.DEFAULT_ICON);
resourceMetaData.setContactId(user.getUserId());
resourceMetaData.setVendorName(resourceVf.getVendorName());
+ resourceMetaData.setTenant(resourceVf.getTenant());
resourceMetaData.setVendorRelease(resourceVf.getVendorRelease());
resourceMetaData.setModel(resourceVf.getModel());
// Setting tag
cvfc.setContactId(csarInfo.getModifier().getUserId());
cvfc.setCreatorUserId(csarInfo.getModifier().getUserId());
cvfc.setVendorName(resourceVf.getVendorName());
+ cvfc.setTenant(resourceVf.getTenant());
cvfc.setVendorRelease(resourceVf.getVendorRelease());
cvfc.setModel(resourceVf.getModel());
cvfc.setResourceVendorModelNumber(resourceVf.getResourceVendorModelNumber());
if (MapUtils.isEmpty(newResource.getToscaArtifacts())) {
setToscaArtifactsPlaceHolders(newResource, user);
}
- if (MapUtils.isEmpty(newResource.getInterfaces())) {
- newResource.setInterfaces(oldResource.getInterfaces());
- }
+
if (CollectionUtils.isEmpty(newResource.getAttributes())) {
newResource.setAttributes(oldResource.getAttributes());
}
if (newResource.getContactId() == null) {
newResource.setContactId(oldResource.getContactId());
}
+ newResource.setIcon(oldResource.getIcon());
newResource.setCategories(oldResource.getCategories());
if (newResource.getVendorName() == null) {
newResource.setVendorName(oldResource.getVendorName());
while (intItr.hasNext() && eitherResult.isLeft()) {
InterfaceDefinition interfaceDefinition = intItr.next();
String intType = interfaceDefinition.getUniqueId();
- Either<InterfaceDefinition, StorageOperationStatus> eitherCapTypeFound = interfaceTypeOperation.getInterface(intType);
+ Either<InterfaceDefinition, StorageOperationStatus> eitherCapTypeFound = interfaceTypeOperation.getInterface(UniqueIdBuilder.buildInterfaceTypeUid(resource.getModel(), intType));
if (eitherCapTypeFound.isRight()) {
if (eitherCapTypeFound.right().value() == StorageOperationStatus.NOT_FOUND) {
BeEcompErrorManager.getInstance()
componentsUtils.auditResource(componentsUtils.getResponseFormat(ActionStatus.CREATED), user, createdResource, actionEnum);
ASDCKpiApi.countCreatedResourcesKPI();
} catch (ComponentException e) {
+ janusGraphDao.rollback();
ResponseFormat responseFormat =
e.getResponseFormat() == null ? componentsUtils.getResponseFormat(e.getActionStatus(), e.getParams()) : e.getResponseFormat();
componentsUtils.auditResource(responseFormat, user, resource, actionEnum);
throw e;
} catch (StorageException e) {
+ janusGraphDao.rollback();
ResponseFormat responseFormat = componentsUtils
.getResponseFormat(componentsUtils.convertFromStorageResponse(e.getStorageOperationStatus()));
componentsUtils.auditResource(responseFormat, user, resource, actionEnum);
throw new ByActionStatusComponentException(ActionStatus.RESOURCE_TOO_MUCH_SUBCATEGORIES);
}
SubCategoryDefinition subcategory = subcategories.get(0);
- if (!ValidationUtils.validateStringNotEmpty(category.getName())) {
+ if (StringUtils.isEmpty(category.getName())) {
log.debug(CATEGORY_IS_EMPTY);
ResponseFormat responseFormat = componentsUtils
.getResponseFormat(ActionStatus.COMPONENT_MISSING_CATEGORY, ComponentTypeEnum.RESOURCE.getValue());
componentsUtils.auditResource(responseFormat, user, resource, actionEnum);
throw new ByActionStatusComponentException(ActionStatus.COMPONENT_MISSING_CATEGORY, ComponentTypeEnum.RESOURCE.getValue());
}
- if (!ValidationUtils.validateStringNotEmpty(subcategory.getName())) {
+ if (StringUtils.isEmpty(subcategory.getName())) {
log.debug(CATEGORY_IS_EMPTY);
ResponseFormat responseFormat = componentsUtils
.getResponseFormat(ActionStatus.COMPONENT_MISSING_SUBCATEGORY, ComponentTypeEnum.RESOURCE.getValue());
public void validateVendorReleaseName(User user, Resource resource, AuditingActionEnum actionEnum) {
String vendorRelease = resource.getVendorRelease();
log.debug("validate vendor relese name");
- if (!ValidationUtils.validateStringNotEmpty(vendorRelease)) {
+ if (StringUtils.isEmpty(vendorRelease)) {
log.info("vendor relese name is missing.");
ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.MISSING_VENDOR_RELEASE);
componentsUtils.auditResource(errorResponse, user, resource, actionEnum);
private void validateVendorName(User user, Resource resource, AuditingActionEnum actionEnum) {
String vendorName = resource.getVendorName();
- if (!ValidationUtils.validateStringNotEmpty(vendorName)) {
+ if (StringUtils.isEmpty(vendorName)) {
log.info("vendor name is missing.");
ResponseFormat errorResponse = componentsUtils.getResponseFormat(ActionStatus.MISSING_VENDOR_NAME);
componentsUtils.auditResource(errorResponse, user, resource, actionEnum);