idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
2,300
private synchronized void onJobFailure ( final JobStatusProto jobStatusProto ) { assert jobStatusProto . getState ( ) == ReefServiceProtos . State . FAILED ; final String id = this . jobId ; final Optional < byte [ ] > data = jobStatusProto . hasException ( ) ? Optional . of ( jobStatusProto . getException ( ) . toByte...
Inform the client of a failed job .
2,301
public synchronized Set < String > recoverEvaluators ( ) { final Set < String > expectedContainers = new HashSet < > ( ) ; try { if ( this . fileSystem == null || this . changeLogLocation == null ) { LOG . log ( Level . WARNING , "Unable to recover evaluators due to failure to instantiate FileSystem. Returning an" + " ...
Recovers the set of evaluators that are alive .
2,302
public synchronized void recordAllocatedEvaluator ( final String id ) { if ( this . fileSystem != null && this . changeLogLocation != null ) { final String entry = ADD_FLAG + id + System . lineSeparator ( ) ; this . logContainerChange ( entry ) ; } }
Adds the allocated evaluator entry to the evaluator log .
2,303
public synchronized void recordRemovedEvaluator ( final String id ) { if ( this . fileSystem != null && this . changeLogLocation != null ) { final String entry = REMOVE_FLAG + id + System . lineSeparator ( ) ; this . logContainerChange ( entry ) ; } }
Adds the removed evaluator entry to the evaluator log .
2,304
public synchronized void close ( ) throws Exception { if ( this . readerWriter != null && ! this . writerClosed ) { this . readerWriter . close ( ) ; this . writerClosed = true ; } }
Closes the readerWriter which in turn closes the FileSystem .
2,305
private void onCleanExit ( final String processId ) { this . onResourceStatus ( ResourceStatusEventImpl . newBuilder ( ) . setIdentifier ( processId ) . setState ( State . DONE ) . setExitCode ( 0 ) . build ( ) ) ; }
Inform REEF of a cleanly exited process .
2,306
private void onUncleanExit ( final String processId , final int exitCode ) { this . onResourceStatus ( ResourceStatusEventImpl . newBuilder ( ) . setIdentifier ( processId ) . setState ( State . FAILED ) . setExitCode ( exitCode ) . build ( ) ) ; }
Inform REEF of an unclean process exit .
2,307
@ SuppressWarnings ( "checkstyle:illegalCatch" ) public Throwable dispatch ( final StopTime stopTime ) { try { for ( final EventHandler < StopTime > handler : stopHandlers ) { handler . onNext ( stopTime ) ; } return null ; } catch ( Throwable t ) { return t ; } }
We must implement this synchronously in order to catch exceptions and forward them back via the bridge before the server shuts down after this method returns .
2,308
public void launchTask ( final ExecutorDriver driver , final TaskInfo task ) { driver . sendStatusUpdate ( TaskStatus . newBuilder ( ) . setTaskId ( TaskID . newBuilder ( ) . setValue ( this . mesosExecutorId ) . build ( ) ) . setState ( TaskState . TASK_STARTING ) . setSlaveId ( task . getSlaveId ( ) ) . setMessage ( ...
We assume a long - running Mesos Task that manages a REEF Evaluator process leveraging Mesos Executor s interface .
2,309
public static void main ( final String [ ] args ) throws Exception { final Injector injector = Tang . Factory . getTang ( ) . newInjector ( parseCommandLine ( args ) ) ; final REEFExecutor reefExecutor = injector . getInstance ( REEFExecutor . class ) ; reefExecutor . onStart ( ) ; }
The starting point of the executor .
2,310
void addTokensFromFile ( final UserGroupInformation ugi ) throws IOException { LOG . log ( Level . FINE , "Reading security tokens from file: {0}" , this . securityTokensFile ) ; try ( final FileInputStream stream = new FileInputStream ( securityTokensFile ) ) { final BinaryDecoder decoder = decoderFactory . binaryDeco...
Read tokens from a file and add them to the user s credentials .
2,311
LocalResource makeLocalResourceForJarFile ( final Path path ) throws IOException { final LocalResource localResource = Records . newRecord ( LocalResource . class ) ; final FileStatus status = FileContext . getFileContext ( this . fileSystem . getUri ( ) ) . getFileStatus ( path ) ; localResource . setType ( LocalResou...
Creates a LocalResource instance for the JAR file referenced by the given Path .
2,312
public static ArrayList < String > getFilteredLinesFromFile ( final String fileName , final String filter , final String removeBeforeToken , final String removeAfterToken ) throws IOException { final ArrayList < String > filteredLines = new ArrayList < > ( ) ; try ( final BufferedReader in = new BufferedReader ( new In...
Get lines from a given file with a specified filter trim the line by removing strings before removeBeforeToken and after removeAfterToken .
2,313
public static ArrayList < String > getFilteredLinesFromFile ( final String fileName , final String filter ) throws IOException { return getFilteredLinesFromFile ( fileName , filter , null , null ) ; }
get lines from given file with specified filter .
2,314
public static ArrayList < String > findStages ( final ArrayList < String > lines , final String [ ] stageIndicators ) { final ArrayList < String > stages = new ArrayList < > ( ) ; int i = 0 ; for ( final String line : lines ) { if ( line . contains ( stageIndicators [ i ] ) ) { stages . add ( stageIndicators [ i ] ) ; ...
find lines that contain stage indicators . The stageIndicators must be in sequence which appear in the lines .
2,315
public static void runHelloReefWithoutClient ( final Configuration runtimeConf ) throws InjectionException { final REEF reef = Tang . Factory . getTang ( ) . newInjector ( runtimeConf ) . getInstance ( REEF . class ) ; final Configuration driverConf = getDriverConfiguration ( ) ; reef . submit ( driverConf ) ; }
Used in the HDInsight example .
2,316
@ SuppressWarnings ( "checkstyle:hiddenfield" ) public void resourceOffers ( final SchedulerDriver driver , final List < Protos . Offer > offers ) { final Map < String , NodeDescriptorEventImpl . Builder > nodeDescriptorEvents = new HashMap < > ( ) ; for ( final Offer offer : offers ) { if ( nodeDescriptorEvents . get ...
All offers in each batch of offers will be either be launched or declined .
2,317
public YarnSubmissionHelper addLocalResource ( final String resourceName , final LocalResource resource ) { resources . put ( resourceName , resource ) ; return this ; }
Add a file to be localized on the driver .
2,318
public YarnSubmissionHelper setPreserveEvaluators ( final boolean preserveEvaluators ) { if ( preserveEvaluators ) { if ( YarnTypes . isAtOrAfterVersion ( YarnTypes . MIN_VERSION_KEEP_CONTAINERS_AVAILABLE ) ) { LOG . log ( Level . FINE , "Hadoop version is {0} or after with KeepContainersAcrossApplicationAttempts suppo...
Set whether or not the resource manager should preserve evaluators across driver restarts .
2,319
public YarnSubmissionHelper setJobSubmissionEnvMap ( final Map < String , String > map ) { for ( final Map . Entry < String , String > entry : map . entrySet ( ) ) { environmentVariablesMap . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } return this ; }
Sets environment variable map .
2,320
public YarnSubmissionHelper setJobSubmissionEnvVariable ( final String key , final String value ) { environmentVariablesMap . put ( key , value ) ; return this ; }
Adds a job submission environment variable .
2,321
public void onException ( final Throwable cause , final SocketAddress remoteAddress , final T message ) { if ( LOG . isLoggable ( Level . FINEST ) ) { LOG . log ( Level . FINEST , "Error sending message " + message + " to " + remoteAddress , cause ) ; } }
Called when the sent message to remoteAddress is failed to be transferred .
2,322
static YarnClusterSubmissionFromCS fromJobSubmissionParametersFile ( final File yarnClusterAppSubmissionParametersFile , final File yarnClusterJobSubmissionParametersFile ) throws IOException { try ( final FileInputStream appFileInputStream = new FileInputStream ( yarnClusterAppSubmissionParametersFile ) ) { try ( fina...
Takes the YARN cluster job submission configuration file deserializes it and creates submission object .
2,323
public void onMeasure ( int widthMeasureSpec , int heightMeasureSpec ) { int measuredWidth = MeasureSpec . getSize ( widthMeasureSpec ) ; int widthMode = MeasureSpec . getMode ( widthMeasureSpec ) ; int measuredHeight = MeasureSpec . getSize ( heightMeasureSpec ) ; int heightMode = MeasureSpec . getMode ( heightMeasure...
Measure the view to end up as a square based on the minimum of the height and width .
2,324
private void setItem ( int index , int value ) { if ( index == HOUR_INDEX ) { setValueForItem ( HOUR_INDEX , value ) ; int hourDegrees = ( value % 12 ) * HOUR_VALUE_TO_DEGREES_STEP_SIZE ; mHourRadialSelectorView . setSelection ( hourDegrees , isHourInnerCircle ( value ) , false ) ; mHourRadialSelectorView . invalidate ...
Set either the hour or the minute . Will set the internal value and set the selection .
2,325
public void setCurrentItemShowing ( int index , boolean animate ) { if ( index != HOUR_INDEX && index != MINUTE_INDEX ) { Log . e ( TAG , "TimePicker does not support view at index " + index ) ; return ; } int lastIndex = getCurrentItemShowing ( ) ; mCurrentItemShowing = index ; if ( animate && ( index != lastIndex ) )...
Set either minutes or hours as showing .
2,326
public final void attach ( T object , IAddon parent ) { if ( mObject != null || object == null || mParent != null || parent == null ) { throw new IllegalStateException ( ) ; } mParent = parent ; onAttach ( mObject = object ) ; }
Only for system usage don t call it!
2,327
public void setFocusedItem ( T item ) { final int itemId = getIdForItem ( item ) ; if ( itemId == INVALID_ID ) { return ; } performAction ( itemId , AccessibilityNodeInfoCompat . ACTION_ACCESSIBILITY_FOCUS , null ) ; }
Requests accessibility focus be placed on the specified item .
2,328
public void clearFocusedItem ( ) { final int itemId = mFocusedItemId ; if ( itemId == INVALID_ID ) { return ; } performAction ( itemId , AccessibilityNodeInfoCompat . ACTION_CLEAR_ACCESSIBILITY_FOCUS , null ) ; }
Clears the current accessibility focused item .
2,329
@ TargetApi ( Build . VERSION_CODES . ICE_CREAM_SANDWICH ) public boolean sendEventForItem ( T item , int eventType ) { if ( ! mManager . isEnabled ( ) || Build . VERSION . SDK_INT < Build . VERSION_CODES . ICE_CREAM_SANDWICH ) { return false ; } final AccessibilityEvent event = getEventForItem ( item , eventType ) ; f...
Populates an event of the specified type with information about an item and attempts to send it up through the view hierarchy .
2,330
void drawDivider ( Canvas canvas , Rect bounds , int childIndex ) { final Drawable divider = getDivider ( ) ; divider . setBounds ( bounds ) ; divider . draw ( canvas ) ; }
O_O This method doesn t override super method but super class invoke it instead of android . widget . ListView . drawDivider . It s fucking magic of dalvik?
2,331
@ SuppressLint ( "InlinedApi" ) private static Object [ ] parseFontStyle ( Context context , AttributeSet attrs , int defStyleAttr ) { final TypedArray a = context . obtainStyledAttributes ( attrs , R . styleable . TextAppearance , defStyleAttr , 0 ) ; final Object [ ] result = parseFontStyle ( a ) ; a . recycle ( ) ; ...
Looks ugly? Yea i know .
2,332
private void removeItemAtInt ( int index , boolean updateChildrenOnMenuViews ) { if ( ( index < 0 ) || ( index >= mItems . size ( ) ) ) { return ; } mItems . remove ( index ) ; if ( updateChildrenOnMenuViews ) { onItemsChanged ( true ) ; } }
Remove the item at the given index and optionally forces menu views to update .
2,333
public void updateMenuView ( boolean cleared ) { final ViewGroup parent = ( ViewGroup ) mMenuView ; if ( parent == null ) { return ; } int childIndex = 0 ; if ( mMenu != null ) { mMenu . flagActionItems ( ) ; ArrayList < MenuItemImpl > visibleItems = mMenu . getVisibleItems ( ) ; final int itemCount = visibleItems . si...
Reuses item views when it can
2,334
private void updateProgressBars ( int value ) { ProgressBar circularProgressBar = getCircularProgressBar ( ) ; ProgressBar horizontalProgressBar = getHorizontalProgressBar ( ) ; if ( value == Window . PROGRESS_VISIBILITY_ON ) { if ( mFeatureProgress ) { int level = horizontalProgressBar . getProgress ( ) ; int visibili...
Progress Bar function . Mostly extracted from PhoneWindow . java
2,335
public CalendarDay getDayFromLocation ( float x , float y ) { int dayStart = mPadding ; if ( x < dayStart || x > mWidth - mPadding ) { return null ; } int row = ( int ) ( y - MONTH_HEADER_SIZE ) / mRowHeight ; int column = ( int ) ( ( x - dayStart ) * mNumDays / ( mWidth - dayStart - mPadding ) ) ; int day = column - f...
Calculates the day that the given x position is in accounting for week number . Returns a Time referencing that day or null if
2,336
private Drawable getDrawable ( Uri uri ) { try { String scheme = uri . getScheme ( ) ; if ( ContentResolver . SCHEME_ANDROID_RESOURCE . equals ( scheme ) ) { try { return getDrawableFromResourceUri ( uri ) ; } catch ( Resources . NotFoundException ex ) { throw new FileNotFoundException ( "Resource does not exist: " + u...
Gets a drawable by URI without using the cache .
2,337
private Drawable getDefaultIcon1 ( Cursor cursor ) { Drawable drawable = getActivityIconWithCache ( mSearchable . getSearchActivity ( ) ) ; if ( drawable != null ) { return drawable ; } return mContext . getPackageManager ( ) . getDefaultActivityIcon ( ) ; }
Gets the left - hand side icon that will be used for the current suggestion if the suggestion contains an icon column but no icon or a broken icon .
2,338
public ResolveInfo getDefaultActivity ( ) { synchronized ( mInstanceLock ) { ensureConsistentState ( ) ; if ( ! mActivities . isEmpty ( ) ) { return mActivities . get ( 0 ) . resolveInfo ; } } return null ; }
Gets the default activity The default activity is defined as the one with highest rank i . e . the first one in the list of activities that can handle the intent .
2,339
public void setDefaultActivity ( int index ) { synchronized ( mInstanceLock ) { ensureConsistentState ( ) ; ActivityResolveInfo newDefaultActivity = mActivities . get ( index ) ; ActivityResolveInfo oldDefaultActivity = mActivities . get ( 0 ) ; final float weight ; if ( oldDefaultActivity != null ) { weight = oldDefau...
Sets the default activity . The default activity is set by adding a historical record with weight high enough that this activity will become the highest ranked . Such a strategy guarantees that the default will eventually change if not used . Also the weight of the record for setting a default is inflated with a consta...
2,340
public void setActivitySorter ( ActivitySorter activitySorter ) { synchronized ( mInstanceLock ) { if ( mActivitySorter == activitySorter ) { return ; } mActivitySorter = activitySorter ; if ( sortActivitiesIfNeeded ( ) ) { notifyChanged ( ) ; } } }
Sets the sorter for ordering activities based on historical data and an intent .
2,341
private boolean sortActivitiesIfNeeded ( ) { if ( mActivitySorter != null && mIntent != null && ! mActivities . isEmpty ( ) && ! mHistoricalRecords . isEmpty ( ) ) { mActivitySorter . sort ( mIntent , mActivities , Collections . unmodifiableList ( mHistoricalRecords ) ) ; return true ; } return false ; }
Sorts the activities if necessary which is if there is a sorter there are some activities to sort and there is some historical data .
2,342
private boolean loadActivitiesIfNeeded ( ) { if ( mReloadActivities && mIntent != null ) { mReloadActivities = false ; mActivities . clear ( ) ; List < ResolveInfo > resolveInfos = mContext . getPackageManager ( ) . queryIntentActivities ( mIntent , 0 ) ; final int resolveInfoCount = resolveInfos . size ( ) ; for ( int...
Loads the activities for the current intent if needed which is if they are not already loaded for the current intent .
2,343
private boolean readHistoricalDataIfNeeded ( ) { if ( mCanReadHistoricalData && mHistoricalRecordsChanged && ! TextUtils . isEmpty ( mHistoryFileName ) ) { mCanReadHistoricalData = false ; mReadShareHistoryCalled = true ; readHistoricalDataImpl ( ) ; return true ; } return false ; }
Reads the historical data if necessary which is it has changed there is a history file and there is not persist in progress .
2,344
private void pruneExcessiveHistoricalRecordsIfNeeded ( ) { final int pruneCount = mHistoricalRecords . size ( ) - mHistoryMaxSize ; if ( pruneCount <= 0 ) { return ; } mHistoricalRecordsChanged = true ; for ( int i = 0 ; i < pruneCount ; i ++ ) { HistoricalRecord prunedRecord = mHistoricalRecords . remove ( 0 ) ; if ( ...
Prunes older excessive records to guarantee maxHistorySize .
2,345
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 .
2,346
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!
2,347
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
2,348
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 .
2,349
public static int getTheme ( Intent intent , boolean applyModifier ) { return prepareFlags ( intent . getIntExtra ( ThemeManager . _THEME_TAG , ThemeManager . _DEFAULT_THEME ) , applyModifier ) ; }
Extract theme flags from intent
2,350
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
2,351
public static void modifyDefaultThemeClear ( int mod ) { mod &= ThemeManager . _THEME_MASK ; ThemeManager . _DEFAULT_THEME |= mod ; ThemeManager . _DEFAULT_THEME ^= mod ; }
Clear modifier from default theme
2,352
public static void reset ( ) { if ( ( _DEFAULT_THEME & COLOR_SCHEME_MASK ) == 0 ) { _DEFAULT_THEME = DARK ; } _THEME_MODIFIER = 0 ; _THEMES_MAP . clear ( ) ; map ( DARK , Holo_Theme ) ; map ( DARK | FULLSCREEN , Holo_Theme_Fullscreen ) ; map ( DARK | NO_ACTION_BAR , Holo_Theme_NoActionBar ) ; map ( DARK | NO_ACTION_BAR...
Reset all themes to default
2,353
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 .
2,354
private void updateSearchAutoComplete ( ) { mQueryTextView . setThreshold ( mSearchable . getSuggestThreshold ( ) ) ; mQueryTextView . setImeOptions ( mSearchable . getImeOptions ( ) ) ; int inputType = mSearchable . getInputType ( ) ; if ( ( inputType & InputType . TYPE_MASK_CLASS ) == InputType . TYPE_CLASS_TEXT ) { ...
Updates the auto - complete text view .
2,355
private void setQuery ( CharSequence query ) { mQueryTextView . setText ( query ) ; mQueryTextView . setSelection ( TextUtils . isEmpty ( query ) ? 0 : query . length ( ) ) ; }
Sets the text in the query box without updating the suggestions .
2,356
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 ; do { if ( ...
Called internally to fill the given menu . If a sub menu is seen it will call this recursively .
2,357
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 .
2,358
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 .
2,359
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 .
2,360
private int getAmOrPmKeyCode ( int amOrPm ) { if ( mAmKeyCode == - 1 || mPmKeyCode == - 1 ) { KeyCharacterMap kcm = KeyCharacterMap . load ( KeyCharacterMap . VIRTUAL_KEYBOARD ) ; char amChar ; char pmChar ; for ( int i = 0 ; i < Math . max ( mAmText . length ( ) , mPmText . length ( ) ) ; i ++ ) { amChar = mAmText . t...
Get the keycode value for AM and PM in the current language .
2,361
public void show ( IBinder windowToken ) { final MenuBuilder menu = mMenu ; final AlertDialog . Builder builder = new AlertDialog . Builder ( menu . getContext ( ) ) ; mPresenter = new ListMenuPresenter ( builder . getContext ( ) , R . layout . abc_list_menu_item_layout ) ; mPresenter . setCallback ( this ) ; mMenu . a...
Shows menu as a dialog .
2,362
public void onScroll ( AbsListView view , int firstVisibleItem , int visibleItemCount , int totalItemCount ) { SimpleMonthView child = ( SimpleMonthView ) view . getChildAt ( 0 ) ; if ( child == null ) { return ; } long currScroll = view . getFirstVisiblePosition ( ) * child . getHeight ( ) - child . getBottom ( ) ; mP...
Updates the title and selected month if the view has moved to a new month .
2,363
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 .
2,364
public ArticleAttachments createUploadArticle ( long articleId , File file ) throws IOException { return createUploadArticle ( articleId , file , false ) ; }
Create upload article with inline false
2,365
@ 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
2,366
public Map serialize ( ) throws OpsGenieClientValidationException { validate ( ) ; try { return JsonUtils . toMap ( this ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return null ; }
convertes request to map
2,367
public void fromJson ( String json ) throws IOException , ParseException { JsonUtils . fromJson ( this , json ) ; this . json = json ; }
Convert json data to response
2,368
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 .
2,369
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 ; i...
Delete Alert Deletes an alert using alert id tiny id or alias
2,370
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
2,371
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
2,372
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
2,373
public ListSavedSearchResponse listSavedSearches ( ) throws ApiException { Object localVarPostBody = null ; String localVarPath = "/v2/alerts/saved-searches" ; List < Pair > localVarQueryParams = new ArrayList < Pair > ( ) ; Map < String , String > localVarHeaderParams = new HashMap < String , String > ( ) ; Map < Stri...
Lists Saved Searches List all saved searches
2,374
public List < ScheduleRotation > getRotations ( ) { if ( getTimeZone ( ) != null && rotations != null ) for ( ScheduleRotation scheduleRotation : rotations ) scheduleRotation . setScheduleTimeZone ( getTimeZone ( ) ) ; return rotations ; }
Rotations of schedule
2,375
@ JsonProperty ( "participants" ) public List < String > getParticipantsNames ( ) { if ( participants == null ) return null ; List < String > participantList = new ArrayList < String > ( ) ; for ( ScheduleParticipant participant : participants ) participantList . add ( participant . getParticipant ( ) ) ; return partic...
Participants of schedule rotation
2,376
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 .
2,377
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 .
2,378
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 .
2,379
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 .
2,380
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 .
2,381
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 .
2,382
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 .
2,383
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 ( ) . matche...
Performs a delete for the corresponding object from the in - memory db .
2,384
public List < ExportFormat > exportFormats ( IssueServiceConfiguration issueServiceConfiguration ) { return issueExportServiceFactory . getIssueExportServices ( ) . stream ( ) . map ( IssueExportService :: getExportFormat ) . collect ( Collectors . toList ( ) ) ; }
Export of both text and HTML by default .
2,385
public TemplateInstanceExecution templateInstanceExecution ( String sourceName , ExpressionEngine expressionEngine ) { Map < String , String > sourceNameInput = Collections . singletonMap ( "sourceName" , sourceName ) ; Map < String , String > parameterMap = Maps . transformValues ( Maps . uniqueIndex ( parameters , Te...
Gets the execution context for the creation of a template instance .
2,386
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 .
2,387
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 .
2,388
@ 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
2,389
@ 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
2,390
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 .
2,391
@ 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 .
2,392
@ RequestMapping ( value = "root" , method = RequestMethod . GET ) public Resources < UIEvent > getEvents ( @ RequestParam ( required = false , defaultValue = "0" ) int offset , @ RequestParam ( required = false , defaultValue = "20" ) int count ) { Resources < UIEvent > resources = Resources . of ( eventQueryService ....
Gets the list of events for the root .
2,393
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 , sym ) ) { cos...
Persists the payload of a key to the disk .
2,394
@ 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
2,395
@ RequestMapping ( value = "configurations/create" , method = RequestMethod . GET ) public Form getConfigurationForm ( ) { return CombinedIssueServiceConfiguration . form ( configurationService . getAvailableIssueServiceConfigurations ( ) ) ; }
Form for a new configuration
2,396
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 Illeg...
Checks list of arguments
2,397
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 .
2,398
private void indexInTransaction ( SVNRepository repository , SVNLogEntry logEntry ) throws SVNException { long revision = logEntry . getRevision ( ) ; String author = logEntry . getAuthor ( ) ; String message = logEntry . getMessage ( ) ; Date date = logEntry . getDate ( ) ; author = Objects . toString ( author , "" ) ...
This method is executed within a transaction
2,399
protected void index ( SVNRepository repository , long from , long to , JobRunListener runListener ) { if ( from > to ) { long t = from ; from = to ; to = t ; } long min = from ; long max = to ; try ( Transaction ignored = transactionService . start ( ) ) { SVNURL url = SVNUtils . toURL ( repository . getConfiguration ...
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 .