use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class FolderManager method cloneFolder.
/**
* Clones folder specified by ID. The following content will be copied: data storages, configurations,
* folder metadata, metadata entities and child folders.
* Note: pipelines will not be cloned.
* @param id ID of {@link Folder} to be cloned
* @param destinationFolderId ID of parent {@link Folder} for storing clone
* @param name {@link Folder} clone name
* @return resulting {@link Folder} instance
*/
@Transactional(propagation = Propagation.REQUIRED)
public Folder cloneFolder(Long id, Long destinationFolderId, String name) {
Folder folderToClone = crudManager.load(id);
Folder destinationFolder = crudManager.load(destinationFolderId);
verifyFolderNames(destinationFolder.getChildFolders(), name);
prepareStoragesForClone(folderToClone, name + storageSuffix, countDataStorages(folderToClone) > 1);
folderToClone.setName(name);
Folder clonedFolder = createCloneFolder(folderToClone, destinationFolderId);
clonedFolder.setChildFolders(Collections.emptyList());
return clonedFolder;
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class PipelineManager method setFolderIfPresent.
private void setFolderIfPresent(Pipeline dbPipeline) {
if (dbPipeline.getParentFolderId() != null) {
Folder parent = folderManager.load(dbPipeline.getParentFolderId());
dbPipeline.setParent(parent);
}
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class GrantPermissionManager method childrenFolderPermission.
public boolean childrenFolderPermission(Long id, String permissionName) {
Folder folder = folderManager.load(id);
Folder initialFolder = folder.copy();
AclPermission aclPermission = AclPermission.getAclPermissionByName(permissionName);
filterTree(folder, aclPermission);
return checkEntityTreeWasNotFilter(initialFolder, folder, aclPermission);
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class RunConfigurationDaoTest method buildFolder.
private Folder buildFolder(final String name, final Long parentId) {
Folder folder = ObjectCreatorUtils.createFolder(name, parentId);
folder.setOwner(TEST_OWNER);
folderDao.createFolder(folder);
return folder;
}
use of com.epam.pipeline.entity.pipeline.Folder in project cloud-pipeline by epam.
the class RunConfigurationDaoTest method shouldLoadRunConfigurationWithFolderTree.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void shouldLoadRunConfigurationWithFolderTree() {
Folder root = buildFolder(TEST_NAME, null);
root.setParentId(0L);
Folder folder = buildFolder(TEST_NAME_1, root.getId());
folder.setParent(root);
Folder parent = buildFolder(TEST_NAME_2, folder.getId());
parent.setParent(folder);
RunConfigurationEntry entry = ObjectCreatorUtils.createConfigEntry(TEST_CONFIG_NAME, true, getTestConfig());
RunConfiguration configuration = ObjectCreatorUtils.createConfiguration(TEST_NAME, TEST_DESCRIPTION, parent.getId(), TEST_OWNER, Collections.singletonList(entry));
RunConfiguration created = runConfigurationDao.create(configuration);
verifyRunConfiguration(configuration, created);
// load with folders
RunConfiguration loaded = runConfigurationDao.loadConfigurationWithParents(created.getId());
verifyRunConfiguration(configuration, loaded);
verifyFolderTree(parent, loaded.getParent());
}
Aggregations