Search in sources :

Example 1 with MetadataClass

use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.

the class MetadataEntityManager method loadClass.

public MetadataClass loadClass(Long id) {
    MetadataClass metadataClass = metadataClassDao.loadMetadataClass(id);
    Assert.notNull(metadataClass, messageHelper.getMessage(MessageConstants.ERROR_METADATA_ENTITY_CLASS_NOT_FOUND, id));
    return metadataClass;
}
Also used : MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass)

Example 2 with MetadataClass

use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.

the class MetadataEntityManager method deleteMetadataEntitiesInProject.

/**
 * Deletes all metadata entities, present in project {@link com.epam.pipeline.entity.pipeline.Folder}.
 * Optionally supports deletion only of specified {@link MetadataClass}
 * @param projectId specifies {@link com.epam.pipeline.entity.pipeline.Folder} to delete metadata from
 * @param entityClassName optional name of {@link MetadataClass}, if it is specified only entities of
 *                    this class are deleted
 */
@Transactional(propagation = Propagation.REQUIRED)
public void deleteMetadataEntitiesInProject(Long projectId, String entityClassName) {
    Objects.requireNonNull(projectId);
    if (StringUtils.hasText(entityClassName)) {
        MetadataClass metadataClass = loadClass(entityClassName);
        metadataEntityDao.deleteMetadataClassFromProject(projectId, metadataClass.getId());
    } else {
        metadataEntityDao.deleteMetadataFromFolder(projectId);
    }
}
Also used : MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with MetadataClass

use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.

the class MetadataEntityManager method createMetadataClass.

@Transactional(propagation = Propagation.REQUIRED)
public MetadataClass createMetadataClass(final String className) {
    if (StringUtils.isEmpty(className)) {
        throw new IllegalArgumentException("User entity class name must be not empty.");
    }
    MetadataClass metadataClass = new MetadataClass();
    metadataClass.setName(className);
    metadataClassDao.createMetadataClass(metadataClass);
    return metadataClass;
}
Also used : MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass) Transactional(org.springframework.transaction.annotation.Transactional)

Example 4 with MetadataClass

use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.

the class MetadataEntityManager method getMetadataKeys.

public List<MetadataField> getMetadataKeys(Long folderId, String className) {
    Assert.notNull(folderId, messageHelper.getMessage(MessageConstants.ERROR_INVALID_METADATA_FILTER, "folderId", folderId));
    folderManager.load(folderId);
    Assert.notNull(className, messageHelper.getMessage(MessageConstants.ERROR_INVALID_METADATA_FILTER, "class", className));
    MetadataClass metadataClass = loadClass(className);
    return metadataEntityDao.getMetadataKeys(folderId, metadataClass.getId());
}
Also used : MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass)

Example 5 with MetadataClass

use of com.epam.pipeline.entity.metadata.MetadataClass in project cloud-pipeline by epam.

the class MetadataEntityManager method loadClass.

public MetadataClass loadClass(String name) {
    MetadataClass metadataClass = metadataClassDao.loadMetadataClass(name);
    Assert.notNull(metadataClass, messageHelper.getMessage(MessageConstants.ERROR_METADATA_ENTITY_CLASS_NOT_FOUND, name));
    return metadataClass;
}
Also used : MetadataClass(com.epam.pipeline.entity.metadata.MetadataClass)

Aggregations

MetadataClass (com.epam.pipeline.entity.metadata.MetadataClass)25 Folder (com.epam.pipeline.entity.pipeline.Folder)11 MetadataEntity (com.epam.pipeline.entity.metadata.MetadataEntity)10 Transactional (org.springframework.transaction.annotation.Transactional)10 Test (org.junit.Test)7 AbstractSpringTest (com.epam.pipeline.AbstractSpringTest)6 PipeConfValue (com.epam.pipeline.entity.metadata.PipeConfValue)5 MetadataEntityVO (com.epam.pipeline.controller.vo.metadata.MetadataEntityVO)3 MetadataReadingException (com.epam.pipeline.exception.MetadataReadingException)3 IOException (java.io.IOException)3 com.epam.pipeline.manager.metadata.parser (com.epam.pipeline.manager.metadata.parser)2 FolderManager (com.epam.pipeline.manager.pipeline.FolderManager)2 AuthManager (com.epam.pipeline.manager.security.AuthManager)2 MetadataParsingUtils (com.epam.pipeline.manager.utils.MetadataParsingUtils)2 InputStream (java.io.InputStream)2 Arrays (java.util.Arrays)2 List (java.util.List)2 Assert.assertEquals (org.junit.Assert.assertEquals)2 Assert.assertTrue (org.junit.Assert.assertTrue)2 Test (org.junit.jupiter.api.Test)2