idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
139,100 | private void setupIndexMonitor ( final DataSchema dataSchema , final GenericDataSource dataSource ) { logger . log ( FINE , "LuceneSearchServiceImpl::setupIndexMonitor Attempting to setup Index monitor..." ) ; try { if ( GoogleAppEngineUtil . isGaeEnv ( ) ) { return ; // only use for pure lucene tomcat implementation, doesn't work on GAE. } if ( dataSource . getDataSourceType ( ) != GenericDataSource . DataSourceType . ServletRelativeDataSource || dataSource . getLocation ( ) == null ) { // only able to monitor servlet relative datasources return ; } else { // assertFilePathExists(dataSource.getLocation(), "jsonPath invalid:"); // File json = new File(dataSource.getLocation()); // try { // fileChangeMonitor = FileChangeMonitor.getInstance(); // fileChangeMonitor.init(json.toPath()); // if(Log.isDebugEnabled()) Log.debug("LuceneSearchServiceImpl::setupIndexMonitor","Index monitor setup completed."); // } catch (IOException e) { // throw new SearchException("Unable to initialize file change monitor",e); // } } fileChangeMonitor = FileChangeMonitor . getInstance ( ) ; fileChangeMonitor . addObserver ( new Observer ( ) { @ Override public void update ( Observable o , Object arg ) { JSONWithMetaData jsonContent ; try { logger . log ( FINE , "LuceneSearchServiceImpl::setupIndexMonitor" , "Index monitor change noted." ) ; jsonContent = getJsonArrayFrom ( dataSource ) ; } catch ( SearchException e ) { throw new IllegalStateException ( e ) ; } setupIndex ( dataSource , dataSchema , jsonContent ) ; } } ) ; } catch ( Exception e ) { logger . log ( SEVERE , "LuceneSearchServiceImpl::setupIndexMonitor Failed to setup monitor for indexed file changes" , e ) ; } } | setup a monitor to watch for changes in datasource | 423 | 10 |
139,101 | public static List < ReqUrl > getUrlListFromValidationDatas ( List < ValidationData > datas ) { Map < String , ReqUrl > urlMap = new HashMap <> ( ) ; datas . stream ( ) . forEach ( data -> { ReqUrl url = new ReqUrl ( data ) ; urlMap . put ( url . getUniqueKey ( ) , url ) ; } ) ; return urlMap . entrySet ( ) . stream ( ) . map ( entry -> entry . getValue ( ) ) . collect ( Collectors . toList ( ) ) ; } | Gets url list from validation datas . | 126 | 8 |
139,102 | private void appendLiteral ( int word ) { // when we have a zero sequence of the maximum lenght (that is, // 00.00000.1111111111111111111111111 = 0x01FFFFFF), it could happen // that we try to append a zero literal because the result of the given operation must be an // empty set. Whitout the following test, we would have increased the // counter of the zero sequence, thus obtaining 0x02000000 that // represents a sequence with the first bit set! if ( lastWordIndex == 0 && word == ConciseSetUtils . ALL_ZEROS_LITERAL && words [ 0 ] == 0x01FFFFFF ) { return ; } // first addition if ( lastWordIndex < 0 ) { words [ lastWordIndex = 0 ] = word ; return ; } final int lastWord = words [ lastWordIndex ] ; if ( word == ConciseSetUtils . ALL_ZEROS_LITERAL ) { if ( lastWord == ConciseSetUtils . ALL_ZEROS_LITERAL ) { words [ lastWordIndex ] = 1 ; } else if ( isZeroSequence ( lastWord ) ) { words [ lastWordIndex ] ++ ; } else if ( ! simulateWAH && containsOnlyOneBit ( getLiteralBits ( lastWord ) ) ) { words [ lastWordIndex ] = 1 | ( ( 1 + Integer . numberOfTrailingZeros ( lastWord ) ) << 25 ) ; } else { words [ ++ lastWordIndex ] = word ; } } else if ( word == ConciseSetUtils . ALL_ONES_LITERAL ) { if ( lastWord == ConciseSetUtils . ALL_ONES_LITERAL ) { words [ lastWordIndex ] = ConciseSetUtils . SEQUENCE_BIT | 1 ; } else if ( isOneSequence ( lastWord ) ) { words [ lastWordIndex ] ++ ; } else if ( ! simulateWAH && containsOnlyOneBit ( ~ lastWord ) ) { words [ lastWordIndex ] = ConciseSetUtils . SEQUENCE_BIT | 1 | ( ( 1 + Integer . numberOfTrailingZeros ( ~ lastWord ) ) << 25 ) ; } else { words [ ++ lastWordIndex ] = word ; } } else { words [ ++ lastWordIndex ] = word ; } } | Append a literal word after the last word | 508 | 9 |
139,103 | public static void addIndexData ( ValidationData data , ValidationDataIndex index ) { String key = index . getKey ( data ) ; List < ValidationData > datas = index . get ( key ) ; if ( datas == null ) { datas = new ArrayList <> ( ) ; } datas . add ( data ) ; index . getMap ( ) . put ( key , datas ) ; } | Add index data . | 85 | 4 |
139,104 | public static void removeIndexData ( ValidationData data , ValidationDataIndex index ) { String key = index . getKey ( data ) ; List < ValidationData > datas = index . get ( key ) ; if ( ! datas . isEmpty ( ) ) { datas = datas . stream ( ) . filter ( d -> ! d . getId ( ) . equals ( data . getId ( ) ) ) . collect ( Collectors . toList ( ) ) ; } if ( datas . isEmpty ( ) ) { index . getMap ( ) . remove ( key ) ; } else { index . getMap ( ) . put ( key , datas ) ; } } | Remove index data . | 140 | 4 |
139,105 | public static String makeKey ( String ... keys ) { StringBuffer keyBuffer = new StringBuffer ( ) ; for ( String s : keys ) { keyBuffer . append ( s ) ; keyBuffer . append ( ":" ) ; } return keyBuffer . toString ( ) ; } | Make key string . | 58 | 4 |
139,106 | public static Method findMethod ( Class < ? > c , String methodName ) { for ( Method m : c . getMethods ( ) ) { if ( ! m . getName ( ) . equalsIgnoreCase ( methodName ) ) { continue ; } if ( m . getParameterCount ( ) != 1 ) { continue ; } return m ; } return null ; } | Find method method . | 77 | 4 |
139,107 | @ SuppressWarnings ( "PMD.LooseCoupling" ) public static Object castValue ( Method m , Class < ? > castType , String value ) { try { if ( castType . isEnum ( ) ) { Method valueOf ; try { valueOf = castType . getMethod ( "valueOf" , String . class ) ; return valueOf . invoke ( null , value ) ; } catch ( Exception e ) { log . info ( "enum value of excute error : (" + castType . getName ( ) + ") | " + value ) ; return null ; } } else if ( castType == Integer . class || castType == int . class ) { return Integer . parseInt ( value ) ; } else if ( castType == Long . class || castType == long . class ) { return Long . parseLong ( value ) ; } else if ( castType == Double . class || castType == double . class ) { return Double . parseDouble ( value ) ; } else if ( castType == Boolean . class || castType == boolean . class ) { return Boolean . parseBoolean ( value ) ; } else if ( castType == Float . class || castType == float . class ) { return Float . parseFloat ( value ) ; } else if ( castType == String . class ) { return value ; } else if ( castType == ArrayList . class || castType == List . class ) { ParameterizedType paramType = ( ParameterizedType ) m . getGenericParameterTypes ( ) [ 0 ] ; Class < ? > paramClass = ( Class < ? > ) paramType . getActualTypeArguments ( ) [ 0 ] ; List < Object > castList = new ArrayList <> ( ) ; String [ ] values = value . split ( "," ) ; for ( String v : values ) { castList . add ( castValue ( m , paramClass , v ) ) ; } return castList ; } else { log . info ( "invalid castType : " + castType ) ; return null ; } } catch ( NumberFormatException e ) { log . info ( "value : " + value + " is invalid value, setter parameter type is : " + castType ) ; return null ; } } | Cast value object . | 481 | 4 |
139,108 | public static Object mapToObject ( Map < String , String > map , Class < ? > c ) { Method m = null ; Object obj = null ; try { obj = c . newInstance ( ) ; } catch ( InstantiationException | IllegalAccessException e ) { log . info ( "instance create fail : " + c . getName ( ) ) ; return null ; } for ( Map . Entry < String , String > entry : map . entrySet ( ) ) { if ( entry . getValue ( ) == null || entry . getValue ( ) . trim ( ) . isEmpty ( ) ) { continue ; } if ( entry . getValue ( ) . equalsIgnoreCase ( "undefined" ) ) { continue ; } try { m = findMethod ( c , getSetMethodName ( entry . getKey ( ) ) ) ; if ( m == null ) { log . info ( "not found mapping method : " + entry . getKey ( ) ) ; continue ; } try { m . invoke ( obj , castValue ( m , m . getParameterTypes ( ) [ 0 ] , entry . getValue ( ) ) ) ; } catch ( IllegalAccessException | IllegalArgumentException | InvocationTargetException e ) { log . info ( "method invoke error : " + m . getName ( ) ) ; } } catch ( SecurityException e ) { log . info ( "security exception : " + e . getMessage ( ) ) ; } } return obj ; } | Map to object object . | 311 | 5 |
139,109 | public List < ValidationData > findByIds ( List < Long > ids ) { return this . datas . stream ( ) . filter ( d -> ids . contains ( d . getId ( ) ) ) . collect ( Collectors . toList ( ) ) ; } | Find by ids list . | 58 | 6 |
139,110 | public List < ValidationData > findAll ( boolean referenceCache ) { if ( referenceCache && this . datas != null ) { return this . datas ; } List < ValidationData > list = null ; File repositroyFile = new File ( this . validationConfig . getRepositoryPath ( ) ) ; try { String jsonStr = ValidationFileUtil . readFileToString ( repositroyFile , Charset . forName ( "UTF-8" ) ) ; list = objectMapper . readValue ( jsonStr , objectMapper . getTypeFactory ( ) . constructCollectionType ( List . class , ValidationData . class ) ) ; } catch ( IOException e ) { log . error ( "repository json file read error : " + repositroyFile . getAbsolutePath ( ) ) ; list = new ArrayList <> ( ) ; } this . parentObjInit ( list ) ; if ( referenceCache ) { this . datas = list ; } return list ; } | Find all list . | 213 | 4 |
139,111 | public List < ValidationData > findByParamTypeAndMethodAndUrl ( ParamType paramType , String method , String url ) { return this . findByMethodAndUrl ( method , url ) . stream ( ) . filter ( d -> d . getParamType ( ) . equals ( paramType ) ) . collect ( Collectors . toList ( ) ) ; } | Find by param type and method and url list . | 77 | 10 |
139,112 | public List < ValidationData > findByParamTypeAndMethodAndUrlAndName ( ParamType paramType , String method , String url , String name ) { return this . findByMethodAndUrlAndName ( method , url , name ) . stream ( ) . filter ( vd -> vd . getParamType ( ) . equals ( paramType ) ) . collect ( Collectors . toList ( ) ) ; } | Find by param type and method and url and name list . | 88 | 12 |
139,113 | public ValidationData findByParamTypeAndMethodAndUrlAndNameAndParentId ( ParamType paramType , String method , String url , String name , Long parentId ) { if ( parentId == null ) { return this . findByParamTypeAndMethodAndUrlAndName ( paramType , method , url , name ) . stream ( ) . filter ( d -> d . getParentId ( ) == null ) . findAny ( ) . orElse ( null ) ; } return this . findByParamTypeAndMethodAndUrlAndName ( paramType , method , url , name ) . stream ( ) . filter ( d -> d . getParentId ( ) != null && d . getParentId ( ) . equals ( parentId ) ) . findAny ( ) . orElse ( null ) ; } | Find by param type and method and url and name and parent id validation data . | 169 | 16 |
139,114 | public List < ValidationData > findByMethodAndUrlAndName ( String method , String url , String name ) { return this . findByMethodAndUrl ( method , url ) . stream ( ) . filter ( d -> d . getName ( ) . equalsIgnoreCase ( name ) ) . collect ( Collectors . toList ( ) ) ; } | Find by method and url and name list . | 75 | 9 |
139,115 | public List < ValidationData > findByParentId ( Long id ) { return this . datas . stream ( ) . filter ( d -> d . getParentId ( ) != null && d . getParentId ( ) . equals ( id ) ) . collect ( Collectors . toList ( ) ) ; } | Find by parent id list . | 65 | 6 |
139,116 | public ValidationData findByMethodAndUrlAndNameAndParentId ( String method , String url , String name , Long parentId ) { if ( parentId == null ) { return this . findByMethodAndUrlAndName ( method , url , name ) . stream ( ) . filter ( d -> d . getParentId ( ) == null ) . findAny ( ) . orElse ( null ) ; } return this . findByMethodAndUrlAndName ( method , url , name ) . stream ( ) . filter ( d -> d . getParentId ( ) != null && d . getParentId ( ) . equals ( parentId ) ) . findAny ( ) . orElse ( null ) ; } | Find by method and url and name and parent id validation data . | 149 | 13 |
139,117 | public List < ValidationData > saveAll ( List < ValidationData > pDatas ) { pDatas . forEach ( this :: save ) ; return pDatas ; } | Save all list . | 39 | 4 |
139,118 | public ValidationData save ( ValidationData data ) { if ( data . getParamType ( ) == null || data . getUrl ( ) == null || data . getMethod ( ) == null || data . getType ( ) == null || data . getTypeClass ( ) == null ) { throw new ValidationLibException ( "mandatory field is null " , HttpStatus . BAD_REQUEST ) ; } ValidationData existData = this . findById ( data . getId ( ) ) ; if ( existData == null ) { return this . addData ( data ) ; } else { existData . setValidationRules ( data . getValidationRules ( ) ) ; return existData ; } } | Save validation data . | 151 | 4 |
139,119 | public static UriBuilder fromPath ( String path ) { if ( path == null ) throw new IllegalArgumentException ( "Path cannot be null" ) ; final UriBuilder builder = newInstance ( ) ; builder . path ( path ) ; return builder ; } | Create a new instance representing a relative URI initialized from a URI path . | 53 | 14 |
139,120 | public static String toJson ( Object obj ) { StringWriter sw = new StringWriter ( ) ; ObjectMapper mapper = getDefaultObjectMapper ( ) ; try { JsonGenerator jg = mapper . getFactory ( ) . createGenerator ( sw ) ; mapper . writeValue ( jg , obj ) ; } catch ( JsonMappingException e ) { e . printStackTrace ( ) ; } catch ( JsonGenerationException e ) { e . printStackTrace ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } return sw . toString ( ) ; } | Convert object to json . If object contains fields of type date they will be converted to strings using lightblue date format . | 138 | 25 |
139,121 | @ Override public boolean remove ( int element ) { if ( element < 0 ) { throw new IndexOutOfBoundsException ( "element < 0: " + element ) ; } int index = findElementOrEmpty ( element ) ; if ( index < 0 ) { return false ; } cells [ index ] = REMOVED ; modCount ++ ; size -- ; return true ; } | Removes the specified element from the set . | 80 | 9 |
139,122 | @ Override public void clear ( ) { size = 0 ; Arrays . fill ( cells , EMPTY ) ; freecells = cells . length ; modCount ++ ; } | Removes all of the elements from this set . | 36 | 10 |
139,123 | protected void rehash ( ) { // do we need to increase capacity, or are there so many // deleted objects hanging around that rehashing to the same // size is sufficient? if 5% (arbitrarily chosen number) of // cells can be freed up by a rehash, we do it. int gargagecells = cells . length - ( size + freecells ) ; if ( ( double ) gargagecells / cells . length > 0.05D ) // rehash with same size { rehash ( cells . length ) ; } else // rehash with increased capacity { rehash ( ( cells . length << 1 ) + 1 ) ; } } | Figures out correct size for rehashed set then does the rehash . | 137 | 16 |
139,124 | protected void rehash ( int newCapacity ) { HashIntSet rehashed = new HashIntSet ( newCapacity ) ; @ SuppressWarnings ( "hiding" ) int [ ] cells = rehashed . cells ; for ( int element : this . cells ) { if ( element < 0 ) // removed or empty { continue ; } // add the element cells [ - ( rehashed . findElementOrEmpty ( element ) + 1 ) ] = element ; } this . cells = cells ; freecells = newCapacity - size ; modCount ++ ; } | Rehashes to a bigger size . | 122 | 8 |
139,125 | public CheckPointHelper replaceExceptionCallback ( BasicCheckRule checkRule , ValidationInvalidCallback cb ) { this . msgChecker . replaceCallback ( checkRule , cb ) ; return this ; } | Replace the callback to be used basic exception . | 42 | 10 |
139,126 | public CheckPointHelper addValidationRule ( String ruleName , StandardValueType standardValueType , BaseValidationCheck validationCheck , AssistType assistType ) { ValidationRule rule = new ValidationRule ( ruleName , standardValueType , validationCheck ) ; if ( assistType == null ) { assistType = AssistType . all ( ) ; } rule . setAssistType ( assistType ) ; this . validationRuleStore . addRule ( rule ) ; return this ; } | Add the fresh user rule | 100 | 5 |
139,127 | private static void track ( String historyToken ) { if ( historyToken == null ) { historyToken = "historyToken_null" ; } historyToken = URL . encode ( "/WWARN-GWT-Analytics/V1.0/" + historyToken ) ; boolean hasErrored = false ; try { trackGoogleAnalytics ( historyToken ) ; } catch ( JavaScriptException e ) { hasErrored = true ; GWT . log ( "Unable to track" , e ) ; } if ( ! hasErrored ) GWT . log ( "Tracked " + historyToken ) ; } | track an event | 126 | 3 |
139,128 | private void addToArray ( JsonNode j ) { if ( j instanceof ArrayNode ) { for ( Iterator < JsonNode > itr = ( ( ArrayNode ) j ) . elements ( ) ; itr . hasNext ( ) ; ) { addToArray ( itr . next ( ) ) ; } } else { ( ( ArrayNode ) node ) . add ( j ) ; } } | Adds p into this array projection | 86 | 6 |
139,129 | public int getFeaturePosition ( AbstractFeature feature ) { AbstractFeature result = feature ; if ( ! featurePositions . containsKey ( feature ) ) { if ( feature instanceof FeatureGroup ) { FeatureGroup featureGroup = ( FeatureGroup ) feature ; List < Feature > features = featureGroup . getConcreteFeatures ( ) ; if ( ! features . isEmpty ( ) ) { Collections . sort ( features , new Comparator < Feature > ( ) { @ Override public int compare ( Feature feat1 , Feature feat2 ) { return getFeaturePosition ( feat1 ) - getFeaturePosition ( feat2 ) ; } } ) ; result = features . get ( 0 ) ; } } } return featurePositions . getOrDefault ( result , 0 ) ; } | Returns the absolute position of the feature or create if not exists | 157 | 12 |
139,130 | public List < Product > getSortedProducts ( ) { ArrayList < Product > result = new ArrayList <> ( pcm . getProducts ( ) ) ; Collections . sort ( result , new Comparator < Product > ( ) { @ Override public int compare ( Product o1 , Product o2 ) { Integer op1 = getProductPosition ( o1 ) ; Integer op2 = getProductPosition ( o2 ) ; return op1 . compareTo ( op2 ) ; } } ) ; return result ; } | Return the sorted products concordingly with metadata | 108 | 9 |
139,131 | public List < Feature > getSortedFeatures ( ) { ArrayList < Feature > result = new ArrayList <> ( pcm . getConcreteFeatures ( ) ) ; Collections . sort ( result , new Comparator < Feature > ( ) { @ Override public int compare ( Feature f1 , Feature f2 ) { Integer fp1 = getFeaturePosition ( f1 ) ; Integer fp2 = getFeaturePosition ( f2 ) ; return fp1 . compareTo ( fp2 ) ; } } ) ; return result ; } | Return the sorted features concordingly with metadata | 114 | 9 |
139,132 | public FacetBuilder setItemsList ( Map < String , String > items ) { ArrayList < FacetWidgetItem > facetWidgetItems = new ArrayList < FacetWidgetItem > ( ) ; for ( String key : items . keySet ( ) ) { String label = items . get ( key ) ; FacetWidgetItem facetWidgetItem = new FacetWidgetItem ( key , label ) ; facetWidgetItems . add ( facetWidgetItem ) ; } this . listItems = facetWidgetItems ; return this ; } | Takes a map of value to labels and the unique name of the list | 108 | 15 |
139,133 | public void updateRuleBasicInfo ( ValidationRule rule ) { this . orderIdx = rule . orderIdx ; this . parentDependency = rule . parentDependency ; this . standardValueType = rule . standardValueType ; this . validationCheck = rule . validationCheck ; this . overlapBanRuleName = rule . overlapBanRuleName ; this . assistType = rule . assistType ; } | Update rule basic info . | 86 | 5 |
139,134 | public boolean isUse ( ) { if ( ! this . use ) { return this . use ; } return ! ( this . standardValueType != null && ! this . standardValueType . equals ( StandardValueType . NONE ) && this . standardValue == null ) ; } | Is use boolean . | 58 | 4 |
139,135 | public boolean isUsedMyRule ( ValidationData item ) { List < ValidationRule > usedRules = item . getValidationRules ( ) ; if ( usedRules == null || usedRules . isEmpty ( ) ) { return false ; } return usedRules . stream ( ) . filter ( ur -> ur . getRuleName ( ) . equals ( this . ruleName ) && ur . isUse ( ) ) . findAny ( ) . orElse ( null ) != null ; } | Is used my rule boolean . | 101 | 6 |
139,136 | public List < ValidationData > filter ( List < ValidationData > allList ) { return allList . stream ( ) . filter ( vd -> this . isUsedMyRule ( vd ) ) . collect ( Collectors . toList ( ) ) ; } | Filter list . | 56 | 3 |
139,137 | public void updateMethodKey ( ) { Arrays . stream ( ParamType . values ( ) ) . forEach ( paramType -> this . syncMethodKey ( paramType ) ) ; this . validationDataRepository . flush ( ) ; this . validationStore . refresh ( ) ; log . info ( "[METHOD_KEY_SYNC] Complete" ) ; } | Update method key . | 75 | 4 |
139,138 | public void setSelected ( String s ) { for ( int i = 0 ; i < listBox . getItemCount ( ) ; i ++ ) { if ( listBox . getItemText ( i ) . equals ( s ) ) listBox . setSelectedIndex ( i ) ; } } | Given a string will find an item in the list box with matching text and select it . | 62 | 18 |
139,139 | public Panel draw ( TemplateViewNodesConfig config , RecordList recordList ) { // setup basic layout // has a reference to builders from plot to do rest of the plots final TemplateViewNodesConfig . TemplateNode rootTemplateNode = config . getRootTemplateNode ( ) ; if ( rootTemplateNode == null ) { throw new IllegalArgumentException ( "RootTemplate node is empty" ) ; } Panel panel = draw ( rootTemplateNode , recordList ) ; return panel ; } | call this with config to initialize the view | 100 | 8 |
139,140 | private VerticalPanel fixedWidthAndHeightPanel ( ) { final VerticalPanel verticalPanel = new VerticalPanel ( ) ; verticalPanel . setHeight ( "300px" ) ; verticalPanel . setWidth ( "500px" ) ; return verticalPanel ; } | Need fix width and height to ensure info widget panel is drawn correctly | 52 | 13 |
139,141 | protected void initNewThread ( Path monitoredFile , CountDownLatch start , CountDownLatch stop ) throws IOException { final Runnable watcher = initializeWatcherWithDirectory ( monitoredFile , start , stop ) ; final Thread thread = new Thread ( watcher ) ; thread . setDaemon ( false ) ; thread . start ( ) ; } | Added countdown latches as a synchronization aid to allow better unit testing Allows one or more threads to wait until a set of operations being performed in other threads completes | 74 | 31 |
139,142 | public void initSynchronous ( Path monitoredFile ) throws IOException { final Runnable watcher = initializeWatcherWithDirectory ( monitoredFile , new CountDownLatch ( 1 ) , new CountDownLatch ( 1 ) ) ; watcher . run ( ) ; } | A blocking method to start begin the monitoring of a directory only exists on thread interrupt | 57 | 16 |
139,143 | protected static void registerGraphiteMetricObserver ( List < MetricObserver > observers , String prefix , String host , String port ) { // verify at least hostname is set, else cannot configure this observer if ( null == host || host . trim ( ) . isEmpty ( ) ) { LOGGER . info ( "GraphiteMetricObserver not configured, missing environment variable: {}" , ENV_GRAPHITE_HOSTNAME ) ; return ; } LOGGER . debug ( "{} environment variable is: {}" , ENV_GRAPHITE_PREFIX , prefix ) ; LOGGER . debug ( "{} environment variable is: {}" , ENV_GRAPHITE_HOSTNAME , host ) ; LOGGER . debug ( "{} environment variable is: {}" , ENV_GRAPHITE_PORT , port ) ; if ( prefix == null ) { if ( System . getenv ( "OPENSHIFT_APP_NAME" ) != null ) { // try to get name from openshift. assume it's scaleable app. // format: <app name>. <namespace>.<gear dns> prefix = String . format ( "%s.%s.%s" , System . getenv ( "OPENSHIFT_APP_NAME" ) , System . getenv ( "OPENSHIFT_NAMESPACE" ) , System . getenv ( "OPENSHIFT_GEAR_DNS" ) ) ; } else { //default prefix = System . getenv ( "HOSTNAME" ) ; LOGGER . debug ( "using HOSTNAME as default prefix" + prefix ) ; } } int iport = - 1 ; if ( port != null && ! port . isEmpty ( ) ) { try { iport = Integer . valueOf ( port ) ; } catch ( NumberFormatException e ) { iport = - 1 ; LOGGER . warn ( "Configured port is not an integer. Falling back to default" ) ; } } if ( iport < 0 ) { iport = 2004 ; //default graphite port LOGGER . debug ( "Using default port: " + iport ) ; } String addr = host + ":" + iport ; LOGGER . debug ( "GraphiteMetricObserver prefix: " + prefix ) ; LOGGER . debug ( "GraphiteMetricObserver address: " + addr ) ; observers . add ( new GraphiteMetricObserver ( prefix , addr ) ) ; } | If there is sufficient configuration register a Graphite observer to publish metrics . Requires at a minimum a host . Optionally can set prefix as well as port . The prefix defaults to the host and port defaults to 2004 . | 528 | 43 |
139,144 | protected static void registerStatsdMetricObserver ( List < MetricObserver > observers , String prefix , String host , String port ) { // verify at least hostname is set, else cannot configure this observer if ( null == host || host . trim ( ) . isEmpty ( ) ) { LOGGER . info ( "StatdsMetricObserver not configured, missing environment variable: {}" , ENV_STATSD_HOSTNAME ) ; return ; } LOGGER . debug ( "{} environment variable is: {}" , ENV_STATSD_PREFIX , prefix ) ; LOGGER . debug ( "{} environment variable is: {}" , ENV_STATSD_HOSTNAME , host ) ; LOGGER . debug ( "{} environment variable is: {}" , ENV_STATSD_PORT , port ) ; int iport = - 1 ; if ( port != null && ! port . isEmpty ( ) ) { try { iport = Integer . valueOf ( port ) ; } catch ( NumberFormatException e ) { iport = - 1 ; LOGGER . warn ( "Configured port is not an integer. Falling back to default" ) ; } } if ( iport < 0 ) { iport = 8125 ; //default statsd port LOGGER . debug ( "Using default port: " + port ) ; } LOGGER . debug ( "StatsdMetricObserver prefix: " + prefix ) ; LOGGER . debug ( "StatsdMetricObserver host: " + host ) ; LOGGER . debug ( "StatsdMetricObserver port: " + iport ) ; observers . add ( new StatsdMetricObserver ( prefix , host , iport ) ) ; } | If there is sufficient configuration register a StatsD metric observer to publish metrics . Requires at a minimum a host . Optionally can set prefix as well as port . The prefix defaults to an empty string and port defaults to 8125 . | 365 | 46 |
139,145 | private static String findVariable ( String key ) { String value = System . getProperty ( key ) ; if ( value == null ) { return System . getenv ( key ) ; } return value ; } | Looks for the value of the key as a key firstly as a JVM argument and if not found to an environment variable . If still not found then null is returned . | 42 | 35 |
139,146 | public void addOverrideMap ( Map < String , String > overrideMap ) { if ( sealed ) { throw new IllegalStateException ( "Instance is sealed." ) ; } for ( Map . Entry < String , String > entry : overrideMap . entrySet ( ) ) { try { ParameterOverrideInfo info = new ParameterOverrideInfo ( entry . getKey ( ) ) ; if ( info . isOverrideSystemDefault ( ) ) { putMapIfNotExsits ( overrideSystemDefaultMap , info . getParameterName ( ) , entry . getValue ( ) ) ; } else if ( StringUtils . isNotEmpty ( info . getConfigurationId ( ) ) ) { Map < String , String > overrideForceScopeMapEntry = overrideForceScopeMap . get ( info . getConfigurationId ( ) ) ; if ( overrideForceScopeMapEntry == null ) { overrideForceScopeMapEntry = new HashMap <> ( ) ; overrideForceScopeMap . put ( info . getConfigurationId ( ) , overrideForceScopeMapEntry ) ; } putMapIfNotExsits ( overrideForceScopeMapEntry , info . getParameterName ( ) , entry . getValue ( ) ) ; if ( info . isLocked ( ) ) { Set < String > lockedParameterNamesScopeMapEntry = lockedParameterNamesScopeMap . get ( info . getConfigurationId ( ) ) ; if ( lockedParameterNamesScopeMapEntry == null ) { lockedParameterNamesScopeMapEntry = new HashSet <> ( ) ; lockedParameterNamesScopeMap . put ( info . getConfigurationId ( ) , lockedParameterNamesScopeMapEntry ) ; } putSetIfNotExsits ( lockedParameterNamesScopeMapEntry , info . getParameterName ( ) ) ; } } else { putMapIfNotExsits ( overrideForceMap , info . getParameterName ( ) , entry . getValue ( ) ) ; if ( info . isLocked ( ) ) { putSetIfNotExsits ( lockedParameterNamesSet , info . getParameterName ( ) ) ; } } } catch ( IllegalArgumentException ex ) { log . warn ( "Ignoring invalid parameter override definition:\n" + ex . getMessage ( ) ) ; } } } | Adds map containing parameter override definitions . Can be called multiple times . New calls do not override settings from previous calls only add new settings . Thus maps with highest priority should be added first . | 465 | 37 |
139,147 | public void seal ( ) { lockedParameterNamesSet = ImmutableSet . copyOf ( lockedParameterNamesSet ) ; lockedParameterNamesScopeMap = ImmutableMap . copyOf ( Maps . transformValues ( lockedParameterNamesScopeMap , new Function < Set < String > , Set < String > > ( ) { @ Override public Set < String > apply ( Set < String > input ) { return ImmutableSet . copyOf ( input ) ; } } ) ) ; sealed = true ; } | Make all maps and sets immutable . | 102 | 7 |
139,148 | public String getOverrideForce ( String configurationId , String parameterName ) { Map < String , String > overrideForceScopeMapEntry = overrideForceScopeMap . get ( configurationId ) ; if ( overrideForceScopeMapEntry != null ) { return overrideForceScopeMapEntry . get ( parameterName ) ; } return null ; } | Lookup force override for given configuration Id . | 67 | 9 |
139,149 | public Set < String > getLockedParameterNames ( String configurationId ) { Set < String > lockedParameterNamesScopeMapEntry = lockedParameterNamesScopeMap . get ( configurationId ) ; if ( lockedParameterNamesScopeMapEntry != null ) { return lockedParameterNamesScopeMapEntry ; } else { return ImmutableSet . of ( ) ; } } | Get locked parameter names for specific configuration Id . | 73 | 9 |
139,150 | @ GetMapping ( "/setting/download/api/json/all" ) public void downloadApiJsonAll ( HttpServletRequest req , HttpServletResponse res ) { this . validationSessionComponent . sessionCheck ( req ) ; List < ValidationData > list = this . msgSettingService . getAllValidationData ( ) ; ValidationFileUtil . sendFileToHttpServiceResponse ( "validation.json" , list , res ) ; } | Download api json all . | 101 | 5 |
139,151 | @ GetMapping ( "/setting/download/api/json" ) public void downloadApiJson ( HttpServletRequest req , @ RequestParam ( "method" ) String method , @ RequestParam ( "url" ) String url , HttpServletResponse res ) { this . validationSessionComponent . sessionCheck ( req ) ; url = new String ( Base64 . getDecoder ( ) . decode ( url ) ) ; List < ValidationData > list = this . msgSettingService . getValidationData ( method , url ) ; ValidationFileUtil . sendFileToHttpServiceResponse ( method + url . replaceAll ( "/" , "-" ) + ".json" , list , res ) ; } | Download api json . | 153 | 4 |
139,152 | @ GetMapping ( "/setting/download/api/excel/all" ) public void downloadApiAll ( HttpServletRequest req , HttpServletResponse res ) { this . validationSessionComponent . sessionCheck ( req ) ; PoiWorkBook workBook = this . msgExcelService . getAllExcels ( ) ; workBook . writeFile ( "ValidationApis_" + System . currentTimeMillis ( ) , res ) ; } | Download api all . | 101 | 4 |
139,153 | @ GetMapping ( "/setting/download/api/excel" ) public void downloadApi ( HttpServletRequest req , @ RequestParam ( "method" ) String method , @ RequestParam ( "url" ) String url , HttpServletResponse res ) { this . validationSessionComponent . sessionCheck ( req ) ; url = new String ( Base64 . getDecoder ( ) . decode ( url ) ) ; PoiWorkBook workBook = this . msgExcelService . getExcel ( method , url ) ; workBook . writeFile ( "ValidationApis_" + System . currentTimeMillis ( ) , res ) ; } | Download api . | 141 | 3 |
139,154 | @ PostMapping ( "/setting/upload/json" ) public void uploadSetting ( HttpServletRequest req ) { this . validationSessionComponent . sessionCheck ( req ) ; this . msgSettingService . updateValidationData ( ( MultipartHttpServletRequest ) req ) ; } | Upload setting . | 62 | 3 |
139,155 | @ GetMapping ( "/setting/url/list/all" ) public List < ReqUrl > reqUrlAllList ( HttpServletRequest req ) { this . validationSessionComponent . sessionCheck ( req ) ; return this . msgSettingService . getAllUrlList ( ) ; } | Req url all list list . | 62 | 7 |
139,156 | @ GetMapping ( "/setting/param/from/url" ) public List < ValidationData > getValidationDataLists ( HttpServletRequest req ) { this . validationSessionComponent . sessionCheck ( req ) ; ValidationData data = ParameterMapper . requestParamaterToObject ( req , ValidationData . class , "UTF-8" ) ; return this . msgSettingService . getValidationData ( data . getParamType ( ) , data . getMethod ( ) , data . getUrl ( ) ) ; } | Gets validation data lists . | 116 | 6 |
139,157 | private int transactionToIndex ( T t ) { Integer r = allTransactions . absoluteIndexOf ( t ) ; return r == null ? - 1 : r . intValue ( ) ; } | maps a transaction to its index and returns - 1 if not found | 40 | 13 |
139,158 | private int itemToIndex ( I i ) { Integer r = allItems . absoluteIndexOf ( i ) ; return r == null ? - 1 : r . intValue ( ) ; } | maps an item to its index and returns - 1 if not found | 39 | 13 |
139,159 | public boolean add ( T transaction , I item ) { return matrix . add ( transactionToIndex ( transaction ) , itemToIndex ( item ) ) ; } | Adds a single transaction - item pair | 32 | 7 |
139,160 | public boolean contains ( T transaction , I item ) { int t = transactionToIndex ( transaction ) ; if ( t < 0 ) return false ; int i = itemToIndex ( item ) ; if ( i < 0 ) return false ; return matrix . contains ( t , i ) ; } | Checks if the given transaction - item pair is contained within the set | 60 | 14 |
139,161 | public boolean remove ( T transaction , I item ) { return matrix . remove ( transactionToIndex ( transaction ) , itemToIndex ( item ) ) ; } | Removes a single transaction - item pair | 32 | 8 |
139,162 | public boolean removeAll ( Collection < T > trans , Collection < I > items ) { if ( trans == null || trans . isEmpty ( ) || items == null || items . isEmpty ( ) ) return false ; return matrix . removeAll ( allTransactions . convert ( trans ) . indices ( ) , allItems . convert ( items ) . indices ( ) ) ; } | Removes the pairs obtained from the Cartesian product of transactions and items | 78 | 14 |
139,163 | public boolean retainAll ( Collection < T > trans , I item ) { if ( isEmpty ( ) ) return false ; if ( trans == null || trans . isEmpty ( ) || item == null ) { clear ( ) ; return true ; } return matrix . retainAll ( allTransactions . convert ( trans ) . indices ( ) , itemToIndex ( item ) ) ; } | Retains the pairs obtained from the Cartesian product of transactions and items | 79 | 14 |
139,164 | public IndexedSet < I > itemsOf ( T transaction ) { IndexedSet < I > res = allItems . empty ( ) ; res . indices ( ) . addAll ( matrix . getRow ( transactionToIndex ( transaction ) ) ) ; return res ; } | Lists all items contained within a given transaction | 56 | 9 |
139,165 | public IndexedSet < T > transactionsOf ( I item ) { IndexedSet < T > res = allTransactions . empty ( ) ; res . indices ( ) . addAll ( matrix . getCol ( itemToIndex ( item ) ) ) ; return res ; } | Lists all transactions involved with a specified item | 57 | 9 |
139,166 | private List < File > unTar ( final File inputFile , final File outputDir ) throws FileNotFoundException , IOException , ArchiveException { _log . info ( String . format ( "Untaring %s to dir %s." , inputFile . getAbsolutePath ( ) , outputDir . getAbsolutePath ( ) ) ) ; final List < File > untaredFiles = new LinkedList < File > ( ) ; final InputStream is = new FileInputStream ( inputFile ) ; final TarArchiveInputStream debInputStream = ( TarArchiveInputStream ) new ArchiveStreamFactory ( ) . createArchiveInputStream ( "tar" , is ) ; TarArchiveEntry entry = null ; while ( ( entry = ( TarArchiveEntry ) debInputStream . getNextEntry ( ) ) != null ) { final File outputFile = new File ( outputDir , entry . getName ( ) ) ; if ( entry . isDirectory ( ) ) { _log . info ( String . format ( "Attempting to write output directory %s." , outputFile . getAbsolutePath ( ) ) ) ; if ( ! outputFile . exists ( ) ) { _log . info ( String . format ( "Attempting to create output directory %s." , outputFile . getAbsolutePath ( ) ) ) ; if ( ! outputFile . mkdirs ( ) ) { throw new IllegalStateException ( String . format ( "Couldn't create directory %s." , outputFile . getAbsolutePath ( ) ) ) ; } } } else { _log . info ( String . format ( "Creating output file %s." , outputFile . getAbsolutePath ( ) ) ) ; final OutputStream outputFileStream = new FileOutputStream ( outputFile ) ; IOUtils . copy ( debInputStream , outputFileStream ) ; outputFileStream . close ( ) ; } untaredFiles . add ( outputFile ) ; } debInputStream . close ( ) ; return untaredFiles ; } | Untar an input file into an output file . | 424 | 10 |
139,167 | private void updateLoockup ( ) { synchronized ( parameterOverrideProviders ) { ParameterOverrideInfoLookup newLookup = new ParameterOverrideInfoLookup ( ) ; for ( ParameterOverrideProvider provider : parameterOverrideProviders ) { newLookup . addOverrideMap ( provider . getOverrideMap ( ) ) ; } newLookup . seal ( ) ; lookup = newLookup ; } } | Update lookup maps with override maps from all override providers . | 85 | 11 |
139,168 | public static void load ( ) { if ( ! isLoaded ( ) ) { ScriptInjector . fromString ( LocalForageResources . INSTANCE . js ( ) . getText ( ) ) . setWindow ( ScriptInjector . TOP_WINDOW ) . inject ( ) ; } } | Loads the offline library . You normally never have to do this manually | 63 | 14 |
139,169 | public static void resetCounters ( ) { unionCount = intersectionCount = differenceCount = symmetricDifferenceCount = complementCount = unionSizeCount = intersectionSizeCount = differenceSizeCount = symmetricDifferenceSizeCount = complementSizeCount = equalsCount = hashCodeCount = containsAllCount = containsAnyCount = containsAtLeastCount = 0 ; } | Resets all counters | 74 | 4 |
139,170 | public void setMarkers ( List < GenericMarker > m ) { this . markers = m ; for ( GenericMarker marker : m ) { marker . setMap ( this ) ; } //setup any clustering options clusterMarkers ( ) ; } | Set markers would be a better description of this method behaviour effectively replaces the references to all markers | 53 | 18 |
139,171 | public static void load ( ) { if ( ! isLoaded ( ) ) { // ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.proj4js().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); // ScriptInjector.fromString(OpenLayersV3Resources.INSTANCE.supercluster().getText()).setWindow(ScriptInjector.TOP_WINDOW).inject(); ScriptInjector . fromString ( OpenLayersV3Resources . INSTANCE . js ( ) . getText ( ) ) . setWindow ( ScriptInjector . TOP_WINDOW ) . inject ( ) ; StyleInjector . injectStylesheetAtStart ( OpenLayersV3Resources . INSTANCE . css ( ) . getText ( ) ) ; } } | Loads the offline library . | 185 | 6 |
139,172 | protected void display ( ) { new FilterPresenter ( new FilterViewUI ( ) ) . go ( layout ) ; resultPresenter = new ResultPresenter ( getResultView ( ) ) ; loadStatusListener . registerObserver ( resultPresenter ) ; resultPresenter . go ( layout ) ; } | Display home screen | 63 | 3 |
139,173 | public BaseValidationCheck getValidationChecker ( ValidationRule rule ) { ValidationRule existRule = this . rules . stream ( ) . filter ( r -> r . getRuleName ( ) . equals ( rule . getRuleName ( ) ) ) . findFirst ( ) . orElse ( null ) ; if ( existRule == null ) { throw new ValidationLibException ( "rulename : " + rule . getRuleName ( ) + "checker is notfound " , HttpStatus . INTERNAL_SERVER_ERROR ) ; } return existRule . getValidationCheck ( ) ; } | Gets validation checker . | 131 | 6 |
139,174 | public synchronized ValidationRuleStore addRule ( ValidationRule rule ) { rule . setOrderIdx ( this . rules . size ( ) ) ; this . rules . add ( rule ) ; this . checkHashMap . put ( rule . getRuleName ( ) , rule . getValidationCheck ( ) ) ; return this ; } | Add rule validation rule store . | 70 | 6 |
139,175 | private static PCM clear_ligne ( PCM pcm , PCM pcm_return ) { List < Product > pdts = pcm . getProducts ( ) ; List < Cell > cells = new ArrayList < Cell > ( ) ; for ( Product pr : pdts ) { float nbCellsEmpty = 0 ; // On ajoute les cellules du product dans une liste cells = pr . getCells ( ) ; // On traite les infos des cellules for ( Cell c : cells ) { if ( c . getContent ( ) . isEmpty ( ) ) { nbCellsEmpty ++ ; } } if ( cells . size ( ) != 0 ) { System . out . println ( "Dans les lignes -- > \n Nombre de cellule vide :" + nbCellsEmpty + "\n Nombre de cellule : " + cells . size ( ) ) ; System . out . println ( "Valeur du if : " + nbCellsEmpty / cells . size ( ) ) ; if ( ! ( ( nbCellsEmpty / cells . size ( ) ) > RATIO_EMPTY_CELL ) ) { System . out . println ( "on ajoute la ligne !" ) ; pcm_return . addProduct ( pr ) ; } } } return pcm_return ; } | Enlever les lignes inutiles | 298 | 10 |
139,176 | private static PCM clear_colonne ( PCM pcm , PCM pcm_return ) { List < Feature > pdts = pcm . getConcreteFeatures ( ) ; List < Cell > cells = new ArrayList < Cell > ( ) ; for ( Feature pr : pdts ) { float nbCellsEmpty = 0 ; // On ajoute les cellules du product dans une liste cells = pr . getCells ( ) ; // On traite les infos des cellules for ( Cell c : cells ) { if ( c . getContent ( ) . isEmpty ( ) ) { nbCellsEmpty ++ ; } } if ( cells . size ( ) != 0 ) { System . out . println ( "Dans les colonnes -- > \n Nombre de cellule vide :" + nbCellsEmpty + "\n Nombre de cellule : " + cells . size ( ) ) ; System . out . println ( "Valeur du if : " + nbCellsEmpty / cells . size ( ) ) ; if ( ! ( ( nbCellsEmpty / cells . size ( ) ) > RATIO_EMPTY_CELL ) ) { System . out . println ( "on ajoute la colonne !" ) ; pcm_return . addFeature ( pr ) ; ; } } } return pcm_return ; } | Enlever les colonnes inutiles | 300 | 9 |
139,177 | public boolean sameFeature ( JFeature f ) { return this . name . equals ( f . name ) && this . type . equals ( f . type ) ; } | Compares the name and type of the 2 features | 34 | 10 |
139,178 | public static void nodeWalker ( NodeList childNodes , NodeElementParser parser ) throws ParseException { for ( int i = 0 ; i < childNodes . getLength ( ) ; i ++ ) { Node item = childNodes . item ( i ) ; String node = item . getNodeName ( ) ; if ( item . getNodeType ( ) == Node . ELEMENT_NODE ) { parser . parse ( item ) ; } nodeWalker ( item . getChildNodes ( ) , parser ) ; } } | nodeWalker walker implementation simple depth first recursive implementation | 111 | 10 |
139,179 | protected boolean isObject ( String text ) { final String trim = text . trim ( ) ; return trim . startsWith ( "{" ) && trim . endsWith ( "}" ) ; } | Checks if the serialized content is a JSON Object . | 39 | 12 |
139,180 | @ SuppressWarnings ( "unchecked" ) protected < D > void evalResponse ( Request request , Deferred < D > deferred , Class < D > resolveType , Class < ? > parametrizedType , RawResponse response ) { if ( parametrizedType != null ) { processor . process ( request , response , parametrizedType , ( Class < Collection > ) resolveType , ( Deferred < Collection > ) deferred ) ; } else { processor . process ( request , response , resolveType , deferred ) ; } } | Evaluates the response and resolves the deferred . This method must be called by implementations after the response is received . | 115 | 23 |
139,181 | private void assertNotNull ( Object value , String message ) throws IllegalArgumentException { if ( value == null ) { throw new IllegalArgumentException ( message ) ; } } | Assert that the value is not null . | 37 | 9 |
139,182 | public List < ReqUrl > getUrlList ( ) { List < ReqUrl > reqUrls = new ArrayList <> ( ) ; for ( String key : this . methodAndUrlIndex . getMap ( ) . keySet ( ) ) { List < ValidationData > datas = this . methodAndUrlIndex . getMap ( ) . get ( key ) ; if ( ! datas . isEmpty ( ) ) { reqUrls . add ( new ReqUrl ( datas . get ( 0 ) . getMethod ( ) , datas . get ( 0 ) . getUrl ( ) ) ) ; } } return reqUrls ; } | Gets url list . | 135 | 5 |
139,183 | public ValidationData findById ( Long id ) { List < ValidationData > datas = this . idIndex . get ( ValidationIndexUtil . makeKey ( String . valueOf ( id ) ) ) ; if ( datas . isEmpty ( ) ) { return null ; } return datas . get ( 0 ) ; } | Find by id validation data . | 68 | 6 |
139,184 | public void addIndex ( ValidationData data ) { for ( ValidationDataIndex idx : this . idxs ) { ValidationIndexUtil . addIndexData ( data , idx ) ; } } | Add index . | 44 | 3 |
139,185 | public void removeIndex ( ValidationData data ) { for ( ValidationDataIndex idx : this . idxs ) { ValidationIndexUtil . removeIndexData ( data , idx ) ; } } | Remove index . | 44 | 3 |
139,186 | public void updateFromFile ( MultipartFile file ) { ObjectMapper objectMapper = ValidationObjUtil . getDefaultObjectMapper ( ) ; try { String jsonStr = new String ( file . getBytes ( ) , "UTF-8" ) ; List < ValidationData > list = objectMapper . readValue ( jsonStr , objectMapper . getTypeFactory ( ) . constructCollectionType ( List . class , ValidationData . class ) ) ; List < ReqUrl > reqUrls = ValidationReqUrlUtil . getUrlListFromValidationDatas ( list ) ; reqUrls . forEach ( reqUrl -> { this . deleteValidationData ( reqUrl ) ; } ) ; Map < Long , Long > idsMap = new HashMap <> ( ) ; List < ValidationData > saveList = new ArrayList <> ( ) ; list . forEach ( data -> { long oldId = data . getId ( ) ; data . setId ( null ) ; data = this . validationDataRepository . save ( data ) ; idsMap . put ( oldId , data . getId ( ) ) ; saveList . add ( data ) ; } ) ; saveList . forEach ( data -> { if ( data . getParentId ( ) != null ) { data . setParentId ( idsMap . get ( data . getParentId ( ) ) ) ; this . validationDataRepository . save ( data ) ; } } ) ; } catch ( IOException e ) { log . info ( "file io exception : " + e . getMessage ( ) ) ; } } | Update from file . | 349 | 4 |
139,187 | public static boolean isNotScanClass ( String className ) { String block = BASIC_PACKAGE_PREFIX_LIST . stream ( ) . filter ( prefix -> className . startsWith ( prefix ) ) . findAny ( ) . orElse ( null ) ; return block != null ; } | Is not scan class boolean . | 64 | 6 |
139,188 | public static boolean isObjClass ( Class < ? > type ) { if ( type . isPrimitive ( ) || type . isEnum ( ) || type . isArray ( ) ) { return false ; } String block = BASIC_PACKAGE_PREFIX_LIST . stream ( ) . filter ( prefix -> type . getName ( ) . startsWith ( prefix ) ) . findAny ( ) . orElse ( null ) ; if ( block != null ) { return false ; } return ! PRIMITIVE_CLASS_LIST . contains ( type ) ; } | Is obj class boolean . | 121 | 5 |
139,189 | public static boolean isListClass ( Class < ? > type ) { if ( type . isPrimitive ( ) || type . isEnum ( ) ) { return false ; } return type . equals ( List . class ) ; } | Is list class boolean . | 48 | 5 |
139,190 | public void initBeans ( Object [ ] beans ) { this . controllers = Arrays . stream ( beans ) . filter ( bean -> this . getController ( bean ) != null ) . map ( bean -> this . getController ( bean ) ) . collect ( Collectors . toList ( ) ) ; } | Init beans . | 64 | 3 |
139,191 | public List < DetailParam > getParameterFromMethodWithAnnotation ( Class < ? > parentClass , Method method , Class < ? > annotationClass ) { List < DetailParam > params = new ArrayList <> ( ) ; if ( method . getParameterCount ( ) < 1 ) { return params ; } for ( Parameter param : method . getParameters ( ) ) { Annotation [ ] annotations = param . getAnnotations ( ) ; for ( Annotation annotation : annotations ) { if ( annotation . annotationType ( ) . equals ( annotationClass ) ) { params . add ( new DetailParam ( param . getType ( ) , method , parentClass ) ) ; break ; } } } return params ; } | Gets parameter from method with annotation . | 148 | 8 |
139,192 | public List < DetailParam > getParameterFromClassWithAnnotation ( Class < ? > baseClass , Class < ? > annotationClass ) { List < DetailParam > params = new ArrayList <> ( ) ; Arrays . stream ( baseClass . getDeclaredMethods ( ) ) . forEach ( method -> params . addAll ( this . getParameterFromMethodWithAnnotation ( baseClass , method , annotationClass ) ) ) ; return params ; } | Gets parameter from class with annotation . | 95 | 8 |
139,193 | public List < DetailParam > getParameterWithAnnotation ( Class < ? > annotation ) { List < DetailParam > params = new ArrayList <> ( ) ; this . controllers . stream ( ) . forEach ( cla -> params . addAll ( this . getParameterFromClassWithAnnotation ( cla , annotation ) ) ) ; return params ; } | Gets parameter with annotation . | 73 | 6 |
139,194 | public Row nextRow ( int cnt ) { Row lastrow = null ; for ( int i = 0 ; i < cnt ; i ++ ) { lastrow = this . nextRow ( ) ; } return lastrow ; } | Next row row . | 48 | 4 |
139,195 | public List < Cell > createTitleCells ( String ... strs ) { List < Cell > cells = new ArrayList <> ( ) ; for ( String s : strs ) { Cell cell = this . createTitleCell ( s , DEFAULT_WIDTH ) ; cells . add ( cell ) ; } return cells ; } | Create title cells list . | 70 | 5 |
139,196 | public void createTitleCells ( double width , String ... strs ) { for ( String s : strs ) { this . createTitleCell ( s , width ) ; } } | Create title cells . | 38 | 4 |
139,197 | public Cell createTitleCell ( String str , double width ) { int cellCnt = this . getCellCnt ( ) ; Cell cell = this . getLastRow ( ) . createCell ( cellCnt ) ; cell . setCellValue ( str ) ; cell . setCellType ( CellType . STRING ) ; cell . setCellStyle ( this . style . getStringCs ( ) ) ; sheet . setColumnWidth ( cellCnt , ( int ) ( sheet . getColumnWidth ( cellCnt ) * width ) ) ; return cell ; } | Create title cell cell . | 118 | 5 |
139,198 | public void createValueCells ( Object ... values ) { for ( Object value : values ) { if ( value == null ) { this . createCell ( "" ) ; continue ; } if ( value instanceof String ) { this . createCell ( ( String ) value ) ; } else if ( value instanceof Date ) { this . createCell ( ( Date ) value ) ; } else if ( ValidationObjUtil . isIntType ( value . getClass ( ) ) ) { long longValue = Long . valueOf ( value + "" ) ; this . createCell ( longValue ) ; } else if ( ValidationObjUtil . isDoubleType ( value . getClass ( ) ) ) { double doubleValue = Double . valueOf ( value + "" ) ; this . createCell ( doubleValue ) ; } else { this . createCell ( value ) ; } } } | Create value cells . | 184 | 4 |
139,199 | private String printStackTrace ( Object [ ] stackTrace ) { StringBuilder output = new StringBuilder ( ) ; for ( Object line : stackTrace ) { output . append ( line ) ; output . append ( newline ) ; } return output . toString ( ) ; } | Given a stack trace turn it into a HTML formatted string - to improve its display | 60 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.