idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
139,300
@ SuppressWarnings ( "unchecked" ) public < T > Serializer < T > getSerializer ( Class < T > type , String mediaType ) throws SerializationException { checkNotNull ( type , "Type (Class<T>) cannot be null." ) ; checkNotNull ( mediaType , "Media-Type cannot be null." ) ; final String typeName = getClassName ( type ) ; f...
Retrieve Serializer from manager .
139,301
private RecordList loadData ( AbstractDataTable table , DataSchema schema ) { RecordListBuilder recordListBuilder = new RecordListBuilder ( RecordListBuilder . CompressionMode . CANONICAL , schema ) ; if ( schema . size ( ) != table . getNumberOfColumns ( ) ) { final IllegalArgumentException illegalArgumentException = ...
Given a schema attempts to load table into internal structure
139,302
private static TrustManager createNaiveTrustManager ( ) { return new X509TrustManager ( ) { public void checkClientTrusted ( X509Certificate [ ] chain , String authType ) throws CertificateException { } public void checkServerTrusted ( X509Certificate [ ] chain , String authType ) throws CertificateException { } public...
Naive trust manager trusts all .
139,303
protected void onLoad ( ) { mainAbsolutePanel . setSize ( String . valueOf ( yuiSliderGwtWidget . getOffsetWidth ( ) ) , String . valueOf ( yuiSliderGwtWidget . getOffsetHeight ( ) ) ) ; setupMarkerLabels ( ) ; }
override onLoad to know when absolutePanel s size can be set
139,304
public void urlCheckAndSave ( BasicCheckInfo basicCheckInfo , ParamType paramType , ReqUrl reqUrl , Class < ? > type ) { if ( ! this . validationConfig . isFreshUrlSave ( ) || ! basicCheckInfo . isUrlMapping ( ) ) { return ; } List < ValidationData > datas = this . validationDataRepository . findByParamTypeAndMethodAnd...
Url check and save .
139,305
public MapBuilder configureMapDimension ( Integer width , Integer height ) { this . mapHeight = height ; this . mapWidth = width ; return this ; }
Setup map display properties
139,306
protected void detectTypes ( ImportMatrix matrix ) { for ( int row = 0 ; row < matrix . getNumberOfRows ( ) ; row ++ ) { for ( int column = 0 ; column < matrix . getNumberOfColumns ( ) ; column ++ ) { ImportCell cell = matrix . getCell ( row , column ) ; if ( cell != null && cell . getInterpretation ( ) == null ) { cel...
Detect types of each cell of the matrix
139,307
protected PCMDirection detectDirection ( ImportMatrix matrix ) { double sumHomogeneityOfRow = 0 ; for ( int row = 0 ; row < matrix . getNumberOfRows ( ) ; row ++ ) { Map < String , Integer > types = new HashMap < > ( ) ; for ( int column = 0 ; column < matrix . getNumberOfColumns ( ) ; column ++ ) { countType ( matrix ...
Detect if products are represented by a line or a column
139,308
protected IONode < String > detectFeatures ( ImportMatrix matrix , PCMContainer pcmContainer ) { IONode < String > root = new IONode < > ( null ) ; List < IONode < String > > parents = new ArrayList < > ( ) ; for ( int column = 0 ; column < matrix . getNumberOfColumns ( ) ; column ++ ) { parents . add ( root ) ; } for ...
Detect features from the information contained in the matrix and the provided direction
139,309
protected void createProducts ( ImportMatrix matrix , PCMContainer pcmContainer , Map < Integer , Feature > positionToFeature ) { int featuresDepth = pcmContainer . getPcm ( ) . getFeaturesDepth ( ) ; for ( int row = featuresDepth ; row < matrix . getNumberOfRows ( ) ; row ++ ) { Product product = factory . createProdu...
Detect and create products from the information contained in the matrix and the provided direction
139,310
public static String readBody ( HttpServletRequest request ) { BufferedReader input = null ; try { input = new BufferedReader ( new InputStreamReader ( request . getInputStream ( ) ) ) ; StringBuilder builder = new StringBuilder ( ) ; String buffer ; while ( ( buffer = input . readLine ( ) ) != null ) { if ( builder . ...
Read body string .
139,311
private RecordList convertDataTable ( AbstractDataTable table , DataSchema schema ) { return dataTableConversionUtility . convertDataTableToRecordList ( schema , table ) ; }
covert a gwtDatatable to an internal RecordList
139,312
private List < Integer > calculateRowsToFilter ( DataView dataView , FilterQuery filterQuery , DataSchema schema ) { JsArray < JavaScriptObject > propertiesJsArray = convertToColumnIndexAndValueArray ( filterQuery , schema ) ; JsArrayInteger jsArrayInteger = getFilteredRows ( dataView , propertiesJsArray ) ; return toT...
Calculate the row indexes for rows that match all of the given filters . Parses the filterQuery
139,313
public static ObjectMapper getDefaultObjectMapper ( ) { ObjectMapper mapper = new ObjectMapper ( ) ; mapper . configure ( DeserializationFeature . FAIL_ON_UNKNOWN_PROPERTIES , false ) ; mapper . configure ( DeserializationFeature . READ_UNKNOWN_ENUM_VALUES_AS_NULL , true ) ; mapper . configure ( SerializationFeature . ...
Gets default object mapper .
139,314
public static boolean isNumberObj ( Object type ) { try { Double . valueOf ( type + "" ) ; } catch ( NumberFormatException e ) { return false ; } return true ; }
Is number obj boolean .
139,315
public static boolean isDoubleType ( Class < ? > type ) { return ( type . isPrimitive ( ) && type == float . class ) || ( type . isPrimitive ( ) && type == double . class ) || ( ! type . isPrimitive ( ) && type == Float . class ) || ( ! type . isPrimitive ( ) && type == Double . class ) ; }
Is double type boolean .
139,316
public static boolean isIntType ( Class < ? > type ) { return ( type . isPrimitive ( ) && type == int . class ) || ( type . isPrimitive ( ) && type == long . class ) || ( ! type . isPrimitive ( ) && type == Integer . class ) || ( ! type . isPrimitive ( ) && type == Long . class ) ; }
Is int type boolean .
139,317
public static Method getSetterMethodNotCheckParamType ( Class < ? > cType , String fieldName ) { String methodName = getMethodName ( fieldName , SET_METHOD_PREFIX ) ; Method [ ] methods = cType . getMethods ( ) ; for ( Method m : methods ) { if ( m . getName ( ) . equals ( methodName ) && m . getParameterCount ( ) == 1...
Gets setter method not check param type .
139,318
public static Method getSetterMethod ( Class < ? > cType , String fieldName , Class < ? > paramType ) { Class < ? > subType = getSubType ( paramType ) ; String methodName = getMethodName ( fieldName , SET_METHOD_PREFIX ) ; try { return cType . getMethod ( methodName , paramType ) ; } catch ( NoSuchMethodException e ) {...
Gets setter method .
139,319
public static String getMethodName ( String name , String prefix ) { return prefix + name . substring ( 0 , 1 ) . toUpperCase ( ) + name . substring ( 1 ) ; }
Gets method name .
139,320
public static String getFieldNameFromMethod ( Method m ) { String methodName = m . getName ( ) ; if ( methodName . startsWith ( GET_METHOD_PREFIX ) ) { methodName = methodName . replaceFirst ( GET_METHOD_PREFIX , "" ) ; } else if ( methodName . startsWith ( IS_METHOD_PREFIX ) ) { methodName = methodName . replaceFirst ...
Gets field name from method .
139,321
public static Method getGetterMethod ( Class < ? > c , String field ) { try { return c . getMethod ( getMethodName ( field , GET_METHOD_PREFIX ) , EMPTY_CLASS ) ; } catch ( NoSuchMethodException e ) { try { return c . getMethod ( getMethodName ( field , IS_METHOD_PREFIX ) , EMPTY_CLASS ) ; } catch ( NoSuchMethodExcepti...
Gets getter method .
139,322
public static Object getValue ( Object obj , String field ) { Method getter = getGetterMethod ( obj . getClass ( ) , field ) ; try { return getter . invoke ( obj ) ; } catch ( IllegalAccessException | InvocationTargetException e ) { return null ; } }
Gets value .
139,323
public static Object objDeepCopy ( Object from , Object to , String ... copyFields ) { if ( from == null || to == null ) { log . error ( "object deep copy from or to is null " ) ; return to ; } for ( String field : copyFields ) { copyFromTo ( from , to , field ) ; } return to ; }
Obj deep copy object .
139,324
public static < T > T objectDeepCopyWithWhiteList ( Object from , Object to , String ... copyFields ) { return ( T ) to . getClass ( ) . cast ( objDeepCopy ( from , to , copyFields ) ) ; }
Object deep copy with white list t .
139,325
public static boolean isGetterMethod ( Method m ) { String methodName = m . getName ( ) ; if ( methodName . equals ( "getClass" ) ) { return false ; } if ( ! methodName . startsWith ( GET_METHOD_PREFIX ) && ! methodName . startsWith ( IS_METHOD_PREFIX ) ) { return false ; } if ( m . getParameterCount ( ) > 0 ) { return...
Is getter method boolean .
139,326
public static Double getObjectSize ( Object value ) { double v = 1 ; if ( value instanceof String ) { v = ( ( String ) value ) . length ( ) ; if ( v < 1 ) { return null ; } } else if ( value instanceof List ) { v = ( ( List ) value ) . size ( ) ; } else if ( ValidationObjUtil . isNumberObj ( value ) ) { v = Double . va...
Gets object size .
139,327
public static Class < ? > getListInnerClassFromGenericType ( Type genericType ) { ParameterizedType innerClass = ( ParameterizedType ) genericType ; return ( Class < ? > ) innerClass . getActualTypeArguments ( ) [ 0 ] ; }
Gets list inner class from generic type .
139,328
public MsgChecker replaceCallback ( BasicCheckRule type , ValidationInvalidCallback cb ) { this . callbackMap . put ( type . name ( ) , cb ) ; return this ; }
Replace callback msg checker .
139,329
public void checkPoint ( ValidationData param , ValidationRule rule , Object bodyObj , Object standardValue ) { Object value = param . getValue ( bodyObj ) ; BaseValidationCheck checker = this . validationRuleStore . getValidationChecker ( rule ) ; if ( ( value != null && standardValue != null ) || rule . getAssistType...
Check point .
139,330
public void checkPointListChild ( ValidationData param , ValidationRule rule , Object bodyObj , Object standardValue ) { ValidationData listParent = param . findListParent ( ) ; List list = ( List ) listParent . getValue ( bodyObj ) ; if ( list == null || list . isEmpty ( ) ) { return ; } list . stream ( ) . forEach ( ...
Check point list child .
139,331
public void checkDataInnerRules ( ValidationData data , Object bodyObj ) { data . getValidationRules ( ) . stream ( ) . filter ( vr -> vr . isUse ( ) ) . forEach ( rule -> { if ( data . isListChild ( ) ) { this . checkPointListChild ( data , rule , bodyObj , rule . getStandardValue ( ) ) ; } else { this . checkPoint ( ...
Check data inner rules .
139,332
public void checkRequest ( BasicCheckInfo basicCheckInfo , Object bodyObj ) { String key = basicCheckInfo . getUniqueKey ( ) ; List < ValidationData > checkData = this . validationStore . getValidationDatas ( basicCheckInfo . getParamType ( ) , key ) ; if ( checkData == null || checkData . isEmpty ( ) ) { return ; } ch...
Check request .
139,333
private void applyDefaultValues ( Map < String , Object > parameterValues ) { for ( Parameter < ? > parameter : allParameters ) { parameterValues . put ( parameter . getName ( ) , getParameterDefaultValue ( parameter ) ) ; } }
Apply default values for all parameters .
139,334
private < T > T getParameterDefaultValue ( Parameter < T > parameter ) { String defaultOsgiConfigProperty = parameter . getDefaultOsgiConfigProperty ( ) ; if ( StringUtils . isNotBlank ( defaultOsgiConfigProperty ) ) { String [ ] parts = StringUtils . split ( defaultOsgiConfigProperty , ":" ) ; String className = parts...
Get default value for parameter - from OSGi configuration property or parameter definition itself .
139,335
private void applyOverrideSystemDefault ( Map < String , Object > parameterValues ) { for ( Parameter < ? > parameter : allParameters ) { Object overrideValue = parameterOverride . getOverrideSystemDefault ( parameter ) ; if ( overrideValue != null ) { parameterValues . put ( parameter . getName ( ) , overrideValue ) ;...
Apply system - wide overrides for default values .
139,336
private Map < String , Object > ensureValidValueTypes ( Map < String , Object > parameterValues ) { Map < String , Object > transformedParameterValues = new HashMap < > ( ) ; for ( Map . Entry < String , Object > entry : parameterValues . entrySet ( ) ) { if ( entry . getKey ( ) == null || entry . getValue ( ) == null ...
Make sure value types match with declared parameter types . Values which types do not match or for which no parameter definition exists are removed . Types are converted from persistence format if required .
139,337
private SortedSet < String > applyOverrideForce ( String configurationId , Map < String , Object > parameterValues , SortedSet < String > ancestorLockedParameterNames ) { for ( Parameter < ? > parameter : allParameters ) { Object overrideValue = parameterOverride . getOverrideForce ( configurationId , parameter ) ; if ...
Apply forced overrides for a configurationId .
139,338
private void validateParameterProviders ( ) { Set < String > parameterNames = new HashSet < > ( ) ; for ( ParameterProvider provider : this . parameterProviders ) { Set < String > applicationIdsOfThisProvider = new HashSet < > ( ) ; for ( Parameter < ? > parameter : provider . getParameters ( ) ) { if ( StringUtils . i...
Validate that application ids and configuration names are unique over all providers .
139,339
private SortedSet < String > mergeSets ( SortedSet < String > primary , Set < String > secondary ) { SortedSet < String > result = primary ; if ( ! secondary . isEmpty ( ) ) { result = new TreeSet < > ( ) ; result . addAll ( primary ) ; result . addAll ( secondary ) ; } return result ; }
Merge two sets . If secondary set is empty return primary .
139,340
public boolean equalUrl ( ReqUrl url ) { return url . getMethod ( ) . equalsIgnoreCase ( this . method ) && url . getUrl ( ) . equalsIgnoreCase ( this . url ) ; }
Equal url boolean .
139,341
public void replaceValue ( Object bodyObj , Object replaceValue ) { Object parentObj = bodyObj ; if ( this . listChild ) { ValidationData rootListParent = this . findListParent ( ) ; if ( this . deepLevel - rootListParent . deepLevel > 1 ) { parentObj = this . parent . getValue ( bodyObj ) ; } } else { if ( this . pare...
Replace value .
139,342
public ValidationData updateKey ( DetailParam detailParam ) { if ( detailParam == null ) { return this ; } this . methodKey = detailParam . getMethodKey ( ) ; this . parameterKey = this . paramType . getUniqueKey ( this . methodKey ) ; this . urlMapping = detailParam . isUrlMapping ( ) ; return this ; }
Update key validation data .
139,343
public boolean diffKey ( DetailParam detailParam ) { if ( detailParam == null ) { return false ; } if ( ! detailParam . getMethodKey ( ) . equals ( this . methodKey ) ) { return true ; } return detailParam . isUrlMapping ( ) != this . isUrlMapping ( ) ; }
Diff key boolean .
139,344
public void updateField ( Field field ) { this . name = field . getName ( ) ; this . obj = TypeCheckUtil . isObjClass ( field ) ; this . list = TypeCheckUtil . isListClass ( field ) ; this . number = TypeCheckUtil . isNumberClass ( field ) ; this . enumType = field . getType ( ) . isEnum ( ) ; this . typeClass = field ...
Update field .
139,345
public ValidationData minimalize ( ) { this . setValidationRules ( this . validationRules . stream ( ) . filter ( vr -> vr . isUse ( ) ) . collect ( Collectors . toList ( ) ) ) ; return this ; }
Minimalize validation data .
139,346
public ValidationData ruleSync ( List < ValidationRule > rules ) { List < ValidationRule > ruleList = new ArrayList < > ( ) ; rules . forEach ( rule -> { ValidationRule existRule = this . getExistRule ( rule ) ; ruleList . add ( existRule != null ? existRule : rule ) ; } ) ; this . validationRules . removeAll ( ruleLis...
Rule sync validation data .
139,347
public ValidationData findListParent ( ) { if ( ! this . listChild ) { return null ; } ValidationData parent = this . parent ; while ( parent != null && ! parent . isList ( ) ) { parent = parent . parent ; } return parent ; }
Find list parent validation data .
139,348
public RecordList getUniqueRecordsBy ( String fieldName ) { Set < String > uniqueKeys = new HashSet < String > ( ) ; final RecordListBuilder uniqueRecordListBuilder = new RecordListBuilder ( schema ) ; for ( int rowIndex = 0 ; rowIndex < this . size ( ) ; rowIndex ++ ) { final Record currentRecord = this . records . ge...
Picks the first available record by given fieldName
139,349
public static void main ( String [ ] args ) throws IOException { inputpath = "off_output/pcms/test_paget/input" ; outputpath = "off_output/pcms/test_paget/output" ; try { Stream < Path > paths = Files . walk ( Paths . get ( inputpath ) ) ; paths . forEach ( filePath -> { if ( Files . isRegularFile ( filePath ) && fileP...
give path with argv
139,350
public void writeFile ( String fn , HttpServletResponse res ) { ValidationFileUtil . initFileSendHeader ( res , ValidationFileUtil . getEncodingFileName ( fn + ".xls" ) , null ) ; try { this . workBook . write ( res . getOutputStream ( ) ) ; } catch ( IOException e ) { throw new ValidationLibException ( "workbook write...
Write file .
139,351
public void onSelectFilter ( SelectFilterEvent selectFilterEvent ) { for ( FacetWidget facetWidget : filterList ) { if ( facetWidget . getFacetField ( ) . equals ( selectFilterEvent . getFilterName ( ) ) ) { for ( FacetWidgetItem facetWidgetItem : facetWidget . getFacetWidgetItems ( ) ) { if ( facetWidgetItem . getValu...
When a SelectFilterEvent is triggered this method will look for the filter and value and will select it .
139,352
public < T > GenericMarker < T > createMarker ( T markerContext , GenericMapWidget mapWidget ) { this . map = mapWidget ; validateRequiredParameters ( ) ; if ( map instanceof GoogleV3MapWidget ) { return new GoogleV3Marker < T > ( this , markerContext ) ; } if ( map instanceof OfflineMapWidget ) { return new OfflineMap...
Final build method of the builder called once all parameters are setup for the Generic Marker
139,353
public static Resource getResource ( Object adaptable ) { if ( adaptable instanceof Resource ) { return ( Resource ) adaptable ; } else if ( adaptable instanceof SlingHttpServletRequest ) { SlingHttpServletRequest request = ( SlingHttpServletRequest ) adaptable ; return request . getResource ( ) ; } return null ; }
Tries to get the resource associated with the adaptable .
139,354
public void readState ( DataInputStream stream ) throws IOException { int len = mt . length ; for ( int x = 0 ; x < len ; x ++ ) mt [ x ] = stream . readInt ( ) ; len = mag01 . length ; for ( int x = 0 ; x < len ; x ++ ) mag01 [ x ] = stream . readInt ( ) ; mti = stream . readInt ( ) ; __nextNextGaussian = stream . rea...
Reads the entire state of the MersenneTwister RNG from the stream
139,355
public void writeState ( DataOutputStream stream ) throws IOException { int len = mt . length ; for ( int x = 0 ; x < len ; x ++ ) stream . writeInt ( mt [ x ] ) ; len = mag01 . length ; for ( int x = 0 ; x < len ; x ++ ) stream . writeInt ( mag01 [ x ] ) ; stream . writeInt ( mti ) ; stream . writeDouble ( __nextNextG...
Writes the entire state of the MersenneTwister RNG to the stream
139,356
synchronized public void setSeed ( final int [ ] array ) { if ( array . length == 0 ) throw new IllegalArgumentException ( "Array length must be greater than zero" ) ; int i , j , k ; setSeed ( 19650218 ) ; i = 1 ; j = 0 ; k = ( N > array . length ? N : array . length ) ; for ( ; k != 0 ; k -- ) { mt [ i ] = ( mt [ i ]...
Sets the seed of the MersenneTwister using an array of integers . Your array must have a non - zero length . Only the first 624 integers in the array are used ; if the array is shorter than this then integers are repeatedly used in a wrap - around fashion .
139,357
public void lire ( ) { try { String adressedufichier = System . getProperty ( "user.dir" ) + "\\monfichier.txt" ; FileReader fr = new FileReader ( adressedufichier ) ; BufferedReader br = new BufferedReader ( fr ) ; String texte = "" ; int a = 0 ; while ( a < 2 ) { texte = texte + br . readLine ( ) + "\n" ; a ++ ; } br...
je vais moins commenter cette partie c est presque la meme chose
139,358
public < T > T deserialize ( Class < T > clazz , String stringContainingSerialisedInput ) { T instance ; try { instance = storageSerializer . deserialize ( clazz , stringContainingSerialisedInput ) ; } catch ( SerializationException e ) { throw new IllegalStateException ( "unable to serialise" , e ) ; } return instance...
Returns an object from a serialised string
139,359
private BitSet parseQuery ( FilterQuery filterQuery , DataSchema schema ) { BitSet queryBitSet = new BitSet ( ) ; if ( filterQuery instanceof MatchAllQuery || filterQuery . getFilterQueries ( ) . size ( ) < 1 ) return queryBitSet ; for ( String filterField : filterQuery . getFilterQueries ( ) . keySet ( ) ) { final int...
Calculates which documents are available given the current FilterQuery selection
139,360
public ResultMetadata [ ] getResultMetadata ( ) throws LightblueParseException { JsonNode node = getJson ( ) . get ( "resultMetadata" ) ; if ( node instanceof ArrayNode ) { try { return getMapper ( ) . readValue ( node . traverse ( ) , ResultMetadata [ ] . class ) ; } catch ( IOException e ) { throw new LightblueParseE...
Returns a result metadata array where each element corresponds to the metadata for the result at the same index in processed array .
139,361
private Map < Feature , Feature > diffFeatures ( List < Feature > pcm1Features , List < Feature > pcm2Features , PCMElementComparator comparator , DiffResult result ) { List < Feature > commonFeatures = new ArrayList < Feature > ( ) ; List < Feature > featuresOnlyInPCM1 = new ArrayList < Feature > ( ) ; List < Feature ...
Compare the features of two PCMs
139,362
private Map < Product , Product > diffProducts ( List < Product > pcm1Products , List < Product > pcm2Products , PCMElementComparator comparator , DiffResult result ) { List < Product > commonProducts = new ArrayList < Product > ( ) ; List < Product > productsOnlyInPCM1 = new ArrayList < Product > ( ) ; List < Product ...
Compare the products of two PCMs
139,363
public static Object toPersistenceType ( Object value , Class < ? > parameterType ) { if ( ! isTypeConversionRequired ( parameterType ) ) { return value ; } if ( Map . class . isAssignableFrom ( parameterType ) && ( value instanceof Map ) ) { Map < ? , ? > map = ( Map < ? , ? > ) value ; Map . Entry < ? , ? > [ ] entri...
Convert object to be persisted .
139,364
public static Object fromPersistenceType ( Object value , Class < ? > parameterType ) { if ( ! isTypeConversionRequired ( parameterType ) ) { return value ; } if ( Map . class . isAssignableFrom ( parameterType ) && ( value instanceof String [ ] ) ) { String [ ] rows = ( String [ ] ) value ; Map < String , String > map...
Convert object from persistence to be used in configuration .
139,365
public void addFilter ( String field , String valueToFilter ) { if ( StringUtils . isEmpty ( field ) || StringUtils . isEmpty ( valueToFilter ) ) { throw new IllegalArgumentException ( "Expected all attributes to be non empty" ) ; } Set < String > valuesToFilter = new HashSet < String > ( ) ; valuesToFilter . add ( val...
add a filter to the to build FilterQuery instance
139,366
public void addMultipleValuesFilter ( String field , Set < String > valueToFilter ) { if ( ! valueToFilter . isEmpty ( ) ) { filterQueries . put ( field , new FilterFieldValue ( field , valueToFilter ) ) ; } }
add a filter with multiple values to build FilterQuery instance
139,367
public long nextLong ( final long n ) { if ( n <= 0 ) throw new IllegalArgumentException ( "n must be > 0" ) ; long bits , val ; do { bits = ( nextLong ( ) >>> 1 ) ; val = bits % n ; } while ( bits - val + ( n - 1 ) < 0 ) ; return val ; }
This method is for completness sake . Returns a long drawn uniformly from 0 to n - 1 . Suffice it to say n must be > 0 or an IllegalArgumentException is raised .
139,368
public void addDocument ( String ... fields ) { for ( int i = 0 ; i < fields . length ; i ++ ) { final DataType type = schema . getType ( i ) ; String field = fields [ i ] ; final Map < String , Set < Integer > > stringSetMap = this . fields . get ( i ) ; if ( type == DataType . DateYear ) { field = field . split ( "-"...
add fields on index
139,369
public void print ( PCM pcm ) { System . out . println ( "--- Products ---" ) ; for ( Product product : pcm . getProducts ( ) ) { System . out . println ( product . getKeyContent ( ) ) ; } pcm . accept ( this ) ; }
Print some information contained in a PCM
139,370
public void visit ( PCM pcm ) { for ( Product product : pcm . getProducts ( ) ) { product . accept ( this ) ; } }
Methods for the visitor
139,371
public String getSheetName ( int idx ) { String name = method + "|" + url . replace ( "/" , "|" ) ; if ( name . length ( ) > 30 ) { return name . substring ( 0 , 29 ) + idx ; } return name ; }
Gets sheet name .
139,372
private void setupIndexMonitor ( final DataSchema dataSchema , final GenericDataSource dataSource ) { logger . log ( FINE , "LuceneSearchServiceImpl::setupIndexMonitor Attempting to setup Index monitor..." ) ; try { if ( GoogleAppEngineUtil . isGaeEnv ( ) ) { return ; } if ( dataSource . getDataSourceType ( ) != Generi...
setup a monitor to watch for changes in datasource
139,373
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 (...
Gets url list from validation datas .
139,374
private void appendLiteral ( int word ) { if ( lastWordIndex == 0 && word == ConciseSetUtils . ALL_ZEROS_LITERAL && words [ 0 ] == 0x01FFFFFF ) { return ; } if ( lastWordIndex < 0 ) { words [ lastWordIndex = 0 ] = word ; return ; } final int lastWord = words [ lastWordIndex ] ; if ( word == ConciseSetUtils . ALL_ZEROS_...
Append a literal word after the last word
139,375
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 .
139,376
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 ( Coll...
Remove index data .
139,377
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 .
139,378
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 .
139,379
@ 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 ) { ...
Cast value object .
139,380
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 < Stri...
Map to object object .
139,381
public List < ValidationData > findByIds ( List < Long > ids ) { return this . datas . stream ( ) . filter ( d -> ids . contains ( d . getId ( ) ) ) . collect ( Collectors . toList ( ) ) ; }
Find by ids list .
139,382
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 . readFileToStr...
Find all list .
139,383
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 .
139,384
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 .
139,385
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 ( ) =...
Find by param type and method and url and name and parent id validation data .
139,386
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 .
139,387
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 .
139,388
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 ....
Find by method and url and name and parent id validation data .
139,389
public List < ValidationData > saveAll ( List < ValidationData > pDatas ) { pDatas . forEach ( this :: save ) ; return pDatas ; }
Save all list .
139,390
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 ) ; } Valid...
Save validation data .
139,391
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 .
139,392
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 (...
Convert object to json . If object contains fields of type date they will be converted to strings using lightblue date format .
139,393
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 .
139,394
public void clear ( ) { size = 0 ; Arrays . fill ( cells , EMPTY ) ; freecells = cells . length ; modCount ++ ; }
Removes all of the elements from this set .
139,395
protected void rehash ( ) { int gargagecells = cells . length - ( size + freecells ) ; if ( ( double ) gargagecells / cells . length > 0.05D ) { rehash ( cells . length ) ; } else { rehash ( ( cells . length << 1 ) + 1 ) ; } }
Figures out correct size for rehashed set then does the rehash .
139,396
protected void rehash ( int newCapacity ) { HashIntSet rehashed = new HashIntSet ( newCapacity ) ; @ SuppressWarnings ( "hiding" ) int [ ] cells = rehashed . cells ; for ( int element : this . cells ) { if ( element < 0 ) { continue ; } cells [ - ( rehashed . findElementOrEmpty ( element ) + 1 ) ] = element ; } this . ...
Rehashes to a bigger size .
139,397
public CheckPointHelper replaceExceptionCallback ( BasicCheckRule checkRule , ValidationInvalidCallback cb ) { this . msgChecker . replaceCallback ( checkRule , cb ) ; return this ; }
Replace the callback to be used basic exception .
139,398
public CheckPointHelper addValidationRule ( String ruleName , StandardValueType standardValueType , BaseValidationCheck validationCheck , AssistType assistType ) { ValidationRule rule = new ValidationRule ( ruleName , standardValueType , validationCheck ) ; if ( assistType == null ) { assistType = AssistType . all ( ) ...
Add the fresh user rule
139,399
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...
track an event