use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.
the class DataStorageDao method loadDataStorageByNameAndParentId.
public AbstractDataStorage loadDataStorageByNameAndParentId(String name, Long folderId) {
MapSqlParameterSource params = new MapSqlParameterSource();
params.addValue(DataStorageParameters.DATASTORAGE_NAME.name(), name);
params.addValue(DataStorageParameters.PATH.name(), name);
params.addValue(DataStorageParameters.FOLDER_ID.name(), folderId);
List<AbstractDataStorage> items = getNamedParameterJdbcTemplate().query(loadDataStorageByNameAndParentIdQuery, params, DataStorageParameters.getRowMapper());
return !items.isEmpty() ? items.get(0) : null;
}
use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.
the class DataStorageManager method analyzePipelineRunsParameters.
public void analyzePipelineRunsParameters(List<PipelineRun> pipelineRuns) {
List<AbstractDataStorage> dataStorages = getDataStorages();
pipelineRuns.forEach(pipelineRun -> {
if (pipelineRun.getPipelineRunParameters() == null) {
return;
}
pipelineRun.getPipelineRunParameters().forEach(pipelineRunParameter -> {
List<DataStorageLink> links = new ArrayList<>();
for (AbstractDataStorage dataStorage : dataStorages) {
String value = StringUtils.isNotBlank(pipelineRunParameter.getResolvedValue()) ? pipelineRunParameter.getResolvedValue() : pipelineRunParameter.getValue();
List<DataStorageLink> dataStorageLinks = getLinks(dataStorage, value);
if (!dataStorageLinks.isEmpty()) {
links.addAll(dataStorageLinks);
}
}
if (!links.isEmpty()) {
pipelineRunParameter.setDataStorageLinks(links);
}
});
});
}
use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.
the class DataStorageManager method changeOwner.
@Override
public AbstractSecuredEntity changeOwner(Long id, String owner) {
final AbstractDataStorage dataStorage = dataStorageDao.loadDataStorage(id);
dataStorage.setOwner(owner);
dataStorageDao.updateDataStorage(dataStorage);
return dataStorage;
}
use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.
the class DataStorageManager method createDataStorageFile.
public DataStorageFile createDataStorageFile(final Long dataStorageId, final String path, final String name, InputStream contentStream) {
AbstractDataStorage dataStorage = load(dataStorageId);
String newFilePath = getRelativePath(path, name, dataStorage);
return storageProviderManager.createFile(dataStorage, newFilePath, contentStream);
}
use of com.epam.pipeline.entity.datastorage.AbstractDataStorage in project cloud-pipeline by epam.
the class DataStorageManager method restoreVersion.
public void restoreVersion(Long id, String path, String version) throws DataStorageException {
Assert.notNull(path, "Path is required to restore file version");
Assert.notNull(version, "Version is required to restore file version");
AbstractDataStorage dataStorage = load(id);
if (!dataStorage.isVersioningEnabled()) {
throw new DataStorageException(messageHelper.getMessage(MessageConstants.ERROR_DATASTORAGE_VERSIONING_REQUIRED, dataStorage.getName()));
}
storageProviderManager.restoreFileVersion(dataStorage, path, version);
}
Aggregations