idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
18,400
public static PreProcessor changePrefix ( String from , String to ) { return mkPreProcessorWithMeta ( ( prefix , data , options ) -> { logger . debug ( "changing prefix at '{}' from '{}' to '{}'" , prefix , from , to ) ; return data . entrySet ( ) . stream ( ) . map ( e -> { if ( ! e . getKey ( ) . startsWith ( prefix ...
change data key prefix from one to other
18,401
public static Command delay ( final Command command , final int delay ) { return ( command == null ) ? null : new Command ( ) { public void execute ( ) { new Timer ( ) { public void run ( ) { command . execute ( ) ; } } . schedule ( delay ) ; } } ; }
Returns a command that when executed itself will execute the supplied command after the specified millisecond delay . For convenience purposes if a null command is supplied null is returned .
18,402
private String escapeSockJsSpecialChars ( char [ ] characters ) { StringBuilder result = new StringBuilder ( ) ; for ( char c : characters ) { if ( isSockJsSpecialChar ( c ) ) { result . append ( '\\' ) . append ( 'u' ) ; String hex = Integer . toHexString ( c ) . toLowerCase ( ) ; for ( int i = 0 ; i < ( 4 - hex . len...
See JSON Unicode Encoding section of SockJS protocol .
18,403
private boolean isSockJsSpecialChar ( char ch ) { return ch <= '\u001F' || ch >= '\u200C' && ch <= '\u200F' || ch >= '\u2028' && ch <= '\u202F' || ch >= '\u2060' && ch <= '\u206F' || ch >= '\uFFF0' || ch >= '\uD800' && ch <= '\uDFFF' ; }
See escapable_by_server variable in the SockJS protocol test suite .
18,404
private void scheduleActiveStatusesUpdates ( EventTarget target , EventStatus status ) { for ( Event event : activeEvents ) { for ( EventMethod method : target . methods ) { if ( event . getKey ( ) . equals ( method . eventKey ) && method . type == EventMethod . Type . STATUS ) { Utils . log ( event . getKey ( ) , meth...
Schedules status updates of all active events for given target .
18,405
private void scheduleStatusUpdates ( Event event , EventStatus status ) { for ( EventTarget target : targets ) { for ( EventMethod method : target . methods ) { if ( event . getKey ( ) . equals ( method . eventKey ) && method . type == EventMethod . Type . STATUS ) { Utils . log ( event . getKey ( ) , method , "Schedul...
Schedules status update of given event for all registered targets .
18,406
private void scheduleSubscribersInvocation ( Event event ) { for ( EventTarget target : targets ) { for ( EventMethod method : target . methods ) { if ( event . getKey ( ) . equals ( method . eventKey ) && method . type == EventMethod . Type . SUBSCRIBE ) { Utils . log ( event . getKey ( ) , method , "Scheduling event ...
Schedules handling of given event for all registered targets .
18,407
private void scheduleResultCallbacks ( Event event , EventResult result ) { for ( EventTarget target : targets ) { for ( EventMethod method : target . methods ) { if ( event . getKey ( ) . equals ( method . eventKey ) && method . type == EventMethod . Type . RESULT ) { Utils . log ( event . getKey ( ) , method , "Sched...
Schedules sending result to all registered targets .
18,408
private void scheduleFailureCallbacks ( Event event , EventFailure failure ) { for ( EventTarget target : targets ) { for ( EventMethod method : target . methods ) { if ( event . getKey ( ) . equals ( method . eventKey ) && method . type == EventMethod . Type . FAILURE ) { Utils . log ( event . getKey ( ) , method , "S...
Schedules sending failure callback to all registered targets .
18,409
private void handleRegistration ( Object targetObj ) { if ( targetObj == null ) { throw new NullPointerException ( "Target cannot be null" ) ; } for ( EventTarget target : targets ) { if ( target . targetObj == targetObj ) { Utils . logE ( targetObj , "Already registered" ) ; return ; } } EventTarget target = new Event...
Handles target object registration
18,410
private void handleUnRegistration ( Object targetObj ) { if ( targetObj == null ) { throw new NullPointerException ( "Target cannot be null" ) ; } EventTarget target = null ; for ( Iterator < EventTarget > iterator = targets . iterator ( ) ; iterator . hasNext ( ) ; ) { EventTarget listTarget = iterator . next ( ) ; if...
Handles target un - registration
18,411
private void handleEventPost ( Event event ) { Utils . log ( event . getKey ( ) , "Handling posted event" ) ; int sizeBefore = executionQueue . size ( ) ; scheduleStatusUpdates ( event , EventStatus . STARTED ) ; scheduleSubscribersInvocation ( event ) ; if ( ( ( EventBase ) event ) . handlersCount == 0 ) { Utils . log...
Handles event posting
18,412
private void handleEventResult ( Event event , EventResult result ) { if ( ! activeEvents . contains ( event ) ) { Utils . logE ( event . getKey ( ) , "Cannot send result of finished event" ) ; return ; } scheduleResultCallbacks ( event , result ) ; executeTasks ( false ) ; }
Handles event result
18,413
private void handleEventFailure ( Event event , EventFailure failure ) { if ( ! activeEvents . contains ( event ) ) { Utils . logE ( event . getKey ( ) , "Cannot send failure callback of finished event" ) ; return ; } scheduleFailureCallbacks ( event , failure ) ; executeTasks ( false ) ; }
Handles event failure
18,414
private void handleTaskFinished ( Task task ) { if ( task . method . type != EventMethod . Type . SUBSCRIBE ) { return ; } if ( task . method . isSingleThread ) { Utils . log ( task , "Single-thread method is no longer in use" ) ; task . method . isInUse = false ; } Event event = task . event ; if ( ! activeEvents . co...
Handles finished event
18,415
private void handleTasksExecution ( ) { if ( isExecuting || executionQueue . isEmpty ( ) ) { return ; } try { isExecuting = true ; handleTasksExecutionWrapped ( ) ; } finally { isExecuting = false ; } }
Handles scheduled execution tasks
18,416
public static < T > ValueLabel < T > create ( Value < T > value , String ... styles ) { return new ValueLabel < T > ( value , styles ) ; }
Creates a value label for the supplied value with the specified CSS styles .
18,417
private boolean isApply ( ChangeSet changeSet ) { return ( changeSet . getType ( ) == ChangeSetType . APPLY || changeSet . getType ( ) == ChangeSetType . PENDING_DROPS ) && ! changeSet . getChangeSetChildren ( ) . isEmpty ( ) ; }
Return true if the changeSet is APPLY and not empty .
18,418
protected void writeApplyDdl ( DdlWrite write ) { scriptInfo . setApplyDdl ( "-- drop dependencies\n" + write . applyDropDependencies ( ) . getBuffer ( ) + "\n" + "-- apply changes\n" + write . apply ( ) . getBuffer ( ) + write . applyForeignKeys ( ) . getBuffer ( ) + write . applyHistoryView ( ) . getBuffer ( ) + writ...
Write the Apply DDL buffers to the writer .
18,419
public void show ( PopupPanel popup , Widget onCenter ) { int ypos = ( onCenter == null ) ? 0 : ( onCenter . getAbsoluteTop ( ) + onCenter . getOffsetHeight ( ) / 2 ) ; PopupPanel showing = _showingPopup . get ( ) ; if ( showing != null ) { _popups . add ( showing ) ; _showingPopup . update ( null ) ; showing . hide ( ...
Pushes any currently showing popup onto the stack and displays the supplied popup . The popup will centered horizontally in the page and centered vertically around the supplied widget .
18,420
public void clear ( ) { _popups . clear ( ) ; if ( _showingPopup . get ( ) != null ) { _showingPopup . get ( ) . hide ( true ) ; _showingPopup . update ( null ) ; } }
Clears out the stack completely removing all pending popups and clearing any currently showing popup .
18,421
public static String escapeAttribute ( String value ) { for ( int ii = 0 ; ii < ATTR_ESCAPES . length ; ++ ii ) { value = value . replace ( ATTR_ESCAPES [ ii ] [ 0 ] , ATTR_ESCAPES [ ii ] [ 1 ] ) ; } return value ; }
Escapes user or deployment values that we need to put into an html attribute .
18,422
public static String sanitizeAttribute ( String value ) { for ( int ii = 0 ; ii < ATTR_ESCAPES . length ; ++ ii ) { value = value . replace ( ATTR_ESCAPES [ ii ] [ 0 ] , "" ) ; } return value ; }
Nukes special attribute characters . Ideally this would not be needed but some integrations do not accept special characters in attributes .
18,423
public static String truncate ( String str , int limit , String appendage ) { if ( str == null || str . length ( ) <= limit ) { return str ; } return str . substring ( 0 , limit - appendage . length ( ) ) + appendage ; }
Truncates the string so it has length less than or equal to the given limit . If truncation occurs the result will end with the given appendage . Returns null if the input is null .
18,424
public static String join ( Iterable < ? > items , String sep ) { Iterator < ? > i = items . iterator ( ) ; if ( ! i . hasNext ( ) ) { return "" ; } StringBuilder buf = new StringBuilder ( String . valueOf ( i . next ( ) ) ) ; while ( i . hasNext ( ) ) { buf . append ( sep ) . append ( i . next ( ) ) ; } return buf . t...
Joins the given sequence of strings which the given separator string between each consecutive pair .
18,425
public String createDefinition ( WidgetUtil . FlashObject obj ) { String transparent = obj . transparent ? "transparent" : "opaque" ; String params = "<param name=\"movie\" value=\"" + obj . movie + "\">" + "<param name=\"allowFullScreen\" value=\"true\">" + "<param name=\"wmode\" value=\"" + transparent + "\">" + "<pa...
Creates the HTML string definition of an embedded Flash object .
18,426
public HTML createApplet ( String ident , String archive , String clazz , String width , String height , boolean mayScript , String ptags ) { String html = "<object classid=\"java:" + clazz + ".class\" " + "type=\"application/x-java-applet\" archive=\"" + archive + "\" " + "width=\"" + width + "\" height=\"" + height +...
Creates the HTML needed to display a Java applet .
18,427
public void run ( ) { synchronized ( lock ) { if ( ! callables . hasNext ( ) ) { checkEnd ( ) ; return ; } for ( int i = 0 ; i < parallelism && callables . hasNext ( ) ; i ++ ) { setupNext ( callables . next ( ) ) ; } } future . whenCancelled ( ( ) -> { cancel = true ; checkNext ( ) ; } ) ; }
coordinate thread .
18,428
public static HandlerRegistration bind ( HasKeyDownHandlers target , ClickHandler onEnter ) { return target . addKeyDownHandler ( new EnterClickAdapter ( onEnter ) ) ; }
Binds a listener to the supplied target text box that triggers the supplied click handler when enter is pressed on the text box .
18,429
public void onKeyDown ( KeyDownEvent event ) { if ( event . getNativeKeyCode ( ) == KeyCodes . KEY_ENTER ) { _onEnter . onClick ( null ) ; } }
from interface KeyDownHandler
18,430
boolean isMatch ( Class < ? > beanType , Object id ) { return beanType . equals ( this . beanType ) && idMatch ( id ) ; }
Return true if matched by beanType and id value .
18,431
public static void set ( String path , int expires , String name , String value , String domain ) { String extra = "" ; if ( path . length ( ) > 0 ) { extra += "; path=" + path ; } if ( domain != null ) { extra += "; domain=" + domain ; } doSet ( name , value , expires , extra ) ; }
Sets the specified cookie to the supplied value .
18,432
public void show ( Popups . Position pos , Widget target ) { Popups . show ( this , pos , target ) ; }
Displays this info popup directly below the specified widget .
18,433
public String get ( String key , Object ... args ) { return fetch ( key . replace ( '.' , '_' ) , args ) ; }
Translate a key with any number of arguments backed by the Lookup .
18,434
public static void configure ( TextBoxBase target , String defaultText ) { DefaultTextListener listener = new DefaultTextListener ( target , defaultText ) ; target . addFocusHandler ( listener ) ; target . addBlurHandler ( listener ) ; }
Configures the target text box to display the supplied default text when it does not have focus and to clear it out when the user selects it to enter text .
18,435
public static String getText ( TextBoxBase target , String defaultText ) { String text = target . getText ( ) . trim ( ) ; return text . equals ( defaultText . trim ( ) ) ? "" : text ; }
Returns the contents of the supplied text box accounting for the supplied default text .
18,436
public void onBlur ( BlurEvent event ) { if ( _target . getText ( ) . trim ( ) . equals ( "" ) ) { _target . setText ( _defaultText ) ; } }
from interface BlurHandler
18,437
static Object workObject ( Map < String , Object > workList , String name , boolean isArray ) { logger . trace ( "get working object for {}" , name ) ; if ( workList . get ( name ) != null ) return workList . get ( name ) ; else { String [ ] parts = splitName ( name ) ; Map < String , Object > parentObj = ( Map < Strin...
find work object specified by name create and attach it if not exists
18,438
public static < T > Constraint checking ( Function < String , T > check , String messageOrKey , boolean isKey , String ... extraMessageArgs ) { return mkSimpleConstraint ( ( ( label , vString , messages ) -> { logger . debug ( "checking for {}" , vString ) ; if ( isEmptyStr ( vString ) ) return null ; else { try { chec...
make a Constraint which will try to check and collect errors
18,439
public static Constraint anyPassed ( Constraint ... constraints ) { return ( ( name , data , messages , options ) -> { logger . debug ( "checking any passed for {}" , name ) ; List < Map . Entry < String , String > > errErrors = new ArrayList < > ( ) ; for ( Constraint constraint : constraints ) { List < Map . Entry < ...
make a compound Constraint which checks whether any inputting constraints passed
18,440
public static List < Integer > indexes ( String name , Map < String , String > data ) { logger . debug ( "get indexes for {}" , name ) ; Pattern keyPattern = Pattern . compile ( "^" + Pattern . quote ( name ) + "\\[(\\d+)\\].*$" ) ; return data . keySet ( ) . stream ( ) . map ( key -> { Matcher m = keyPattern . matcher...
Computes the available indexes for the given key in this set of data .
18,441
public static List < String > keys ( String prefix , Map < String , String > data ) { logger . debug ( "get keys for {}" , prefix ) ; Pattern keyPattern = Pattern . compile ( "^" + Pattern . quote ( prefix ) + "\\.(\"[^\"]+\"|[^\\.]+).*$" ) ; return data . keySet ( ) . stream ( ) . map ( key -> { Matcher m = keyPattern...
Computes the available keys for the given prefix in this set of data .
18,442
public static Map < String , String > json2map ( String prefix , JsonNode json ) { logger . trace ( "json to map - prefix: {}" , prefix ) ; if ( json . isArray ( ) ) { Map < String , String > result = new HashMap < > ( ) ; for ( int i = 0 ; i < json . size ( ) ; i ++ ) { result . putAll ( json2map ( prefix + "[" + i + ...
Construct data map from inputting jackson json object
18,443
private String getVersion ( MigrationModel migrationModel ) { String version = migrationConfig . getVersion ( ) ; if ( version == null ) { version = migrationModel . getNextVersion ( initialVersion ) ; } return version ; }
Return the full version for the migration being generated .
18,444
public < T > Predicate < T > in ( final Collection < ? extends T > target ) { return new Predicate < T > ( ) { public boolean apply ( T arg ) { try { return target . contains ( arg ) ; } catch ( NullPointerException e ) { return false ; } catch ( ClassCastException e ) { return false ; } } } ; }
Returns a predicate that evaluates to true if the object reference being tested is a member of the given collection .
18,445
public CommandResponse doVagrant ( String vagrantVm , final String ... vagrantCommand ) { CommandResponse response = commandProcessor . run ( aCommand ( "vagrant" ) . withArguments ( vagrantCommand ) . withOptions ( vagrantVm ) ) ; if ( ! response . isSuccessful ( ) ) { throw new RuntimeException ( "Errors during vagra...
Executes vagrant command which means that arguments passed here will be prepended with vagrant
18,446
private LzoIndex readIndex ( Path file , FileSystem fs ) throws IOException { FSDataInputStream indexIn = null ; try { Path indexFile = new Path ( file . toString ( ) + LZO_INDEX_SUFFIX ) ; if ( ! fs . exists ( indexFile ) ) { return new LzoIndex ( ) ; } long indexLen = fs . getFileStatus ( indexFile ) . getLen ( ) ; i...
Read the index of the lzo file .
18,447
public static void createIndex ( FileSystem fs , Path lzoFile ) throws IOException { Configuration conf = fs . getConf ( ) ; CompressionCodecFactory factory = new CompressionCodecFactory ( fs . getConf ( ) ) ; CompressionCodec codec = factory . getCodec ( lzoFile ) ; ( ( Configurable ) codec ) . setConf ( conf ) ; Inpu...
Index an lzo file to allow the input format to split them into separate map jobs .
18,448
public static List < Domain > getDefinedDomains ( Connect libvirt ) { try { List < Domain > domains = new ArrayList < > ( ) ; String [ ] domainNames = libvirt . listDefinedDomains ( ) ; for ( String name : domainNames ) { domains . add ( libvirt . domainLookupByName ( name ) ) ; } return domains ; } catch ( LibvirtExce...
Get list of the inactive domains .
18,449
public static List < Domain > getRunningDomains ( Connect libvirt ) { try { List < Domain > domains = new ArrayList < > ( ) ; int [ ] ids = libvirt . listDomains ( ) ; for ( int id : ids ) { domains . add ( libvirt . domainLookupByID ( id ) ) ; } return domains ; } catch ( LibvirtException e ) { throw new LibvirtRuntim...
Get list of the active domains .
18,450
public static Connect getConnection ( String libvirtURL , boolean readOnly ) { connectLock . lock ( ) ; try { return new Connect ( libvirtURL , readOnly ) ; } catch ( LibvirtException e ) { throw new LibvirtRuntimeException ( "Unable to connect to " + libvirtURL , e ) ; } finally { connectLock . unlock ( ) ; } }
Create a connection to libvirt in a thread safe manner .
18,451
public void addInstance ( Object instance ) throws Exception { if ( isDestroyed ( ) ) { throw new IllegalStateException ( "System already stopped" ) ; } else { startInstance ( instance ) ; if ( methodsMap . get ( instance . getClass ( ) ) . hasFor ( PreDestroy . class ) ) { managedInstances . add ( instance ) ; } } }
Add an additional managed instance
18,452
public static < T > T bind ( T service , String entryPoint ) { ( ( ServiceDefTarget ) service ) . setServiceEntryPoint ( entryPoint ) ; return service ; }
Binds the supplied service to the specified entry point .
18,453
@ SuppressWarnings ( "deprecation" ) public static Date toUtc ( Date date ) { if ( date == null ) { return null ; } return new Date ( Date . UTC ( date . getYear ( ) , date . getMonth ( ) , date . getDate ( ) , date . getHours ( ) , date . getMinutes ( ) , date . getSeconds ( ) ) ) ; }
Returns the equivalent of this date when it was in Greenwich . For example a date at 4pm pacific would result in a new date at 4pm gmt or 8am pacific . This has the effect of normalizing the date . It may be used to allow clients to send data requests to the server in absolute time which can then be treated appropriate...
18,454
public void add ( final Metric metric ) { Preconditions . checkNotNull ( metric ) ; MetricAggregate aggregate = getAggregate ( metric . getIdentity ( ) ) ; switch ( metric . getIdentity ( ) . getType ( ) ) { case COUNTER : case TIMER : case AVERAGE : aggregate . setCount ( aggregate . getCount ( ) + 1 ) ; aggregate . s...
Aggregates a single metric into the collection of aggregates
18,455
private boolean aggregateExistsForCurrentMinute ( final MetricIdentity identity ) { Preconditions . checkNotNull ( identity ) ; if ( aggregates . containsKey ( identity ) ) { if ( aggregates . get ( identity ) . containsKey ( currentMinute ) ) { return true ; } } return false ; }
Determines if the specified aggregate metric exists for the current minute
18,456
private MetricAggregate getAggregate ( final MetricIdentity identity ) { if ( ! aggregates . containsKey ( identity ) ) { aggregates . put ( identity , new HashMap < Long , MetricAggregate > ( ) ) ; } Map < Long , MetricAggregate > metricAggregates = aggregates . get ( identity ) ; if ( ! metricAggregates . containsKey...
Retrieves the specified metric for the current minute
18,457
public static < L > ListenerList < L > addListener ( ListenerList < L > list , L listener ) { if ( list == null ) { list = new ListenerList < L > ( ) ; } list . add ( listener ) ; return list ; }
Adds the supplied listener to the supplied list . If the list is null a new listener list will be created . The supplied or newly created list as appropriate will be returned .
18,458
public static < L , K > void addListener ( Map < K , ListenerList < L > > map , K key , L listener ) { ListenerList < L > list = map . get ( key ) ; if ( list == null ) { map . put ( key , list = new ListenerList < L > ( ) ) ; } list . add ( listener ) ; }
Adds a listener to the listener list in the supplied map . If no list exists one will be created and mapped to the supplied key .
18,459
public static < L , K > void removeListener ( Map < K , ListenerList < L > > map , K key , L listener ) { ListenerList < L > list = map . get ( key ) ; if ( list != null ) { list . remove ( listener ) ; } }
Removes a listener from the supplied list in the supplied map .
18,460
public Migration read ( ) { try ( StringReader reader = new StringReader ( info . getModelDiff ( ) ) ) { JAXBContext jaxbContext = JAXBContext . newInstance ( Migration . class ) ; Unmarshaller unmarshaller = jaxbContext . createUnmarshaller ( ) ; return ( Migration ) unmarshaller . unmarshal ( reader ) ; } catch ( JAX...
Read and return the migration from the resource .
18,461
void add ( final byte type , final Object value ) { final int w = write . getAndIncrement ( ) ; if ( w < size ) { writeAt ( w , type , value ) ; } final int c = countdown . decrementAndGet ( ) ; if ( c < 0 ) { throw new IllegalStateException ( "already finished (countdown)" ) ; } if ( c != 0 ) { return ; } if ( ! done ...
Checks in a doCall back . It also wraps up the group if all the callbacks have checked in .
18,462
public static synchronized void configure ( final ApiConfiguration config ) { ApiConfiguration . Builder builder = ApiConfiguration . newBuilder ( ) ; builder . apiUrl ( config . getApiUrl ( ) ) ; builder . apiKey ( config . getApiKey ( ) ) ; builder . application ( config . getApplication ( ) ) ; builder . environment...
Manually configure the metrics api
18,463
private static synchronized void startup ( ) { try { if ( CONFIG == null ) { CONFIG = ApiConfigurations . fromProperties ( ) ; } ObjectMapper objectMapper = new ObjectMapper ( ) ; AppIdentityService appIdentityService = new AppIdentityService ( CONFIG , objectMapper , true ) ; MetricMonitorService monitorService = new ...
Start up the background thread that is processing metrics
18,464
public static synchronized void shutdown ( ) { if ( BACKGROUND_SERVICE != null ) { try { BACKGROUND_SERVICE . stop ( ) ; } catch ( Throwable t ) { LOGGER . error ( "Exception stopping Stackify Metrics API service" , t ) ; } INITIALIZED . compareAndSet ( true , false ) ; } }
Shut down the background thread that is processing metrics
18,465
public < T > WithStaticFinder < T > withFinder ( Class < T > beanType ) { WithStaticFinder < T > withFinder = new WithStaticFinder < > ( beanType ) ; staticFinderReplacement . add ( withFinder ) ; return withFinder ; }
Create and return a WithStaticFinder . Expects a static finder field on the beanType class .
18,466
RunnablePair takeAndClear ( ) { RunnablePair entries ; while ( ( entries = callbacks . get ( ) ) != END ) { if ( callbacks . compareAndSet ( entries , END ) ) { return entries ; } } return null ; }
Take and reset all callbacks in an atomic fashion .
18,467
boolean add ( Runnable runnable ) { int spins = 0 ; RunnablePair entries ; while ( ( entries = callbacks . get ( ) ) != END ) { if ( callbacks . compareAndSet ( entries , new RunnablePair ( runnable , entries ) ) ) { return true ; } if ( spins ++ > MAX_SPINS ) { Thread . yield ( ) ; spins = 0 ; } } return false ; }
Attempt to add an event listener to the list of listeners .
18,468
@ SuppressWarnings ( "unchecked" ) T result ( final Object r ) { return ( T ) ( r == NULL ? null : r ) ; }
Convert the result object to a result .
18,469
public static HTML createTransparentFlashContainer ( String ident , String movie , int width , int height , String flashVars ) { FlashObject obj = new FlashObject ( ident , movie , width , height , flashVars ) ; obj . transparent = true ; return createContainer ( obj ) ; }
Creates the HTML to display a transparent Flash movie for the browser on which we re running .
18,470
public static HTML createFlashContainer ( String ident , String movie , int width , int height , String flashVars ) { return createContainer ( new FlashObject ( ident , movie , width , height , flashVars ) ) ; }
Creates the HTML to display a Flash movie for the browser on which we re running .
18,471
public static String ensurePixels ( String value ) { int index = 0 ; for ( int nn = value . length ( ) ; index < nn ; index ++ ) { char c = value . charAt ( index ) ; if ( c < '0' || c > '9' ) { break ; } } return value . substring ( 0 , index ) ; }
Chops off any non - numeric suffix .
18,472
public static synchronized boolean isNativeLzoLoaded ( Configuration conf ) { if ( ! nativeLzoChecked ) { if ( GPLNativeCodeLoader . isNativeCodeLoaded ( ) ) { nativeLzoLoaded = LzoCompressor . isNativeLzoLoaded ( ) && LzoDecompressor . isNativeLzoLoaded ( ) ; if ( nativeLzoLoaded ) { LOG . info ( "Successfully loaded ...
Check if native - lzo library is loaded & initialized .
18,473
@ RequestMapping ( path = "" , method = RequestMethod . GET ) public List < Product > getProducts ( ) { return productService . getProducts ( ) ; }
Request a page of products
18,474
@ RequestMapping ( path = "/{productId}" , method = RequestMethod . GET ) public ResponseEntity < Product > getCustomer ( @ PathVariable ( "productId" ) Long productId ) { Product product = productService . getProduct ( productId ) ; if ( product != null ) { return new ResponseEntity < Product > ( product , HttpStatus ...
Get a specific product by id
18,475
public Number getNumber ( ) { String valstr = getText ( ) . length ( ) == 0 ? "0" : getText ( ) ; return _allowFloatingPoint ? ( Number ) ( new Double ( valstr ) ) : ( Number ) ( new Long ( valstr ) ) ; }
Get the numberic value of this box . Returns 0 if the box is empty .
18,476
public void send ( final List < MetricAggregate > aggregates ) throws IOException , HttpException { HttpClient httpClient = new HttpClient ( apiConfig ) ; resendQueue . drain ( httpClient , "/Metrics/SubmitMetricsByID" ) ; List < JsonMetric > metrics = new ArrayList < JsonMetric > ( aggregates . size ( ) ) ; for ( Metr...
Sends aggregate metrics to Stackify
18,477
public static Value < Boolean > not ( Value < Boolean > value ) { return value . map ( Functions . NOT ) ; }
Returns a value which is the logical NOT of the supplied value .
18,478
protected static boolean computeAnd ( Iterable < Value < Boolean > > values ) { for ( Value < Boolean > value : values ) { if ( ! value . get ( ) ) { return false ; } } return true ; }
my kingdom for a higher order
18,479
public static ClickHandler chain ( final ClickHandler ... handlers ) { return new ClickHandler ( ) { public void onClick ( ClickEvent event ) { for ( ClickHandler handler : handlers ) { try { handler . onClick ( event ) ; } catch ( Exception e ) { Console . log ( "Chained click handler failed" , "handler" , handler , e...
Creates a click handler that dispatches a single click event to a series of handlers in sequence . If any handler fails the error will be caught logged and the other handlers will still have a chance to process the event .
18,480
@ RequestMapping ( path = "" , method = RequestMethod . GET ) public Page < Customer > getCustomers ( Pageable pageable ) { return customerService . getCustomers ( pageable ) ; }
Request a page of customers
18,481
@ RequestMapping ( path = "/{customerId}" , method = RequestMethod . GET ) public ResponseEntity < Customer > getCustomer ( @ PathVariable ( "customerId" ) Long customerId , @ RequestParam ( required = true ) String name ) { Customer customer = customerService . getCustomer ( customerId ) ; if ( customer != null ) { re...
Get a specific customer by id
18,482
@ RequestMapping ( path = "/{customerId}" , method = RequestMethod . DELETE ) public ResponseEntity removeCustomer ( @ PathVariable ( "customerId" ) Long customerId ) { boolean succeed = customerService . removeCustomer ( customerId ) ; if ( succeed ) { return new ResponseEntity ( HttpStatus . OK ) ; } else { return ne...
Delete customer by id
18,483
private static void checkNoAnnotations ( Method method , Class < ? extends Annotation > foundAn , Class < ? extends Annotation > ... disallowedAn ) { for ( Class < ? extends Annotation > an : disallowedAn ) { if ( method . isAnnotationPresent ( an ) ) { throw new EventsException ( "Method " + Utils . methodToString ( m...
Checks that no given annotations are present on given method
18,484
private static CacheProvider getCacheProvider ( Method javaMethod ) { if ( ! javaMethod . isAnnotationPresent ( Cache . class ) ) { return null ; } Cache an = javaMethod . getAnnotation ( Cache . class ) ; Class < ? extends CacheProvider > cacheClazz = an . value ( ) ; try { Constructor < ? extends CacheProvider > cons...
Retrieves cache provider instance for method
18,485
protected void submit ( final double value , final boolean isIncrement ) { MetricCollector collector = MetricManager . getCollector ( ) ; if ( collector != null ) { Metric . Builder builder = Metric . newBuilder ( ) ; builder . identity ( identity ) ; builder . value ( value ) ; builder . isIncrement ( isIncrement ) ; ...
Submits a metric to the collector
18,486
protected void autoReportZero ( ) { MetricCollector collector = MetricManager . getCollector ( ) ; if ( collector != null ) { collector . autoReportZero ( identity ) ; } }
Auto reports zero if the metric hasn t been modified
18,487
protected void autoReportLast ( ) { MetricCollector collector = MetricManager . getCollector ( ) ; if ( collector != null ) { collector . autoReportLast ( identity ) ; } }
Auto reports the last value if the metric hasn t been modified
18,488
public static MozuUrl updateLocalizedContentsUrl ( String attributeFQN ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent" ) ; formatter . formatUrl ( "attributeFQN" , attributeFQN ) ; return new MozuUrl ( formatter . getResourceUr...
Get Resource Url for UpdateLocalizedContents
18,489
public static MozuUrl updateLocalizedContentUrl ( String attributeFQN , String localeCode , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}?responseFields={responseFields}" ) ; formatter . form...
Get Resource Url for UpdateLocalizedContent
18,490
public static MozuUrl deleteLocalizedContentUrl ( String attributeFQN , String localeCode ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/LocalizedContent/{localeCode}" ) ; formatter . formatUrl ( "attributeFQN" , attributeFQN ) ; formatter . fo...
Get Resource Url for DeleteLocalizedContent
18,491
public static MozuUrl applyCouponUrl ( String checkoutId , String couponCode , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/coupons/{couponCode}?responseFields={responseFields}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl...
Get Resource Url for ApplyCoupon
18,492
public static MozuUrl removeCouponUrl ( String checkoutId , String couponCode ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/coupons/{couponcode}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "couponCode" , couponCode ) ; return new MozuUrl ( f...
Get Resource Url for RemoveCoupon
18,493
public static MozuUrl getRandomAccessCursorUrl ( String filter , Integer pageSize , String query , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/storefront/productsearch/randomAccessCursor/?query={query}&filter={filter}&pageSize={pageSize}&responseFields={responseFields}" ...
Get Resource Url for GetRandomAccessCursor
18,494
public static MozuUrl getAccountNotesUrl ( Integer accountId , String filter , Integer pageSize , String responseFields , String sortBy , Integer startIndex ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/accounts/{accountId}/notes?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&filt...
Get Resource Url for GetAccountNotes
18,495
public static MozuUrl addAccountNoteUrl ( Integer accountId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/accounts/{accountId}/notes?responseFields={responseFields}" ) ; formatter . formatUrl ( "accountId" , accountId ) ; formatter . formatUrl ( "responseFields" , respo...
Get Resource Url for AddAccountNote
18,496
public static MozuUrl updateAccountNoteUrl ( Integer accountId , Integer noteId , String responseFields ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/accounts/{accountId}/notes/{noteId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "accountId" , accountId ) ; formatter . formatU...
Get Resource Url for UpdateAccountNote
18,497
public static MozuUrl deleteAccountNoteUrl ( Integer accountId , Integer noteId ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/customer/accounts/{accountId}/notes/{noteId}" ) ; formatter . formatUrl ( "accountId" , accountId ) ; formatter . formatUrl ( "noteId" , noteId ) ; return new MozuUrl ( formatte...
Get Resource Url for DeleteAccountNote
18,498
public static MozuUrl getFacetsUrl ( String documentListName , String propertyName ) { UrlFormatter formatter = new UrlFormatter ( "/api/content/documentlists/{documentListName}/facets/{propertyName}" ) ; formatter . formatUrl ( "documentListName" , documentListName ) ; formatter . formatUrl ( "propertyName" , property...
Get Resource Url for GetFacets
18,499
public static MozuUrl getAttributeVocabularyValueLocalizedContentsUrl ( String attributeFQN , String value ) { UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/attributedefinition/attributes/{attributeFQN}/VocabularyValues/{value}/LocalizedContent" ) ; formatter . formatUrl ( "attributeFQN" , at...
Get Resource Url for GetAttributeVocabularyValueLocalizedContents