private Multimap < String , Setting > loadComponentSettings ( DbSession dbSession , Set < String > keys , ComponentDto component ) { List < String > componentUuids = DOT_SPLITTER . splitToList ( component . moduleUuidPath ( ) ) ; List < ComponentDto > componentDtos = dbClient . componentDao ( ) . selectByUuids ( dbSession , componentUuids ) ; Set < Long > componentIds = componentDtos . stream ( ) . map ( ComponentDto :: getId ) . collect ( Collectors . toSet ( ) ) ; Map < Long , String > uuidsById = componentDtos . stream ( ) . collect ( Collectors . toMap ( ComponentDto :: getId , ComponentDto :: uuid ) ) ; List < PropertyDto > properties = dbClient . propertiesDao ( ) . selectPropertiesByKeysAndComponentIds ( dbSession , keys , componentIds ) ; List < PropertyDto > propertySets = dbClient . propertiesDao ( ) . selectPropertiesByKeysAndComponentIds ( dbSession , getPropertySetKeys ( properties ) , componentIds ) ; Multimap < String , Setting > settingsByUuid = TreeMultimap . create ( Ordering . explicit ( componentUuids ) , Ordering . arbitrary ( ) ) ; for ( PropertyDto propertyDto : properties ) { Long componentId = propertyDto . getResourceId ( ) ; String componentUuid = uuidsById . get ( componentId ) ; String propertyKey = propertyDto . getKey ( ) ; settingsByUuid . put ( componentUuid , Setting . createFromDto ( propertyDto , getPropertySets ( propertyKey , propertySets , componentId ) , propertyDefinitions . get ( propertyKey ) ) ) ; } return settingsByUuid ; }
Return list of settings by component uuid sorted from project to lowest module