use of com.epam.pipeline.entity.metadata.FolderWithMetadata in project cloud-pipeline by epam.
the class ParameterMapper method resolveConfigurations.
public List<ResolvedConfiguration> resolveConfigurations(AnalysisConfiguration<? extends AbstractRunConfigurationEntry> configuration) {
FolderWithMetadata project = folderManager.getProject(configuration.getConfigurationId(), AclClass.CONFIGURATION);
Map<String, PipeConfValue> projectData = project == null ? new HashMap<>() : project.getData();
List<? extends AbstractRunConfigurationEntry> entries = configuration.getEntries();
if (CollectionUtils.isEmpty(configuration.getEntitiesIds())) {
return Collections.singletonList(resolveParameters(entries, projectData));
}
// In case of array references one entity may be expanded to
// list of references entities, e.g. SampleSet is expanded
// to list of Sample entities
// TODO: The only reason to store it as map - is to add association to run
// TODO: to initial entity, from which link comes. Find better solution.
Map<Long, List<MetadataEntity>> targetEntities = fetchAndExpandInputEntities(configuration);
// resolve all parameter references in configurations
Map<Long, ResolvedConfiguration> resolvedConfigurations = targetEntities.values().stream().flatMap(Collection::stream).collect(Collectors.toMap(BaseEntity::getId, entity -> resolveParameters(entity, entries, projectData)));
return targetEntities.entrySet().stream().map(idToEntities -> idToEntities.getValue().stream().map(entity -> {
ResolvedConfiguration currentConfiguration = resolvedConfigurations.get(entity.getId());
currentConfiguration.getAssociatedEntityIds().add(idToEntities.getKey());
return currentConfiguration;
}).collect(Collectors.toList())).flatMap(Collection::stream).collect(Collectors.toList());
}
use of com.epam.pipeline.entity.metadata.FolderWithMetadata in project cloud-pipeline by epam.
the class FirecloudRunner method runAnalysis.
@Override
public List<PipelineRun> runAnalysis(AnalysisConfiguration<FirecloudRunConfigurationEntry> configuration) {
Assert.state(CollectionUtils.isNotEmpty(configuration.getEntitiesIds()), "Entities are required to run analysis in Firecloud");
FolderWithMetadata project = folderManager.getProject(configuration.getConfigurationId(), AclClass.CONFIGURATION);
Assert.notNull(project, "Project folder must be specified to run analysis in Firecloud.");
List<Long> entities = parameterMapper.fetchAndExpandInputEntities(configuration).values().stream().flatMap(Collection::stream).map(BaseEntity::getId).collect(Collectors.toList());
// TODO: after merge - add check that FC class is filled
configuration.getEntries().forEach(this::validateFirecloudConfiguration);
FirecloudConfiguration settings = buildFirecloudConfig(configuration.getRefreshToken());
return configuration.getEntries().stream().map(entry -> runFirecloudAnalysis(settings, entry, configuration.getConfigurationId(), entities, project.getId())).collect(Collectors.toList());
}
use of com.epam.pipeline.entity.metadata.FolderWithMetadata in project cloud-pipeline by epam.
the class FolderDaoTest method testLoadParentFolders.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testLoadParentFolders() {
Folder folder = getFolder();
Folder folder1 = createFolderWithParent(folder, "folder1");
Folder folder2 = createFolderWithParent(folder1, "folder2");
// folder that exists but mustn't be included in actualFolders
createFolderWithParent(folder1, "folder3");
List<Folder> expectedFolders = Stream.of(folder, folder1, folder2).collect(Collectors.toList());
List<FolderWithMetadata> expectedFoldersWithMetadata = createObjectMetadata(expectedFolders);
List<FolderWithMetadata> actualFoldersWithMetadata = folderDao.loadParentFolders(folder2.getId());
assertTrue(CollectionUtils.isEqualCollection(actualFoldersWithMetadata, expectedFoldersWithMetadata));
List<Folder> actualFolders = folderDao.loadFolderWithParents(folder2.getId());
assertTrue(CollectionUtils.isEqualCollection(actualFolders, expectedFolders));
}
use of com.epam.pipeline.entity.metadata.FolderWithMetadata in project cloud-pipeline by epam.
the class FolderDaoTest method convertToFolderWithMetadata.
private FolderWithMetadata convertToFolderWithMetadata(Folder folder) {
FolderWithMetadata folderWithMetadata = new FolderWithMetadata();
folderWithMetadata.setId(folder.getId());
folderWithMetadata.setParentId(folder.getParentId());
folderWithMetadata.setName(folder.getName());
folderWithMetadata.setOwner(folder.getOwner());
return folderWithMetadata;
}
use of com.epam.pipeline.entity.metadata.FolderWithMetadata in project cloud-pipeline by epam.
the class FolderManagerGetProjectTest method getProjectShouldWorkWithoutParent.
@Test
public void getProjectShouldWorkWithoutParent() {
Mockito.when(entityManager.load(Matchers.any(AclClass.class), Matchers.any(Long.class))).thenReturn(folder1);
FolderWithMetadata project = folderManager.getProject(folder1.getId(), AclClass.FOLDER);
assertNull(project);
}
Aggregations