@ Override public DataResponse < List < Feature > > getFeatureEpicEstimates ( ObjectId componentId , String teamId , String projectId , Optional < String > agileType , Optional < String > estimateMetricType ) { Component component = componentRepository . findOne ( componentId ) ; if ( ( component == null ) || CollectionUtils . isEmpty ( component . getCollectorItems ( ) ) || CollectionUtils . isEmpty ( component . getCollectorItems ( ) . get ( CollectorType . AgileTool ) ) || ( component . getCollectorItems ( ) . get ( CollectorType . AgileTool ) . get ( 0 ) == null ) ) { return getEmptyLegacyDataResponse ( ) ; } CollectorItem item = component . getCollectorItems ( ) . get ( CollectorType . AgileTool ) . get ( 0 ) ; List < Feature > relevantFeatureEstimates = getFeaturesForCurrentSprints ( teamId , projectId , item . getCollectorId ( ) , agileType . isPresent ( ) ? agileType . get ( ) : null , true ) ; // epicID : epic information (in the form of a Feature object) Map < String , Feature > epicIDToEpicFeatureMap = new HashMap <> ( ) ; for ( Feature tempRs : relevantFeatureEstimates ) { String epicID = tempRs . getsEpicID ( ) ; if ( StringUtils . isEmpty ( epicID ) ) continue ; Feature feature = epicIDToEpicFeatureMap . get ( epicID ) ; if ( feature == null ) { feature = new Feature ( ) ; feature . setId ( null ) ; feature . setsEpicID ( epicID ) ; feature . setsEpicNumber ( tempRs . getsEpicNumber ( ) ) ; feature . setsEpicUrl ( tempRs . getsEpicUrl ( ) ) ; feature . setsEpicName ( tempRs . getsEpicName ( ) ) ; feature . setsEpicAssetState ( tempRs . getsEpicAssetState ( ) ) ; feature . setsEstimate ( "0" ) ; epicIDToEpicFeatureMap . put ( epicID , feature ) ; } // if estimateMetricType is hours accumulate time estimate in minutes for better precision ... divide by 60 later int estimate = getEstimate ( tempRs , estimateMetricType ) ; feature . setsEstimate ( String . valueOf ( Integer . valueOf ( feature . getsEstimate ( ) ) + estimate ) ) ; } if ( isEstimateTime ( estimateMetricType ) ) { // time estimate is in minutes but we want to return in hours for ( Feature f : epicIDToEpicFeatureMap . values ( ) ) { f . setsEstimate ( String . valueOf ( Integer . valueOf ( f . getsEstimate ( ) ) / 60 ) ) ; } } Collector collector = collectorRepository . findOne ( item . getCollectorId ( ) ) ; return new DataResponse <> ( new ArrayList <> ( epicIDToEpicFeatureMap . values ( ) ) , collector . getLastExecuted ( ) ) ; }
Retrieves all unique super features and their total sub feature estimates for a given team and their current sprint