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();
}
Aggregations