use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class RunConfigurationVO method toEntity.
public RunConfiguration toEntity() {
RunConfiguration configuration = new RunConfiguration();
configuration.setId(getId());
configuration.setName(getName());
configuration.setDescription(getDescription());
if (parentId != null) {
configuration.setParent(new Folder(getParentId()));
}
if (CollectionUtils.isNotEmpty(entries)) {
configuration.setEntries(entries);
} else {
configuration.setEntries(Collections.emptyList());
}
return configuration;
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class DaoHelper method fillFolder.
public static Folder fillFolder(Map<Long, Folder> folders, Folder currentFolder) {
if (currentFolder == null) {
return null;
}
Long parentId = currentFolder.getParentId();
if (parentId == null) {
return currentFolder;
}
Folder folder = folders.get(parentId);
Folder newFolder = fillFolder(folders, folder);
currentFolder.setParent(newFolder);
return currentFolder;
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class MetadataEntityVO method convertToMetadataEntity.
public MetadataEntity convertToMetadataEntity() {
MetadataEntity metadataEntity = new MetadataEntity();
MetadataClass metadataClass = new MetadataClass();
metadataClass.setId(classId);
metadataClass.setName(className);
if (parentId != null) {
metadataEntity.setParent(new Folder(parentId));
}
metadataEntity.setId(entityId);
metadataEntity.setName(entityName);
metadataEntity.setExternalId(externalId);
metadataEntity.setClassEntity(metadataClass);
metadataEntity.setData(data);
return metadataEntity;
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class DataStorageManager method loadByNameOrId.
public AbstractDataStorage loadByNameOrId(final String identifier) {
AbstractDataStorage dataStorage = null;
if (NumberUtils.isDigits(identifier)) {
dataStorage = dataStorageDao.loadDataStorage(Long.parseLong(identifier));
}
if (dataStorage == null) {
String pathWithName = identifier;
if (pathWithName.startsWith("/")) {
pathWithName = pathWithName.substring(1);
}
if (pathWithName.endsWith("/")) {
pathWithName = pathWithName.substring(0, pathWithName.length() - 1);
}
String[] pathParts = pathWithName.split("/");
String dataStorageName = pathParts[pathParts.length - 1];
Long parentFolderId = null;
if (pathParts.length > 1) {
Folder parentFolder = folderManager.loadByNameOrId(String.join("/", Arrays.asList(pathParts).subList(0, pathParts.length - 1)));
if (parentFolder != null) {
parentFolderId = parentFolder.getId();
}
}
if (parentFolderId != null) {
dataStorage = dataStorageDao.loadDataStorageByNameAndParentId(dataStorageName, parentFolderId);
} else {
dataStorage = dataStorageDao.loadDataStorageByNameOrPath(dataStorageName, dataStorageName);
}
}
Assert.notNull(dataStorage, messageHelper.getMessage(MessageConstants.ERROR_DATASTORAGE_NOT_FOUND, identifier));
dataStorage.setHasMetadata(metadataManager.hasMetadata(new EntityVO(dataStorage.getId(), AclClass.DATA_STORAGE)));
return dataStorage;
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class DataStorageManager method create.
@Transactional(propagation = Propagation.REQUIRED)
public AbstractDataStorage create(DataStorageVO dataStorageVO, Boolean proceedOnCloud, Boolean checkExistence, boolean replaceStoragePath) throws DataStorageException {
Assert.isTrue(!StringUtils.isEmpty(dataStorageVO.getName()), messageHelper.getMessage(MessageConstants.ERROR_PARAMETER_NULL_OR_EMPTY, "name"));
assertDataStorageMountPoint(dataStorageVO);
dataStorageVO.setName(dataStorageVO.getName().trim());
checkDatastorageDoesntExist(dataStorageVO.getName(), dataStorageVO.getPath());
verifyStoragePolicy(dataStorageVO, dataStorageVO.getStoragePolicy(), true);
AbstractDataStorage dataStorage = dataStorageFactory.convertToDataStorage(dataStorageVO);
if (StringUtils.isBlank(dataStorage.getMountOptions())) {
dataStorage.setMountOptions(storageProviderManager.getStorageProvider(dataStorage).getDefaultMountOptions());
}
if (proceedOnCloud) {
if (replaceStoragePath) {
dataStorage.setPath(adjustStoragePath(dataStorage.getPath(), dataStorage.getType()));
}
String created = storageProviderManager.createBucket(dataStorage);
dataStorage.setPath(created);
} else if (checkExistence && !storageProviderManager.checkStorage(dataStorage)) {
throw new IllegalStateException(messageHelper.getMessage(MessageConstants.ERROR_DATASTORAGE_NOT_FOUND_BY_NAME, dataStorage.getName(), dataStorage.getPath()));
}
dataStorage.setOwner(authManager.getAuthorizedUser());
if (dataStorage.getParentFolderId() != null) {
Folder parent = folderManager.load(dataStorage.getParentFolderId());
dataStorage.setParent(parent);
}
dataStorageDao.createDataStorage(dataStorage);
if (dataStorage.isPolicySupported()) {
storageProviderManager.applyStoragePolicy(dataStorage);
}
return dataStorage;
}
Aggregations