Search in sources :

Example 16 with AbstractDataStorage

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;
}
Also used : MapSqlParameterSource(org.springframework.jdbc.core.namedparam.MapSqlParameterSource) AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage)

Example 17 with AbstractDataStorage

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);
            }
        });
    });
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) ArrayList(java.util.ArrayList) DataStorageLink(com.epam.pipeline.entity.pipeline.run.parameter.DataStorageLink)

Example 18 with AbstractDataStorage

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;
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage)

Example 19 with AbstractDataStorage

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);
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage)

Example 20 with AbstractDataStorage

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);
}
Also used : AbstractDataStorage(com.epam.pipeline.entity.datastorage.AbstractDataStorage) DataStorageException(com.epam.pipeline.entity.datastorage.DataStorageException)

Aggregations

AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)62 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)22 Test (org.junit.Test)22 Transactional (org.springframework.transaction.annotation.Transactional)18 Folder (com.epam.pipeline.entity.pipeline.Folder)13 DataStorageVO (com.epam.pipeline.controller.vo.DataStorageVO)11 ArrayList (java.util.ArrayList)7 List (java.util.List)6 EntityVO (com.epam.pipeline.controller.vo.EntityVO)5 StoragePolicy (com.epam.pipeline.entity.datastorage.StoragePolicy)5 Service (org.springframework.stereotype.Service)5 Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)4 UpdateDataStorageItemVO (com.epam.pipeline.controller.vo.data.storage.UpdateDataStorageItemVO)3 DataStorageDownloadFileUrl (com.epam.pipeline.entity.datastorage.DataStorageDownloadFileUrl)3 DataStorageException (com.epam.pipeline.entity.datastorage.DataStorageException)3 DataStorageFile (com.epam.pipeline.entity.datastorage.DataStorageFile)3 DataStorageLink (com.epam.pipeline.entity.pipeline.run.parameter.DataStorageLink)3 ObjectCreatorUtils.constructDataStorageVO (com.epam.pipeline.manager.ObjectCreatorUtils.constructDataStorageVO)3 IOException (java.io.IOException)3 MessageConstants (com.epam.pipeline.common.MessageConstants)2