idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
123,000
void draw ( final DisplayerListener displayerListener ) { tableDisplayer . addListener ( displayerListener ) ; view . setDisplayer ( tableDisplayer ) ; tableDisplayer . draw ( ) ; }
Show the table displayer .
123,001
public void onPlugInAdded ( final PluginAdded event ) { Plugin plugin = event . getPlugin ( ) ; if ( isRuntimePerspective ( plugin ) ) { pluginMap . put ( plugin . getName ( ) , plugin ) ; perspectivesChangedEvent . fire ( new PerspectivePluginsChangedEvent ( ) ) ; } }
Sync up both the internals plugin & widget registry
123,002
public DataSetEditWorkflow edit ( final DataSetProviderType type ) { final boolean isSQL = type != null && DataSetProviderType . SQL . equals ( type ) ; final boolean isBean = type != null && DataSetProviderType . BEAN . equals ( type ) ; final boolean isCSV = type != null && DataSetProviderType . CSV . equals ( type )...
Obtain the bean for editing a data set definition for a given type .
123,003
public static String join ( Collection strings , String delimiter ) { StringBuilder builder = new StringBuilder ( ) ; Iterator < String > iter = strings . iterator ( ) ; while ( iter . hasNext ( ) ) { builder . append ( iter . next ( ) ) ; if ( ! iter . hasNext ( ) ) { break ; } builder . append ( delimiter ) ; } retur...
Joins a collection of string with a given delimiter .
123,004
public void draw ( ) { if ( displayerSettings == null ) { getView ( ) . errorMissingSettings ( ) ; } else if ( dataSetHandler == null ) { getView ( ) . errorMissingHandler ( ) ; } else if ( ! isDrawn ( ) ) { try { drawn = true ; getView ( ) . showLoading ( ) ; beforeLoad ( ) ; beforeDataSetLookup ( ) ; dataSetHandler ....
Draw the displayer by executing first the lookup call to retrieve the target data set
123,005
public void redraw ( ) { if ( ! isDrawn ( ) ) { draw ( ) ; } else { try { beforeLoad ( ) ; beforeDataSetLookup ( ) ; dataSetHandler . lookupDataSet ( new DataSetReadyCallback ( ) { public void callback ( DataSet result ) { try { dataSet = result ; afterDataSetLookup ( result ) ; updateVisualization ( ) ; afterRedraw ( ...
Just reload the data set and make the current displayer to redraw .
123,006
public List < Interval > filterIntervals ( String columnId ) { List < Interval > selected = columnSelectionMap . get ( columnId ) ; if ( selected == null ) { return new ArrayList < > ( ) ; } return selected ; }
Get the current filter intervals for the given data set column .
123,007
public Interval filterInterval ( String columnId , int idx ) { List < Interval > selected = columnSelectionMap . get ( columnId ) ; if ( selected != null && ! selected . isEmpty ( ) ) { for ( Interval interval : selected ) { if ( interval . getIndex ( ) == idx ) { return interval ; } } } return null ; }
Get the current filter interval matching the specified index
123,008
public List < Integer > filterIndexes ( String columnId ) { List < Integer > result = new ArrayList < > ( ) ; List < Interval > selected = columnSelectionMap . get ( columnId ) ; if ( selected == null ) { return result ; } for ( Interval interval : selected ) { result . add ( interval . getIndex ( ) ) ; } return result...
Get the current filter selected interval indexes for the given data set column .
123,009
public void filterUpdate ( String columnId , int row , Integer maxSelections ) { if ( displayerSettings . isFilterEnabled ( ) ) { List < Interval > selectedIntervals = columnSelectionMap . get ( columnId ) ; Interval intervalFiltered = filterInterval ( columnId , row ) ; if ( intervalFiltered != null ) { selectedInterv...
Updates the current filter values for the given data set column .
123,010
public void filterApply ( String columnId , List < Interval > intervalList ) { if ( displayerSettings . isFilterEnabled ( ) ) { DataSetGroup groupOp = dataSetHandler . getGroupOperation ( columnId ) ; groupOp . setSelectedIntervalList ( intervalList ) ; if ( displayerSettings . isFilterNotificationEnabled ( ) ) { for (...
Filter the values of the given column .
123,011
public void filterApply ( DataSetFilter filter ) { if ( displayerSettings . isFilterEnabled ( ) ) { this . currentFilter = filter ; if ( displayerSettings . isFilterNotificationEnabled ( ) ) { for ( DisplayerListener listener : listenerList ) { listener . onFilterEnabled ( this , filter ) ; } } if ( displayerSettings ....
Apply the given filter
123,012
public void filterUpdate ( DataSetFilter filter ) { if ( displayerSettings . isFilterEnabled ( ) ) { DataSetFilter oldFilter = currentFilter ; this . currentFilter = filter ; if ( displayerSettings . isFilterNotificationEnabled ( ) ) { for ( DisplayerListener listener : listenerList ) { listener . onFilterUpdate ( this...
Updates the current filter values for the given data set column . Any previous filter is reset .
123,013
public void filterReset ( String columnId ) { if ( displayerSettings . isFilterEnabled ( ) ) { columnSelectionMap . remove ( columnId ) ; DataSetGroup groupOp = dataSetHandler . getGroupOperation ( columnId ) ; if ( displayerSettings . isFilterNotificationEnabled ( ) ) { for ( DisplayerListener listener : listenerList ...
Clear any filter on the given column .
123,014
public void filterReset ( ) { if ( displayerSettings . isFilterEnabled ( ) ) { List < DataSetGroup > groupOpList = new ArrayList < DataSetGroup > ( ) ; for ( String columnId : columnSelectionMap . keySet ( ) ) { DataSetGroup groupOp = dataSetHandler . getGroupOperation ( columnId ) ; groupOpList . add ( groupOp ) ; } c...
Clear any filter .
123,015
private void hideLoadingPopup ( ) { final Element e = RootPanel . get ( "loading" ) . getElement ( ) ; new Animation ( ) { protected void onUpdate ( double progress ) { e . getStyle ( ) . setOpacity ( 1.0 - progress ) ; } protected void onComplete ( ) { e . getStyle ( ) . setVisibility ( Style . Visibility . HIDDEN ) ;...
Fade out the Loading application pop - up
123,016
public Image getSnapshot ( ) { String code = getBase64Image ( nativeCanvas ) ; if ( code == null ) return null ; Image image = new Image ( code ) ; return image ; }
Creates snapshot of current state of chart as image
123,017
protected static void printDataSet ( DataSet dataSet ) { final String SPACER = "| \t |" ; if ( dataSet == null ) System . out . println ( "DataSet is null" ) ; if ( dataSet . getRowCount ( ) == 0 ) System . out . println ( "DataSet is empty" ) ; List < DataColumn > dataSetColumns = dataSet . getColumns ( ) ; int colCol...
Helper method to print to standard output the dataset values .
123,018
public void draw ( final List < Displayer > displayerList ) { Set < ChartPackage > packageList = EnumSet . noneOf ( ChartPackage . class ) ; for ( Displayer displayer : displayerList ) { try { GoogleDisplayer googleDisplayer = ( GoogleDisplayer ) displayer ; packageList . add ( _packageTypes . get ( googleDisplayer . g...
In Google the renderer mechanism is asynchronous .
123,019
public static Class < ? > getImplementationClassOfLocalName ( final String sLocalName ) { final EUBLTRDocumentType eDocType = getDocumentTypeOfLocalName ( sLocalName ) ; return eDocType == null ? null : eDocType . getImplementationClass ( ) ; }
Get the domain object class of the passed document element local name .
123,020
public static EUBLTRDocumentType getDocumentTypeOfImplementationClass ( final Class < ? > aImplClass ) { if ( aImplClass == null ) return null ; return ArrayHelper . findFirst ( EUBLTRDocumentType . values ( ) , eDocType -> eDocType . getImplementationClass ( ) . equals ( aImplClass ) ) ; }
Get the UBLTR document type matching the passed implementation class .
123,021
public static Schema getSchemaOfLocalName ( final String sLocalName ) { final EUBLTRDocumentType eDocType = getDocumentTypeOfLocalName ( sLocalName ) ; return eDocType == null ? null : eDocType . getSchema ( ) ; }
Get the XSD Schema object for the UBLTR document type of the passed document element local name .
123,022
public static Schema getSchemaOfImplementationClass ( final Class < ? > aImplClass ) { final EUBLTRDocumentType eDocType = getDocumentTypeOfImplementationClass ( aImplClass ) ; return eDocType == null ? null : eDocType . getSchema ( ) ; }
Get the XSD Schema object for the UBLTR document type of the passed implementation class .
123,023
public static Class < ? > getImplementationClassOfNamespace ( final String sNamespace ) { final EUBL21DocumentType eDocType = getDocumentTypeOfNamespace ( sNamespace ) ; return eDocType == null ? null : eDocType . getImplementationClass ( ) ; }
Get the domain object class of the passed namespace .
123,024
public static Schema getSchemaOfNamespace ( final String sNamespace ) { final EUBL21DocumentType eDocType = getDocumentTypeOfNamespace ( sNamespace ) ; return eDocType == null ? null : eDocType . getSchema ( ) ; }
Get the XSD Schema object for the UBL 2 . 1 document type of the passed namespace .
123,025
protected String getRoot ( ) { JsonObject result = ( ( JsonObject ) new JsonParser ( ) . parse ( raw ) ) ; String root = null ; for ( Map . Entry < String , JsonElement > member : result . entrySet ( ) ) { root = member . getKey ( ) ; } return root ; }
Get the name of the root JSON result
123,026
protected void attachSecurityInfo ( HttpRequestBase request ) throws IOException , URISyntaxException { if ( ! SECURITY_ENDPOINT_DOES_NOT_EXIST . equals ( securityToken ) ) { try { if ( securityToken == null ) { HttpGet httpGet = new HttpGet ( getWsapiUrl ( ) + SECURITY_TOKEN_URL ) ; httpGet . addHeader ( BasicScheme ....
Attach the security token parameter to the request .
123,027
public CreateResponse create ( CreateRequest request ) throws IOException { return new CreateResponse ( client . doPost ( request . toUrl ( ) , request . getBody ( ) ) ) ; }
Create the specified object .
123,028
public UpdateResponse update ( UpdateRequest request ) throws IOException { return new UpdateResponse ( client . doPost ( request . toUrl ( ) , request . getBody ( ) ) ) ; }
Update the specified object .
123,029
public CollectionUpdateResponse updateCollection ( CollectionUpdateRequest request ) throws IOException { return new CollectionUpdateResponse ( client . doPost ( request . toUrl ( ) , request . getBody ( ) ) ) ; }
Update the specified collection . Note that this method is only usable with WSAPI versions 2 . 0 and above .
123,030
public DeleteResponse delete ( DeleteRequest request ) throws IOException { return new DeleteResponse ( client . doDelete ( request . toUrl ( ) ) ) ; }
Delete the specified object .
123,031
public QueryResponse query ( QueryRequest request ) throws IOException { QueryResponse queryResponse = new QueryResponse ( client . doGet ( request . toUrl ( ) ) ) ; if ( queryResponse . wasSuccessful ( ) ) { int receivedRecords = request . getPageSize ( ) ; while ( receivedRecords < request . getLimit ( ) && ( receive...
Query for objects matching the specified request . By default one page of data will be returned . Paging will automatically be performed if a limit is set on the request .
123,032
public GetResponse get ( GetRequest request ) throws IOException { return new GetResponse ( client . doGet ( request . toUrl ( ) ) ) ; }
Get the specified object .
123,033
public static QueryFilter and ( QueryFilter ... queryFilters ) { QueryFilter result = null ; for ( QueryFilter q : queryFilters ) { result = result == null ? q : result . and ( q ) ; } return result ; }
Get a query filter that is the ANDed combination of the specified filters .
123,034
public static QueryFilter or ( QueryFilter ... queryFilters ) { QueryFilter result = null ; for ( QueryFilter q : queryFilters ) { result = result == null ? q : result . or ( q ) ; } return result ; }
Get a query filter that is the ORed combination of the specified filters .
123,035
public String getBody ( ) { JsonObject wrapper = new JsonObject ( ) ; wrapper . add ( type , obj ) ; return gsonBuilder . create ( ) . toJson ( wrapper ) ; }
Get the JSON encoded string representation of the object to be created .
123,036
public static String getRelativeRef ( String ref ) { Matcher matcher = match ( ref ) ; return matcher != null ? String . format ( "/%s/%s" , matcher . group ( 1 ) , matcher . group ( 2 ) ) : null ; }
Create a relative ref url from the specified ref
123,037
public static String getTypeFromRef ( String ref ) { Matcher matcher = match ( ref ) ; return matcher != null ? matcher . group ( 1 ) : null ; }
Get the type from the specified ref url
123,038
public static String getOidFromRef ( String ref ) { Matcher matcher = match ( ref ) ; return matcher != null ? matcher . group ( 2 ) : null ; }
Get the ObjectID from the specified ref url
123,039
public void addParam ( String name , String value ) { getParams ( ) . add ( new BasicNameValuePair ( name , value ) ) ; }
Add the specified parameter to this request .
123,040
public void setProxy ( URI proxy ) { this . getParams ( ) . setParameter ( ConnRoutePNames . DEFAULT_PROXY , new HttpHost ( proxy . getHost ( ) , proxy . getPort ( ) , proxy . getScheme ( ) ) ) ; }
Set the unauthenticated proxy server to use . By default no proxy is configured .
123,041
public String doPost ( String url , String body ) throws IOException { HttpPost httpPost = new HttpPost ( getWsapiUrl ( ) + url ) ; httpPost . setEntity ( new StringEntity ( body , "utf-8" ) ) ; return doRequest ( httpPost ) ; }
Perform a post against the WSAPI
123,042
public String doPut ( String url , String body ) throws IOException { HttpPut httpPut = new HttpPut ( getWsapiUrl ( ) + url ) ; httpPut . setEntity ( new StringEntity ( body , "utf-8" ) ) ; return doRequest ( httpPut ) ; }
Perform a put against the WSAPI
123,043
public String doDelete ( String url ) throws IOException { HttpDelete httpDelete = new HttpDelete ( getWsapiUrl ( ) + url ) ; return doRequest ( httpDelete ) ; }
Perform a delete against the WSAPI
123,044
public String doGet ( String url ) throws IOException { HttpGet httpGet = new HttpGet ( getWsapiUrl ( ) + url ) ; return doRequest ( httpGet ) ; }
Perform a get against the WSAPI
123,045
public FormElementController addElement ( FormElementController element , int position ) { if ( element instanceof FormSectionController ) { throw new IllegalArgumentException ( "Sub-sections are not supported" ) ; } if ( elements . containsKey ( element . getName ( ) ) ) { throw new IllegalArgumentException ( "Element...
Adds a form element to this section . Note that sub - sections are not supported .
123,046
public FormElementController removeElement ( String name ) { FormElementController element = elements . remove ( name ) ; orderedElements . remove ( element ) ; return element ; }
Removes the form element with the specified name from this section .
123,047
public void setIsRequired ( boolean required ) { if ( ! required ) { validators . remove ( REQUIRED_FIELD_VALIDATOR ) ; } else if ( ! isRequired ( ) ) { validators . add ( REQUIRED_FIELD_VALIDATOR ) ; } }
Sets whether this field is required to have user input .
123,048
private Set < Object > retrieveModelValues ( ) { Set < Object > modelValues = ( Set < Object > ) getModel ( ) . getValue ( getName ( ) ) ; if ( modelValues == null ) { modelValues = new HashSet < > ( ) ; } return modelValues ; }
Returns the values hold in the model .
123,049
public int getNumberOfElements ( ) { int count = 0 ; for ( FormSectionController section : getSections ( ) ) { count += section . getElements ( ) . size ( ) ; } return count ; }
Returns the total number of elements in this form not including sections .
123,050
public List < ValidationError > validateInput ( ) { List < ValidationError > errors = new ArrayList < ValidationError > ( ) ; for ( FormSectionController section : getSections ( ) ) { for ( FormElementController element : section . getElements ( ) ) { if ( element instanceof LabeledFieldController ) { LabeledFieldContr...
Returns a list of validation errors of the form s input
123,051
protected void recreateViews ( ) { ViewGroup containerView = ( ViewGroup ) getActivity ( ) . findViewById ( R . id . form_elements_container ) ; formController . recreateViews ( containerView ) ; }
Recreates the views for all the elements that are in the form . This method needs to be called when field are dynamically added or removed
123,052
public File download ( String pathToFile , String extension ) { return fileDownloadRequest . download ( pathToFile , extension ) ; }
Download file from Selenium Node .
123,053
private void refreshAccessToken ( ) { final Long expiresIn = credential . getExpiresInSeconds ( ) ; String accessToken = credential . getAccessToken ( ) ; if ( accessToken == null || expiresIn != null && expiresIn <= 60 ) { try { credential . refreshToken ( ) ; accessToken = credential . getAccessToken ( ) ; } catch ( ...
Refresh the Google Cloud API access token if necessary .
123,054
private < T > PubsubFuture < T > get ( final String operation , final String path , final ResponseReader < T > responseReader ) { return request ( operation , HttpMethod . GET , path , responseReader ) ; }
Make a GET request .
123,055
private < T > PubsubFuture < T > post ( final String operation , final String path , final Object payload , final ResponseReader < T > responseReader ) { return request ( operation , HttpMethod . POST , path , payload , responseReader ) ; }
Make a POST request .
123,056
private < T > PubsubFuture < T > put ( final String operation , final String path , final Object payload , final ResponseReader < T > responseReader ) { return request ( operation , HttpMethod . PUT , path , payload , responseReader ) ; }
Make a PUT request .
123,057
private < T > PubsubFuture < T > delete ( final String operation , final String path , final ResponseReader < T > responseReader ) { return request ( operation , HttpMethod . DELETE , path , responseReader ) ; }
Make a DELETE request .
123,058
public CompletableFuture < String > publish ( final String topic , final Message message ) { final TopicQueue queue = topics . computeIfAbsent ( topic , TopicQueue :: new ) ; final CompletableFuture < String > future = queue . send ( message ) ; listener . publishingMessage ( this , topic , message , future ) ; return ...
Publish a message on a specific topic .
123,059
public int topicQueueSize ( final String topic ) { final TopicQueue topicQueue = this . topics . get ( topic ) ; return topicQueue == null ? 0 : topicQueue . queue . size ( ) ; }
Get the current queue size for the given topic name . Returns 0 if the topic does not exist .
123,060
private void sendPending ( ) { while ( outstanding . get ( ) < concurrency ) { final TopicQueue queue = pendingTopics . poll ( ) ; if ( queue == null ) { return ; } queue . pending = false ; final int sent = queue . sendBatch ( ) ; if ( sent == batchSize ) { queue . pending = true ; pendingTopics . offer ( queue ) ; } ...
Send any pending topics .
123,061
private void serve ( HttpRequest request , HttpResponse response ) { String url = request . getUri ( ) ; System . out . println ( "[Server] serve " + url ) ; IncomingWebRequestTracer incomingWebrequestTracer = oneAgentSDK . traceIncomingWebRequest ( webAppInfo , url , request . getMethod ( ) ) ; for ( Entry < String , ...
faked http request handling . shows usage of OneAgent SDK s incoming webrequest API
123,062
private void receiveMessage ( ) { MessagingSystemInfo messagingSystemInfo = oneAgentSdk . createMessagingSystemInfo ( "DynatraceSample" , "theQueue" , MessageDestinationType . QUEUE , ChannelType . IN_PROCESS , null ) ; IncomingMessageReceiveTracer incomingMessageReceiveTracer = oneAgentSdk . traceIncomingMessageReceiv...
shows how to trace a blocking receive of a message
123,063
public void versionDownloadableFound ( String versionDownloadable ) { if ( Comparator . isVersionDownloadableNewer ( mActivity , versionDownloadable ) ) { if ( hasToShowNotice ( versionDownloadable ) && ! hasUserTappedToNotShowNoticeAgain ( versionDownloadable ) ) { mLibraryResultCallaback . foundUpdateAndShowIt ( vers...
If the library found a version available on the Store and it s different from the installed one notify it to the user .
123,064
private boolean hasUserTappedToNotShowNoticeAgain ( String versionDownloadable ) { SharedPreferences prefs = mActivity . getSharedPreferences ( PREFS_FILENAME , 0 ) ; String prefKey = DONT_SHOW_AGAIN_PREF_KEY + versionDownloadable ; return prefs . getBoolean ( prefKey , false ) ; }
Get if the user has tapped on No thanks button on dialog for this downloable version .
123,065
private void saveNumberOfChecksForUpdatedVersion ( String versionDownloadable , int mChecksMade ) { mChecksMade ++ ; SharedPreferences prefs = mActivity . getSharedPreferences ( PREFS_FILENAME , 0 ) ; SharedPreferences . Editor editor = prefs . edit ( ) ; editor . putInt ( SUCCESSFUL_CHEKS_PREF_KEY + versionDownloadabl...
Update number of checks for this version downloadable from the Store .
123,066
public static boolean isVersionDownloadableNewer ( Activity mActivity , String versionDownloadable ) { String versionInstalled = null ; try { versionInstalled = mActivity . getPackageManager ( ) . getPackageInfo ( mActivity . getPackageName ( ) , 0 ) . versionName ; } catch ( PackageManager . NameNotFoundException igno...
Compare the string versionDownloadable to the version installed of the app .
123,067
public static boolean isAvailable ( Context context ) { boolean connected = false ; ConnectivityManager cm = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; if ( cm != null ) { NetworkInfo ni = cm . getActiveNetworkInfo ( ) ; if ( ni != null ) { connected = ni . isConnected ( ) ;...
Check if a network is available
123,068
protected void onPostExecute ( Integer result ) { if ( result == VERSION_DOWNLOADABLE_FOUND ) { mResultInterface . versionDownloadableFound ( mVersionDownloadable ) ; } else if ( result == NETWORK_ERROR ) { mResultInterface . networkError ( ) ; Network . logConnectionError ( ) ; } else if ( result == MULTIPLE_APKS_PUBL...
Return to UpdateChecker class to work with the versionDownloadable if the library found it .
123,069
public static String makeServicePath ( String serviceName ) { checkNotNull ( serviceName ) ; checkArgument ( ! "" . equals ( serviceName ) ) ; return ZKPaths . makePath ( ROOT_SERVICES_PATH , serviceName ) ; }
Construct the path in ZooKeeper to where a service s children live .
123,070
public ServiceCachingPolicyBuilder withMaxServiceInstanceIdleTime ( int maxServiceInstanceIdleTime , TimeUnit unit ) { checkState ( maxServiceInstanceIdleTime > 0 ) ; checkNotNull ( unit ) ; _maxServiceInstanceIdleTimeNanos = unit . toNanos ( maxServiceInstanceIdleTime ) ; return this ; }
Set the amount of time a cached instance is allowed to sit idle in the cache before being eligible for expiration . If never called cached instances will not expire solely due to idle time .
123,071
private void destroyService ( ServiceHandle < S > serviceHandle ) { try { _serviceFactory . destroy ( serviceHandle . getEndPoint ( ) , serviceHandle . getService ( ) ) ; } catch ( Exception e ) { LOG . warn ( "Error destroying serviceHandle" , e ) ; } }
Destroys a service handle quietly swallows any exception occurred
123,072
public PartitionContextBuilder put ( String key , Object value ) { _map . put ( key , value ) ; return this ; }
Adds the specified key and value to the partition context . Null keys or values and duplicate keys are not allowed .
123,073
public static InstanceMetrics forInstance ( MetricRegistry metrics , Object instance , String serviceName ) { return new InstanceMetrics ( metrics , instance , serviceName ) ; }
Create a metrics instance that corresponds to a single instance of a class . This is useful for cases where there exists one instance per service . For example in a ServicePool .
123,074
private String [ ] collectPartitionKeyAnnotations ( Method method ) { Annotation [ ] [ ] annotations = method . getParameterAnnotations ( ) ; String [ ] keyMappings = new String [ annotations . length ] ; boolean keyMappingFound = false ; Map < String , Integer > unique = Maps . newHashMap ( ) ; for ( int i = 0 ; i < a...
Returns an array indexed by argument index with the value of the
123,075
public void checkIn ( ServiceHandle < S > handle ) throws Exception { checkNotNull ( handle ) ; S service = handle . getService ( ) ; ServiceEndPoint endPoint = handle . getEndPoint ( ) ; Long invalidRevision = _invalidRevisions . get ( endPoint ) ; Long serviceRevision = _checkedOutRevisions . remove ( handle ) ; if (...
Returns a service instance for an end point to the cache so that it may be used by other users .
123,076
private List < Integer > computeHashCodes ( String endPointId ) { List < Integer > list = Lists . newArrayListWithCapacity ( _entriesPerEndPoint ) ; for ( int i = 0 ; list . size ( ) < _entriesPerEndPoint ; i ++ ) { Hasher hasher = Hashing . md5 ( ) . newHasher ( ) ; hasher . putInt ( i ) ; putUnencodedChars ( hasher ,...
Returns a list of pseudo - random 32 - bit values derived from the specified end point ID .
123,077
public static < S > void close ( S dynamicProxy ) { try { Closeables . close ( getPool ( dynamicProxy ) , true ) ; } catch ( IOException e ) { throw new AssertionError ( ) ; } }
Closes the service pool associated with the specified dynamic service proxy .
123,078
@ SuppressWarnings ( "UnusedParameters" ) protected String serialize ( String serviceName , String id , Payload payload ) { return String . valueOf ( payload ) ; }
Subclasses may override this to customize the persistent format of the payload .
123,079
static String getDeepName ( final Element element ) { if ( element == null ) { return "" ; } return getDeepName ( element . getParentElement ( ) ) + '/' + element . getName ( ) ; }
Returns fully qualified name for an Xml element .
123,080
static boolean isElementParentName ( Element element , String name ) { Element parent = element . getParentElement ( ) ; if ( parent == null ) { return false ; } return isElementName ( parent , name ) ; }
Returns true if an elements parents name is same as argument
123,081
void createWrappedStructure ( final WrapperFactory factory ) { HierarchyWrapper currentWrapper = null ; for ( Content child : castToContentList ( elementContent ) ) { Wrapper < ? > wrapper = factory . create ( child ) ; if ( wrapper instanceof SingleNewlineInTextWrapper ) { continue ; } if ( currentWrapper == null ) { ...
Traverses the initial xml element wrapper and builds hierarchy
123,082
void processOperation ( HierarchyWrapperOperation operation ) { operation . startOfProcess ( ) ; otherContentList . forEach ( operation :: processOtherContent ) ; if ( elementContent != null && elementContent . isContentElement ( ) ) { operation . processElement ( elementContent ) ; } operation . manipulateChildElement...
Template method to traverse xml hierarchy
123,083
public void scanForIgnoredSections ( String originalXml ) { this . originalXml = originalXml ; SortpomPiScanner sortpomPiScanner = new SortpomPiScanner ( logger ) ; sortpomPiScanner . scan ( originalXml ) ; if ( sortpomPiScanner . isScanError ( ) ) { throw new FailureException ( sortpomPiScanner . getFirstError ( ) ) ;...
Checks if pom file contains any processing instructions
123,084
public String getIndentCharacters ( ) { if ( nrOfIndentSpace == 0 ) { return "" ; } if ( nrOfIndentSpace == INDENT_TAB ) { return "\t" ; } if ( nrOfIndentSpace < INDENT_TAB || nrOfIndentSpace > MAX_INDENT_SPACES ) { throw new FailureException ( "nrOfIndentSpace cannot be below -1 or above 255, was: " + nrOfIndentSpace ...
Gets the indent characters from parameter .
123,085
public void setup ( PluginParameters parameters ) { this . pomFile = parameters . pomFile ; this . backupFileExtension = parameters . backupFileExtension ; this . encoding = parameters . encoding ; this . customSortOrderFile = parameters . customSortOrderFile ; this . predefinedSortOrder = parameters . predefinedSortOr...
Initializes the class with sortpom parameters .
123,086
public String getPomFileContent ( ) { try ( InputStream inputStream = new FileInputStream ( pomFile ) ) { return IOUtils . toString ( inputStream , encoding ) ; } catch ( UnsupportedCharsetException ex ) { throw new FailureException ( "Could not handle encoding: " + encoding , ex ) ; } catch ( IOException ex ) { throw ...
Loads the pom file that will be sorted .
123,087
private String getDefaultSortOrderXml ( ) throws IOException { CheckedSupplier < InputStream , IOException > createStreamFunc = ( ) -> { if ( customSortOrderFile != null ) { UrlWrapper urlWrapper = new UrlWrapper ( customSortOrderFile ) ; if ( urlWrapper . isUrl ( ) ) { return urlWrapper . openStream ( ) ; } else { ret...
Retrieves the default sort order for sortpom
123,088
private InputStream openCustomSortOrderFile ( ) throws FileNotFoundException { InputStream inputStream ; try { inputStream = new FileInputStream ( customSortOrderFile ) ; } catch ( FileNotFoundException ex ) { try { URL resource = this . getClass ( ) . getClassLoader ( ) . getResource ( customSortOrderFile ) ; if ( res...
Load custom sort order file from absolute or class path .
123,089
public static XmlOrderedResult nameDiffers ( String originalElementName , String newElementName ) { return new XmlOrderedResult ( false , String . format ( "The xml element <%s> should be placed before <%s>" , newElementName , originalElementName ) ) ; }
The xml elements was not in the right order
123,090
public void processElement ( Wrapper < Element > elementWrapper ) { Element content = elementWrapper . getContent ( ) ; content . detach ( ) ; content . removeContent ( ) ; }
Detach each xml element
123,091
public void scan ( String originalXml ) { Matcher matcher = INSTRUCTION_PATTERN . matcher ( originalXml ) ; while ( matcher . find ( ) ) { scanOneInstruction ( matcher . group ( 1 ) ) ; containsIgnoredSections = true ; } if ( expectedNextInstruction != IGNORE ) { addError ( String . format ( "Xml processing instruction...
Scan and verifies the pom file for processing instructions
123,092
public void processElement ( Wrapper < Element > elementWrapper ) { Element element = elementWrapper . getContent ( ) ; element . setAttributes ( getSortedAttributes ( element ) ) ; }
Sort attributes of each element
123,093
public void processOtherContent ( Wrapper < Content > content ) { if ( parentElement != null ) { parentElement . addContent ( content . getContent ( ) ) ; } }
Add all other content to the parent xml element
123,094
public void processElement ( Wrapper < Element > element ) { activeElement = element . getContent ( ) ; if ( parentElement != null ) { parentElement . addContent ( activeElement ) ; } }
Add the element to its parent
123,095
public void manipulateChildElements ( List < HierarchyWrapper > children ) { for ( int i = 0 ; i < children . size ( ) ; i ++ ) { HierarchyWrapper wrapperImpl = children . get ( i ) ; final Wrapper < Element > wrapper = wrapperImpl . getElementContent ( ) ; if ( wrapper != null && wrapper . isSortable ( ) ) { insertChi...
Sort all children of an element
123,096
public void startOfProcess ( ) { String previousBaseIndent = baseIndent . substring ( INDENT_LENGTH ) ; builder . append ( previousBaseIndent ) . append ( "HierarchyWrapper{\n" ) ; processFirstOtherContent = true ; }
Add text before each element
123,097
public void processOtherContent ( Wrapper < Content > content ) { if ( processFirstOtherContent ) { builder . append ( baseIndent ) . append ( "otherContentList=" ) . append ( "\n" ) ; processFirstOtherContent = false ; } builder . append ( content . toString ( baseIndent ) ) . append ( "\n" ) ; }
Add each other element to string
123,098
public void processElement ( Wrapper < Element > elementWrapper ) { builder . append ( baseIndent ) . append ( "elementContent=" ) . append ( elementWrapper ) . append ( "\n" ) ; }
Add each element to string
123,099
public void manipulateChildElements ( List < HierarchyWrapper > children ) { if ( ! children . isEmpty ( ) ) { builder . append ( baseIndent ) . append ( "children=" ) . append ( "\n" ) ; } }
Add text before processing each child