public StorageEntity createStorageEntity(String storageName,StoragePlatformEntity storagePlatformEntity,List<Attribute> attributes){
  StorageEntity storageEntity=new StorageEntity();
  storageEntity.setName(storageName);
  storageEntity.setStoragePlatform(storagePlatformEntity);
  if (!CollectionUtils.isEmpty(attributes)) {
    List<StorageAttributeEntity> attributeEntities=new ArrayList<>();
    storageEntity.setAttributes(attributeEntities);
    for (    Attribute attribute : attributes) {
      StorageAttributeEntity attributeEntity=new StorageAttributeEntity();
      attributeEntities.add(attributeEntity);
      attributeEntity.setStorage(storageEntity);
      attributeEntity.setName(attribute.getName());
      attributeEntity.setValue(attribute.getValue());
    }
  }
  return storageDao.saveAndRefresh(storageEntity);
}

public StorageEntity createStorageEntity ( String storageName , StoragePlatformEntity storagePlatformEntity , List < Attribute > attributes ) { StorageEntity storageEntity = new StorageEntity ( ) ; storageEntity . setName ( storageName ) ; storageEntity . setStoragePlatform ( storagePlatformEntity ) ; if ( ! CollectionUtils . isEmpty ( attributes ) ) { List < StorageAttributeEntity > attributeEntities = new ArrayList < > ( ) ; storageEntity . setAttributes ( attributeEntities ) ; for ( Attribute attribute : attributes ) { StorageAttributeEntity attributeEntity = new StorageAttributeEntity ( ) ; attributeEntities . add ( attributeEntity ) ; attributeEntity . setStorage ( storageEntity ) ; attributeEntity . setName ( attribute . getName ( ) ) ; attributeEntity . setValue ( attribute . getValue ( ) ) ; } } return storageDao . saveAndRefresh ( storageEntity ) ; }
creates and persists a new storage entity .
