Search in sources :

Example 1 with DatabaseEntity

use of com.synopsys.integration.alert.database.DatabaseEntity in project hub-alert by blackducksoftware.

the class DescriptorMocker method registerDescriptor.

public void registerDescriptor(String descriptorName, DescriptorType type) {
    Optional<Long> optionalTypeId = descriptorTypeRepository.findFirstByType(type.name()).map(DatabaseEntity::getId);
    Long typeId;
    if (optionalTypeId.isPresent()) {
        typeId = optionalTypeId.get();
    } else {
        typeId = descriptorTypeRepository.save(new DescriptorTypeEntity(type.name())).getId();
    }
    registeredDescriptorRepository.save(new RegisteredDescriptorEntity(descriptorName, typeId)).getId();
}
Also used : RegisteredDescriptorEntity(com.synopsys.integration.alert.database.configuration.RegisteredDescriptorEntity) DescriptorTypeEntity(com.synopsys.integration.alert.database.configuration.DescriptorTypeEntity) DatabaseEntity(com.synopsys.integration.alert.database.DatabaseEntity)

Aggregations

DatabaseEntity (com.synopsys.integration.alert.database.DatabaseEntity)1 DescriptorTypeEntity (com.synopsys.integration.alert.database.configuration.DescriptorTypeEntity)1 RegisteredDescriptorEntity (com.synopsys.integration.alert.database.configuration.RegisteredDescriptorEntity)1