idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
22,900
private Map < String , PipelineCommit > findCommitsForStage ( Dashboard dashboard , Pipeline pipeline , PipelineStage stage ) { Map < String , PipelineCommit > commitMap = new HashMap < > ( ) ; String psuedoEnvironmentName = PipelineStage . COMMIT . equals ( stage ) || PipelineStage . BUILD . equals ( stage ) ? stage ....
Gets all commits for a given pipeline stage taking into account the mappings for environment stages
22,901
public List < PipelineResponseCommit > findNotPropagatedCommits ( Dashboard dashboard , Pipeline pipeline , PipelineStage stage , List < PipelineStage > pipelineStageList ) { Map < String , PipelineCommit > startingStage = findCommitsForStage ( dashboard , pipeline , stage ) ; List < PipelineResponseCommit > notPropaga...
get the commits for a given stage by finding which commits havent passed to a later stage
22,902
protected List < AuditResult > getAuditResults ( Iterable < Dashboard > dashboards ) { int numberOfAuditDays = settings . getDays ( ) ; long auditBeginDateTimeStamp = Instant . now ( ) . minus ( Duration . ofDays ( numberOfAuditDays ) ) . toEpochMilli ( ) ; long auditEndDateTimeStamp = Instant . now ( ) . toEpochMilli ...
Get audit statuses for the dashboards
22,903
public void collect ( AWSCloudCollector collector ) { log ( "Starting AWS collection..." ) ; log ( "Collecting AWS Cloud Data..." ) ; Map < String , List < CloudInstance > > accountToInstanceMap = collectInstances ( ) ; Map < String , String > instanceToAccountMap = new HashMap < > ( ) ; for ( String account : accountT...
The collection action . This is the task which will run on a schedule to gather data from the feature content source system and update the repository with retrieved .
22,904
private BuildAuditResponse getBuildJobAuditResponse ( CollectorItem buildItem , long beginDate , long endDate , List < CollectorItem > repoItems ) { BuildAuditResponse buildAuditResponse = new BuildAuditResponse ( ) ; List < CollectorItemConfigHistory > jobConfigHists = collItemConfigHistoryRepository . findByCollector...
Calculates Audit Response for a given dashboard
22,905
public static AWSCloudCollector prototype ( ) { AWSCloudCollector protoType = new AWSCloudCollector ( ) ; protoType . setName ( "AWSCloud" ) ; protoType . setOnline ( true ) ; protoType . setEnabled ( true ) ; protoType . setCollectorType ( CollectorType . Cloud ) ; protoType . setLastExecuted ( System . currentTimeMil...
Creates a static prototype of the Cloud Collector which includes any specific settings or configuration required for the use of this collector including settings for connecting to any source systems .
22,906
@ RequestMapping ( value = "/feature/estimates/aggregatedsprints" , method = GET , produces = APPLICATION_JSON_VALUE ) public DataResponse < SprintEstimate > featureAggregatedSprintEstimates ( @ RequestParam ( value = "projectId" , required = true ) String projectId , @ RequestParam ( value = "agileType" , required = f...
REST endpoint for retrieving the current sprint estimates for a team
22,907
public Collection < CodeReviewAuditResponse > getPeerReviewResponses ( String repoUrl , String repoBranch , String scmName , long beginDt , long endDt ) { Collector githubCollector = collectorRepository . findByName ( ! StringUtils . isEmpty ( scmName ) ? scmName : "GitHub" ) ; CollectorItem collectorItem = collectorIt...
Calculates peer review response
22,908
public boolean isUserValid ( String userId , AuthType authType ) { if ( userInfoRepository . findByUsernameAndAuthType ( userId , authType ) != null ) { return true ; } else { if ( authType == AuthType . LDAP ) { try { return searchLdapUser ( userId ) ; } catch ( NamingException ne ) { LOGGER . error ( "Failed to query...
Can be called to check validity of userId when creating a dashboard remotely via api
22,909
private List < Owner > getOwners ( DashboardRemoteRequest request ) throws HygieiaException { DashboardRemoteRequest . DashboardMetaData metaData = request . getMetaData ( ) ; Owner owner = metaData . getOwner ( ) ; List < Owner > owners = metaData . getOwners ( ) ; if ( owner == null && CollectionUtils . isEmpty ( own...
Creates a list of unique owners from the owner and owners requests
22,910
private Map < String , WidgetRequest > generateRequestWidgetList ( List < DashboardRemoteRequest . Entry > entries , Dashboard dashboard ) throws HygieiaException { Map < String , WidgetRequest > allWidgetRequests = new HashMap < > ( ) ; for ( DashboardRemoteRequest . Entry entry : entries ) { List < Collector > collec...
Generates a Widget Request list of Widgets to be created from the request
22,911
private List < Dashboard > findExistingDashboardsFromRequest ( DashboardRemoteRequest request ) { String businessService = request . getMetaData ( ) . getBusinessService ( ) ; String businessApplication = request . getMetaData ( ) . getBusinessApplication ( ) ; if ( ! StringUtils . isEmpty ( businessService ) && ! Stri...
Takes a DashboardRemoteRequest . If the request contains a Business Service and Business Application then returns dashboard . Otherwise Checks dashboards for existing Title and returns dashboards .
22,912
private WidgetRequest entryToWidgetRequest ( Dashboard dashboard , DashboardRemoteRequest . Entry entry , Collector collector ) throws HygieiaException { WidgetRequest request = new WidgetRequest ( ) ; CollectorItem item = entryToCollectorItem ( entry , collector ) ; if ( item != null ) { request . setName ( entry . ge...
Creates a widget from entry
22,913
private Dashboard requestToDashboard ( DashboardRemoteRequest request ) throws HygieiaException { DashboardRemoteRequest . DashboardMetaData metaData = request . getMetaData ( ) ; Application application = new Application ( metaData . getApplicationName ( ) , new Component ( metaData . getComponentName ( ) ) ) ; String...
Creates a Dashboard object from the request .
22,914
private ScoreWeight getDashboardScoreFromWidgets ( List < ScoreWeight > widgetScores ) { if ( null == widgetScores ) { return getDashboardScore ( new ScoreTypeValue ( Constants . ZERO_SCORE ) , widgetScores ) ; } try { return getDashboardScore ( ScoreCalculationUtils . calculateComponentScoreTypeValue ( widgetScores , ...
Calculate dashboard score from widget score settings
22,915
private List < ScoreWeight > processWidgetScores ( List < Widget > widgets , ScoreCriteriaSettings scoreCriteriaSettings ) { List < ScoreWeight > scoreWeights = new ArrayList < > ( ) ; Map < String , ScoreComponentSettings > scoreParamSettingsMap = generateWidgetSettings ( scoreCriteriaSettings ) ; Set < String > widge...
Process scores for each widget based on widget settings
22,916
private void addSettingsToMap ( Map < String , ScoreComponentSettings > scoreParamSettingsMap , String widgetType , ScoreComponentSettings scoreComponentSettings ) { LOGGER . info ( "addSettingsToMap with widgetType:" + widgetType + " scoreParamSettings:" + scoreComponentSettings ) ; if ( null != scoreComponentSettings...
Add settings for widget in map if it exists This map is used to calculate score for team
22,917
private Map < String , ScoreComponentSettings > generateWidgetSettings ( ScoreCriteriaSettings scoreCriteriaSettings ) { Map < String , ScoreComponentSettings > scoreParamSettingsMap = new HashMap < > ( ) ; addSettingsToMap ( scoreParamSettingsMap , Constants . WIDGET_BUILD , getSettingsIfEnabled ( scoreCriteriaSetting...
Generate criteria settings for each widget type
22,918
private CodeQualityAuditResponse codeQualityDetailsForMissingStatus ( CollectorItem codeQualityCollectorItem ) { CodeQualityAuditResponse detailsMissing = new CodeQualityAuditResponse ( ) ; detailsMissing . addAuditStatus ( CodeQualityAuditStatus . CODE_QUALITY_DETAIL_MISSING ) ; detailsMissing . setLastUpdated ( codeQ...
It will return response when codeQuality details not found in given date range .
22,919
private void auditStatusWhenQualityGateDetailsFound ( Map condition , CodeQualityAuditResponse codeQualityAuditResponse ) { if ( StringUtils . equalsIgnoreCase ( condition . get ( "metric" ) . toString ( ) , CodeQualityMetricType . BLOCKER_VIOLATIONS . getType ( ) ) ) { codeQualityAuditResponse . addAuditStatus ( CodeQ...
Sets audit status when code quality gate details are found . Sonar 6 . 7 style data .
22,920
private JSONObject getDataFromRestCallPost ( GitHubParsed gitHubParsed , GitHubRepo repo , String password , String personalAccessToken , JSONObject query ) throws MalformedURLException , HygieiaException { ResponseEntity < String > response = makeRestCallPost ( gitHubParsed . getGraphQLUrl ( ) , repo . getUserId ( ) ,...
Makes use of the graphQL endpoint will not work for REST api
22,921
public ScoreWeight processWidgetScore ( Widget widget , ScoreComponentSettings paramSettings ) { if ( ! Utils . isScoreEnabled ( paramSettings ) ) { return null ; } ScoreWeight scoreWidget = initWidgetScore ( paramSettings ) ; if ( null == widget ) { scoreWidget . setScore ( paramSettings . getCriteria ( ) . getNoWidge...
Process widget score
22,922
public String getMaxChangeDate ( ) { Collector col = featureCollectorRepository . findByName ( FeatureCollectorConstants . VERSIONONE ) ; if ( col == null ) return "" ; if ( StringUtils . isEmpty ( getFeatureSettings ( ) . getDeltaCollectorItemStartDate ( ) ) ) return "" ; List < Team > response = teamRepo . findTopByC...
Retrieves the maximum change date for a given query .
22,923
private Double getPercentCoverageForDays ( Iterable < Commit > commits , int days ) { Set < String > dates = new HashSet < > ( ) ; for ( Commit commit : commits ) { dates . add ( Constants . DAY_FORMAT . format ( new Date ( commit . getScmCommitTimestamp ( ) ) ) ) ; } return ( dates . size ( ) / ( double ) days ) * 100...
Calculate percentage of days with commits out of total days
22,924
private List < PipelineStage > findUnmappedStages ( Dashboard dashboard , List < PipelineStage > pipelineStageList ) { List < PipelineStage > unmappedStages = new ArrayList < > ( ) ; Map < PipelineStage , String > stageToEnvironmentNameMap = PipelineUtils . getStageToEnvironmentNameMap ( dashboard ) ; for ( PipelineSta...
finds any stages for a dashboard that aren t mapped .
22,925
private Map < String , PipelineCommit > getCommitsAfterStage ( PipelineStage stage , Pipeline pipeline , Dashboard dashboard , List < PipelineStage > pipelineStageList , Map < String , String > orderMap ) { Map < String , PipelineCommit > unionOfAllSets = new HashMap < > ( ) ; List < String > list = getKeysByValue ( or...
Finds a map of commits for all stages after the current stage
22,926
public static String determineArtifactName ( FilePath file , String version ) { String fileName = file . getBaseName ( ) ; if ( "" . equals ( version ) ) return fileName ; int vIndex = fileName . indexOf ( version ) ; if ( vIndex <= 0 ) return fileName ; if ( ( fileName . charAt ( vIndex - 1 ) == '-' ) || ( fileName . ...
Determine the artifact s name . The name excludes the version string and the file extension .
22,927
public static AuditCollector prototype ( List < String > servers ) { AuditCollector protoType = new AuditCollector ( ) ; protoType . setName ( "AuditCollector" ) ; protoType . setCollectorType ( CollectorType . Audit ) ; protoType . setOnline ( true ) ; protoType . setEnabled ( true ) ; protoType . auditServers . addAl...
Audit Collector Instance built with required config settings
22,928
private void processOrphanCommits ( GitHubRepo repo ) { long refTime = Math . min ( System . currentTimeMillis ( ) - gitHubSettings . getCommitPullSyncTime ( ) , gitHubClient . getRepoOffsetTime ( repo ) ) ; List < Commit > orphanCommits = commitRepository . findCommitsByCollectorItemIdAndTimestampAfterAndPullNumberIsN...
Retrieves a st of previous commits and Pulls and tries to reconnect them
22,929
public Set < AppdynamicsApplication > getApplications ( String instanceUrl ) { Set < AppdynamicsApplication > returnSet = new HashSet < > ( ) ; try { String url = joinURL ( instanceUrl , APPLICATION_LIST_PATH ) ; ResponseEntity < String > responseEntity = makeRestCall ( url ) ; String returnJSON = responseEntity . getB...
Retrieves a JSON array of all of the applications that are registered in AppDynamics .
22,930
public Map < String , Object > getPerformanceMetrics ( AppdynamicsApplication application , String instanceUrl ) { Map < String , Object > metrics = new HashMap < > ( ) ; metrics . putAll ( getOverallMetrics ( application , instanceUrl ) ) ; metrics . putAll ( getCalculatedMetrics ( metrics ) ) ; metrics . putAll ( get...
Obtains the relevant data via different appdynamics api calls .
22,931
private Map < String , Object > getHealthMetrics ( AppdynamicsApplication application , String instanceUrl ) { long numNodeViolations = 0 ; long numBusinessViolations = 0 ; long numNodes = 0 ; long numBusinessTransactions = 0 ; double nodeHealthPercent = 0.0 ; double businessHealthPercent = 0.0 ; Map < String , Object ...
Calculates the Node Health Percent and Business Health Percent values
22,932
public List < Comment > getComments ( String commentsUrl , GitHubRepo repo ) throws RestClientException { List < Comment > comments = new ArrayList < > ( ) ; String decryptedPassword = decryptString ( repo . getPassword ( ) , settings . getKey ( ) ) ; String personalAccessToken = ( String ) repo . getOptions ( ) . get ...
Get comments from the given comment url
22,933
public List < CommitStatus > getCommitStatuses ( String statusUrl , GitHubRepo repo ) throws RestClientException { Map < String , CommitStatus > statuses = new HashMap < > ( ) ; String decryptedPassword = decryptString ( repo . getPassword ( ) , settings . getKey ( ) ) ; String personalAccessToken = ( String ) repo . g...
Get commit statuses from the given commit status url Retrieve the most recent status for each unique context .
22,934
public List < Review > getReviews ( String reviewsUrl , GitHubRepo repo ) throws RestClientException { List < Review > reviews = new ArrayList < > ( ) ; String decryptedPassword = decryptString ( repo . getPassword ( ) , settings . getKey ( ) ) ; String personalAccessToken = ( String ) repo . getOptions ( ) . get ( "pe...
Get reviews from the given reviews url
22,935
private boolean isRateLimitReached ( ResponseEntity < String > response ) { HttpHeaders header = response . getHeaders ( ) ; List < String > limit = header . get ( "X-RateLimit-Remaining" ) ; boolean rateLimitReached = CollectionUtils . isEmpty ( limit ) ? false : Integer . valueOf ( limit . get ( 0 ) ) < settings . ge...
Checks rate limit
22,936
private static String getTimeForApi ( Date dt ) { Calendar calendar = new GregorianCalendar ( ) ; TimeZone timeZone = calendar . getTimeZone ( ) ; Calendar cal = Calendar . getInstance ( timeZone ) ; cal . setTime ( dt ) ; return String . format ( "%tFT%<tRZ" , cal ) ; }
Format date the way Github api wants
22,937
protected String makeSoapCall ( String soapMessageString , HpsmSoapModel hpsmSoapModel ) throws HygieiaException { String requestAction = hpsmSoapModel . getSoapAction ( ) ; String response = "" ; contentType = hpsmSettings . getContentType ( ) ; charset = hpsmSettings . getCharset ( ) ; try { startHttpConnection ( ) ;...
Makes SOAP request for given soap message
22,938
protected Document responseToDoc ( String response ) { Document doc = null ; try { DocumentBuilderFactory factory = new DocumentBuilderFactoryImpl ( ) ; DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; ByteArrayInputStream input = new ByteArrayInputStream ( respons...
Converts String response into document for parsing
22,939
public List < Team > getBoards ( ) { int count = 0 ; int startAt = 0 ; boolean isLast = false ; List < Team > result = new ArrayList < > ( ) ; while ( ! isLast ) { String url = featureSettings . getJiraBaseUrl ( ) + ( featureSettings . getJiraBaseUrl ( ) . endsWith ( "/" ) ? "" : "/" ) + BOARD_TEAMS_REST_SUFFIX + "?sta...
Get a list of Boards . It s saved as Team in Hygieia
22,940
public List < Team > getTeams ( ) { List < Team > result = new ArrayList < > ( ) ; try { String url = featureSettings . getJiraBaseUrl ( ) + ( featureSettings . getJiraBaseUrl ( ) . endsWith ( "/" ) ? "" : "/" ) + TEMPO_TEAMS_REST_SUFFIX ; ResponseEntity < String > responseEntity = makeRestCall ( url ) ; String respons...
Get all the teams using Jira Rest API
22,941
protected static void processEpicData ( Feature feature , Epic epic ) { feature . setsEpicID ( epic . getId ( ) ) ; feature . setsEpicIsDeleted ( "false" ) ; feature . setsEpicName ( epic . getName ( ) ) ; feature . setsEpicNumber ( epic . getNumber ( ) ) ; feature . setsEpicType ( "" ) ; feature . setsEpicAssetState (...
Process Epic data for a feature updating the passed in feature
22,942
protected void processSprintData ( Feature feature , Sprint sprint ) { feature . setsSprintChangeDate ( "" ) ; feature . setsSprintIsDeleted ( "False" ) ; feature . setsSprintID ( sprint . getId ( ) ) ; feature . setsSprintName ( sprint . getName ( ) ) ; feature . setsSprintBeginDate ( sprint . getStartDateStr ( ) ) ; ...
Process Sprint data for a feature updating the passed in feature
22,943
@ SuppressWarnings ( "PMD.NPathComplexity" ) protected static void processAssigneeData ( Feature feature , JSONObject assignee ) { if ( assignee == null ) { return ; } String key = getString ( assignee , "key" ) ; String name = getString ( assignee , "name" ) ; String displayName = getString ( assignee , "displayName" ...
Process Assignee data for a feature updating the passed in feature
22,944
protected static List < FeatureIssueLink > getIssueLinks ( JSONArray issueLinkArray ) { if ( issueLinkArray == null ) { return Collections . EMPTY_LIST ; } List < FeatureIssueLink > jiraIssueLinks = new ArrayList < > ( ) ; issueLinkArray . forEach ( issueLink -> { JSONObject outward = ( JSONObject ) ( ( JSONObject ) is...
Get Array of issuesLinks
22,945
public Epic getEpic ( String epicKey , Map < String , Epic > epicMap ) { try { String url = featureSettings . getJiraBaseUrl ( ) + ( featureSettings . getJiraBaseUrl ( ) . endsWith ( "/" ) ? "" : "/" ) + String . format ( EPIC_REST_SUFFIX , epicKey ) ; ResponseEntity < String > responseEntity = makeRestCall ( url ) ; S...
Get Epic using Jira API
22,946
public static boolean checkForServiceAccount ( String userLdapDN , ApiSettings settings , Map < String , String > allowedUsers , String author , List < String > commitFiles , boolean isCommit , AuditReviewResponse auditReviewResponse ) { List < String > serviceAccountOU = settings . getServiceAccountOU ( ) ; boolean is...
Check if the passed in account is a Service Account or not by comparing against list of valid ServiceAccountOU in ApiSettings .
22,947
private static Map < String , String > getActors ( GitRequest pr ) { Map < String , String > actors = new HashMap < > ( ) ; if ( ! StringUtils . isEmpty ( pr . getMergeAuthorLDAPDN ( ) ) ) { actors . put ( pr . getMergeAuthor ( ) , pr . getMergeAuthorLDAPDN ( ) ) ; } Optional . ofNullable ( pr . getCommits ( ) ) . orEl...
Get all the actors associated with this user . s
22,948
private static boolean isPRLookedAtByPeer ( GitRequest pr ) { Set < String > commentUsers = pr . getComments ( ) != null ? pr . getComments ( ) . stream ( ) . map ( Comment :: getUser ) . collect ( Collectors . toCollection ( HashSet :: new ) ) : new HashSet < > ( ) ; Set < String > reviewAuthors = pr . getReviews ( ) ...
Calculates if the PR was looked at by a peer
22,949
public Page < Scope > getScopeByCollectorWithFilter ( ObjectId collectorId , String projectName , Pageable pageable ) { Page < Scope > scopeItems = scopeRepository . findAllByCollectorIdAndNameContainingIgnoreCase ( collectorId , projectName , pageable ) ; return scopeItems ; }
Finds paged results of scope items of a given collectorId projectName pageable
22,950
private void processQualityCCScore ( ScoreComponentSettings qualityCCSettings , Iterable < CodeQuality > codeQualityIterable , List < ScoreWeight > categoryScores ) { ScoreWeight qualityCCScore = getCategoryScoreByIdName ( categoryScores , WIDGET_QUALITY_CC_ID_NAME ) ; Double qualityCCRatio = fetchQualityValue ( codeQu...
Process Code Coverage score
22,951
private void processQualityUTScore ( ScoreComponentSettings qualityUTSettings , Iterable < CodeQuality > codeQualityIterable , List < ScoreWeight > categoryScores ) { ScoreWeight qualityUTScore = getCategoryScoreByIdName ( categoryScores , WIDGET_QUALITY_UT_ID_NAME ) ; Double qualityUTRatio = fetchQualityValue ( codeQu...
Process Unit Tests score
22,952
private void processQualityViolationsScore ( QualityScoreSettings . ViolationsScoreSettings qualityViolationsSettings , Iterable < CodeQuality > codeQualityIterable , List < ScoreWeight > categoryScores ) { ScoreWeight qualityViolationsScore = getCategoryScoreByIdName ( categoryScores , WIDGET_QUALITY_VIOLATIONS_ID_NAM...
Calculate Violations score based on Blocker Critical & Major violations
22,953
private Double fetchQualityValue ( Iterable < CodeQuality > qualityIterable , String param ) { Double paramValue = null ; Iterator < CodeQuality > qualityIterator = qualityIterable . iterator ( ) ; if ( ! qualityIterator . hasNext ( ) ) { return paramValue ; } CodeQuality codeQuality = qualityIterator . next ( ) ; for ...
Fetch param value by param name from quality values
22,954
@ RequestMapping ( value = "/cloud/instance/refresh" , method = POST , consumes = APPLICATION_JSON_VALUE , produces = APPLICATION_JSON_VALUE ) public ResponseEntity < Collection < String > > refreshInstances ( @ RequestBody ( required = false ) CloudInstanceListRefreshRequest request ) { return ResponseEntity . ok ( ) ...
Cloud Instance Endpoints
22,955
public final void generateDashboardScoreSettings ( ) { ScoreCriteriaSettings dashboardScoreCriteriaSettings = new ScoreCriteriaSettings ( ) ; dashboardScoreCriteriaSettings . setMaxScore ( this . scoreSettings . getMaxScore ( ) ) ; dashboardScoreCriteriaSettings . setType ( ScoreValueType . DASHBOARD ) ; dashboardScore...
Generate Score Criteria Settings from Score Settings
22,956
private void initBuildScoreChildrenSettings ( BuildScoreSettings buildScoreSettings ) { ScoreComponentSettings buildStatusSettings = Utils . getInstanceIfNull ( buildScoreSettings . getStatus ( ) , ScoreComponentSettings . class ) ; buildStatusSettings . setCriteria ( Utils . mergeCriteria ( buildScoreSettings . getCri...
Initialize Settings for child components in build widget 1 . Build Status criteria settings 2 . Build Duration criteria settings
22,957
private void initDeployScoreChildrenSettings ( DeployScoreSettings deployScoreSettings ) { ScoreComponentSettings deploySuccessSettings = Utils . getInstanceIfNull ( deployScoreSettings . getDeploySuccess ( ) , ScoreComponentSettings . class ) ; deploySuccessSettings . setCriteria ( Utils . mergeCriteria ( deployScoreS...
Initialize Settings for child components in deploy widget 1 . Deploys Success criteria settings 2 . Instances Online criteria settings
22,958
private void initQualityScoreChildrenSettings ( QualityScoreSettings qualityScoreSettings ) { ScoreComponentSettings qualityCCSettings = Utils . getInstanceIfNull ( qualityScoreSettings . getCodeCoverage ( ) , ScoreComponentSettings . class ) ; qualityCCSettings . setCriteria ( Utils . mergeCriteria ( qualityScoreSetti...
Initialize Settings for child components in quality widget 1 . Code Coverage criteria settings 2 . Unit Tests criteria settings 3 . Violations criteria settings
22,959
private void initGithubScmScoreChildrenSettings ( ScmScoreSettings scmScoreSettings ) { ScoreComponentSettings commitsPerDaySettings = Utils . getInstanceIfNull ( scmScoreSettings . getCommitsPerDay ( ) , ScoreComponentSettings . class ) ; commitsPerDaySettings . setCriteria ( Utils . mergeCriteria ( scmScoreSettings ....
Initialize Settings for child components in scm widget 1 . Commits Per Day criteria settings
22,960
private Page < CollectorItem > removeJobUrlAndInstanceUrl ( Page < CollectorItem > collectorItems ) { for ( CollectorItem cItem : collectorItems ) { if ( cItem . getOptions ( ) . containsKey ( "jobUrl" ) ) cItem . getOptions ( ) . remove ( "jobUrl" ) ; if ( cItem . getOptions ( ) . containsKey ( "instanceUrl" ) ) cItem...
method to remove jobUrl and instanceUrl from build collector items .
22,961
public CollectorItem createCollectorItemSelectOptions ( CollectorItem item , Map < String , Object > allOptions , Map < String , Object > uniqueOptions ) { Collector collector = collectorRepository . findOne ( item . getCollectorId ( ) ) ; Map < String , Object > uniqueFieldsFromCollector = collector . getUniqueFields ...
just update the new credentials .
22,962
public static List < String > toCanonicalList ( List < String > list ) { return list . stream ( ) . map ( BaseClient :: sanitizeResponse ) . collect ( Collectors . toList ( ) ) ; }
Canonicalizes a given JSONArray to a basic List object to avoid the use of JSON parsers .
22,963
public Page < Team > getTeamByCollectorWithFilter ( ObjectId collectorId , String teamName , Pageable pageable ) { Page < Team > teams = teamRepository . findAllByCollectorIdAndNameContainingIgnoreCase ( collectorId , teamName , pageable ) ; return teams ; }
Retrieves the team information for a given collectorId teamName pageable
22,964
public List < Dashboard > getDashboardsByCollectorItems ( Set < CollectorItem > collectorItems , CollectorType collectorType ) { if ( org . apache . commons . collections4 . CollectionUtils . isEmpty ( collectorItems ) ) { return new ArrayList < > ( ) ; } List < ObjectId > collectorItemIds = collectorItems . stream ( )...
Get all the dashboards that have the collector items
22,965
private void handleCollectorItems ( List < Component > components ) { for ( Component component : components ) { Map < CollectorType , List < CollectorItem > > itemMap = component . getCollectorItems ( ) ; for ( CollectorType type : itemMap . keySet ( ) ) { List < CollectorItem > items = itemMap . get ( type ) ; for ( ...
For the dashboard get all the components and get all the collector items for the components . If a collector item is NOT associated with any Component disable it .
22,966
private void setAppAndComponentNameToDashboard ( Dashboard dashboard , String appName , String compName ) { if ( appName != null && ! "" . equals ( appName ) ) { Cmdb cmdb = cmdbService . configurationItemByConfigurationItem ( appName ) ; if ( cmdb != null ) { dashboard . setConfigurationItemBusServName ( cmdb . getCon...
Sets business service business application and valid flag for each to the give Dashboard
22,967
private void duplicateDashboardErrorCheck ( Dashboard dashboard ) throws HygieiaException { String appName = dashboard . getConfigurationItemBusServName ( ) ; String compName = dashboard . getConfigurationItemBusAppName ( ) ; if ( appName != null && ! appName . isEmpty ( ) && compName != null && ! compName . isEmpty ( ...
Takes Dashboard and checks to see if there is an existing Dashboard with the same business service and business application Throws error if found
22,968
public Integer getAllDashboardsByTitleCount ( String title , String type ) { List < Dashboard > dashboards = null ; if ( ( type != null ) && ( ! type . isEmpty ( ) ) && ( ! UNDEFINED . equalsIgnoreCase ( type ) ) ) { dashboards = dashboardRepository . findAllByTypeContainingIgnoreCaseAndTitleContainingIgnoreCase ( type...
Get count of all dashboards filtered by title
22,969
public long count ( String type ) { if ( ( type != null ) && ( ! type . isEmpty ( ) ) && ( ! UNDEFINED . equalsIgnoreCase ( type ) ) ) { return dashboardRepository . countByTypeContainingIgnoreCase ( type ) ; } else { return dashboardRepository . count ( ) ; } }
Get count of all dashboards use dashboard type if supplied
22,970
private void updateRelationship ( CmdbRequest request ) { if ( ! StringUtils . isEmpty ( request . getConfigurationItemBusServName ( ) ) ) { Cmdb busServiceItem = cmdbRepository . findByConfigurationItemAndItemType ( request . getConfigurationItemBusServName ( ) , APP_TYPE ) ; if ( busServiceItem . getComponents ( ) ==...
If ConfigurationItemBusServName is set then update it with the new relationship
22,971
private void validateRequest ( CmdbRequest request ) throws HygieiaException { String busServiceName = request . getConfigurationItemBusServName ( ) ; if ( ! StringUtils . isEmpty ( busServiceName ) && cmdbRepository . findByConfigurationItemAndItemType ( busServiceName , APP_TYPE ) == null ) { throw new HygieiaExcepti...
Validates CmdbRequest for errors
22,972
private Cmdb requestToCmdb ( CmdbRequest request ) { Cmdb cmdb = new Cmdb ( ) ; cmdb . setConfigurationItem ( request . getConfigurationItem ( ) ) ; cmdb . setConfigurationItemSubType ( request . getConfigurationItemSubType ( ) ) ; cmdb . setConfigurationItemType ( request . getConfigurationItemType ( ) ) ; cmdb . setA...
Takes CmdbRequest and converts to Cmdb Object
22,973
private CollectorItem buildCollectorItem ( CmdbRequest request , Collector collector ) { CollectorItem collectorItem = new CollectorItem ( ) ; collectorItem . setCollectorId ( collector . getId ( ) ) ; collectorItem . setEnabled ( false ) ; collectorItem . setPushed ( true ) ; collectorItem . setDescription ( request ....
Builds collector Item for new Cmdb item
22,974
@ SuppressWarnings ( { "PMD.NPathComplexity" } ) URI buildUri ( final String rawUrl , final String branch , final String lastKnownCommit ) throws URISyntaxException { URIBuilder builder = new URIBuilder ( ) ; String repoUrlRaw = rawUrl ; String repoUrlProcessed = repoUrlRaw ; if ( repoUrlProcessed . endsWith ( ".git" )...
package for junit
22,975
@ SuppressWarnings ( "PMD.NPathComplexity" ) public DashboardReviewResponse getDashboardReviewResponse ( String dashboardTitle , DashboardType dashboardType , String businessService , String businessApp , long beginDate , long endDate , Set < AuditType > auditTypes ) throws AuditException { validateParameters ( dashboa...
Calculates audit response for a given dashboard
22,976
private Dashboard getDashboard ( String title , DashboardType type , String busServ , String busApp ) throws AuditException { if ( ! StringUtils . isEmpty ( title ) && ( type != null ) ) { return dashboardRepository . findByTitleAndType ( title , type ) ; } else if ( ! StringUtils . isEmpty ( busServ ) && ! StringUtils...
Finds the dashboard
22,977
public static void toFile ( InputStream input , File file ) throws IOException { OutputStream os = new FileOutputStream ( file ) ; int bytesRead = 0 ; byte [ ] buffer = new byte [ DEFAULT_BUFFER_SIZE ] ; while ( ( bytesRead = input . read ( buffer , 0 , DEFAULT_BUFFER_SIZE ) ) != - 1 ) { os . write ( buffer , 0 , bytes...
InputStream to File
22,978
public static String get ( String url , Map < String , String > queryParas , Map < String , String > headers ) { HttpURLConnection conn = null ; try { conn = getHttpConnection ( buildUrlWithQueryString ( url , queryParas ) , GET , headers ) ; conn . connect ( ) ; return readResponseString ( conn ) ; } catch ( Exception...
Send GET request
22,979
public static String post ( String url , Map < String , String > queryParas , String data , Map < String , String > headers ) { HttpURLConnection conn = null ; try { conn = getHttpConnection ( buildUrlWithQueryString ( url , queryParas ) , POST , headers ) ; conn . connect ( ) ; OutputStream out = conn . getOutputStrea...
Send POST request
22,980
private static String buildUrlWithQueryString ( String url , Map < String , String > queryParas ) { if ( queryParas == null || queryParas . isEmpty ( ) ) return url ; StringBuilder sb = new StringBuilder ( url ) ; boolean isFirst ; if ( ! url . contains ( "?" ) ) { isFirst = true ; sb . append ( "?" ) ; } else { isFirs...
Build queryString of the url
22,981
public IdempotentPo getIdempotentPo ( EasyTransFilterChain filterChain , Map < String , Object > header , EasyTransRequest < ? , ? > reqest ) { BusinessIdentifer businessType = ReflectUtil . getBusinessIdentifer ( reqest . getClass ( ) ) ; Object trxIdObj = header . get ( EasytransConstant . CallHeadKeys . PARENT_TRX_I...
get execute result from database
22,982
public Boolean getFinalMasterTransStatus ( ) { if ( finalMasterTransStatus == null ) { finalMasterTransStatus = checkTransStatusByLogs ( ) ; if ( finalMasterTransStatus == null ) { finalMasterTransStatus = transStatusChecker . checkTransactionStatus ( getLogCollection ( ) . getAppId ( ) , getLogCollection ( ) . getBusC...
status true for commit false for roll back null for unknown
22,983
private CompletableFuture < Void > postScaleRequest ( final AutoScaleEvent request , final List < Long > segments , final List < Map . Entry < Double , Double > > newRanges , final long requestId ) { ScaleOpEvent event = new ScaleOpEvent ( request . getScope ( ) , request . getStream ( ) , segments , newRanges , false ...
Scale tasks exceptions are absorbed .
22,984
public static < T > boolean await ( CompletableFuture < T > f , long timeout ) { Exceptions . handleInterrupted ( ( ) -> { try { f . get ( timeout , TimeUnit . MILLISECONDS ) ; } catch ( TimeoutException | ExecutionException e ) { } } ) ; return isSuccessful ( f ) ; }
Waits for the provided future to be complete and returns true if it was successful false if it failed or did not complete .
22,985
public static < T > void completeAfter ( Supplier < CompletableFuture < ? extends T > > futureSupplier , CompletableFuture < T > toComplete ) { Preconditions . checkArgument ( ! toComplete . isDone ( ) , "toComplete is already completed." ) ; try { CompletableFuture < ? extends T > f = futureSupplier . get ( ) ; f . th...
Given a Supplier returning a Future completes another future either with the result of the first future in case of normal completion or exceptionally with the exception of the first future .
22,986
public static < T > boolean isSuccessful ( CompletableFuture < T > f ) { return f . isDone ( ) && ! f . isCompletedExceptionally ( ) && ! f . isCancelled ( ) ; }
Returns true if the future is done and successful .
22,987
public static < T > Throwable getException ( CompletableFuture < T > future ) { try { future . getNow ( null ) ; return null ; } catch ( Exception e ) { return Exceptions . unwrap ( e ) ; } }
If the future has failed returns the exception that caused it . Otherwise returns null .
22,988
public static < ResultT , ExceptionT extends Exception > ResultT getAndHandleExceptions ( Future < ResultT > future , Function < Throwable , ExceptionT > exceptionConstructor ) throws ExceptionT { Preconditions . checkNotNull ( exceptionConstructor ) ; try { return Exceptions . handleInterruptedCall ( ( ) -> future . g...
Calls get on the provided future handling interrupted and transforming the executionException into an exception of the type whose constructor is provided .
22,989
public static < T > CompletableFuture < T > failedFuture ( Throwable exception ) { CompletableFuture < T > result = new CompletableFuture < > ( ) ; result . completeExceptionally ( exception ) ; return result ; }
Creates a new CompletableFuture that is failed with the given exception .
22,990
public static < T > void exceptionListener ( CompletableFuture < T > completableFuture , Consumer < Throwable > exceptionListener ) { completableFuture . whenComplete ( ( r , ex ) -> { if ( ex != null ) { Callbacks . invokeSafely ( exceptionListener , ex , null ) ; } } ) ; }
Registers an exception listener to the given CompletableFuture .
22,991
@ SuppressWarnings ( "unchecked" ) public static < T , E extends Throwable > void exceptionListener ( CompletableFuture < T > completableFuture , Class < E > exceptionClass , Consumer < E > exceptionListener ) { completableFuture . whenComplete ( ( r , ex ) -> { if ( ex != null && exceptionClass . isAssignableFrom ( ex...
Registers an exception listener to the given CompletableFuture for a particular type of exception .
22,992
public static < T > CompletableFuture < Void > toVoid ( CompletableFuture < T > future ) { return future . thenAccept ( Callbacks :: doNothing ) ; }
Returns a CompletableFuture that will end when the given future ends but discards its result . If the given future fails the returned future will fail with the same exception .
22,993
public static < T > CompletableFuture < List < T > > filter ( List < T > input , Function < T , CompletableFuture < Boolean > > predicate ) { Preconditions . checkNotNull ( input ) ; val allFutures = input . stream ( ) . collect ( Collectors . toMap ( key -> key , predicate :: apply ) ) ; return Futures . allOf ( allFu...
Filter that takes a predicate that evaluates in future and returns the filtered list that evaluates in future .
22,994
public static CompletableFuture < Void > delayedFuture ( Duration delay , ScheduledExecutorService executorService ) { CompletableFuture < Void > result = new CompletableFuture < > ( ) ; if ( delay . toMillis ( ) == 0 ) { result . complete ( null ) ; } else { ScheduledFuture < Boolean > sf = executorService . schedule ...
Creates a CompletableFuture that will do nothing and complete after a specified delay without using a thread during the delay .
22,995
public static < T > CompletableFuture < T > delayedFuture ( final Supplier < CompletableFuture < T > > task , final long delay , final ScheduledExecutorService executorService ) { return delayedFuture ( Duration . ofMillis ( delay ) , executorService ) . thenCompose ( v -> task . get ( ) ) ; }
Executes the asynchronous task after the specified delay .
22,996
public static < T > CompletableFuture < T > delayedTask ( final Supplier < T > task , final Duration delay , final ScheduledExecutorService executorService ) { CompletableFuture < T > result = new CompletableFuture < > ( ) ; executorService . schedule ( ( ) -> result . complete ( runOrFail ( ( ) -> task . get ( ) , res...
Executes the given task after the specified delay .
22,997
public static < T > CompletableFuture < Void > loop ( Iterable < T > iterable , Function < T , CompletableFuture < Boolean > > loopBody , Executor executor ) { Iterator < T > iterator = iterable . iterator ( ) ; AtomicBoolean canContinue = new AtomicBoolean ( true ) ; return loop ( ( ) -> iterator . hasNext ( ) && canC...
Executes a loop using CompletableFutures over the given Iterable processing each item in order without overlap using the given Executor for task execution .
22,998
public static < T > CompletableFuture < Void > doWhileLoop ( Supplier < CompletableFuture < T > > loopBody , Predicate < T > condition , Executor executor ) { CompletableFuture < Void > result = new CompletableFuture < > ( ) ; AtomicBoolean canContinue = new AtomicBoolean ( ) ; Consumer < T > iterationResultHandler = i...
Executes a code fragment returning a CompletableFutures while a condition on the returned value is satisfied .
22,999
private void pingTransactions ( ) { log . info ( "Start sending transaction pings." ) ; txnList . stream ( ) . forEach ( uuid -> { try { log . debug ( "Sending ping request for txn ID: {} with lease: {}" , uuid , txnLeaseMillis ) ; controller . pingTransaction ( stream , uuid , txnLeaseMillis ) . exceptionally ( e -> {...
Ping all the transactions present in the list . Controller client performs retries in case of a failures . On a failure the particular transaction it is removed from the ping list .