idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
43,500
private void readHistoricalDataImpl ( ) { FileInputStream fis = null ; try { fis = mContext . openFileInput ( mHistoryFileName ) ; } catch ( FileNotFoundException fnfe ) { if ( DEBUG ) { Log . i ( LOG_TAG , "Could not open historical records file: " + mHistoryFileName ) ; } return ; } try { XmlPullParser parser = Xml ....
Command for reading the historical records from a file off the UI thread .
621
14
43,501
public static void applyTheme ( Activity activity , boolean force ) { if ( force || ThemeManager . hasSpecifiedTheme ( activity ) ) { activity . setTheme ( ThemeManager . getTheme ( activity ) ) ; } }
Apply theme from intent . Only system use don t call it!
46
13
43,502
public static void cloneTheme ( Intent sourceIntent , Intent intent , boolean force ) { final boolean hasSourceTheme = hasSpecifiedTheme ( sourceIntent ) ; if ( force || hasSourceTheme ) { intent . putExtra ( _THEME_TAG , hasSourceTheme ? getTheme ( sourceIntent ) : _DEFAULT_THEME ) ; } }
Clone theme from sourceIntent to intent if it specified for sourceIntent or set flag force
78
20
43,503
public static void setDefaultTheme ( int theme ) { ThemeManager . _DEFAULT_THEME = theme ; if ( theme < _START_RESOURCES_ID ) { ThemeManager . _DEFAULT_THEME &= ThemeManager . _THEME_MASK ; } }
Set default theme . May be theme resource instead flags but it not recommend .
65
15
43,504
public static int getTheme ( Intent intent , boolean applyModifier ) { return prepareFlags ( intent . getIntExtra ( ThemeManager . _THEME_TAG , ThemeManager . _DEFAULT_THEME ) , applyModifier ) ; }
Extract theme flags from intent
53
6
43,505
public static int getThemeResource ( int themeTag , boolean applyModifier ) { if ( themeTag >= _START_RESOURCES_ID ) { return themeTag ; } themeTag = prepareFlags ( themeTag , applyModifier ) ; if ( ThemeManager . sThemeGetters != null ) { int getterResource ; final ThemeTag tag = new ThemeTag ( themeTag ) ; for ( int ...
Resolve theme resource id by flags
215
7
43,506
public static void modifyDefaultThemeClear ( int mod ) { mod &= ThemeManager . _THEME_MASK ; ThemeManager . _DEFAULT_THEME |= mod ; ThemeManager . _DEFAULT_THEME ^= mod ; }
Clear modifier from default theme
55
5
43,507
public boolean onSupportNavigateUp ( ) { Intent upIntent = getSupportParentActivityIntent ( ) ; if ( upIntent != null ) { if ( supportShouldUpRecreateTask ( upIntent ) ) { TaskStackBuilder b = TaskStackBuilder . create ( this ) ; onCreateSupportNavigateUpTaskStack ( b ) ; onPrepareSupportNavigateUpTaskStack ( b ) ; b ....
This method is called whenever the user chooses to navigate Up within your application s activity hierarchy from the action bar .
198
22
43,508
private void updateSearchAutoComplete ( ) { mQueryTextView . setThreshold ( mSearchable . getSuggestThreshold ( ) ) ; mQueryTextView . setImeOptions ( mSearchable . getImeOptions ( ) ) ; int inputType = mSearchable . getInputType ( ) ; // We only touch this if the input type is set up for text (which it almost certainl...
Updates the auto - complete text view .
487
9
43,509
private void setQuery ( CharSequence query ) { mQueryTextView . setText ( query ) ; // Move the cursor to the end mQueryTextView . setSelection ( TextUtils . isEmpty ( query ) ? 0 : query . length ( ) ) ; }
Sets the text in the query box without updating the suggestions .
58
13
43,510
private void parseMenu ( XmlPullParser parser , AttributeSet attrs , Menu menu ) throws XmlPullParserException , IOException { MenuState menuState = new MenuState ( menu ) ; int eventType = parser . getEventType ( ) ; String tagName ; boolean lookingForEndOfUnknownTag = false ; String unknownTagName = null ; // This lo...
Called internally to fill the given menu . If a sub menu is seen it will call this recursively .
626
23
43,511
private void tryStartingKbMode ( int keyCode ) { if ( mTimePicker . trySettingInputEnabled ( false ) && ( keyCode == - 1 || addKeyIfLegal ( keyCode ) ) ) { mInKbMode = true ; mDoneButton . setEnabled ( false ) ; updateDisplay ( false ) ; } }
Try to start keyboard mode with the specified key as long as the timepicker is not in the middle of a touch - event .
72
27
43,512
private void finishKbMode ( boolean updateDisplays ) { mInKbMode = false ; if ( ! mTypedTimes . isEmpty ( ) ) { int values [ ] = getEnteredTime ( null ) ; mTimePicker . setTime ( values [ 0 ] , values [ 1 ] ) ; if ( ! mIs24HourMode ) { mTimePicker . setAmOrPm ( values [ 2 ] ) ; } mTypedTimes . clear ( ) ; } if ( update...
Get out of keyboard mode . If there is nothing in typedTimes revert to TimePicker s time .
133
21
43,513
private int [ ] getEnteredTime ( Boolean [ ] enteredZeros ) { int amOrPm = - 1 ; int startIndex = 1 ; if ( ! mIs24HourMode && isTypedTimeFullyLegal ( ) ) { int keyCode = mTypedTimes . get ( mTypedTimes . size ( ) - 1 ) ; if ( keyCode == getAmOrPmKeyCode ( AM ) ) { amOrPm = AM ; } else if ( keyCode == getAmOrPmKeyCode (...
Get the currently - entered time as integer values of the hours and minutes typed .
328
16
43,514
private int getAmOrPmKeyCode ( int amOrPm ) { // Cache the codes. if ( mAmKeyCode == - 1 || mPmKeyCode == - 1 ) { // Find the first character in the AM/PM text that is unique. KeyCharacterMap kcm = KeyCharacterMap . load ( KeyCharacterMap . VIRTUAL_KEYBOARD ) ; char amChar ; char pmChar ; for ( int i = 0 ; i < Math . m...
Get the keycode value for AM and PM in the current language .
345
14
43,515
public void show ( IBinder windowToken ) { // Many references to mMenu, create local reference final MenuBuilder menu = mMenu ; // Get the builder for the dialog final AlertDialog . Builder builder = new AlertDialog . Builder ( menu . getContext ( ) ) ; mPresenter = new ListMenuPresenter ( builder . getContext ( ) , R ...
Shows menu as a dialog .
356
7
43,516
@ Override public void onScroll ( AbsListView view , int firstVisibleItem , int visibleItemCount , int totalItemCount ) { SimpleMonthView child = ( SimpleMonthView ) view . getChildAt ( 0 ) ; if ( child == null ) { return ; } // Figure out where we are long currScroll = view . getFirstVisiblePosition ( ) * child . getH...
Updates the title and selected month if the view has moved to a new month .
114
17
43,517
public int getMostVisiblePosition ( ) { final int firstPosition = getFirstVisiblePosition ( ) ; final int height = getHeight ( ) ; int maxDisplayedHeight = 0 ; int mostVisibleIndex = 0 ; int i = 0 ; int bottom = 0 ; while ( bottom < height ) { View child = getChildAt ( i ) ; if ( child == null ) { break ; } bottom = ch...
Gets the position of the view that is most prominently displayed within the list view .
162
17
43,518
public ArticleAttachments createUploadArticle ( long articleId , File file ) throws IOException { return createUploadArticle ( articleId , file , false ) ; }
Create upload article with inline false
33
6
43,519
@ NotNull @ ApiModelProperty ( required = true , value = "Key-value pairs to add as custom property into alert. You can refer here for example values" ) public Map < String , String > getDetails ( ) { return details ; }
Key - value pairs to add as custom property into alert . You can refer here for example values
53
19
43,520
@ Deprecated public Map serialize ( ) throws OpsGenieClientValidationException { validate ( ) ; try { return JsonUtils . toMap ( this ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return null ; }
convertes request to map
57
6
43,521
public void fromJson ( String json ) throws IOException , ParseException { JsonUtils . fromJson ( this , json ) ; this . json = json ; }
Convert json data to response
38
6
43,522
public void setApiKey ( String apiKey ) { if ( this . jsonHttpClient != null ) { this . jsonHttpClient . setApiKey ( apiKey ) ; } if ( this . restApiClient != null ) { this . restApiClient . setApiKey ( apiKey ) ; } if ( this . swaggerApiClient != null ) { ApiKeyAuth genieKey = ( ApiKeyAuth ) this . swaggerApiClient . ...
Sets the customer key used for authenticating API requests .
147
12
43,523
public SuccessResponse deleteAlert ( DeleteAlertRequest params ) throws ApiException { String identifier = params . getIdentifier ( ) ; String identifierType = params . getIdentifierType ( ) . getValue ( ) ; String source = params . getSource ( ) ; String user = params . getUser ( ) ; Object localVarPostBody = null ; /...
Delete Alert Deletes an alert using alert id tiny id or alias
495
13
43,524
public SuccessResponse deleteAttachment ( DeleteAlertAttachmentRequest params ) throws ApiException { String identifier = params . getIdentifier ( ) ; Long attachmentId = params . getAttachmentId ( ) ; String alertIdentifierType = params . getAlertIdentifierType ( ) . getValue ( ) ; String user = params . getUser ( ) ;...
Delete Alert Attachment Delete alert attachment for the given identifier
570
11
43,525
public ListAlertsResponse listAlerts ( ListAlertsRequest params ) throws ApiException { Integer limit = params . getLimit ( ) ; String sort = params . getSort ( ) . getValue ( ) ; Integer offset = params . getOffset ( ) ; String order = params . getOrder ( ) . getValue ( ) ; String query = params . getQuery ( ) ; Strin...
List Alerts Returns list of alerts
584
7
43,526
public ListAlertNotesResponse listNotes ( ListAlertNotesRequest params ) throws ApiException { String identifier = params . getIdentifier ( ) ; String identifierType = params . getIdentifierType ( ) . getValue ( ) ; String offset = params . getOffset ( ) ; String direction = params . getDirection ( ) . getValue ( ) ; I...
List Alert Notes List alert notes for the given alert identifier
588
11
43,527
public ListSavedSearchResponse listSavedSearches ( ) throws ApiException { Object localVarPostBody = null ; // create path and map variables String localVarPath = "/v2/alerts/saved-searches" ; // query params List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams =...
Lists Saved Searches List all saved searches
298
10
43,528
public List < ScheduleRotation > getRotations ( ) { if ( getTimeZone ( ) != null && rotations != null ) for ( ScheduleRotation scheduleRotation : rotations ) scheduleRotation . setScheduleTimeZone ( getTimeZone ( ) ) ; return rotations ; }
Rotations of schedule
62
4
43,529
@ JsonProperty ( "participants" ) public List < String > getParticipantsNames ( ) { if ( participants == null ) return null ; List < String > participantList = new ArrayList < String > ( ) ; for ( ScheduleParticipant participant : participants ) participantList . ( participant . getParticipant ( ) ) ; return participan...
Participants of schedule rotation
74
5
43,530
public void setConnectionValues ( final Google google , final ConnectionValues values ) { final UserInfo userInfo = google . oauth2Operations ( ) . getUserinfo ( ) ; values . setProviderUserId ( userInfo . getId ( ) ) ; values . setDisplayName ( userInfo . getName ( ) ) ; values . setProfileUrl ( userInfo . getLink ( )...
Set a value on the connection .
100
7
43,531
public UserProfile fetchUserProfile ( final Google google ) { final UserInfo userInfo = google . oauth2Operations ( ) . getUserinfo ( ) ; return new UserProfileBuilder ( ) . setUsername ( userInfo . getId ( ) ) . setId ( userInfo . getId ( ) ) . setEmail ( userInfo . getEmail ( ) ) . setName ( userInfo . getName ( ) ) ...
Return the current user profile .
124
6
43,532
public String getImageUrl ( ) { if ( thumbnailUrl != null ) { return thumbnailUrl ; } if ( image != null ) { return image . url ; } return null ; }
Get the image URL - uses the thumbnail if set then the main image otherwise returns null .
38
18
43,533
public String getAccountEmail ( ) { if ( emails != null ) { for ( final Entry < String , String > entry : emails . entrySet ( ) ) { if ( entry . getValue ( ) . equals ( "account" ) ) { return entry . getKey ( ) ; } } } return null ; }
Return the account email .
66
5
43,534
public static String enumToString ( final Enum < ? > value ) { if ( value == null ) { return null ; } final String underscored = value . name ( ) ; final StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < underscored . length ( ) ; i ++ ) { final char c = underscored . charAt ( i ) ; if ( c == ' ' ) { sb ...
Convert an enumeration to a String representation .
145
10
43,535
public MockResponse handleCreate ( String path , String s ) { MockResponse response = new MockResponse ( ) ; AttributeSet features = AttributeSet . merge ( attributeExtractor . fromPath ( path ) , attributeExtractor . fromResource ( s ) ) ; map . put ( features , s ) ; response . setBody ( s ) ; response . setResponseC...
Adds the specified object to the in - memory db .
85
11
43,536
public MockResponse handlePatch ( String path , String s ) { MockResponse response = new MockResponse ( ) ; String body = doGet ( path ) ; if ( body == null ) { response . setResponseCode ( 404 ) ; } else { try { JsonNode patch = context . getMapper ( ) . readTree ( s ) ; JsonNode source = context . getMapper ( ) . rea...
Patches the specified object to the in - memory db .
213
12
43,537
public MockResponse handleDelete ( String path ) { MockResponse response = new MockResponse ( ) ; List < AttributeSet > items = new ArrayList <> ( ) ; AttributeSet query = attributeExtractor . extract ( path ) ; for ( Map . Entry < AttributeSet , String > entry : map . entrySet ( ) ) { if ( entry . getKey ( ) . matches...
Performs a delete for the corresponding object from the in - memory db .
156
15
43,538
@ Override public List < ExportFormat > exportFormats ( IssueServiceConfiguration issueServiceConfiguration ) { return issueExportServiceFactory . getIssueExportServices ( ) . stream ( ) . map ( IssueExportService :: getExportFormat ) . collect ( Collectors . toList ( ) ) ; }
Export of both text and HTML by default .
61
9
43,539
public TemplateInstanceExecution templateInstanceExecution ( String sourceName , ExpressionEngine expressionEngine ) { // Transforms each parameter in a name/value pair, using only the source name as input Map < String , String > sourceNameInput = Collections . singletonMap ( "sourceName" , sourceName ) ; Map < String ...
Gets the execution context for the creation of a template instance .
181
13
43,540
@ JsonIgnore public Map < String , Set < String > > getGroupingSpecification ( ) { Map < String , Set < String > > result = new LinkedHashMap <> ( ) ; if ( ! StringUtils . isBlank ( grouping ) ) { String [ ] groups = split ( grouping , ' ' ) ; for ( String group : groups ) { String [ ] groupSpec = split ( group . trim ...
Parses the specification and returns a map of groups x set of types . The map will be empty if no group is defined but never null .
201
30
43,541
@ JsonIgnore public Set < String > getExcludedTypes ( ) { if ( StringUtils . isBlank ( exclude ) ) { return Collections . emptySet ( ) ; } else { return Sets . newHashSet ( Arrays . asList ( StringUtils . split ( exclude , "," ) ) . stream ( ) . map ( StringUtils :: trim ) . collect ( Collectors . toList ( ) ) ) ; } }
Parses the comma - separated list of excluded types .
95
12
43,542
@ RequestMapping ( value = "ldap-mapping" , method = RequestMethod . GET ) public Resources < LDAPMapping > getMappings ( ) { securityService . checkGlobalFunction ( AccountGroupManagement . class ) ; return Resources . of ( accountGroupMappingService . getMappings ( LDAPExtensionFeature . LDAP_GROUP_MAPPING ) . stream...
Gets the list of mappings
160
7
43,543
@ RequestMapping ( value = "ldap-mapping/create" , method = RequestMethod . GET ) public Form getMappingCreationForm ( ) { securityService . checkGlobalFunction ( AccountGroupManagement . class ) ; return AccountGroupMapping . form ( accountService . getAccountGroups ( ) ) ; }
Gets the form for the creation of a mapping
69
10
43,544
@ Override public boolean canEdit ( ProjectEntity entity , SecurityService securityService ) { return securityService . isProjectFunctionGranted ( entity , PromotionRunCreate . class ) ; }
If one can promote a build he can also attach a release label to a build .
38
17
43,545
@ RequestMapping ( value = "predefinedPromotionLevels" , method = RequestMethod . GET ) public Resources < PredefinedPromotionLevel > getPredefinedPromotionLevelList ( ) { return Resources . of ( predefinedPromotionLevelService . getPredefinedPromotionLevels ( ) , uri ( on ( getClass ( ) ) . getPredefinedPromotionLevel...
Gets the list of predefined promotion levels .
157
10
43,546
@ RequestMapping ( value = "root" , method = RequestMethod . GET ) public Resources < UIEvent > getEvents ( @ RequestParam ( required = false , defaultValue = "0" ) int offset , @ RequestParam ( required = false , defaultValue = "20" ) int count ) { // Gets the events Resources < UIEvent > resources = Resources . of ( ...
Gets the list of events for the root .
265
10
43,547
@ Override public void store ( String key , byte [ ] payload ) throws IOException { try { Cipher sym = Cipher . getInstance ( "AES" ) ; sym . init ( Cipher . ENCRYPT_MODE , masterKey ) ; try ( FileOutputStream fos = new FileOutputStream ( getFileFor ( key ) ) ; CipherOutputStream cos = new CipherOutputStream ( fos , sy...
Persists the payload of a key to the disk .
137
11
43,548
@ RequestMapping ( value = "configurations" , method = RequestMethod . GET ) public Resources < CombinedIssueServiceConfiguration > getConfigurationList ( ) { return Resources . of ( configurationService . getConfigurationList ( ) , uri ( on ( getClass ( ) ) . getConfigurationList ( ) ) ) . with ( Link . CREATE , uri (...
Gets the list of configurations
93
6
43,549
@ RequestMapping ( value = "configurations/create" , method = RequestMethod . GET ) public Form getConfigurationForm ( ) { return CombinedIssueServiceConfiguration . form ( configurationService . getAvailableIssueServiceConfigurations ( ) ) ; }
Form for a new configuration
51
5
43,550
public static void checkArgList ( DataFetchingEnvironment environment , String ... args ) { Set < String > actualArgs = getActualArguments ( environment ) . keySet ( ) ; Set < String > expectedArgs = new HashSet <> ( Arrays . asList ( args ) ) ; if ( ! Objects . equals ( actualArgs , expectedArgs ) ) { throw new Illega...
Checks list of arguments
116
5
43,551
@ JsonIgnore public String getCuredBranchPath ( ) { String trim = StringUtils . trim ( branchPath ) ; if ( "/" . equals ( trim ) ) { return trim ; } else { return StringUtils . stripEnd ( trim , "/" ) ; } }
Returns a path which has been cleaned from its trailing or leading components .
62
14
43,552
private void indexInTransaction ( SVNRepository repository , SVNLogEntry logEntry ) throws SVNException { // Log values long revision = logEntry . getRevision ( ) ; String author = logEntry . getAuthor ( ) ; String message = logEntry . getMessage ( ) ; Date date = logEntry . getDate ( ) ; // Sanitizes the possible null...
This method is executed within a transaction
373
7
43,553
protected void index ( SVNRepository repository , long from , long to , JobRunListener runListener ) { // Ordering if ( from > to ) { long t = from ; from = to ; to = t ; } // Range long min = from ; long max = to ; // Opens a transaction try ( Transaction ignored = transactionService . start ( ) ) { // SVN URL SVNURL ...
Indexation of a range in a thread for one repository - since it is called by a single thread executor we can be sure that only one call of this method is running at one time for one given repository .
447
43
43,554
@ Override protected void configure ( HttpSecurity http ) throws Exception { // Gets a secure random key for the remember be token key SecureRandom random = new SecureRandom ( ) ; byte [ ] randomBytes = new byte [ 64 ] ; random . nextBytes ( randomBytes ) ; String rememberBeKey = new String ( Hex . encode ( randomBytes...
By default all queries are accessible anonymously . Security is enforced at service level .
329
15
43,555
@ Override public JsonNode forStorage ( AutoPromotionProperty value ) { return format ( MapBuilder . create ( ) . with ( "validationStamps" , value . getValidationStamps ( ) . stream ( ) . map ( Entity :: id ) . collect ( Collectors . toList ( ) ) ) . with ( "include" , value . getInclude ( ) ) . with ( "exclude" , val...
As a list of validation stamp IDs
106
7
43,556
public VersionInfo toInfo ( ) { return new VersionInfo ( parseDate ( date ) , display , full , branch , build , commit , source , sourceType ) ; }
Gets the representation of the version
36
7
43,557
public ExtensionFeatureOptions withDependency ( ExtensionFeature feature ) { Set < String > existing = this . dependencies ; Set < String > newDependencies ; if ( existing == null ) { newDependencies = new HashSet <> ( ) ; } else { newDependencies = new HashSet <> ( existing ) ; } newDependencies . add ( feature . getI...
Adds a dependency
99
3
43,558
@ RequestMapping ( value = "" , method = RequestMethod . GET ) public Resources < Account > getAccounts ( ) { return Resources . of ( accountService . getAccounts ( ) , uri ( on ( getClass ( ) ) . getAccounts ( ) ) ) . with ( Link . CREATE , uri ( on ( AccountController . class ) . getCreationForm ( ) ) ) . with ( "_ac...
List of accounts
116
3
43,559
@ RequestMapping ( value = "actions" , method = RequestMethod . GET ) public Resources < Action > getAccountMgtActions ( ) { return Resources . of ( extensionManager . getExtensions ( AccountMgtActionExtension . class ) . stream ( ) . map ( this :: resolveExtensionAction ) . filter ( action -> action != null ) , uri ( ...
Action management contributions
100
3
43,560
@ RequestMapping ( value = "create" , method = RequestMethod . GET ) public Form getCreationForm ( ) { return Form . create ( ) . with ( Form . defaultNameField ( ) ) . with ( Text . of ( "fullName" ) . length ( 100 ) . label ( "Full name" ) . help ( "Display name for the account" ) ) . with ( Email . of ( "email" ) . ...
Form to create a built - in account
194
8
43,561
@ RequestMapping ( value = "groups" , method = RequestMethod . GET ) public Resources < AccountGroup > getAccountGroups ( ) { return Resources . of ( accountService . getAccountGroups ( ) , uri ( on ( getClass ( ) ) . getAccountGroups ( ) ) ) . with ( Link . CREATE , uri ( on ( AccountController . class ) . getGroupCre...
List of groups
95
3
43,562
protected Collection < ConfiguredIssueService > getConfiguredIssueServices ( IssueServiceConfiguration issueServiceConfiguration ) { CombinedIssueServiceConfiguration combinedIssueServiceConfiguration = ( CombinedIssueServiceConfiguration ) issueServiceConfiguration ; return combinedIssueServiceConfiguration . getIssue...
Gets the list of attached configured issue services .
86
10
43,563
@ RequestMapping ( value = "branches/{branchId}/update/bulk" , method = RequestMethod . GET ) public Form bulkUpdate ( @ SuppressWarnings ( "UnusedParameters" ) @ PathVariable ID branchId ) { return Form . create ( ) . with ( Replacements . of ( "replacements" ) . label ( "Replacements" ) ) ; }
Gets the form for a bulk update of the branch
86
11
43,564
public static < T > List < SelectableItem > listOf ( Collection < T > items , Function < T , String > idFn , Function < T , String > nameFn , Predicate < T > selectedFn ) { return items . stream ( ) . map ( i -> new SelectableItem ( selectedFn . test ( i ) , idFn . apply ( i ) , nameFn . apply ( i ) ) ) . collect ( Col...
Creation of a list of selectable items from a list of items using an extractor for the id and the name and a predicate for the selection .
107
31
43,565
@ Override public void configureContentNegotiation ( ContentNegotiationConfigurer configurer ) { configurer . favorParameter ( false ) ; configurer . favorPathExtension ( false ) ; }
Uses the HTTP header for content negociation .
40
10
43,566
@ Override public IssueServiceConfiguration getConfigurationByName ( String name ) { // Parsing of the name String [ ] tokens = StringUtils . split ( name , GitHubGitConfiguration . CONFIGURATION_REPOSITORY_SEPARATOR ) ; if ( tokens == null || tokens . length != 2 ) { throw new IllegalStateException ( "The GitHub issue...
A GitHub configuration name
131
4
43,567
@ RequestMapping ( value = "" , method = RequestMethod . GET ) public Resource < ExtensionList > getExtensions ( ) { return Resource . of ( extensionManager . getExtensionList ( ) , uri ( MvcUriComponentsBuilder . on ( getClass ( ) ) . getExtensions ( ) ) ) ; }
Gets the list of extensions .
71
7
43,568
public static < T > Decoration < T > of ( Decorator < T > decorator , T data ) { Validate . notNull ( decorator , "The decorator is required" ) ; Validate . notNull ( data , "The decoration data is required" ) ; return new Decoration <> ( decorator , data , null ) ; }
Basic construction . Only the data is required
76
8
43,569
public static < T > Decoration < T > error ( Decorator < T > decorator , String error ) { Validate . notNull ( decorator , "The decorator is required" ) ; Validate . notBlank ( error , "The decoration error is required" ) ; return new Decoration <> ( decorator , null , error ) ; }
Basic construction . With an error
77
6
43,570
@ RequestMapping ( value = "configurations" , method = RequestMethod . GET ) public Resources < StashConfiguration > getConfigurations ( ) { return Resources . of ( configurationService . getConfigurations ( ) , uri ( on ( getClass ( ) ) . getConfigurations ( ) ) ) . with ( Link . CREATE , uri ( on ( getClass ( ) ) . g...
Gets the configurations
132
4
43,571
@ RequestMapping ( value = "changeLog/fileFilter/{projectId}/create" , method = RequestMethod . GET ) public Form createChangeLogFileFilterForm ( @ SuppressWarnings ( "UnusedParameters" ) @ PathVariable ID projectId ) { return Form . create ( ) . with ( Text . of ( "name" ) . label ( "Name" ) . help ( "Name to use to s...
Form to create a change log filter
139
7
43,572
@ RequestMapping ( value = "" , method = RequestMethod . GET ) public Resource < Info > info ( ) { return Resource . of ( infoService . getInfo ( ) , uri ( on ( getClass ( ) ) . info ( ) ) ) // API links . with ( "user" , uri ( on ( UserController . class ) . getCurrentUser ( ) ) ) // TODO Structure controller (--> pro...
General information about the application
125
5
43,573
@ RequestMapping ( value = "application" , method = RequestMethod . GET ) public Resources < ApplicationInfo > applicationInfo ( ) { return Resources . of ( applicationInfoService . getApplicationInfoList ( ) , uri ( on ( InfoController . class ) . applicationInfo ( ) ) ) ; }
Messages about the application
64
5
43,574
@ Override public boolean canEdit ( ProjectEntity entity , SecurityService securityService ) { return securityService . isProjectFunctionGranted ( entity . projectId ( ) , ProjectConfig . class ) && propertyService . hasProperty ( entity . getProject ( ) , SVNProjectConfigurationPropertyType . class ) ; }
One can edit the SVN configuration of a branch only if he can configurure a project and if the project is itself configured with SVN .
65
30
43,575
@ Override public void start ( ) { register ( STATUS_PASSED ) ; register ( STATUS_FIXED ) ; register ( STATUS_DEFECTIVE ) ; register ( STATUS_EXPLAINED , FIXED ) ; register ( STATUS_INVESTIGATING , DEFECTIVE , EXPLAINED , FIXED ) ; register ( STATUS_INTERRUPTED , INVESTIGATING , FIXED ) ; register ( STATUS_FAILED , INT...
Registers the tree of validation run status ids .
300
11
43,576
protected < T > List < ? extends Decoration > getDecorations ( ProjectEntity entity , Decorator < T > decorator ) { try { return decorator . getDecorations ( entity ) ; } catch ( Exception ex ) { return Collections . singletonList ( Decoration . error ( decorator , getErrorMessage ( ex ) ) ) ; } }
Gets the decoration for an entity and returns an error decoration in case of problem .
77
17
43,577
public static List < String > asList ( String text ) { if ( StringUtils . isBlank ( text ) ) { return Collections . emptyList ( ) ; } else { try { return IOUtils . readLines ( new StringReader ( text ) ) ; } catch ( IOException e ) { throw new RuntimeException ( "Cannot get lines" , e ) ; } } }
Splits a text in several lines .
84
8
43,578
public static String toHexString ( byte [ ] bytes , int start , int len ) { StringBuilder buf = new StringBuilder ( ) ; for ( int i = 0 ; i < len ; i ++ ) { int b = bytes [ start + i ] & 0xFF ; if ( b < 16 ) buf . append ( ' ' ) ; buf . append ( Integer . toHexString ( b ) ) ; } return buf . toString ( ) ; }
Writes some bytes in Hexadecimal format
98
10
43,579
@ Override public boolean canEdit ( ProjectEntity entity , SecurityService securityService ) { return securityService . isProjectFunctionGranted ( entity , ProjectConfig . class ) && propertyService . hasProperty ( entity , SVNBranchConfigurationPropertyType . class ) ; }
One can edit the SVN synchronisation only if he can configure the project and if the branch is configured for SVN .
55
25
43,580
@ RequestMapping ( value = "configurations/descriptors" , method = RequestMethod . GET ) public Resources < ConfigurationDescriptor > getConfigurationsDescriptors ( ) { return Resources . of ( jenkinsService . getConfigurationDescriptors ( ) , uri ( on ( getClass ( ) ) . getConfigurationsDescriptors ( ) ) ) ; }
Gets the configuration descriptors
81
6
43,581
protected T injectCredentials ( T configuration ) { T oldConfig = findConfiguration ( configuration . getName ( ) ) . orElse ( null ) ; T target ; if ( StringUtils . isBlank ( configuration . getPassword ( ) ) ) { if ( oldConfig != null && StringUtils . equals ( oldConfig . getUser ( ) , configuration . getUser ( ) ) )...
Adjust a configuration so that it contains a password if 1 ) the password is empty 2 ) the configuration already exists 3 ) the user name is the same
120
30
43,582
@ RequestMapping ( value = "predefinedValidationStamps" , method = RequestMethod . GET ) public Resources < PredefinedValidationStamp > getPredefinedValidationStampList ( ) { return Resources . of ( predefinedValidationStampService . getPredefinedValidationStamps ( ) , uri ( on ( getClass ( ) ) . getPredefinedValidatio...
Gets the list of predefined validation stamps .
125
10
43,583
@ RequestMapping ( value = "" , method = RequestMethod . GET ) public Resources < DescribedForm > configuration ( ) { securityService . checkGlobalFunction ( GlobalSettings . class ) ; List < DescribedForm > forms = settingsManagers . stream ( ) . sorted ( ( o1 , o2 ) -> o1 . getTitle ( ) . compareTo ( o2 . getTitle ( ...
List of forms to configure .
134
6
43,584
public OptionalLong extractRevision ( String buildName ) { // Gets the regex for the pattern String regex = getRegex ( ) ; // Matching Matcher matcher = Pattern . compile ( regex ) . matcher ( buildName ) ; if ( matcher . matches ( ) ) { String token = matcher . group ( 1 ) ; return OptionalLong . of ( Long . parseLong...
Extracts the revision from a build name .
101
10
43,585
public static OntrackSVNIssueInfo empty ( SVNConfiguration configuration ) { return new OntrackSVNIssueInfo ( configuration , null , null , Collections . emptyList ( ) , Collections . emptyList ( ) ) ; }
Empty issue info .
51
4
43,586
@ Override public boolean canEdit ( ProjectEntity entity , SecurityService securityService ) { switch ( entity . getProjectEntityType ( ) ) { case BUILD : return securityService . isProjectFunctionGranted ( entity , BuildCreate . class ) ; case PROMOTION_RUN : return securityService . isProjectFunctionGranted ( entity ...
Depends on the nature of the entity . Allowed to the ones who can create the associated entity .
141
21
43,587
public static void main ( String [ ] args ) { // PID file File pid = new File ( "ontrack.pid" ) ; // Runs the application SpringApplication application = new SpringApplication ( Application . class ) ; application . addListeners ( new ApplicationPidFileWriter ( pid ) ) ; application . run ( args ) ; }
Start - up point
70
4
43,588
public boolean hasValidationStamp ( String name , String status ) { return ( StringUtils . equals ( name , getValidationStamp ( ) . getName ( ) ) ) && isRun ( ) && ( StringUtils . isBlank ( status ) || StringUtils . equals ( status , getLastStatus ( ) . getStatusID ( ) . getId ( ) ) ) ; }
Checks if the validation run view has the given validation stamp with the given status .
85
17
43,589
protected Stream < Branch > getSVNConfiguredBranches ( ) { return structureService . getProjectList ( ) . stream ( ) // ...which have a SVN configuration . filter ( project -> propertyService . hasProperty ( project , SVNProjectConfigurationPropertyType . class ) ) // ...gets all their branches . flatMap ( project -> s...
Gets the list of all branches for all projects which are properly configured for SVN .
126
18
43,590
@ RequestMapping ( value = "globals" , method = RequestMethod . GET ) public Resources < GlobalPermission > getGlobalPermissions ( ) { return Resources . of ( accountService . getGlobalPermissions ( ) , uri ( on ( PermissionController . class ) . getGlobalPermissions ( ) ) ) . with ( "_globalRoles" , uri ( on ( Permiss...
List of global permissions
100
4
43,591
@ RequestMapping ( value = "globals/roles" , method = RequestMethod . GET ) public Resources < GlobalRole > getGlobalRoles ( ) { return Resources . of ( rolesService . getGlobalRoles ( ) , uri ( on ( PermissionController . class ) . getGlobalRoles ( ) ) ) ; }
List of global roles
73
4
43,592
@ RequestMapping ( value = "projects/roles" , method = RequestMethod . GET ) public Resources < ProjectRole > getProjectRoles ( ) { return Resources . of ( rolesService . getProjectRoles ( ) , uri ( on ( PermissionController . class ) . getProjectRoles ( ) ) ) ; }
List of project roles
71
4
43,593
protected Set < File > jrxmlFilesToCompile ( SourceMapping mapping ) throws MojoExecutionException { if ( ! sourceDirectory . isDirectory ( ) ) { String message = sourceDirectory . getName ( ) + " is not a directory" ; if ( failOnMissingSourceDirectory ) { throw new IllegalArgumentException ( message ) ; } else { log ....
Determines source files to be compiled .
183
9
43,594
private void checkOutDirWritable ( File outputDirectory ) throws MojoExecutionException { if ( ! outputDirectory . exists ( ) ) { checkIfOutputCanBeCreated ( ) ; checkIfOutputDirIsWritable ( ) ; if ( verbose ) { log . info ( "Output dir check OK" ) ; } } else if ( ! outputDirectory . canWrite ( ) ) { throw new MojoExec...
Check if the output directory exist and is writable . If not try to create an output dir and see if that is writable .
119
27
43,595
@ Override public Void call ( ) throws Exception { OutputStream out = null ; InputStream in = null ; try { out = new FileOutputStream ( destination ) ; in = new FileInputStream ( source ) ; JasperCompileManager . compileReportToStream ( in , out ) ; if ( verbose ) { log . info ( "Compiling " + source . getName ( ) ) ; ...
Compile the source file . If the source file doesn t have the right extension it is skipped .
138
20
43,596
public static Bitmap screenshot ( int width , int height ) { if ( METHOD_screenshot_II == null ) { Log . e ( TAG , "screenshot method was not found." ) ; return null ; } return ( Bitmap ) CompatUtils . invoke ( null , null , METHOD_screenshot_II , width , height ) ; }
Copy the current screen contents into a bitmap and return it . Use width = 0 and height = 0 to obtain an unscaled screenshot .
76
28
43,597
public static Bitmap createScreenshot ( Context context ) { if ( ! hasScreenshotPermission ( context ) ) { LogUtils . log ( ScreenshotUtils . class , Log . ERROR , "Screenshot permission denied." ) ; return null ; } final WindowManager windowManager = ( WindowManager ) context . getSystemService ( Context . WINDOW_SERV...
Returns a screenshot with the contents of the current display that matches the current display rotation .
438
17
43,598
public void reset ( AccessibilityNodeInfoCompat newNode ) { if ( mNode != newNode && mNode != null && mOwned ) { mNode . recycle ( ) ; } mNode = newNode ; mOwned = true ; }
Resets this object to contain a new node taking ownership of the new node .
52
16
43,599
public void init ( Context context ) { if ( ! mNotFoundClassesMap . isEmpty ( ) ) { buildInstalledPackagesCache ( context ) ; } mPackageMonitor . register ( context ) ; }
Builds the package cache and registers the package monitor
45
10