idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
36,900 | public void value ( AjaxRequestTarget ajaxRequestTarget , int value ) { ajaxRequestTarget . appendJavaScript ( this . value ( value ) . render ( ) . toString ( ) ) ; } | Method to set the current value of the slider within the ajax request |
36,901 | public void values ( AjaxRequestTarget ajaxRequestTarget , int index , int value ) { ajaxRequestTarget . appendJavaScript ( this . values ( index , value ) . render ( ) . toString ( ) ) ; } | Method to set the current values of the slider within the ajax request |
36,902 | public JsStatement simpleDialog ( String title , String message ) { JsStatement statement = new JsStatement ( ) ; statement . append ( "$.ui.dialog.wiquery.simpleDialog(" ) ; statement . append ( "" + Session . get ( ) . nextSequenceValue ( ) + ", " ) ; statement . append ( DialogUtilsLanguages . getDialogUtilsLiteral ( DialogUtilsLanguages . getDialogUtilsLanguages ( getLocale ( ) ) ) + ", " ) ; statement . append ( JsUtils . quotes ( title , true ) + ", " ) ; statement . append ( JsUtils . doubleQuotes ( message , true ) + ")" ) ; return statement ; } | Method creating a simple dialog |
36,903 | public JsStatement warningDialog ( String message ) { JsStatement statement = new JsStatement ( ) ; statement . append ( "$.ui.dialog.wiquery.warningDialog(" ) ; statement . append ( "" + Session . get ( ) . nextSequenceValue ( ) + ", " ) ; statement . append ( DialogUtilsLanguages . getDialogUtilsLiteral ( DialogUtilsLanguages . getDialogUtilsLanguages ( getLocale ( ) ) ) + ", " ) ; statement . append ( JsUtils . doubleQuotes ( message , true ) + ", " ) ; statement . append ( JsUtils . quotes ( RequestCycle . get ( ) . urlFor ( WARNING_IMG , null ) ) + ")" ) ; return statement ; } | Method creating a warning Dialog |
36,904 | public void setAjaxStopEvent ( ISliderAjaxEvent ajaxStopEvent ) { this . ajaxEvents . put ( SliderAjaxEvent . ajaxStopEvent , ajaxStopEvent ) ; setStopEvent ( new SliderAjaxJsScopeUiEvent ( this , SliderAjaxEvent . ajaxStopEvent ) ) ; } | Sets the call - back for the AJAX stop event . |
36,905 | public void setAjaxSlideEvent ( ISliderAjaxEvent ajaxSlideEvent ) { this . ajaxEvents . put ( SliderAjaxEvent . ajaxSlideEvent , ajaxSlideEvent ) ; setSlideEvent ( new SliderAjaxJsScopeUiEvent ( this , SliderAjaxEvent . ajaxSlideEvent ) ) ; } | Sets the call - back for the AJAX Slide Event . |
36,906 | public void setAjaxStartEvent ( ISliderAjaxEvent ajaxStartEvent ) { this . ajaxEvents . put ( SliderAjaxEvent . ajaxStartEvent , ajaxStartEvent ) ; setSlideEvent ( new SliderAjaxJsScopeUiEvent ( this , SliderAjaxEvent . ajaxStartEvent ) ) ; } | Sets the call - back for the AJAX Start Event . |
36,907 | public void setAjaxChangeEvent ( ISliderAjaxEvent ajaxChangeEvent ) { this . ajaxEvents . put ( SliderAjaxEvent . ajaxChangeEvent , ajaxChangeEvent ) ; setChangeEvent ( new SliderAjaxJsScopeUiEvent ( this , SliderAjaxEvent . ajaxChangeEvent ) ) ; } | Sets the call - back for the AJAX Change Event . |
36,908 | public SnapModeEnum getSnapMode ( ) { String literal = options . getLiteral ( "snapMode" ) ; return literal == null ? SnapModeEnum . BOTH : SnapModeEnum . valueOf ( literal . toUpperCase ( ) ) ; } | Returns the snapMode option |
36,909 | public static ChainableStatement blur ( JsScope jsScope ) { return new DefaultChainableStatement ( StateEvent . BLUR . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the blur event of each matched element . |
36,910 | public static ChainableStatement change ( JsScope jsScope ) { return new DefaultChainableStatement ( StateEvent . CHANGE . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the change event of each matched element . |
36,911 | public static ChainableStatement click ( JsScope jsScope ) { return new DefaultChainableStatement ( MouseEvent . CLICK . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the click event of each matched element . |
36,912 | public static ChainableStatement dblclick ( JsScope jsScope ) { return new DefaultChainableStatement ( MouseEvent . DBLCLICK . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the dblclick event of each matched element . |
36,913 | public static ChainableStatement die ( EventLabel eventLabel , JsScope jsScope ) { return new DefaultChainableStatement ( "die" , JsUtils . quotes ( eventLabel . getEventLabel ( ) ) , jsScope . render ( ) ) ; } | This does the opposite of live it removes a bound live event . |
36,914 | public static ChainableStatement error ( JsScope jsScope ) { return new DefaultChainableStatement ( StateEvent . ERROR . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the error event of each matched element . |
36,915 | public static ChainableStatement focus ( JsScope jsScope ) { return new DefaultChainableStatement ( StateEvent . FOCUS . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the focus event of each matched element . |
36,916 | public static ChainableStatement keydown ( JsScope jsScope ) { return new DefaultChainableStatement ( KeyboardEvent . KEYDOWN . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the keydown event of each matched element . |
36,917 | public static ChainableStatement keypress ( JsScope jsScope ) { return new DefaultChainableStatement ( KeyboardEvent . KEYPRESS . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the keypress event of each matched element . |
36,918 | public static ChainableStatement keyup ( JsScope jsScope ) { return new DefaultChainableStatement ( KeyboardEvent . KEYUP . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the keyup event of each matched element . |
36,919 | public static ChainableStatement load ( JsScope jsScope ) { return new DefaultChainableStatement ( StateEvent . LOAD . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the load event of each matched element . |
36,920 | public static ChainableStatement mousedown ( JsScope jsScope ) { return new DefaultChainableStatement ( MouseEvent . MOUSEDOWN . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the mousedown event of each matched element . |
36,921 | public static ChainableStatement mouseenter ( JsScope jsScope ) { return new DefaultChainableStatement ( MouseEvent . MOUSEENTER . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the mouseenter event of each matched element . |
36,922 | public static ChainableStatement mouseleave ( JsScope jsScope ) { return new DefaultChainableStatement ( MouseEvent . MOUSELEAVE . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the mouseleave event of each matched element . |
36,923 | public static ChainableStatement mousemove ( JsScope jsScope ) { return new DefaultChainableStatement ( MouseEvent . MOUSEMOVE . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the mousemove event of each matched element . |
36,924 | public static ChainableStatement mouseout ( JsScope jsScope ) { return new DefaultChainableStatement ( MouseEvent . MOUSEOUT . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the mouseout event of each matched element . |
36,925 | public static ChainableStatement mouseover ( JsScope jsScope ) { return new DefaultChainableStatement ( MouseEvent . MOUSEOVER . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the mouseover event of each matched element . |
36,926 | public static ChainableStatement mouseup ( JsScope jsScope ) { return new DefaultChainableStatement ( MouseEvent . MOUSEUP . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the mouseup event of each matched element . |
36,927 | public static ChainableStatement scroll ( JsScope jsScope ) { return new DefaultChainableStatement ( MouseEvent . SCROLL . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the scroll event of each matched element . |
36,928 | public static ChainableStatement select ( JsScope jsScope ) { return new DefaultChainableStatement ( StateEvent . SELECT . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the select event of each matched element . |
36,929 | public static ChainableStatement submit ( JsScope jsScope ) { return new DefaultChainableStatement ( FormEvent . SUBMIT . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the submit event of each matched element . |
36,930 | public static ChainableStatement toggle ( JsScope jsScope , JsScope jsScope2 ) { return new DefaultChainableStatement ( "toggle" , jsScope . render ( ) , jsScope2 . render ( ) ) ; } | Toggle among two function calls every other click . |
36,931 | public static ChainableStatement toggle ( JsScope jsScope , JsScope jsScope2 , JsScope ... jsScopes ) { CharSequence [ ] args = null ; if ( jsScopes != null && jsScopes . length > 0 ) { args = new CharSequence [ jsScopes . length + 2 ] ; args [ 0 ] = jsScope . render ( ) ; args [ 1 ] = jsScope2 . render ( ) ; Integer index = 2 ; for ( JsScope scope : jsScopes ) { args [ index ] = scope . render ( ) ; index ++ ; } return new DefaultChainableStatement ( "toggle" , args ) ; } return toggle ( jsScope , jsScope2 ) ; } | Toggle among two or more function calls every other click . |
36,932 | public static ChainableStatement trigger ( EventLabel eventLabel , CharSequence ... data ) { return new DefaultChainableStatement ( "trigger" , JsUtils . quotes ( eventLabel . getEventLabel ( ) ) , JsUtils . array ( data ) ) ; } | Trigger an event on every matched element . |
36,933 | public static ChainableStatement unload ( JsScope jsScope ) { return new DefaultChainableStatement ( StateEvent . UNLOAD . getEventLabel ( ) , jsScope . render ( ) ) ; } | Bind a function to the unload event of each matched element . |
36,934 | public PositionAlignmentOptions setHorizontalAlignment ( PositionRelation horizontalAlignment , int offsetLeft ) { switch ( horizontalAlignment ) { case LEFT : case CENTER : case RIGHT : break ; default : throw new IllegalArgumentException ( "Illegal value for the horizontal alignment property" ) ; } this . horizontalAlignment = horizontalAlignment ; this . offsetLeft = offsetLeft ; return this ; } | Set the horizontalAlignment property with an offset . One of LEFT CENTER RIGHT . |
36,935 | public PositionAlignmentOptions setVerticalAlignment ( PositionRelation verticalAlignment , int offsetTop ) { switch ( verticalAlignment ) { case TOP : case CENTER : case BOTTOM : break ; default : throw new IllegalArgumentException ( "Illegal value for the vertical alignment property" ) ; } this . verticalAlignment = verticalAlignment ; this . offsetTop = offsetTop ; return this ; } | Set the verticalAlignment property with an offset . One of TOP CENTER BOTTOM . |
36,936 | public void mergeWithSurveyServerSettings ( Settings settings ) { if ( settings == null ) { return ; } this . adminPanelCustomMessage = settings . adminPanelCustomMessage ; this . adminPanelTimeDelay = settings . adminPanelTimeDelay ; this . localizedTexts = settings . localizedTexts ; this . userID = settings . userID ; this . accountID = settings . accountID ; this . resurveyThrottle = settings . resurveyThrottle ; this . declineResurveyThrottle = settings . declineResurveyThrottle ; this . surveyType = settings . surveyType ; } | Sets values from the argument settings only if they are not provided yet |
36,937 | public void setPaths ( String paths ) { if ( paths != null && paths . trim ( ) . length ( ) > 0 ) { String [ ] pathArray = paths . split ( "," ) ; pathList . addAll ( Arrays . asList ( pathArray ) ) ; } } | If paths are set only these paths are affected by the cleaning . |
36,938 | public void setCredentials ( String username , String password ) { if ( GitTaskUtils . isNullOrBlankString ( username ) || GitTaskUtils . isNullOrBlankString ( password ) ) { throw new IllegalArgumentException ( "Credentials must not be empty." ) ; } credentials = new UsernamePasswordCredentialsProvider ( username , password ) ; } | Sets the Git credentials |
36,939 | public void setIdentity ( String name , String email ) { if ( GitTaskUtils . isNullOrBlankString ( name ) || GitTaskUtils . isNullOrBlankString ( email ) ) { throw new IllegalArgumentException ( "Both the username and password must be provided." ) ; } identity = new PersonIdent ( name , email ) ; } | Sets the name and email for the Git commands user |
36,940 | protected String translateFilePathUsingPrefix ( String file , String prefix ) throws IOException { if ( file . equals ( prefix ) ) { return "." ; } String result = new File ( file ) . getCanonicalPath ( ) . substring ( prefix . length ( ) + 1 ) ; if ( File . separatorChar != '/' ) { result = result . replace ( File . separatorChar , '/' ) ; } return result ; } | return either a . if file and prefix have the same value or the right part of file - length of prefix plus one removed |
36,941 | public void setSettingsRef ( String settingsRef ) { if ( GitTaskUtils . isNullOrBlankString ( settingsRef ) ) { throw new BuildException ( "Can't set blank git settings reference." ) ; } if ( this . settingsRef == null ) { this . settingsRef = settingsRef ; } } | Sets a git settings reference |
36,942 | public void setUri ( String uri ) { if ( GitTaskUtils . isNullOrBlankString ( uri ) ) { throw new BuildException ( "Can't set null URI attribute." ) ; } if ( this . uri == null ) { try { new URIish ( uri ) ; this . uri = uri ; } catch ( URISyntaxException e ) { throw new BuildException ( String . format ( "Invalid URI '%s'." , uri ) , e ) ; } } } | Sets the git repository uri |
36,943 | public void setDirectory ( File dir ) { if ( dir == null ) { throw new BuildException ( "Cannot set null directory attribute." ) ; } if ( this . directory == null ) { this . directory = new File ( dir . getAbsolutePath ( ) ) ; } } | Sets the Git repository directory |
36,944 | protected GitSettings lookupSettings ( ) { if ( getProject ( ) != null && settingsRef != null ) { Reference ref = ( Reference ) getProject ( ) . getReference ( settingsRef ) ; if ( ref != null ) { GitSettings settings = ( GitSettings ) ref . getReferencedObject ( ) ; return settings ; } } return null ; } | Lookup the git settings for this task via a project reference |
36,945 | @ SuppressWarnings ( "rawtypes" ) protected void setupCredentials ( GitCommand < ? > command ) { GitSettings settings = lookupSettings ( ) ; if ( settings != null && command instanceof TransportCommand ) { TransportCommand cmd = ( TransportCommand ) command ; cmd . setCredentialsProvider ( settings . getCredentials ( ) ) ; } } | Setups the Git credentials if specified and needed |
36,946 | public void setListMode ( String listMode ) { if ( ! GitTaskUtils . isNullOrBlankString ( listMode ) ) { try { this . listMode = ListBranchCommand . ListMode . valueOf ( listMode ) ; } catch ( IllegalArgumentException e ) { ListBranchCommand . ListMode [ ] listModes = ListBranchCommand . ListMode . values ( ) ; List < String > listModeValidValues = new ArrayList < String > ( listModes . length ) ; for ( ListBranchCommand . ListMode aListMode : listModes ) { listModeValidValues . add ( aListMode . name ( ) ) ; } String validModes = listModeValidValues . toString ( ) ; throw new BuildException ( String . format ( "Valid listMode options are: %s." , validModes ) ) ; } } } | Sets the listing mode |
36,947 | public void setMode ( String mode ) { if ( "soft" . equalsIgnoreCase ( mode ) ) { this . mode = ResetType . SOFT ; } else if ( "mixed" . equalsIgnoreCase ( mode ) ) { this . mode = ResetType . MIXED ; } else if ( "hard" . equalsIgnoreCase ( mode ) ) { this . mode = ResetType . HARD ; } else if ( "merge" . equalsIgnoreCase ( mode ) ) { this . mode = ResetType . MERGE ; } else if ( "keep" . equalsIgnoreCase ( mode ) ) { this . mode = ResetType . KEEP ; } else { this . mode = ResetType . MIXED ; } } | If mode is set apply the specified mode according to Git manual . |
36,948 | public void setVerifyContainNames ( String names ) { if ( ! GitTaskUtils . isNullOrBlankString ( names ) ) { namesToCheck . addAll ( Arrays . asList ( names . split ( "," ) ) ) ; } else { throw new BuildException ( "Invalid references names." ) ; } } | Sets the comma separated list of reference names to check in the list returned by the command |
36,949 | protected void processReferencesAndOutput ( List < Ref > refList ) { List < String > refNames = new ArrayList < String > ( refList . size ( ) ) ; for ( Ref ref : refList ) { refNames . add ( GitTaskUtils . sanitizeRefName ( ref . getName ( ) ) ) ; } if ( ! namesToCheck . isEmpty ( ) ) { if ( ! refNames . containsAll ( namesToCheck ) ) { List < String > namesCopy = new ArrayList < String > ( namesToCheck ) ; namesCopy . removeAll ( refNames ) ; throw new GitBuildException ( String . format ( MISSING_REFS_TEMPLATE , namesCopy . toString ( ) ) ) ; } } if ( ! GitTaskUtils . isNullOrBlankString ( outputFilename ) ) { FileUtils fileUtils = FileUtils . getFileUtils ( ) ; Echo echo = new Echo ( ) ; echo . setProject ( getProject ( ) ) ; echo . setFile ( fileUtils . resolveFile ( getProject ( ) . getBaseDir ( ) , outputFilename ) ) ; for ( int i = 0 ; i < refNames . size ( ) ; i ++ ) { String refName = refNames . get ( i ) ; echo . addText ( String . format ( REF_NAME_TEMPLATE , refName ) ) ; } echo . perform ( ) ; } } | Processes a list of references check references names and output to a file if requested . |
36,950 | public static < T , K > MapReduceCommand < T , K > build ( String map , String reduce , OutputType outputType , String collection , Class < T > resultType , Class < K > keyType ) { return new MapReduceCommand < T , K > ( map , reduce , outputType , collection , resultType , keyType ) ; } | Build a map reduce command |
36,951 | public static DBObject serializeFields ( ObjectMapper objectMapper , DBObject object ) { BasicDBObject serialised = null ; for ( String field : object . keySet ( ) ) { Object value = object . get ( field ) ; Object serialisedValue = serializeField ( objectMapper , value ) ; if ( value != serialisedValue ) { if ( serialised == null ) { serialised = new BasicDBObject ( ) ; for ( String f : object . keySet ( ) ) { serialised . put ( f , object . get ( f ) ) ; } } serialised . put ( field , serialisedValue ) ; } } if ( serialised != null ) { return serialised ; } else { return object ; } } | Serialize the fields of the given object using the given object mapper . This will convert POJOs to DBObjects where necessary . |
36,952 | public static Object serializeField ( ObjectMapper objectMapper , Object value ) { if ( value == null || BASIC_TYPES . contains ( value . getClass ( ) ) ) { return value ; } else if ( value instanceof DBObject ) { return serializeFields ( objectMapper , ( DBObject ) value ) ; } else if ( value instanceof Collection ) { Collection < ? > coll = ( Collection < ? > ) value ; List < Object > copy = null ; int position = 0 ; for ( Object item : coll ) { Object returned = serializeField ( objectMapper , item ) ; if ( returned != item ) { if ( copy == null ) { copy = new ArrayList < Object > ( coll ) ; } copy . set ( position , returned ) ; } position ++ ; } if ( copy != null ) { return copy ; } else { return coll ; } } else if ( value . getClass ( ) . isArray ( ) ) { if ( BASIC_TYPES . contains ( value . getClass ( ) . getComponentType ( ) ) ) { return value ; } Object [ ] array = ( Object [ ] ) value ; Object [ ] copy = null ; for ( int i = 0 ; i < array . length ; i ++ ) { Object returned = serializeField ( objectMapper , array [ i ] ) ; if ( returned != array [ i ] ) { if ( copy == null ) { copy = new Object [ array . length ] ; System . arraycopy ( array , 0 , copy , 0 , array . length ) ; } copy [ i ] = returned ; } } if ( copy != null ) { return copy ; } else { return array ; } } else { BsonObjectGenerator generator = new BsonObjectGenerator ( ) ; try { objectMapper . writeValue ( generator , value ) ; } catch ( JsonMappingException e ) { throw new MongoJsonMappingException ( e ) ; } catch ( IOException e ) { throw new RuntimeException ( "Somehow got an IOException writing to memory" , e ) ; } return generator . getValue ( ) ; } } | Serialize the given field |
36,953 | public T next ( ) throws MongoException { executed ( ) ; current = jacksonDBCollection . convertFromDbObject ( cursor . next ( ) ) ; return current ; } | Returns the object the cursor is at and moves the cursor ahead by one . |
36,954 | public List < T > toArray ( int max ) throws MongoException { executed ( ) ; if ( max > all . size ( ) ) { List < DBObject > objects = cursor . toArray ( max ) ; for ( int i = all . size ( ) ; i < objects . size ( ) ; i ++ ) { all . add ( jacksonDBCollection . convertFromDbObject ( objects . get ( i ) ) ) ; } } return all ; } | Converts this cursor to an array . |
36,955 | public Object findSerializer ( Annotated am ) { if ( am . hasAnnotation ( ObjectId . class ) ) { return ObjectIdSerializer . class ; } return null ; } | Handling of ObjectId annotated properties |
36,956 | public static < T , K > JacksonDBCollection < T , K > wrap ( DBCollection dbCollection , Class < T > type , Class < K > keyType , ObjectMapper objectMapper ) { return new JacksonDBCollection < T , K > ( dbCollection , objectMapper . constructType ( type ) , objectMapper . constructType ( keyType ) , objectMapper , null ) ; } | Wraps a DB collection in a JacksonDBCollection using the given object mapper . |
36,957 | public JacksonDBCollection < T , K > enable ( Feature feature ) { features . put ( feature , true ) ; return this ; } | Enable the given feature |
36,958 | public JacksonDBCollection < T , K > disable ( Feature feature ) { features . put ( feature , false ) ; return this ; } | Disable the given feature |
36,959 | public boolean isEnabled ( Feature feature ) { Boolean enabled = features . get ( feature ) ; if ( enabled == null ) { return feature . isEnabledByDefault ( ) ; } else { return enabled ; } } | Whether the given feature is enabled |
36,960 | public void createIndex ( DBObject keys , DBObject options ) throws MongoException { dbCollection . createIndex ( keys , options ) ; } | Forces creation of an index on a set of fields if one does not already exist . |
36,961 | public void ensureIndex ( final DBObject keys , final DBObject optionsIN ) throws MongoException { dbCollection . ensureIndex ( keys , optionsIN ) ; } | Creates an index on a set of fields if one does not already exist . |
36,962 | public JacksonDBCollection < T , K > rename ( String newName , boolean dropTarget ) throws MongoException { return new JacksonDBCollection < T , K > ( dbCollection . rename ( newName , dropTarget ) , type , keyType , objectMapper , features ) ; } | renames of this collection to newName |
36,963 | public DBObject group ( DBObject key , DBObject cond , DBObject initial , String reduce , String finalize ) throws MongoException { GroupCommand cmd = new GroupCommand ( dbCollection , key , cond , initial , reduce , finalize ) ; return group ( cmd ) ; } | Applies a group operation |
36,964 | public List distinct ( String key , DBObject query ) { return dbCollection . distinct ( key , serializeFields ( query ) ) ; } | find distinct values for a key |
36,965 | public com . mongodb . MapReduceOutput mapReduce ( MapReduceCommand command ) throws MongoException { return dbCollection . mapReduce ( command ) ; } | performs a map reduce operation |
36,966 | public < S , L > MapReduceOutput < S , L > mapReduce ( MapReduce . MapReduceCommand < S , L > command ) throws MongoException { return new MapReduceOutput < S , L > ( this , dbCollection . mapReduce ( command . build ( this ) ) , command . getResultType ( ) , command . getKeyType ( ) ) ; } | Performs a map reduce operation |
36,967 | public static Builder push ( String field , Object value ) { return new Builder ( ) . push ( field , value ) ; } | Add the given value to the array value at the specified field atomically |
36,968 | public static Builder addToSet ( String field , Object value ) { return new Builder ( ) . addToSet ( field , value ) ; } | Add the given value to the array value if it doesn t already exist in the specified field atomically |
36,969 | public static Builder pull ( String field , Object value ) { return new Builder ( ) . pull ( field , value ) ; } | Remove all occurances of value from the array at field |
36,970 | public static Builder rename ( String oldFieldName , String newFieldName ) { return new Builder ( ) . rename ( oldFieldName , newFieldName ) ; } | Rename the given field to the new field name |
36,971 | public static Builder bit ( String field , String operation , int value ) { return new Builder ( ) . bit ( field , operation , value ) ; } | Perform a bit operation on the given field |
36,972 | public static Builder bit ( String field , String operation1 , int value1 , String operation2 , int value2 ) { return new Builder ( ) . bit ( field , operation1 , value1 , operation2 , value2 ) ; } | Perform two bit operations on the given field |
36,973 | public K getSavedId ( ) { if ( dbObjects . length == 0 ) { throw new MongoException ( "No objects to return" ) ; } if ( dbObjects [ 0 ] instanceof JacksonDBObject ) { throw new UnsupportedOperationException ( "Generated _id retrieval not supported when using stream serialization" ) ; } return jacksonDBCollection . convertFromDbId ( dbObjects [ 0 ] . get ( "_id" ) ) ; } | Get the saved ID . This may be useful for finding out the ID that was generated by MongoDB if no ID was supplied . |
36,974 | public List < K > getSavedIds ( ) { if ( dbObjects . length > 0 && dbObjects [ 0 ] instanceof JacksonDBObject ) { throw new UnsupportedOperationException ( "Generated _id retrieval not supported when using stream serialization" ) ; } List < K > ids = new ArrayList < K > ( ) ; for ( int i = 0 ; i < dbObjects . length ; i ++ ) { ids . add ( ( K ) jacksonDBCollection . convertFromDbId ( dbObjects [ i ] . get ( "_id" ) ) ) ; } return ids ; } | Get the saved IDs . This may be useful for finding out the IDs that were generated by MongoDB if no IDs were supplied . |
36,975 | public static Query is ( String field , Object value ) { return new Query ( ) . is ( field , value ) ; } | The field is equal to the given value |
36,976 | public static Query lessThan ( String field , Object value ) { return new Query ( ) . lessThan ( field , value ) ; } | The field is less than the given value |
36,977 | public static Query lessThanEquals ( String field , Object value ) { return new Query ( ) . lessThanEquals ( field , value ) ; } | The field is less than or equal to the given value |
36,978 | public static Query greaterThan ( String field , Object value ) { return new Query ( ) . greaterThan ( field , value ) ; } | The field is greater than the given value |
36,979 | public static Query greaterThanEquals ( String field , Object value ) { return new Query ( ) . greaterThanEquals ( field , value ) ; } | The field is greater than or equal to the given value |
36,980 | public static Query notEquals ( String field , Object value ) { return new Query ( ) . notEquals ( field , value ) ; } | The field is not equal to the given value |
36,981 | public static Query mod ( String field , Number mod , Number value ) { return new Query ( ) . mod ( field , mod , value ) ; } | The field modulo the given mod argument is equal to the value |
36,982 | public static Query regex ( String field , Pattern regex ) { return new Query ( ) . regex ( field , regex ) ; } | The given field matches the regular expression |
36,983 | public static Query elemMatch ( String field , Query query ) { return new Query ( ) . elemMatch ( field , query ) ; } | An element in the given array field matches the given query |
36,984 | private List < String > readDupAccounts ( InputStream dupAccountsStream ) throws IOException { ObjectMapper objMapper = new ObjectMapper ( ) ; return objMapper . readValue ( dupAccountsStream , new TypeReference < List < String > > ( ) { } ) ; } | Reads duplication account listing . File is expected to be a JSON formatted list of String values . |
36,985 | protected void init ( ) { log . debug ( "taskworker {} initializing..." , this ) ; scheduleVisibilityTimeoutExtender ( task , new Date ( ) , task . getVisibilityTimeout ( ) ) ; log . debug ( "taskworker {} initialized" , this ) ; initialized = true ; } | This method be called before run since it is possible that there may be significant delay between when the TaskWorker is initialized and when it is executed . |
36,986 | public ChartConfiguration < T > setSimpleTitle ( String title ) { if ( title == null ) { this . title = new Title ( title ) ; } else { this . title . setText ( title ) ; } return this ; } | Sets the simple title . |
36,987 | public ChartConfiguration < T > setLabelX ( String label ) { if ( label != null ) { axesInstance ( ) . xAxisInstance ( ) . setLabel ( label ) ; } return this ; } | Sets the label x . |
36,988 | public ChartConfiguration < T > setLabelY ( String label ) { if ( label != null ) { axesInstance ( ) . yAxisInstance ( ) . setLabel ( label ) ; } return this ; } | Sets the label y . |
36,989 | @ SuppressWarnings ( "unchecked" ) public static < T > T create ( T target ) { if ( target instanceof WestCacheCglib ) return target ; val in = new CglibCacheMethodInterceptor ( target ) ; return ( T ) Cglibs . proxy ( target . getClass ( ) , in , WestCacheCglib . class ) ; } | Create a proxied object of target object . |
36,990 | private boolean spaceExists ( final StorageProvider store , final String spaceId ) throws TaskExecutionFailedException { try { return new Retrier ( ) . execute ( new Retriable ( ) { public Boolean retry ( ) throws Exception { store . getSpaceProperties ( spaceId ) ; return true ; } } ) ; } catch ( NotFoundException nfe ) { return false ; } catch ( Exception e ) { String msg = "Error attempting to check if space exists: " + e . getMessage ( ) ; throw new DuplicationTaskExecutionFailedException ( buildFailureMessage ( msg ) , e ) ; } } | Determines if a space in the given store exists . |
36,991 | private Iterator < String > getSpaceListing ( final StorageProvider store , final String spaceId ) throws TaskExecutionFailedException { try { return new Retrier ( ) . execute ( new Retriable ( ) { public Iterator < String > retry ( ) throws Exception { return store . getSpaceContents ( spaceId , null ) ; } } ) ; } catch ( Exception e ) { String msg = "Error attempting to retrieve space listing: " + e . getMessage ( ) ; throw new DuplicationTaskExecutionFailedException ( buildFailureMessage ( msg ) , e ) ; } } | Retrieve the content listing for a space |
36,992 | private void deleteDestSpace ( final String spaceId ) throws TaskExecutionFailedException { log . info ( "Deleting space " + spaceId + " from dest provider in account " + dupTask . getAccount ( ) ) ; try { new Retrier ( ) . execute ( new Retriable ( ) { public String retry ( ) throws Exception { destStore . deleteSpace ( spaceId ) ; return "success" ; } } ) ; } catch ( Exception e ) { String msg = "Error attempting to delete the destination space: " + e . getMessage ( ) ; throw new DuplicationTaskExecutionFailedException ( buildFailureMessage ( msg ) , e ) ; } log . info ( "Successfully deleted space " + spaceId + " from dest provider in account " + dupTask . getAccount ( ) ) ; } | Deletes a space from the destination store |
36,993 | private Map < String , String > getContentProperties ( final StorageProvider store , final String spaceId , final String contentId ) throws TaskExecutionFailedException { try { return new Retrier ( ) . execute ( new Retriable ( ) { public Map < String , String > retry ( ) throws Exception { return store . getContentProperties ( spaceId , contentId ) ; } } , new ExceptionHandler ( ) { public void handle ( Exception ex ) { if ( ! ( ex instanceof NotFoundException ) ) { log . debug ( ex . getMessage ( ) , ex ) ; } else { log . debug ( "retry attempt failed but probably not an issue: {}" , ex . getMessage ( ) ) ; } } } ) ; } catch ( NotFoundException nfe ) { return null ; } catch ( Exception e ) { String msg = "Error attempting to retrieve content properties: " + e . getMessage ( ) ; throw new DuplicationTaskExecutionFailedException ( buildFailureMessage ( msg ) , e ) ; } } | Retrieves the properties for the given content item |
36,994 | protected boolean compareProperties ( Map < String , String > sourceProps , Map < String , String > destProps ) { return sourceProps . equals ( destProps ) ; } | Determines if source and destination properties are equal . |
36,995 | private void duplicateProperties ( final String spaceId , final String contentId , final Map < String , String > sourceProperties ) throws TaskExecutionFailedException { log . info ( "Duplicating properties for " + contentId + " in space " + spaceId + " in account " + dupTask . getAccount ( ) ) ; try { new Retrier ( ) . execute ( new Retriable ( ) { public String retry ( ) throws Exception { try { destStore . setContentProperties ( spaceId , contentId , sourceProperties ) ; } catch ( StorageStateException ex ) { String message = "Unable to set content properties" + " on destination store ({0}) for " + "{1} (content) in {2} (space)" ; log . warn ( MessageFormat . format ( message , destStore , contentId , spaceId ) ) ; } return "success" ; } } ) ; log . info ( "Successfully duplicated properties for " + contentId + " in space " + spaceId + " in account " + dupTask . getAccount ( ) ) ; } catch ( Exception e ) { String msg = "Error attempting to duplicate content properties: " + e . getMessage ( ) ; throw new DuplicationTaskExecutionFailedException ( buildFailureMessage ( msg ) , e ) ; } } | Copies the properties from the source item to the destination item . |
36,996 | private void cleanProperties ( Map < String , String > props ) { if ( props != null ) { props . remove ( StorageProvider . PROPERTIES_CONTENT_MD5 ) ; props . remove ( StorageProvider . PROPERTIES_CONTENT_CHECKSUM ) ; props . remove ( StorageProvider . PROPERTIES_CONTENT_MODIFIED ) ; props . remove ( StorageProvider . PROPERTIES_CONTENT_SIZE ) ; props . remove ( HttpHeaders . CONTENT_LENGTH ) ; props . remove ( HttpHeaders . CONTENT_TYPE ) ; props . remove ( HttpHeaders . LAST_MODIFIED ) ; props . remove ( HttpHeaders . DATE ) ; props . remove ( HttpHeaders . ETAG ) ; props . remove ( HttpHeaders . CONTENT_LENGTH . toLowerCase ( ) ) ; props . remove ( HttpHeaders . CONTENT_TYPE . toLowerCase ( ) ) ; props . remove ( HttpHeaders . LAST_MODIFIED . toLowerCase ( ) ) ; props . remove ( HttpHeaders . DATE . toLowerCase ( ) ) ; props . remove ( HttpHeaders . ETAG . toLowerCase ( ) ) ; } } | Pull out the system - generated properties to allow the properties that are added to the duplicated item to be only the user - defined properties . |
36,997 | private void duplicateContent ( final String spaceId , final String contentId , final String sourceChecksum , final Map < String , String > sourceProperties ) throws TaskExecutionFailedException { log . info ( "Duplicating " + contentId + " in space " + spaceId + " in account " + dupTask . getAccount ( ) ) ; ChecksumUtil checksumUtil = new ChecksumUtil ( MD5 ) ; boolean localChecksumMatch = false ; int attempt = 0 ; File localFile = null ; while ( ! localChecksumMatch && attempt < 3 ) { try ( InputStream sourceStream = getSourceContent ( spaceId , contentId ) ) { localFile = cacheContent ( sourceStream ) ; String localChecksum = checksumUtil . generateChecksum ( localFile ) ; if ( sourceChecksum . equals ( localChecksum ) ) { localChecksumMatch = true ; } else { cleanup ( localFile ) ; } } catch ( Exception e ) { log . warn ( "Error generating checksum for source content: " + e . getMessage ( ) , e ) ; } attempt ++ ; } if ( localChecksumMatch ) { putDestinationContent ( spaceId , contentId , sourceChecksum , sourceProperties , localFile ) ; log . info ( "Successfully duplicated id={} dup_size={} space={} account={}" , contentId , localFile . length ( ) , spaceId , dupTask . getAccount ( ) ) ; } else { cleanup ( localFile ) ; String msg = "Unable to retrieve content which matches the" + " expected source checksum of: " + sourceChecksum ; throw new DuplicationTaskExecutionFailedException ( buildFailureMessage ( msg ) ) ; } cleanup ( localFile ) ; } | Copies a content item from the source store to the destination store |
36,998 | private void duplicateDeletion ( final String spaceId , final String contentId ) throws TaskExecutionFailedException { if ( existsInSourceManifest ( spaceId , contentId ) ) { throw new TaskExecutionFailedException ( MessageFormat . format ( "item exists in source manifest and thus appears to be " + "missing content. account={0}, storeId={1}, spaceId={2}, contentId={3}" , this . dupTask . getAccount ( ) , this . dupTask . getSourceStoreId ( ) , spaceId , contentId ) ) ; } log . info ( "Duplicating deletion of " + contentId + " in dest space " + spaceId + " in account " + dupTask . getAccount ( ) ) ; try { new Retrier ( ) . execute ( new Retriable ( ) { public String retry ( ) throws Exception { destStore . deleteContent ( spaceId , contentId ) ; return "success" ; } } ) ; } catch ( Exception e ) { String msg = "Error attempting to delete content : " + e . getMessage ( ) ; throw new DuplicationTaskExecutionFailedException ( buildFailureMessage ( msg ) , e ) ; } log . info ( "Successfully deleted content item (content_id=" + contentId + ") in dest space (space_id=" + spaceId + ") where account_id=" + dupTask . getAccount ( ) ) ; } | Deletes a content item in the destination space but only if it does not exists in the source manifest . |
36,999 | public boolean addDuplicationStorePolicy ( String spaceId , DuplicationStorePolicy dupStore ) { LinkedHashSet < DuplicationStorePolicy > dupStores = spaceDuplicationStorePolicies . get ( spaceId ) ; if ( dupStores == null ) { dupStores = new LinkedHashSet < > ( ) ; spaceDuplicationStorePolicies . put ( spaceId , dupStores ) ; } return dupStores . add ( dupStore ) ; } | Adds a DuplicationStorePolicy for the specified space ID . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.