Search in sources :

Example 61 with Folder

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;
}
Also used : Folder(com.epam.pipeline.entity.pipeline.Folder) Transactional(org.springframework.transaction.annotation.Transactional)

Example 62 with Folder

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

Example 63 with Folder

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);
}
Also used : AclPermission(com.epam.pipeline.security.acl.AclPermission) Folder(com.epam.pipeline.entity.pipeline.Folder)

Example 64 with Folder

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

Example 65 with 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());
}
Also used : RunConfiguration(com.epam.pipeline.entity.configuration.RunConfiguration) FirecloudRunConfigurationEntry(com.epam.pipeline.entity.configuration.FirecloudRunConfigurationEntry) RunConfigurationEntry(com.epam.pipeline.entity.configuration.RunConfigurationEntry) Folder(com.epam.pipeline.entity.pipeline.Folder) Test(org.junit.Test) AbstractSpringTest(com.epam.pipeline.AbstractSpringTest) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

Folder (com.epam.pipeline.entity.pipeline.Folder)102 Transactional (org.springframework.transaction.annotation.Transactional)53 Test (org.junit.Test)52 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)48 EntityVO (com.epam.pipeline.controller.vo.EntityVO)14 AbstractDataStorage (com.epam.pipeline.entity.datastorage.AbstractDataStorage)14 Pipeline (com.epam.pipeline.entity.pipeline.Pipeline)14 MetadataClass (com.epam.pipeline.entity.metadata.MetadataClass)13 RunConfiguration (com.epam.pipeline.entity.configuration.RunConfiguration)11 MetadataEntity (com.epam.pipeline.entity.metadata.MetadataEntity)11 PipeConfValue (com.epam.pipeline.entity.metadata.PipeConfValue)10 AclClass (com.epam.pipeline.entity.security.acl.AclClass)10 Autowired (org.springframework.beans.factory.annotation.Autowired)8 Propagation (org.springframework.transaction.annotation.Propagation)8 MetadataEntityVO (com.epam.pipeline.controller.vo.metadata.MetadataEntityVO)7 PasswordGenerator.generateRandomString (com.epam.pipeline.utils.PasswordGenerator.generateRandomString)6 FolderWithMetadata (com.epam.pipeline.entity.metadata.FolderWithMetadata)5 DataStorageVO (com.epam.pipeline.controller.vo.DataStorageVO)4 AbstractManagerTest (com.epam.pipeline.manager.AbstractManagerTest)4 Collectors (java.util.stream.Collectors)4