idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
32,500 | public static int hash ( ByteBuffer buf , int seed ) { ByteOrder byteOrder = buf . order ( ) ; buf . order ( ByteOrder . LITTLE_ENDIAN ) ; int m = 0x5bd1e995 ; int r = 24 ; int h = seed ^ buf . remaining ( ) ; while ( buf . remaining ( ) >= 4 ) { int k = buf . getInt ( ) ; k *= m ; k ^= k >>> r ; k *= m ; h *= m ; h ^=... | Hashes the bytes in a buffer from the current position to the limit . |
32,501 | public String getTopologyJsonPayload ( Set < Host > activeHosts ) { int count = NUM_RETRIER_ACROSS_NODES ; String response ; Exception lastEx = null ; do { try { response = getTopologyFromRandomNodeWithRetry ( activeHosts ) ; if ( response != null ) { return response ; } } catch ( Exception e ) { lastEx = e ; } finally... | Tries to get topology information by randomly trying across nodes . |
32,502 | public Host getRandomHost ( Set < Host > activeHosts ) { Random random = new Random ( ) ; List < Host > hostsUp = new ArrayList < Host > ( CollectionUtils . filter ( activeHosts , new Predicate < Host > ( ) { public boolean apply ( Host x ) { return x . isUp ( ) ; } } ) ) ; return hostsUp . get ( random . nextInt ( hos... | Finds a random host from the set of active hosts to perform cluster_describe |
32,503 | private String getTopologyFromRandomNodeWithRetry ( Set < Host > activeHosts ) { int count = NUM_RETRIES_PER_NODE ; String nodeResponse ; Exception lastEx ; final Host randomHost = getRandomHost ( activeHosts ) ; do { try { lastEx = null ; nodeResponse = getResponseViaHttp ( randomHost . getHostName ( ) ) ; if ( nodeRe... | Tries multiple nodes and it only bubbles up the last node s exception . We want to bubble up the exception in order for the last node to be removed from the connection pool . |
32,504 | List < HostToken > parseTokenListFromJson ( String json ) { List < HostToken > hostTokens = new ArrayList < HostToken > ( ) ; JSONParser parser = new JSONParser ( ) ; try { JSONArray arr = ( JSONArray ) parser . parse ( json ) ; Iterator < ? > iter = arr . iterator ( ) ; while ( iter . hasNext ( ) ) { Object item = ite... | package - private for Test |
32,505 | public void start ( final BaseCallback < Authentication , AuthenticationException > callback ) { credentialsRequest . start ( new BaseCallback < Credentials , AuthenticationException > ( ) { public void onSuccess ( final Credentials credentials ) { userInfoRequest . addHeader ( HEADER_AUTHORIZATION , "Bearer " + creden... | Starts the log in request and then fetches the user s profile |
32,506 | public Authentication execute ( ) throws Auth0Exception { Credentials credentials = credentialsRequest . execute ( ) ; UserProfile profile = userInfoRequest . addHeader ( HEADER_AUTHORIZATION , "Bearer " + credentials . getAccessToken ( ) ) . execute ( ) ; return new Authentication ( profile , credentials ) ; } | Logs in the user with Auth0 and fetches it s profile . |
32,507 | public Map < String , Object > getExtraInfo ( ) { return extraInfo != null ? new HashMap < > ( extraInfo ) : Collections . < String , Object > emptyMap ( ) ; } | Returns extra information of the profile that is not part of the normalized profile |
32,508 | public SignUpRequest addAuthenticationParameters ( Map < String , Object > parameters ) { authenticationRequest . addAuthenticationParameters ( parameters ) ; return this ; } | Add additional parameters sent when logging the user in |
32,509 | public void start ( final BaseCallback < Credentials , AuthenticationException > callback ) { signUpRequest . start ( new BaseCallback < DatabaseUser , AuthenticationException > ( ) { public void onSuccess ( final DatabaseUser user ) { authenticationRequest . start ( callback ) ; } public void onFailure ( Authenticatio... | Starts to execute create user request and then logs the user in . |
32,510 | public void bindService ( ) { Log . v ( TAG , "Trying to bind the service" ) ; Context context = this . context . get ( ) ; isBound = false ; if ( context != null && preferredPackage != null ) { isBound = CustomTabsClient . bindCustomTabsService ( context , preferredPackage , this ) ; } Log . v ( TAG , "Bind request re... | Attempts to bind the Custom Tabs Service to the Context . |
32,511 | public void unbindService ( ) { Log . v ( TAG , "Trying to unbind the service" ) ; Context context = this . context . get ( ) ; if ( isBound && context != null ) { context . unbindService ( this ) ; isBound = false ; } } | Attempts to unbind the Custom Tabs Service from the Context . |
32,512 | public void getToken ( String authorizationCode , final AuthCallback callback ) { apiClient . token ( authorizationCode , redirectUri ) . setCodeVerifier ( codeVerifier ) . start ( new BaseCallback < Credentials , AuthenticationException > ( ) { public void onSuccess ( Credentials payload ) { callback . onSuccess ( pay... | Performs a request to the Auth0 API to get the OAuth Token and end the PKCE flow . The instance of this class must be disposed after this method is called . |
32,513 | private boolean checkPermissions ( Activity activity ) { String [ ] permissions = getRequiredAndroidPermissions ( ) ; return handler . areAllPermissionsGranted ( activity , permissions ) ; } | Checks if all the required Android Manifest . permissions have already been granted . |
32,514 | private void requestPermissions ( Activity activity , int requestCode ) { String [ ] permissions = getRequiredAndroidPermissions ( ) ; handler . requestPermissions ( activity , permissions , requestCode ) ; } | Starts the async Permission Request . The caller activity will be notified of the result on the onRequestPermissionsResult method from the ActivityCompat . OnRequestPermissionsResultCallback interface . |
32,515 | public DelegationRequest < T > addParameters ( Map < String , Object > parameters ) { request . addParameters ( parameters ) ; return this ; } | Add additional parameters to be sent in the request |
32,516 | public DelegationRequest < T > setScope ( String scope ) { request . addParameter ( ParameterBuilder . SCOPE_KEY , scope ) ; return this ; } | Set the scope used to make the delegation |
32,517 | @ SuppressWarnings ( "WeakerAccess" ) private ParameterizableRequest < Void , AuthenticationException > passwordless ( ) { HttpUrl url = HttpUrl . parse ( auth0 . getDomainUrl ( ) ) . newBuilder ( ) . addPathSegment ( PASSWORDLESS_PATH ) . addPathSegment ( START_PATH ) . build ( ) ; final Map < String , Object > parame... | Start a custom passwordless flow |
32,518 | public AuthenticationRequest setConnection ( String connection ) { if ( ! hasLegacyPath ( ) ) { Log . w ( TAG , "Not setting the 'connection' parameter as the request is using a OAuth 2.0 API Authorization endpoint that doesn't support it." ) ; return this ; } addParameter ( CONNECTION_KEY , connection ) ; return this ... | Sets the connection parameter . |
32,519 | public AuthenticationRequest setRealm ( String realm ) { if ( hasLegacyPath ( ) ) { Log . w ( TAG , "Not setting the 'realm' parameter as the request is using a Legacy Authorization API endpoint that doesn't support it." ) ; return this ; } addParameter ( REALM_KEY , realm ) ; return this ; } | Sets the realm parameter . A realm identifies the host against which the authentication will be made and usually helps to know which username and password to use . |
32,520 | public DatabaseConnectionRequest < T , U > addParameters ( Map < String , Object > parameters ) { request . addParameters ( parameters ) ; return this ; } | Add the given parameters to the request |
32,521 | public DatabaseConnectionRequest < T , U > addParameter ( String name , Object value ) { request . addParameter ( name , value ) ; return this ; } | Add a parameter by name to the request |
32,522 | public DatabaseConnectionRequest < T , U > setConnection ( String connection ) { request . addParameter ( ParameterBuilder . CONNECTION_KEY , connection ) ; return this ; } | Set the Auth0 Database Connection used for this request using its name . |
32,523 | public OkHttpClient createClient ( boolean loggingEnabled , boolean tls12Enforced , int connectTimeout , int readTimeout , int writeTimeout ) { return modifyClient ( new OkHttpClient ( ) , loggingEnabled , tls12Enforced , connectTimeout , readTimeout , writeTimeout ) ; } | This method creates an instance of OKHttpClient according to the provided parameters . It is used internally and is not intended to be used directly . |
32,524 | private void enforceTls12 ( OkHttpClient client ) { if ( Build . VERSION . SDK_INT < Build . VERSION_CODES . JELLY_BEAN || Build . VERSION . SDK_INT > Build . VERSION_CODES . LOLLIPOP ) { return ; } try { SSLContext sc = SSLContext . getInstance ( "TLSv1.2" ) ; sc . init ( null , null , null ) ; client . setSslSocketFa... | Enable TLS 1 . 2 on the OkHttpClient on API 16 - 21 which is supported but not enabled by default . |
32,525 | public ParameterBuilder addAll ( Map < String , Object > parameters ) { if ( parameters != null ) { for ( String k : parameters . keySet ( ) ) { if ( parameters . get ( k ) != null ) { this . parameters . put ( k , parameters . get ( k ) ) ; } } } return this ; } | Adds all parameter from a map |
32,526 | public boolean isValid ( int expectedRequestCode ) { Uri uri = intent != null ? intent . getData ( ) : null ; if ( uri == null ) { Log . d ( TAG , "Result is invalid: Received Intent's Uri is null." ) ; return false ; } if ( requestCode == MISSING_REQUEST_CODE ) { return true ; } boolean fromRequest = getRequestCode ( ... | Checks if the received data is valid and can be parsed . |
32,527 | public boolean hasValidCredentials ( ) { String accessToken = storage . retrieveString ( KEY_ACCESS_TOKEN ) ; String refreshToken = storage . retrieveString ( KEY_REFRESH_TOKEN ) ; String idToken = storage . retrieveString ( KEY_ID_TOKEN ) ; Long expiresAt = storage . retrieveLong ( KEY_EXPIRES_AT ) ; return ! ( isEmpt... | Checks if a non - expired pair of credentials can be obtained from this manager . |
32,528 | public void clearCredentials ( ) { storage . remove ( KEY_ACCESS_TOKEN ) ; storage . remove ( KEY_REFRESH_TOKEN ) ; storage . remove ( KEY_ID_TOKEN ) ; storage . remove ( KEY_TOKEN_TYPE ) ; storage . remove ( KEY_EXPIRES_AT ) ; storage . remove ( KEY_SCOPE ) ; } | Removes the credentials from the storage if present . |
32,529 | public void clearCredentials ( ) { storage . remove ( KEY_CREDENTIALS ) ; storage . remove ( KEY_EXPIRES_AT ) ; storage . remove ( KEY_CAN_REFRESH ) ; Log . d ( TAG , "Credentials were just removed from the storage" ) ; } | Delete the stored credentials |
32,530 | public boolean hasValidCredentials ( ) { String encryptedEncoded = storage . retrieveString ( KEY_CREDENTIALS ) ; Long expiresAt = storage . retrieveLong ( KEY_EXPIRES_AT ) ; Boolean canRefresh = storage . retrieveBoolean ( KEY_CAN_REFRESH ) ; return ! ( isEmpty ( encryptedEncoded ) || expiresAt == null || expiresAt <=... | Returns whether this manager contains a valid non - expired pair of credentials . |
32,531 | public boolean hasNext ( ) { if ( ! members . hasNext ( ) ) { try { getNextEntries ( ) ; } catch ( final Exception ignored ) { LOG . error ( "An error occured while getting next entries" , ignored ) ; } } return members . hasNext ( ) ; } | Returns true if more entries are available . |
32,532 | public ClientEntry next ( ) { if ( hasNext ( ) ) { final Entry romeEntry = members . next ( ) ; try { if ( ! romeEntry . isMediaEntry ( ) ) { return new ClientEntry ( null , collection , romeEntry , true ) ; } else { return new ClientMediaEntry ( null , collection , romeEntry , true ) ; } } catch ( final ProponoExcepti... | Get next entry in collection . |
32,533 | public ClientEntry getEntry ( final String uri ) throws ProponoException { final GetMethod method = new GetMethod ( uri ) ; authStrategy . addAuthentication ( httpClient , method ) ; try { httpClient . executeMethod ( method ) ; if ( method . getStatusCode ( ) != 200 ) { throw new ProponoException ( "ERROR HTTP status ... | Get full entry specified by entry edit URI . Note that entry may or may not be associated with this collection . |
32,534 | public ClientMediaEntry createMediaEntry ( final String title , final String slug , final String contentType , final byte [ ] bytes ) throws ProponoException { if ( ! isWritable ( ) ) { throw new ProponoException ( "Collection is not writable" ) ; } return new ClientMediaEntry ( service , this , title , slug , contentT... | Create new media entry assocaited with collection but do not save . server . Depending on the Atom server you may or may not be able to persist the properties of the entry that is returned . |
32,535 | public ClientMediaEntry createMediaEntry ( final String title , final String slug , final String contentType , final InputStream is ) throws ProponoException { if ( ! isWritable ( ) ) { throw new ProponoException ( "Collection is not writable" ) ; } return new ClientMediaEntry ( service , this , title , slug , contentT... | Create new media entry assocaited with collection but do not save . server . Depending on the Atom server you may or may not be able to . persist the properties of the entry that is returned . |
32,536 | public Module parse ( final Element elem , final Locale locale ) { final AppModule m = new AppModuleImpl ( ) ; final Element control = elem . getChild ( "control" , getContentNamespace ( ) ) ; if ( control != null ) { final Element draftElem = control . getChild ( "draft" , getContentNamespace ( ) ) ; if ( draftElem !=... | Parse JDOM element into module |
32,537 | public InputStream getAsStream ( ) throws ProponoException { if ( getContents ( ) != null && ! getContents ( ) . isEmpty ( ) ) { final Content c = getContents ( ) . get ( 0 ) ; if ( c . getSrc ( ) != null ) { return getResourceAsStream ( ) ; } else if ( inputStream != null ) { return inputStream ; } else if ( bytes != ... | Get media resource as an InputStream should work regardless of whether you set the media resource data as an InputStream or as a byte array . |
32,538 | public void update ( ) throws ProponoException { if ( partial ) { throw new ProponoException ( "ERROR: attempt to update partial entry" ) ; } EntityEnclosingMethod method = null ; final Content updateContent = getContents ( ) . get ( 0 ) ; try { if ( getMediaLinkURI ( ) != null && getBytes ( ) != null ) { method = new ... | Update entry on server . |
32,539 | public final synchronized void setSyndFeed ( final SyndFeed feed ) { super . setSyndFeed ( feed ) ; changedMap . clear ( ) ; final List < SyndEntry > entries = feed . getEntries ( ) ; for ( final SyndEntry entry : entries ) { final String currentEntryTag = computeEntryTag ( entry ) ; final String previousEntryTag = ent... | Overrides super class method to update changedMap and entryTagsMap for tracking changed entries . |
32,540 | public void setContent ( final String contentString , final String type ) { final Content newContent = new Content ( ) ; newContent . setType ( type == null ? Content . HTML : type ) ; newContent . setValue ( contentString ) ; final ArrayList < Content > contents = new ArrayList < Content > ( ) ; contents . add ( newCo... | Set content of entry . |
32,541 | public void setContent ( final Content c ) { final ArrayList < Content > contents = new ArrayList < Content > ( ) ; contents . add ( c ) ; setContents ( contents ) ; } | Convenience method to set first content object in content collection . Atom 1 . 0 allows only one content element per entry . |
32,542 | public Content getContent ( ) { if ( getContents ( ) != null && ! getContents ( ) . isEmpty ( ) ) { final Content c = getContents ( ) . get ( 0 ) ; return c ; } return null ; } | Convenience method to get first content object in content collection . Atom 1 . 0 allows only one content element per entry . |
32,543 | public void remove ( ) throws ProponoException { if ( getEditURI ( ) == null ) { throw new ProponoException ( "ERROR: cannot delete unsaved entry" ) ; } final DeleteMethod method = new DeleteMethod ( getEditURI ( ) ) ; addAuthentication ( method ) ; try { getHttpClient ( ) . executeMethod ( method ) ; } catch ( final I... | Remove entry from server . |
32,544 | public String getEditURI ( ) { for ( int i = 0 ; i < getOtherLinks ( ) . size ( ) ; i ++ ) { final Link link = getOtherLinks ( ) . get ( i ) ; if ( link . getRel ( ) != null && link . getRel ( ) . equals ( "edit" ) ) { return link . getHrefResolved ( ) ; } } return null ; } | Get the URI that can be used to edit the entry via HTTP PUT or DELETE . |
32,545 | public void setDefaultContentIndex ( final Integer defaultContentIndex ) { for ( int i = 0 ; i < getContents ( ) . length ; i ++ ) { if ( i == defaultContentIndex . intValue ( ) ) { getContents ( ) [ i ] . setDefaultContent ( true ) ; } else { getContents ( ) [ i ] . setDefaultContent ( false ) ; } } this . defaultCont... | Default content index MediaContent . |
32,546 | public Element workspaceToElement ( ) { final Workspace space = this ; final Element element = new Element ( "workspace" , AtomService . ATOM_PROTOCOL ) ; final Element titleElem = new Element ( "title" , AtomService . ATOM_FORMAT ) ; titleElem . setText ( space . getTitle ( ) ) ; if ( space . getTitleType ( ) != null ... | Serialize an AtomService . DefaultWorkspace object into an XML element |
32,547 | protected void parseWorkspaceElement ( final Element element ) throws ProponoException { final Element titleElem = element . getChild ( "title" , AtomService . ATOM_FORMAT ) ; setTitle ( titleElem . getText ( ) ) ; if ( titleElem . getAttribute ( "type" , AtomService . ATOM_FORMAT ) != null ) { setTitleType ( titleElem... | Deserialize a Atom workspace XML element into an object |
32,548 | public Workspace findWorkspace ( final String title ) { for ( final Object element : workspaces ) { final Workspace ws = ( Workspace ) element ; if ( title . equals ( ws . getTitle ( ) ) ) { return ws ; } } return null ; } | Find workspace by title . |
32,549 | public Document serviceToDocument ( ) { final AtomService service = this ; final Document doc = new Document ( ) ; final Element root = new Element ( "service" , ATOM_PROTOCOL ) ; doc . setRootElement ( root ) ; final List < Workspace > spaces = service . getWorkspaces ( ) ; for ( final Workspace space : spaces ) { roo... | Serialize an AtomService object into an XML document |
32,550 | public synchronized void sortOnProperty ( final Object value , final boolean ascending , final ValueStrategy strategy ) { final int elementCount = size ( ) ; for ( int i = 0 ; i < elementCount - 1 ; i ++ ) { for ( int j = i + 1 ; j < elementCount ; j ++ ) { final T entry1 = get ( i ) ; final T entry2 = get ( j ) ; fina... | performs a selection sort on all the beans in the List |
32,551 | public InputStream getAsStream ( ) throws BlogClientException { final HttpClient httpClient = new HttpClient ( ) ; final GetMethod method = new GetMethod ( permalink ) ; try { httpClient . executeMethod ( method ) ; } catch ( final Exception e ) { throw new BlogClientException ( "ERROR: error reading file" , e ) ; } if... | Get media resource as input stream . |
32,552 | protected SAXBuilder createSAXBuilder ( ) { SAXBuilder saxBuilder ; if ( validate ) { saxBuilder = new SAXBuilder ( XMLReaders . DTDVALIDATING ) ; } else { saxBuilder = new SAXBuilder ( XMLReaders . NONVALIDATING ) ; } saxBuilder . setEntityResolver ( RESOLVER ) ; try { final XMLReader parser = saxBuilder . createParse... | Creates and sets up a org . jdom2 . input . SAXBuilder for parsing . |
32,553 | public String getRootCauseMessage ( ) { String rcmessage = null ; if ( getRootCause ( ) != null ) { if ( getRootCause ( ) . getCause ( ) != null ) { rcmessage = getRootCause ( ) . getCause ( ) . getMessage ( ) ; } rcmessage = rcmessage == null ? getRootCause ( ) . getMessage ( ) : rcmessage ; rcmessage = rcmessage == n... | Get root cause message . |
32,554 | public String getHrefResolved ( ) { if ( Atom10Parser . isAbsoluteURI ( href ) ) { return href ; } else if ( baseURI != null && categoriesElement != null ) { return Atom10Parser . resolveURI ( baseURI , categoriesElement , href ) ; } return null ; } | Get unresolved URI of the collection or null if impossible to determine |
32,555 | public static < T > List < T > createWhenNull ( final List < T > list ) { if ( list == null ) { return new ArrayList < T > ( ) ; } else { return list ; } } | Returns the list when it is not null . Returns a new list otherwise . |
32,556 | public static < T > List < T > create ( final T item ) { final List < T > list = new ArrayList < T > ( ) ; list . add ( item ) ; return list ; } | Creates a new List with the given item as the first entry . |
32,557 | public static < T > T firstEntry ( final List < T > list ) { if ( list != null && ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } else { return null ; } } | Extracts the first entry of the list when it is not null and contains values . |
32,558 | public static boolean sizeIs ( final List < ? > list , final int size ) { if ( size == 0 ) { return list == null || list . isEmpty ( ) ; } else { return list != null && list . size ( ) == size ; } } | Checks whether the list has the given size . A null list is treated like a list without entries . |
32,559 | public static < T > List < T > emptyToNull ( final List < T > list ) { if ( isEmpty ( list ) ) { return null ; } else { return list ; } } | Returns null when the given list is empty or null |
32,560 | public static Long parseLong ( final String str ) { if ( null != str ) { try { return new Long ( Long . parseLong ( str . trim ( ) ) ) ; } catch ( final Exception e ) { } } return null ; } | Parses a Long out of a string . |
32,561 | public static Float parseFloat ( final String str ) { if ( null != str ) { try { return new Float ( Float . parseFloat ( str . trim ( ) ) ) ; } catch ( final Exception e ) { } } return null ; } | Parse a Float from a String without exceptions . If the String is not a Float then null is returned |
32,562 | public static float parseFloat ( final String str , final float def ) { final Float result = parseFloat ( str ) ; if ( result == null ) { return def ; } else { return result . floatValue ( ) ; } } | Parse a float from a String with a default value |
32,563 | public static long parseLong ( final String str , final long def ) { final Long ret = parseLong ( str ) ; if ( ret == null ) { return def ; } else { return ret . longValue ( ) ; } } | Parses a long out of a string . |
32,564 | public static PropertiesLoader getPropertiesLoader ( ) { synchronized ( PropertiesLoader . class ) { final ClassLoader classLoader = ConfigurableClassLoader . INSTANCE . getClassLoader ( ) ; PropertiesLoader loader = clMap . get ( classLoader ) ; if ( loader == null ) { try { loader = new PropertiesLoader ( MASTER_PLUG... | Returns the PropertiesLoader singleton used by ROME to load plugin components . |
32,565 | public static void serializeEntry ( final Entry entry , final Writer writer ) throws IllegalArgumentException , FeedException , IOException { final List < Entry > entries = new ArrayList < Entry > ( ) ; entries . add ( entry ) ; final Feed feed1 = new Feed ( ) ; feed1 . setFeedType ( "atom_1.0" ) ; feed1 . setEntries (... | Utility method to serialize an entry to writer . |
32,566 | public SyndFeed retrieveFeed ( final String userAgent , final URL feedUrl ) throws IllegalArgumentException , IOException , FeedException , FetcherException { if ( feedUrl == null ) { throw new IllegalArgumentException ( "null is not a valid URL" ) ; } final URLConnection connection = feedUrl . openConnection ( ) ; if ... | Retrieve a feed over HTTP |
32,567 | private static Object newInstance ( final String className , ClassLoader cl , final boolean doFallback ) throws ConfigurationError { try { Class < ? > providerClass ; if ( cl == null ) { providerClass = Class . forName ( className ) ; } else { try { providerClass = cl . loadClass ( className ) ; } catch ( final ClassNo... | Create an instance of a class using the specified ClassLoader and optionally fall back to the current ClassLoader if not found . |
32,568 | static Object find ( final String factoryId , final String fallbackClassName ) throws ConfigurationError { ClassLoader classLoader = ss . getContextClassLoader ( ) ; if ( classLoader == null ) { classLoader = FactoryFinder . class . getClassLoader ( ) ; } dPrint ( "find factoryId =" + factoryId ) ; try { final String s... | Finds the implementation Class object in the specified order . Main entry point . |
32,569 | public static Double parse ( final String s ) { Double parsed = null ; try { if ( s != null ) { parsed = Double . parseDouble ( s ) ; } } catch ( final NumberFormatException e ) { } return parsed ; } | Converts a String into an Double . |
32,570 | public static PriceTypeEnumeration findByValue ( final String value ) { if ( value . equalsIgnoreCase ( "negotiable" ) ) { return PriceTypeEnumeration . NEGOTIABLE ; } else { return PriceTypeEnumeration . STARTING ; } } | Returns a PriceTypeEnumeration based on the String value or null . |
32,571 | protected void populateChannel ( final Channel channel , final Element eChannel ) { final String title = channel . getTitle ( ) ; if ( title != null ) { eChannel . addContent ( generateSimpleElement ( "title" , title ) ) ; } final String link = channel . getLink ( ) ; if ( link != null ) { eChannel . addContent ( gener... | Populates the given channel with parsed data from the ROME element that holds the channel data . |
32,572 | protected SyndEntry createSyndEntry ( final Item item , final boolean preserveWireItem ) { final SyndEntry syndEntry = super . createSyndEntry ( item , preserveWireItem ) ; final Description desc = item . getDescription ( ) ; if ( desc != null ) { final SyndContent descContent = new SyndContentImpl ( ) ; descContent . ... | rss . description - > synd . description |
32,573 | protected void doDelete ( final HttpServletRequest req , final HttpServletResponse res ) throws ServletException , IOException { LOG . debug ( "Entering" ) ; final AtomHandler handler = createAtomRequestHandler ( req , res ) ; final String userName = handler . getAuthenticatedUsername ( ) ; if ( userName != null ) { fi... | Handle Atom DELETE by calling appropriate handler . |
32,574 | public String getAttributeValue ( final String name ) { final List < Attribute > attributes = Collections . synchronizedList ( getAttributes ( ) ) ; for ( int i = 0 ; i < attributes . size ( ) ; i ++ ) { final Attribute a = attributes . get ( i ) ; if ( a . getName ( ) != null && a . getName ( ) . equals ( name ) ) { r... | Returns the value of an attribute on the outline or null . |
32,575 | public void sendUpdateNotification ( final String hub , final String topic ) throws NotificationException { try { final StringBuilder sb = new StringBuilder ( "hub.mode=publish&hub.url=" ) . append ( URLEncoder . encode ( topic , "UTF-8" ) ) ; final URL hubUrl = new URL ( hub ) ; final HttpURLConnection connection = ( ... | Sends the HUB url a notification of a change in topic |
32,576 | public void sendUpdateNotification ( final String topic , final SyndFeed feed ) throws NotificationException { for ( final SyndLink link : feed . getLinks ( ) ) { if ( "hub" . equals ( link . getRel ( ) ) ) { sendUpdateNotification ( link . getRel ( ) , topic ) ; return ; } } throw new NotificationException ( "Hub link... | Sends a notification for a feed located at topic . The feed MUST contain rel = hub . |
32,577 | public void sendUpdateNotification ( final SyndFeed feed ) throws NotificationException { SyndLink hub = null ; SyndLink self = null ; for ( final SyndLink link : feed . getLinks ( ) ) { if ( "hub" . equals ( link . getRel ( ) ) ) { hub = link ; } if ( "self" . equals ( link . getRel ( ) ) ) { self = link ; } if ( hub ... | Sends a notification for a feed . The feed MUST contain rel = hub and rel = self links . |
32,578 | public void sendUpdateNotificationAsyncronously ( final String hub , final String topic , final AsyncNotificationCallback callback ) { final Runnable r = new Runnable ( ) { public void run ( ) { try { sendUpdateNotification ( hub , topic ) ; callback . onSuccess ( ) ; } catch ( final Throwable t ) { callback . onFailur... | Sends the HUB url a notification of a change in topic asynchronously |
32,579 | public Categories getCategories ( final AtomRequest areq ) throws AtomException { LOG . debug ( "getCollection" ) ; final String [ ] pathInfo = StringUtils . split ( areq . getPathInfo ( ) , "/" ) ; final String handle = pathInfo [ 0 ] ; final String collection = pathInfo [ 1 ] ; final FileBasedCollection col = service... | Returns null because we use in - line categories . |
32,580 | public Feed getCollection ( final AtomRequest areq ) throws AtomException { LOG . debug ( "getCollection" ) ; final String [ ] pathInfo = StringUtils . split ( areq . getPathInfo ( ) , "/" ) ; final String handle = pathInfo [ 0 ] ; final String collection = pathInfo [ 1 ] ; final FileBasedCollection col = service . fin... | Get collection specified by pathinfo . |
32,581 | public Entry postEntry ( final AtomRequest areq , final Entry entry ) throws AtomException { LOG . debug ( "postEntry" ) ; final String [ ] pathInfo = StringUtils . split ( areq . getPathInfo ( ) , "/" ) ; final String handle = pathInfo [ 0 ] ; final String collection = pathInfo [ 1 ] ; final FileBasedCollection col = ... | Create a new entry specified by pathInfo and posted entry . We save the submitted Atom entry verbatim but we do set the id and reset the update time . |
32,582 | public void putEntry ( final AtomRequest areq , final Entry entry ) throws AtomException { LOG . debug ( "putEntry" ) ; final String [ ] pathInfo = StringUtils . split ( areq . getPathInfo ( ) , "/" ) ; final String handle = pathInfo [ 0 ] ; final String collection = pathInfo [ 1 ] ; final String fileName = pathInfo [ ... | Update entry specified by pathInfo and posted entry . |
32,583 | public void deleteEntry ( final AtomRequest areq ) throws AtomException { LOG . debug ( "deleteEntry" ) ; final String [ ] pathInfo = StringUtils . split ( areq . getPathInfo ( ) , "/" ) ; final String handle = pathInfo [ 0 ] ; final String collection = pathInfo [ 1 ] ; final String fileName = pathInfo [ 2 ] ; final Fi... | Delete entry specified by pathInfo . |
32,584 | public Entry postMedia ( final AtomRequest areq , final Entry entry ) throws AtomException { final String slug = areq . getHeader ( "Slug" ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "postMedia - title: " + entry . getTitle ( ) + " slug:" + slug ) ; } try { final File tempFile = null ; final String [ ] pathInfo... | Store media data in collection specified by pathInfo create an Atom media - link entry to store metadata for the new media file and return that entry to the caller . |
32,585 | public void putMedia ( final AtomRequest areq ) throws AtomException { LOG . debug ( "putMedia" ) ; final String [ ] pathInfo = StringUtils . split ( areq . getPathInfo ( ) , "/" ) ; final String handle = pathInfo [ 0 ] ; final String collection = pathInfo [ 1 ] ; final String fileName = pathInfo [ 3 ] ; final FileBase... | Update the media file part of a media - link entry . |
32,586 | public boolean isAtomServiceURI ( final AtomRequest areq ) { final String [ ] pathInfo = StringUtils . split ( areq . getPathInfo ( ) , "/" ) ; if ( pathInfo . length == 0 ) { return true ; } return false ; } | Return true if specified pathinfo represents URI of service doc . |
32,587 | public boolean isCategoriesURI ( final AtomRequest areq ) { LOG . debug ( "isCategoriesDocumentURI" ) ; final String [ ] pathInfo = StringUtils . split ( areq . getPathInfo ( ) , "/" ) ; if ( pathInfo . length == 3 && "categories" . equals ( pathInfo [ 2 ] ) ) { return true ; } return false ; } | Return true if specified pathinfo represents URI of category doc . |
32,588 | public boolean isCollectionURI ( final AtomRequest areq ) { LOG . debug ( "isCollectionURI" ) ; final String [ ] pathInfo = StringUtils . split ( areq . getPathInfo ( ) , "/" ) ; if ( pathInfo . length == 2 ) { final String handle = pathInfo [ 0 ] ; final String collection = pathInfo [ 1 ] ; if ( service . findCollecti... | Return true if specified pathinfo represents URI of a collection . |
32,589 | public String authenticateBASIC ( final HttpServletRequest request ) { LOG . debug ( "authenticateBASIC" ) ; boolean valid = false ; String userID = null ; String password = null ; try { final String authHeader = request . getHeader ( "Authorization" ) ; if ( authHeader != null ) { final StringTokenizer st = new String... | BASIC authentication . |
32,590 | public boolean isMediaEntry ( ) { boolean mediaEntry = false ; final List < Link > links = getOtherLinks ( ) ; for ( final Link link : links ) { if ( "edit-media" . equals ( link . getRel ( ) ) ) { mediaEntry = true ; break ; } } return mediaEntry ; } | Returns true if entry is a media entry i . e . has rel = edit - media . |
32,591 | protected void enqueueNotification ( final Notification not ) { final Runnable r = new Runnable ( ) { public void run ( ) { not . lastRun = System . currentTimeMillis ( ) ; final SubscriptionSummary summary = postNotification ( not . subscriber , not . mimeType , not . payload ) ; if ( ! summary . isLastPublishSuccessf... | Enqueues a notification to run . If the notification fails it will be retried every two minutes until 5 attempts are completed . Notifications to the same callback should be delivered successfully in order . |
32,592 | protected void retry ( final Notification not ) { if ( ! pendings . contains ( not . subscriber . getCallback ( ) ) ) { pendings . add ( not . subscriber . getCallback ( ) ) ; timer . schedule ( new TimerTask ( ) { public void run ( ) { pendings . remove ( not . subscriber . getCallback ( ) ) ; enqueueNotification ( no... | Schedules a notification to retry in two minutes . |
32,593 | protected List < Element > getItems ( final Element rssRoot ) { final Element eChannel = rssRoot . getChild ( "channel" , getRSSNamespace ( ) ) ; if ( eChannel != null ) { return eChannel . getChildren ( "item" , getRSSNamespace ( ) ) ; } else { return Collections . emptyList ( ) ; } } | It looks for the item elements under the channel elemment . |
32,594 | protected Element getImage ( final Element rssRoot ) { final Element eChannel = rssRoot . getChild ( "channel" , getRSSNamespace ( ) ) ; if ( eChannel != null ) { return eChannel . getChild ( "image" , getRSSNamespace ( ) ) ; } else { return null ; } } | It looks for the image elements under the channel elemment . |
32,595 | protected Element getTextInput ( final Element rssRoot ) { final String elementName = getTextInputLabel ( ) ; final Element eChannel = rssRoot . getChild ( "channel" , getRSSNamespace ( ) ) ; if ( eChannel != null ) { return eChannel . getChild ( elementName , getRSSNamespace ( ) ) ; } else { return null ; } } | It looks for the textinput elements under the channel elemment . |
32,596 | public List < Category > getCategories ( ) { return categories == null ? ( categories = new ArrayList < Category > ( ) ) : categories ; } | The parent categories for this feed |
32,597 | public static Long parseDecimal ( final String s ) { Long parsed = null ; try { if ( s != null ) { parsed = ( long ) Double . parseDouble ( s ) ; } } catch ( final NumberFormatException e ) { } return parsed ; } | Converts a String into a Long by first parsing it as Double and then casting it to Long . |
32,598 | public void add ( final double latitude , final double longitude ) { ensureCapacity ( size + 1 ) ; this . longitude [ size ] = longitude ; this . latitude [ size ] = latitude ; ++ size ; } | Add a position at the end of the list |
32,599 | public void insert ( final int pos , final double latitude , final double longitude ) { ensureCapacity ( size + 1 ) ; System . arraycopy ( this . longitude , pos , this . longitude , pos + 1 , size - pos ) ; System . arraycopy ( this . latitude , pos , this . latitude , pos + 1 , size - pos ) ; this . longitude [ pos ]... | Add a position at a given index in the list . The rest of the list is shifted one place to the right |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.