use of com.epam.pipeline.controller.vo.MetadataVO in project cloud-pipeline by epam.
the class FolderTemplateManager method updateMetadata.
private void updateMetadata(Map<String, PipeConfValue> data, EntityVO entity) {
MetadataVO metadataVO = new MetadataVO();
metadataVO.setData(data);
metadataVO.setEntity(entity);
metadataManager.updateMetadataItemKeys(metadataVO);
}
use of com.epam.pipeline.controller.vo.MetadataVO in project cloud-pipeline by epam.
the class MetadataManager method uploadMetadataFromFile.
@Transactional(propagation = Propagation.REQUIRED)
public MetadataEntry uploadMetadataFromFile(final EntityVO entityVO, final MultipartFile file, final boolean mergeWithExistingMetadata) {
checkEntityExistence(entityVO.getEntityId(), entityVO.getEntityClass());
final MetadataVO metadataVO = new MetadataVO();
metadataVO.setEntity(entityVO);
metadataVO.setData(convertFileContentToMetadata(file));
if (mergeWithExistingMetadata) {
return updateMetadataItemKeys(metadataVO);
} else {
return updateMetadataItem(metadataVO);
}
}
use of com.epam.pipeline.controller.vo.MetadataVO in project cloud-pipeline by epam.
the class FolderManagerTest method testListProjectsShouldReturnFolderWithIndicatorSet.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void testListProjectsShouldReturnFolderWithIndicatorSet() {
folderManager.create(folder);
MetadataVO metadataVO = new MetadataVO();
metadataVO.setEntity(new EntityVO(folder.getId(), AclClass.FOLDER));
metadataVO.setData(Collections.singletonMap(PROJECT_INDICATOR_TYPE, new PipeConfValue(DEFAULT_PARAM_TYPE, PROJECT_INDICATOR_VALUE)));
metadataManager.updateMetadataItem(metadataVO);
List<Folder> folders = folderManager.loadAllProjects().getChildFolders();
assertThat(folders.size(), is(1));
assertThat(folders.get(0).getId(), is(folder.getId()));
}
use of com.epam.pipeline.controller.vo.MetadataVO in project cloud-pipeline by epam.
the class FolderManagerTest method shouldCloneFolderWithFolderMetadata.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
public void shouldCloneFolderWithFolderMetadata() {
Folder sourceFolder = new Folder();
sourceFolder.setName(FOLDER_TO_CLONE);
folderManager.create(sourceFolder);
Map<String, PipeConfValue> metadata = new HashMap<>();
metadata.put(DATA_KEY_1, new PipeConfValue(DATA_TYPE_1, DATA_VALUE_1));
MetadataVO metadataVO = new MetadataVO();
metadataVO.setEntity(new EntityVO(sourceFolder.getId(), AclClass.FOLDER));
metadataVO.setData(metadata);
MetadataEntry expectedMetadata = metadataManager.updateMetadataItem(metadataVO);
Folder childSourceFolder = new Folder();
childSourceFolder.setName(CHILD_FOLDER_TO_CLONE);
childSourceFolder.setParentId(sourceFolder.getId());
folderManager.create(childSourceFolder);
metadataVO.setEntity(new EntityVO(childSourceFolder.getId(), AclClass.FOLDER));
metadataManager.updateMetadataItem(metadataVO);
Folder destinationFolder = new Folder();
destinationFolder.setName(TEST_NAME);
folderManager.create(destinationFolder);
folderManager.cloneFolder(sourceFolder.getId(), destinationFolder.getId(), TEST_CLONE_PREFIX);
destinationFolder = folderManager.load(folderManager.loadByNameOrId(TEST_NAME).getId());
Folder clonedFolder = destinationFolder.getChildFolders().get(0);
MetadataEntry clonedFolderMetadata = metadataManager.loadMetadataItem(clonedFolder.getId(), AclClass.FOLDER);
assertEquals(clonedFolder.getId(), clonedFolderMetadata.getEntity().getEntityId());
assertFolderMetadata(expectedMetadata, clonedFolderMetadata);
Folder clonedChildFolder = clonedFolder.getChildFolders().get(0);
clonedFolderMetadata = metadataManager.loadMetadataItem(clonedChildFolder.getId(), AclClass.FOLDER);
assertEquals(clonedChildFolder.getId(), clonedFolderMetadata.getEntity().getEntityId());
assertFolderMetadata(expectedMetadata, clonedFolderMetadata);
}
Aggregations