idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
34,600 | public String getAsString ( String key ) { Object value = mValues . get ( key ) ; return value != null ? value . toString ( ) : null ; } | Gets a value and converts it to a String . |
34,601 | public int getVersion ( ) throws SQLException { try { return this . submit ( new VersionCallable ( ) ) . get ( ) ; } catch ( InterruptedException e ) { logger . log ( Level . SEVERE , "Failed to get database version" , e ) ; throw new SQLException ( e ) ; } catch ( ExecutionException e ) { logger . log ( Level . SEVERE... | Returns the current version of the database . |
34,602 | public < T > Future < T > submit ( SQLCallable < T > callable ) { return this . submitTaskToQueue ( new SQLQueueCallable < T > ( db , callable ) ) ; } | Submits a database task for execution |
34,603 | public < T > Future < T > submitTransaction ( SQLCallable < T > callable ) { return this . submitTaskToQueue ( new SQLQueueCallable < T > ( db , callable , true ) ) ; } | Submits a database task for execution in a transaction |
34,604 | public void shutdown ( ) { if ( acceptTasks . getAndSet ( false ) ) { Future < ? > close = queue . submit ( new Runnable ( ) { public void run ( ) { db . close ( ) ; } } ) ; queue . shutdown ( ) ; try { close . get ( ) ; queue . awaitTermination ( 5 , TimeUnit . MINUTES ) ; } catch ( InterruptedException e ) { logger .... | Shuts down this database queue and closes the underlying database connection . Any tasks previously submitted for execution will still be executed however the queue will not accept additional tasks |
34,605 | private < T > Future < T > submitTaskToQueue ( SQLQueueCallable < T > callable ) { if ( acceptTasks . get ( ) ) { return queue . submit ( callable ) ; } else { throw new RejectedExecutionException ( "Database is closed" ) ; } } | Adds a task to the queue checking if the queue is still open to accepting tasks |
34,606 | public synchronized String getSQLiteVersion ( ) { if ( this . sqliteVersion == null ) { try { this . sqliteVersion = this . submit ( new SQLiteVersionCallable ( ) ) . get ( ) ; return sqliteVersion ; } catch ( InterruptedException e ) { logger . log ( Level . WARNING , "Could not determine SQLite version" , e ) ; } cat... | Returns the SQLite Version . |
34,607 | private boolean validateEncryptionKeyData ( KeyData data ) { if ( data . getIv ( ) . length != ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE ) { LOGGER . warning ( "IV does not have the expected size: " + ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE + " bytes" ) ; return false ; } return true ; } | PRIVATE HELPER METHODS |
34,608 | @ SuppressWarnings ( "unchecked" ) private List < DBParameter > parametersToIndexRevision ( DocumentRevision rev , String indexName , List < FieldSort > fieldNames ) { Misc . checkNotNull ( rev , "rev" ) ; Misc . checkNotNull ( indexName , "indexName" ) ; Misc . checkNotNull ( fieldNames , "fieldNames" ) ; int arrayCou... | Returns a List of DBParameters containing table name and ContentValues to index a document in an index . |
34,609 | private static SQLDatabase internalOpenSQLDatabase ( File dbFile , KeyProvider provider ) throws SQLException { boolean runningOnAndroid = Misc . isRunningOnAndroid ( ) ; boolean useSqlCipher = ( provider . getEncryptionKey ( ) != null ) ; try { if ( runningOnAndroid ) { if ( useSqlCipher ) { return ( SQLDatabase ) Cla... | Internal method for creating a SQLDatabase that allows a null filename to create an in - memory database which can be useful for performing checks but creating in - memory databases is not permitted from outside of this class hence the private visibility . |
34,610 | public Task createDocument ( Task task ) { DocumentRevision rev = new DocumentRevision ( ) ; rev . setBody ( DocumentBodyFactory . create ( task . asMap ( ) ) ) ; try { DocumentRevision created = this . mDocumentStore . database ( ) . create ( rev ) ; return Task . fromRevision ( created ) ; } catch ( DocumentException... | Creates a task assigning an ID . |
34,611 | public Task updateDocument ( Task task ) throws ConflictException , DocumentStoreException { DocumentRevision rev = task . getDocumentRevision ( ) ; rev . setBody ( DocumentBodyFactory . create ( task . asMap ( ) ) ) ; try { DocumentRevision updated = this . mDocumentStore . database ( ) . update ( rev ) ; return Task ... | Updates a Task document within the DocumentStore . |
34,612 | public void deleteDocument ( Task task ) throws ConflictException , DocumentNotFoundException , DocumentStoreException { this . mDocumentStore . database ( ) . delete ( task . getDocumentRevision ( ) ) ; } | Deletes a Task document within the DocumentStore . |
34,613 | protected static boolean validFieldName ( String fieldName ) { String [ ] parts = fieldName . split ( "\\." ) ; for ( String part : parts ) { if ( part . startsWith ( "$" ) ) { String msg = String . format ( "Field names cannot start with a $ in field %s" , part ) ; logger . log ( Level . SEVERE , msg ) ; return false ... | Validate the field name string is usable . |
34,614 | public static String tokenizerToJson ( Tokenizer tokenizer ) { Map < String , String > settingsMap = new HashMap < String , String > ( ) ; if ( tokenizer != null ) { settingsMap . put ( TOKENIZE , tokenizer . tokenizerName ) ; settingsMap . put ( TOKENIZE_ARGS , tokenizer . tokenizerArguments ) ; } return JSONUtils . s... | Convert Tokenizer into serialized options or empty map if null |
34,615 | public static UnindexedMatcher matcherWithSelector ( Map < String , Object > selector ) { ChildrenQueryNode root = buildExecutionTreeForSelector ( selector ) ; if ( root == null ) { return null ; } UnindexedMatcher matcher = new UnindexedMatcher ( ) ; matcher . root = root ; return matcher ; } | Return a new initialised matcher . |
34,616 | protected static boolean compareLT ( Object l , Object r ) { if ( l == null || r == null ) { return false ; } else if ( ! ( l instanceof String || l instanceof Number ) ) { String msg = String . format ( "Value in document not a Number or String: %s" , l ) ; logger . log ( Level . WARNING , msg ) ; return false ; } els... | 4 . BLOB |
34,617 | public List < String > documentIds ( ) { List < String > documentIds = new ArrayList < String > ( ) ; List < DocumentRevision > docs = CollectionUtils . newArrayList ( iterator ( ) ) ; for ( DocumentRevision doc : docs ) { documentIds . add ( doc . getId ( ) ) ; } return documentIds ; } | Returns a list of the document IDs in this query result . |
34,618 | public static List < String > createRevisionIdHistory ( DocumentRevs documentRevs ) { validateDocumentRevs ( documentRevs ) ; String latestRevision = documentRevs . getRev ( ) ; int generation = CouchUtils . generationFromRevId ( latestRevision ) ; assert generation == documentRevs . getRevisions ( ) . getStart ( ) ; L... | Create the list of the revision IDs in ascending order . |
34,619 | public List < DocumentRevision > delete ( final String id ) throws DocumentNotFoundException , DocumentStoreException { Misc . checkNotNull ( id , "ID" ) ; try { if ( id . startsWith ( CouchConstants . _local_prefix ) ) { String localId = id . substring ( CouchConstants . _local_prefix . length ( ) ) ; deleteLocalDocum... | delete all leaf nodes |
34,620 | public static < T > T get ( Future < T > future ) throws ExecutionException { try { return future . get ( ) ; } catch ( InterruptedException e ) { logger . log ( Level . SEVERE , "Re-throwing InterruptedException as ExecutionException" ) ; throw new ExecutionException ( e ) ; } } | helper to avoid having to catch ExecutionExceptions |
34,621 | public static String join ( String separator , Collection < String > stringsToJoin ) { StringBuilder builder = new StringBuilder ( ) ; int index = stringsToJoin . size ( ) ; for ( String str : stringsToJoin ) { index -- ; if ( str != null ) { builder . append ( str ) ; if ( index > 0 ) { builder . append ( separator ) ... | Utility to join strings with a separator . Skips null strings and does not append a trailing separator . |
34,622 | public static void checkNotNull ( Object param , String errorMessagePrefix ) throws IllegalArgumentException { checkArgument ( param != null , ( errorMessagePrefix != null ? errorMessagePrefix : "Parameter" ) + " must not be null." ) ; } | Check that a parameter is not null and throw IllegalArgumentException with a message of errorMessagePrefix + must not be null . if it is null defaulting to Parameter must not be null . . |
34,623 | public static void checkNotNullOrEmpty ( String param , String errorMessagePrefix ) throws IllegalArgumentException { checkNotNull ( param , errorMessagePrefix ) ; checkArgument ( ! param . isEmpty ( ) , ( errorMessagePrefix != null ? errorMessagePrefix : "Parameter" ) + " must not be empty." ) ; } | Check that a string parameter is not null or empty and throw IllegalArgumentException with a message of errorMessagePrefix + must not be empty . if it is empty defaulting to Parameter must not be empty . |
34,624 | private void setup ( ) { try { this . partBoundary = ( "--" + boundary ) . getBytes ( "UTF-8" ) ; this . trailingBoundary = ( "--" + boundary + "--" ) . getBytes ( "UTF-8" ) ; this . contentType = "content-type: application/json" . getBytes ( "UTF-8" ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeExc... | common constructor stuff |
34,625 | public static void updateAllIndexes ( List < Index > indexes , Database database , SQLDatabaseQueue queue ) throws QueryException { IndexUpdater updater = new IndexUpdater ( database , queue ) ; updater . updateAllIndexes ( indexes ) ; } | Update all indexes in a set . |
34,626 | public static void updateIndex ( String indexName , List < FieldSort > fieldNames , Database database , SQLDatabaseQueue queue ) throws QueryException { IndexUpdater updater = new IndexUpdater ( database , queue ) ; updater . updateIndex ( indexName , fieldNames ) ; } | Update a single index . |
34,627 | public void setOthers ( String name , Object value ) { if ( name . startsWith ( "_" ) ) { throw new RuntimeException ( "This is a reserved field, and should not be treated as document content." ) ; } this . others . put ( name , value ) ; } | Jackson will automatically put any field it can not find match to this |
34,628 | @ SuppressWarnings ( "unchecked" ) public static Map < String , Object > normaliseAndValidateQuery ( Map < String , Object > query ) throws QueryException { boolean isWildCard = false ; if ( query . isEmpty ( ) ) { isWildCard = true ; } query = addImplicitAnd ( query ) ; String compoundOperator = ( String ) query . key... | Expand implicit operators in a query and validate |
34,629 | @ SuppressWarnings ( "unchecked" ) private static void validateSelector ( Map < String , Object > selector ) throws QueryException { String topLevelOp = ( String ) selector . keySet ( ) . toArray ( ) [ 0 ] ; if ( topLevelOp . equals ( AND ) || topLevelOp . equals ( OR ) ) { Object topLevelArg = selector . get ( topLeve... | we are going to need to walk the query tree to validate it before executing it |
34,630 | @ SuppressWarnings ( "unchecked" ) private static void validateCompoundOperatorClauses ( List < Object > clauses , Boolean [ ] textClauseLimitReached ) throws QueryException { for ( Object obj : clauses ) { if ( ! ( obj instanceof Map ) ) { String msg = String . format ( "Operator argument must be a Map %s" , clauses .... | This method runs the list of clauses making up the selector through a series of validation steps and returns whether the clause list is valid or not . |
34,631 | public InputStream getInputStream ( File file , Attachment . Encoding encoding ) throws IOException { InputStream is = new FileInputStream ( file ) ; if ( key != null ) { try { is = new EncryptedAttachmentInputStream ( is , key ) ; } catch ( InvalidKeyException ex ) { throw new IOException ( "Bad key used to open file;... | Return a stream to be used to read from the file on disk . |
34,632 | public OutputStream getOutputStream ( File file , Attachment . Encoding encoding ) throws IOException { OutputStream os = FileUtils . openOutputStream ( file ) ; if ( key != null ) { try { byte [ ] iv = new byte [ 16 ] ; new SecureRandom ( ) . nextBytes ( iv ) ; os = new EncryptedAttachmentOutputStream ( os , key , iv ... | Get stream for writing attachment data to disk . |
34,633 | public void addValueToKey ( K key , V value ) { this . addValuesToKey ( key , Collections . singletonList ( value ) ) ; } | Add a value to the map under the existing key or creating a new key if it does not yet exist . |
34,634 | public void addValuesToKey ( K key , Collection < V > valueCollection ) { if ( ! valueCollection . isEmpty ( ) ) { List < V > collectionToAppendValuesOn = new ArrayList < V > ( ) ; List < V > existing = this . putIfAbsent ( key , collectionToAppendValuesOn ) ; if ( existing != null ) { collectionToAppendValuesOn = exis... | Add a collection of one or more values to the map under the existing key or creating a new key if it does not yet exist in the map . |
34,635 | private String queryAsString ( Map < String , Object > query ) { ArrayList < String > queryParts = new ArrayList < String > ( query . size ( ) ) ; for ( Map . Entry < String , Object > entry : query . entrySet ( ) ) { String value = this . encodeQueryParameter ( entry . getValue ( ) . toString ( ) ) ; String key = this... | Joins the entries in a map into a URL - encoded query string . |
34,636 | void replicationComplete ( ) { reloadTasksFromModel ( ) ; Toast . makeText ( getApplicationContext ( ) , R . string . replication_completed , Toast . LENGTH_LONG ) . show ( ) ; dismissDialog ( DIALOG_PROGRESS ) ; } | Called by TasksModel when it receives a replication complete callback . TasksModel takes care of calling this on the main thread . |
34,637 | void replicationError ( ) { Log . i ( LOG_TAG , "error()" ) ; reloadTasksFromModel ( ) ; Toast . makeText ( getApplicationContext ( ) , R . string . replication_error , Toast . LENGTH_LONG ) . show ( ) ; dismissDialog ( DIALOG_PROGRESS ) ; } | Called by TasksModel when it receives a replication error callback . TasksModel takes care of calling this on the main thread . |
34,638 | protected static PreparedAttachment prepareAttachment ( String attachmentsDir , AttachmentStreamFactory attachmentStreamFactory , Attachment attachment , long length , long encodedLength ) throws AttachmentException { PreparedAttachment pa = new PreparedAttachment ( attachment , attachmentsDir , length , attachmentStre... | prepare an attachment and check validity of length and encodedLength metadata |
34,639 | public static Map < String , SavedAttachment > findExistingAttachments ( Map < String , ? extends Attachment > attachments ) { Map < String , SavedAttachment > existingAttachments = new HashMap < String , SavedAttachment > ( ) ; for ( Map . Entry < String , ? extends Attachment > a : attachments . entrySet ( ) ) { if (... | Return a map of the existing attachments in the map passed in . |
34,640 | public static Map < String , Attachment > findNewAttachments ( Map < String , ? extends Attachment > attachments ) { Map < String , Attachment > newAttachments = new HashMap < String , Attachment > ( ) ; for ( Map . Entry < String , ? extends Attachment > a : attachments . entrySet ( ) ) { if ( ! ( a instanceof SavedAt... | Return a map of the new attachments in the map passed in . |
34,641 | public static void copyAttachment ( SQLDatabase db , long parentSequence , long newSequence , String filename ) throws SQLException { Cursor c = null ; try { c = db . rawQuery ( SQL_ATTACHMENTS_SELECT , new String [ ] { filename , String . valueOf ( parentSequence ) } ) ; copyCursorValuesToNewSequence ( db , c , newSeq... | Copy a single attachment for a given revision to a new revision . |
34,642 | public static void purgeAttachments ( SQLDatabase db , String attachmentsDir ) { Set < String > currentKeys = new HashSet < String > ( ) ; Cursor c = null ; try { db . delete ( "attachments" , "sequence IN " + "(SELECT sequence from revs WHERE json IS null)" , null ) ; c = db . rawQuery ( SQL_ATTACHMENTS_SELECT_ALL_KEY... | Called by DatabaseImpl on the execution queue this needs to have the db passed to it . |
34,643 | static String generateFilenameForKey ( SQLDatabase db , String keyString ) throws NameGenerationException { String filename = null ; long result = - 1 ; int tries = 0 ; while ( result == - 1 && tries < 200 ) { byte [ ] randomBytes = new byte [ 20 ] ; filenameRandom . nextBytes ( randomBytes ) ; String candidate = keyTo... | Iterate candidate filenames generated from the filenameRandom generator until we find one which doesn t already exist . |
34,644 | public void put ( int index , long value ) { if ( desc . get ( index ) != Cursor . FIELD_TYPE_INTEGER ) { throw new IllegalArgumentException ( "Inserting an integer, but expecting " + getTypeName ( desc . get ( index ) ) ) ; } this . values . add ( index , value ) ; } | Internally we always store the SQLite number as long |
34,645 | private URI addAuthInterceptorIfRequired ( URI uri ) { String uriProtocol = uri . getScheme ( ) ; String uriHost = uri . getHost ( ) ; String uriPath = uri . getRawPath ( ) ; int uriPort = getDefaultPort ( uri ) ; setUserInfo ( uri ) ; setAuthInterceptor ( uriHost , uriPath , uriProtocol , uriPort ) ; return scrubUri (... | - else add cookie interceptor if needed |
34,646 | public E username ( String username ) { Misc . checkNotNull ( username , "username" ) ; this . username = username ; return ( E ) this ; } | Sets the username to use when authenticating with the server . |
34,647 | public E password ( String password ) { Misc . checkNotNull ( password , "password" ) ; this . password = password ; return ( E ) this ; } | Sets the password to use when authenticating with the server . |
34,648 | public List < Index > listIndexes ( ) throws QueryException { try { return DatabaseImpl . get ( dbQueue . submit ( new ListIndexesCallable ( ) ) ) ; } catch ( ExecutionException e ) { String msg = "Failed to list indexes" ; logger . log ( Level . SEVERE , msg , e ) ; throw new QueryException ( msg , e ) ; } } | Get a list of indexes and their definitions as a Map . |
34,649 | private Index ensureIndexed ( List < FieldSort > fieldNames , String indexName , IndexType indexType , Tokenizer tokenizer ) throws QueryException { synchronized ( this ) { return IndexCreator . ensureIndexed ( new Index ( fieldNames , indexName , indexType , tokenizer ) , database , dbQueue ) ; } } | Add a single possibly compound index for the given field names . |
34,650 | public void deleteIndex ( final String indexName ) throws QueryException { Misc . checkNotNullOrEmpty ( indexName , "indexName" ) ; Future < Void > result = dbQueue . submitTransaction ( new DeleteIndexCallable ( indexName ) ) ; try { result . get ( ) ; } catch ( ExecutionException e ) { String message = "Execution err... | Delete an index . |
34,651 | public void refreshAllIndexes ( ) throws QueryException { List < Index > indexes = listIndexes ( ) ; IndexUpdater . updateAllIndexes ( indexes , database , dbQueue ) ; } | Update all indexes . |
34,652 | public QueryResult find ( Map < String , Object > query , final List < Index > indexes , long skip , long limit , List < String > fields , final List < FieldSort > sortDocument ) throws QueryException { fields = normaliseFields ( fields ) ; validateFields ( fields ) ; query = QueryValidator . normaliseAndValidateQuery ... | Execute the query passed using the selection of index definition provided . |
34,653 | private void validateFields ( List < String > fields ) { if ( fields == null ) { return ; } List < String > badFields = new ArrayList < String > ( ) ; for ( String field : fields ) { if ( field . contains ( "." ) ) { badFields . add ( field ) ; } } if ( ! badFields . isEmpty ( ) ) { String msg = String . format ( "Proj... | Checks if the fields are valid . |
34,654 | private List < String > sortIds ( Set < String > docIdSet , List < FieldSort > sortDocument , List < Index > indexes , SQLDatabase db ) throws QueryException { boolean smallResultSet = ( docIdSet . size ( ) < SMALL_RESULT_SET_SIZE_THRESHOLD ) ; SqlParts orderBy = sqlToSortIds ( docIdSet , sortDocument , indexes ) ; Lis... | Return ordered list of document IDs using provided indexes . |
34,655 | protected static SqlParts sqlToSortIds ( Set < String > docIdSet , List < FieldSort > sortDocument , List < Index > indexes ) throws QueryException { String chosenIndex = chooseIndexForSort ( sortDocument , indexes ) ; if ( chosenIndex == null ) { String msg = String . format ( Locale . ENGLISH , "No single index can s... | Return SQL to get ordered list of docIds . |
34,656 | public static String generateNextRevisionId ( String revisionId ) { validateRevisionId ( revisionId ) ; int generation = generationFromRevId ( revisionId ) ; String digest = createUUID ( ) ; return Integer . toString ( generation + 1 ) + "-" + digest ; } | DBObject IDs have a generation count a hyphen and a UUID . |
34,657 | public static AndroidSQLCipherSQLite open ( File path , KeyProvider provider ) { SQLiteDatabase db = SQLiteDatabase . openOrCreateDatabase ( path , KeyUtils . sqlCipherKeyForKeyProvider ( provider ) , null ) ; return new AndroidSQLCipherSQLite ( db ) ; } | Constructor for creating SQLCipher - based SQLite database . |
34,658 | protected void upgradePreferences ( ) { String alarmDueElapsed = "com.cloudant.sync.replication.PeriodicReplicationService.alarmDueElapsed" ; if ( mPrefs . contains ( alarmDueElapsed ) ) { String alarmDueClock = "com.cloudant.sync.replication.PeriodicReplicationService.alarmDueClock" ; String replicationsActive = "com.... | If the stored preferences are in the old format upgrade them to the new format so that the app continues to work after upgrade to this version . |
34,659 | public synchronized void startPeriodicReplication ( ) { if ( ! isPeriodicReplicationEnabled ( ) ) { setPeriodicReplicationEnabled ( true ) ; AlarmManager alarmManager = ( AlarmManager ) getSystemService ( Context . ALARM_SERVICE ) ; Intent alarmIntent = new Intent ( this , clazz ) ; alarmIntent . setAction ( PeriodicRe... | Start periodic replications . |
34,660 | public synchronized void stopPeriodicReplication ( ) { if ( isPeriodicReplicationEnabled ( ) ) { setPeriodicReplicationEnabled ( false ) ; AlarmManager alarmManager = ( AlarmManager ) getSystemService ( Context . ALARM_SERVICE ) ; Intent alarmIntent = new Intent ( this , clazz ) ; alarmIntent . setAction ( PeriodicRepl... | Stop replications currently in progress and cancel future scheduled replications . |
34,661 | private void setPeriodicReplicationEnabled ( boolean running ) { SharedPreferences . Editor editor = mPrefs . edit ( ) ; editor . putBoolean ( constructKey ( PERIODIC_REPLICATION_ENABLED_SUFFIX ) , running ) ; editor . apply ( ) ; } | Set a flag in SharedPreferences to indicate whether periodic replications are enabled . |
34,662 | private void setExplicitlyStopped ( boolean explicitlyStopped ) { SharedPreferences . Editor editor = mPrefs . edit ( ) ; editor . putBoolean ( constructKey ( EXPLICITLY_STOPPED_SUFFIX ) , explicitlyStopped ) ; editor . apply ( ) ; } | Set a flag in SharedPreferences to indicate whether periodic replications were explicitly stopped . |
34,663 | private void resetAlarmDueTimesOnReboot ( ) { setPeriodicReplicationEnabled ( false ) ; long initialInterval = getNextAlarmDueClockTime ( ) - System . currentTimeMillis ( ) ; if ( initialInterval < 0 ) { setLastAlarmTime ( getIntervalInSeconds ( ) * MILLISECONDS_IN_SECOND ) ; } else if ( initialInterval > getIntervalIn... | Reset the alarm times stored in SharedPreferences following a reboot of the device . After a reboot the AlarmManager must be setup again so that periodic replications will occur following reboot . |
34,664 | public static void setReplicationsPending ( Context context , Class < ? extends PeriodicReplicationService > prsClass , boolean pending ) { SharedPreferences prefs = context . getSharedPreferences ( PREFERENCES_FILE_NAME , Context . MODE_PRIVATE ) ; SharedPreferences . Editor editor = prefs . edit ( ) ; editor . putBoo... | Sets whether there are replications pending . This may be because replications are currently in progress and have not yet completed or because a previous scheduled replication didn t take place because the conditions for replication were not met . |
34,665 | public static boolean replicationsPending ( Context context , Class < ? extends PeriodicReplicationService > prsClass ) { SharedPreferences prefs = context . getSharedPreferences ( PREFERENCES_FILE_NAME , Context . MODE_PRIVATE ) ; return prefs . getBoolean ( constructKey ( prsClass , REPLICATIONS_PENDING_SUFFIX ) , tr... | Gets whether there are replications pending . Replications may be pending because they are currently in progress and have not yet completed or because a previous scheduled replication didn t take place because the conditions for replication were not met . |
34,666 | private < T > T executeWithRetry ( final Callable < ExecuteResult > task , InputStreamProcessor < T > processor ) throws CouchException { int attempts = 10 ; CouchException lastException = null ; while ( attempts -- > 0 ) { ExecuteResult result = null ; try { result = task . call ( ) ; if ( result . stream != null ) { ... | return an InputStream if successful or throw an exception |
34,667 | public Response update ( String id , Object document ) { Misc . checkNotNullOrEmpty ( id , "id" ) ; Misc . checkNotNull ( document , "Document" ) ; getDocumentRev ( id ) ; return putUpdate ( id , document ) ; } | Document should be complete document include _id matches ID |
34,668 | public List < Response > bulkCreateSerializedDocs ( List < String > serializedDocs ) { Misc . checkNotNull ( serializedDocs , "Serialized doc list" ) ; String payload = generateBulkSerializedDocsPayload ( serializedDocs ) ; return bulkCreateDocs ( payload ) ; } | Bulk insert a list of document that are serialized to JSON data already . For performance reasons the JSON doc is not validated . |
34,669 | public String initializeView ( Model model , RenderRequest renderRequest ) { IUserInstance ui = userInstanceManager . getUserInstance ( portalRequestUtils . getCurrentPortalRequest ( ) ) ; UserPreferencesManager upm = ( UserPreferencesManager ) ui . getPreferencesManager ( ) ; IUserLayoutManager ulm = upm . getUserLayo... | Handles all Favorites portlet EDIT mode renders . Populates model with user s favorites and selects a view to display those favorites . |
34,670 | public String getAttributeValue ( String name ) { Attr att = node . getAttributeNode ( name ) ; if ( att == null ) return null ; return att . getNodeValue ( ) ; } | Returns the value of an attribute or null if such an attribute is not defined on the underlying element . |
34,671 | public static Element getPLFNode ( Element compViewNode , IPerson person , boolean create , boolean includeChildNodes ) throws PortalException { Document plf = ( Document ) person . getAttribute ( Constants . PLF ) ; String ID = compViewNode . getAttribute ( Constants . ATT_ID ) ; Element plfNode = plf . getElementById... | This method returns the PLF version of the passed in compViewNode . If create is false and a node with the same id is not found in the PLF then null is returned . If the create is true then an attempt is made to create the node along with any necessary ancestor nodes needed to represent the path along the tree . |
34,672 | public static Element createPlfNodeAndPath ( Element compViewNode , boolean includeChildNodes , IPerson person ) throws PortalException { Element compViewParent = ( Element ) compViewNode . getParentNode ( ) ; Element plfParent = getPLFNode ( compViewParent , person , true , false ) ; Document plf = ( Document ) person... | Creates a copy of the passed in ILF node in the PLF if not already there as well as creating any ancestor nodes along the path from this node up to the layout root if they are not there . |
34,673 | private static Element createILFCopy ( Element compViewNode , Element compViewParent , boolean includeChildNodes , Document plf , Element plfParent , IPerson person ) throws PortalException { Element plfNode = ( Element ) plf . importNode ( compViewNode , includeChildNodes ) ; plfNode . removeAttributeNS ( Constants . ... | Creates a copy of an ilf node in the plf and sets up necessary storage attributes . |
34,674 | static Element createOrMovePLFOwnedNode ( Element compViewNode , Element compViewParent , boolean createIfNotFound , boolean createChildNodes , Document plf , Element plfParent , IPerson person ) throws PortalException { Element child = ( Element ) compViewParent . getFirstChild ( ) ; Element nextOwnedSibling = null ; ... | Creates or moves the plf copy of a node in the composite view and inserting it before its next highest sibling so that if dlm is not used then the model ends up exactly like the original non - dlm persistance version . The position set is also updated and if no ilf copy nodes are found in the sibling list the set is cl... |
34,675 | public static void mergeFragment ( Document fragment , Document composite , IAuthorizationPrincipal ap ) throws AuthorizationException { Element fragmentLayout = fragment . getDocumentElement ( ) ; Element fragmentRoot = ( Element ) fragmentLayout . getFirstChild ( ) ; Element compositeLayout = composite . getDocumentE... | Passes the layout root of each of these documents to mergeChildren causing all children of newLayout to be merged into compositeLayout following merging protocal for distributed layout management . |
34,676 | private static boolean mergeAllowed ( Element child , IAuthorizationPrincipal ap ) throws AuthorizationException { if ( ! child . getTagName ( ) . equals ( "channel" ) ) return true ; String channelPublishId = child . getAttribute ( "chanID" ) ; return ap . canRender ( channelPublishId ) ; } | Tests to see if channels to be merged from ILF can be rendered by the end user . If not then they are discarded from the merge . |
34,677 | private Object [ ] getPersonGroupMemberKeys ( IGroupMember gm ) { Object [ ] keys = null ; EntityIdentifier ei = gm . getUnderlyingEntityIdentifier ( ) ; IPersonAttributes attr = personAttributeDao . getPerson ( ei . getKey ( ) ) ; if ( attr != null && attr . getAttributes ( ) != null && ! attr . getAttributes ( ) . is... | gm should already be determined to be reference to person |
34,678 | public IEntityGroup newInstance ( Class entityType ) throws GroupsException { log . warn ( "Unsupported method accessed: SmartLdapGroupStore.newInstance" ) ; throw new UnsupportedOperationException ( UNSUPPORTED_MESSAGE ) ; } | Return an UnsupportedOperationException ! |
34,679 | public EntityIdentifier [ ] searchForGroups ( String query , SearchMethod method , Class leaftype ) throws GroupsException { if ( isTreeRefreshRequired ( ) ) { refreshTree ( ) ; } log . debug ( "Invoking searchForGroups(): query={}, method={}, leaftype=" , query , method , leaftype . getName ( ) ) ; final IEntityGroup... | Treats case sensitive and case insensitive searching the same . |
34,680 | @ RequestMapping ( method = RequestMethod . POST , params = "action=removeElement" ) public ModelAndView removeElement ( HttpServletRequest request , HttpServletResponse response ) throws IOException { IUserInstance ui = userInstanceManager . getUserInstance ( request ) ; IPerson per = getPerson ( ui , response ) ; Use... | Remove an element from the layout . |
34,681 | @ RequestMapping ( method = RequestMethod . POST , params = "action=removeByFName" ) public ModelAndView removeByFName ( HttpServletRequest request , HttpServletResponse response , @ RequestParam ( value = "fname" ) String fname ) throws IOException { IUserInstance ui = userInstanceManager . getUserInstance ( request )... | Remove the first element with the provided fname from the layout . |
34,682 | @ RequestMapping ( method = RequestMethod . POST , params = "action=addFolder" ) public ModelAndView addFolder ( HttpServletRequest request , HttpServletResponse response , @ RequestParam ( "targetId" ) String targetId , @ RequestParam ( value = "siblingId" , required = false ) String siblingId , @ RequestBody ( requir... | Add a new folder to the layout . |
34,683 | @ RequestMapping ( method = RequestMethod . POST , params = "action=renameTab" ) public ModelAndView renameTab ( HttpServletRequest request , HttpServletResponse response ) throws IOException { IUserInstance ui = userInstanceManager . getUserInstance ( request ) ; UserPreferencesManager upm = ( UserPreferencesManager )... | Rename a specified tab . |
34,684 | private void setObjectAttributes ( IUserLayoutNodeDescription node , HttpServletRequest request , Map < String , Map < String , String > > attributes ) { for ( String name : attributes . get ( "attributes" ) . keySet ( ) ) { try { BeanUtils . setProperty ( node , name , attributes . get ( name ) ) ; } catch ( IllegalAc... | Attempt to map the attribute values to the given object . |
34,685 | protected boolean isTab ( IUserLayoutManager ulm , String folderId ) throws PortalException { return ulm . getRootFolderId ( ) . equals ( ulm . getParentId ( folderId ) ) ; } | A folder is a tab if its parent element is the layout element |
34,686 | protected String getMessage ( String key , String defaultMessage , Locale locale ) { try { return messageSource . getMessage ( key , new Object [ ] { } , defaultMessage , locale ) ; } catch ( Exception e ) { logger . error ( "Error resolving message with key {}." , key , e ) ; return defaultMessage ; } } | Syntactic sugar for safely resolving a no - args message from message bundle . |
34,687 | private boolean moveElementInternal ( HttpServletRequest request , String sourceId , String destinationId , String method ) { logger . debug ( "moveElementInternal invoked for sourceId={}, destinationId={}, method={}" , sourceId , destinationId , method ) ; if ( StringUtils . isEmpty ( destinationId ) ) { return true ;... | Moves the source element . |
34,688 | protected final void setReportFormGroups ( final F report ) { if ( ! report . getGroups ( ) . isEmpty ( ) ) { return ; } final Set < AggregatedGroupMapping > groups = this . getGroups ( ) ; if ( ! groups . isEmpty ( ) ) { report . getGroups ( ) . add ( groups . iterator ( ) . next ( ) . getId ( ) ) ; } } | Set the groups to have selected by default if not already set |
34,689 | protected final boolean showFullColumnHeaderDescriptions ( F form ) { boolean showFullHeaderDescriptions = false ; switch ( form . getFormat ( ) ) { case csv : { showFullHeaderDescriptions = true ; break ; } case html : { showFullHeaderDescriptions = true ; break ; } default : { showFullHeaderDescriptions = false ; } }... | Returns true to indicate report format is only data table and doesn t have report graph titles etc . so the report columns needs to fully describe the data columns . CSV and HTML tables require full column header descriptions . |
34,690 | private AggregatedGroupMapping [ ] extractGroupsArray ( Set < D > columnGroups ) { Set < AggregatedGroupMapping > groupMappings = new HashSet < AggregatedGroupMapping > ( ) ; for ( D discriminator : columnGroups ) { groupMappings . add ( discriminator . getAggregatedGroup ( ) ) ; } return groupMappings . toArray ( new ... | use a Set to filter down to unique values . |
34,691 | public static Preference createSingleTextPreference ( String name , String label ) { return createSingleTextPreference ( name , "attribute.displayName." + name , TextDisplay . TEXT , null ) ; } | Define a single - valued text input preferences . This method is a convenient wrapper for the most common expected use case and assumes null values for the default value and a predictable label . |
34,692 | public static Preference createSingleTextPreference ( String name , String label , TextDisplay displayType , String defaultValue ) { SingleTextPreferenceInput input = new SingleTextPreferenceInput ( ) ; input . setDefault ( defaultValue ) ; input . setDisplay ( displayType ) ; Preference pref = new Preference ( ) ; pre... | Craete a single - valued text input preference . |
34,693 | public static Preference createSingleChoicePreference ( String name , String label , SingleChoiceDisplay displayType , List < Option > options , String defaultValue ) { SingleChoicePreferenceInput input = new SingleChoicePreferenceInput ( ) ; input . setDefault ( defaultValue ) ; input . setDisplay ( displayType ) ; in... | Create a single - valued choice preference input . |
34,694 | public static Preference createMultiTextPreference ( String name , String label , TextDisplay displayType , List < String > defaultValues ) { MultiTextPreferenceInput input = new MultiTextPreferenceInput ( ) ; input . getDefaults ( ) . addAll ( defaultValues ) ; input . setDisplay ( displayType ) ; Preference pref = ne... | Create a multi - valued text input preference . |
34,695 | public static Preference createMultiChoicePreference ( String name , String label , MultiChoiceDisplay displayType , List < Option > options , List < String > defaultValues ) { MultiChoicePreferenceInput input = new MultiChoicePreferenceInput ( ) ; input . getDefaults ( ) . addAll ( defaultValues ) ; input . setDisplay... | Create a multi - valued choice input preference . |
34,696 | private void initRelatedPortlets ( ) { final Set < MarketplacePortletDefinition > allRelatedPortlets = new HashSet < > ( ) ; for ( PortletCategory parentCategory : this . portletCategoryRegistry . getParentCategories ( this ) ) { final Set < IPortletDefinition > portletsInCategory = this . portletCategoryRegistry . get... | Initialize related portlets . This must be called lazily so that MarketplacePortletDefinitions instantiated as related portlets off of a MarketplacePortletDefinition do not always instantiate their related MarketplacePortletDefinitions ad infinitem . |
34,697 | public Set < MarketplacePortletDefinition > getRandomSamplingRelatedPortlets ( final IPerson user ) { Validate . notNull ( user , "Cannot filter to BROWSEable by a null user" ) ; final IAuthorizationPrincipal principal = AuthorizationPrincipalHelper . principalFromUser ( user ) ; if ( this . relatedPortlets == null ) {... | Obtain up to QUANTITY_RELATED_PORTLETS_TO_SHOW random related portlets BROWSEable by the given user . |
34,698 | public String getRenderUrl ( ) { final String alternativeMaximizedUrl = getAlternativeMaximizedLink ( ) ; if ( null != alternativeMaximizedUrl ) { return alternativeMaximizedUrl ; } final String contextPath = PortalWebUtils . currentRequestContextPath ( ) ; return contextPath + "/p/" + getFName ( ) + "/render.uP" ; } | Convenience method for getting a bookmarkable URL for rendering the defined portlet |
34,699 | static void evaluateAndApply ( List < NodeInfo > order , Element compViewParent , Element positionSet , IntegrationResult result ) throws PortalException { adjustPositionSet ( order , positionSet , result ) ; if ( hasAffectOnCVP ( order , compViewParent ) ) { applyToNodes ( order , compViewParent ) ; result . setChange... | This method determines if applying all of the positioning rules and restrictions ended up making changes to the compViewParent or the original position set . If changes are applicable to the CVP then they are applied . If the position set changed then the original stored in the PLF is updated . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.