private void validateRequest ( CmdbRequest request ) throws HygieiaException { String busServiceName = request . getConfigurationItemBusServName ( ) ; if ( ! StringUtils . isEmpty ( busServiceName ) && cmdbRepository . findByConfigurationItemAndItemType ( busServiceName , APP_TYPE ) == null ) { throw new HygieiaException ( "Configuration Item " + busServiceName + " does not exist" , HygieiaException . BAD_DATA ) ; } Cmdb cmdb = cmdbRepository . findByConfigurationItemIgnoreCaseOrCommonNameIgnoreCase ( request . getConfigurationItem ( ) , request . getCommonName ( ) ) ; if ( cmdb != null ) { throw new HygieiaException ( "Configuration Item " + cmdb . getConfigurationItem ( ) + " already exists" , HygieiaException . DUPLICATE_DATA ) ; } List < Collector > collectors = collectorRepository . findByCollectorTypeAndName ( CollectorType . CMDB , request . getToolName ( ) ) ; if ( CollectionUtils . isEmpty ( collectors ) ) { throw new HygieiaException ( request . getToolName ( ) + " collector is not available." , HygieiaException . BAD_DATA ) ; } }
Validates CmdbRequest for errors