repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/android/ContentValues.java
ContentValues.getAsString
public String getAsString(String key) { Object value = mValues.get(key); return value != null ? value.toString() : null; }
java
public String getAsString(String key) { Object value = mValues.get(key); return value != null ? value.toString() : null; }
[ "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. @param key the value to get @return the String for the value
[ "Gets", "a", "value", "and", "converts", "it", "to", "a", "String", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/android/ContentValues.java#L261-L264
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java
SQLDatabaseQueue.getVersion
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) { ...
java
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) { ...
[ "public", "int", "getVersion", "(", ")", "throws", "SQLException", "{", "try", "{", "return", "this", ".", "submit", "(", "new", "VersionCallable", "(", ")", ")", ".", "get", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "log...
Returns the current version of the database. @return The current version of the database. @throws SQLException Throws if there was an error getting the current database version
[ "Returns", "the", "current", "version", "of", "the", "database", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L90-L100
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java
SQLDatabaseQueue.submit
public <T> Future<T> submit(SQLCallable<T> callable){ return this.submitTaskToQueue(new SQLQueueCallable<T>(db, callable)); }
java
public <T> Future<T> submit(SQLCallable<T> callable){ return this.submitTaskToQueue(new SQLQueueCallable<T>(db, callable)); }
[ "public", "<", "T", ">", "Future", "<", "T", ">", "submit", "(", "SQLCallable", "<", "T", ">", "callable", ")", "{", "return", "this", ".", "submitTaskToQueue", "(", "new", "SQLQueueCallable", "<", "T", ">", "(", "db", ",", "callable", ")", ")", ";",...
Submits a database task for execution @param callable The task to be performed @param <T> The type of object that is returned from the task @throws RejectedExecutionException Thrown when the queue has been shutdown @return Future representing the task to be executed.
[ "Submits", "a", "database", "task", "for", "execution" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L109-L111
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java
SQLDatabaseQueue.submitTransaction
public <T> Future<T> submitTransaction(SQLCallable<T> callable){ return this.submitTaskToQueue(new SQLQueueCallable<T>(db, callable, true)); }
java
public <T> Future<T> submitTransaction(SQLCallable<T> callable){ return this.submitTaskToQueue(new SQLQueueCallable<T>(db, callable, true)); }
[ "public", "<", "T", ">", "Future", "<", "T", ">", "submitTransaction", "(", "SQLCallable", "<", "T", ">", "callable", ")", "{", "return", "this", ".", "submitTaskToQueue", "(", "new", "SQLQueueCallable", "<", "T", ">", "(", "db", ",", "callable", ",", ...
Submits a database task for execution in a transaction @param callable The task to be performed @param <T> The type of object that is returned from the task @throws RejectedExecutionException thrown when the queue has been shutdown @return Future representing the task to be executed.
[ "Submits", "a", "database", "task", "for", "execution", "in", "a", "transaction" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L120-L122
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java
SQLDatabaseQueue.shutdown
public void shutdown() { // If shutdown has already been called then we don't need to shutdown again if (acceptTasks.getAndSet(false)) { //pass straight to queue, tasks passed via submitTaskToQueue will now be blocked. Future<?> close = queue.submit(new Runnable() { ...
java
public void shutdown() { // If shutdown has already been called then we don't need to shutdown again if (acceptTasks.getAndSet(false)) { //pass straight to queue, tasks passed via submitTaskToQueue will now be blocked. Future<?> close = queue.submit(new Runnable() { ...
[ "public", "void", "shutdown", "(", ")", "{", "// If shutdown has already been called then we don't need to shutdown again", "if", "(", "acceptTasks", ".", "getAndSet", "(", "false", ")", ")", "{", "//pass straight to queue, tasks passed via submitTaskToQueue will now be blocked.", ...
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
[ "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...
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L131-L153
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java
SQLDatabaseQueue.submitTaskToQueue
private <T> Future<T> submitTaskToQueue(SQLQueueCallable<T> callable){ if(acceptTasks.get()){ return queue.submit(callable); } else { throw new RejectedExecutionException("Database is closed"); } }
java
private <T> Future<T> submitTaskToQueue(SQLQueueCallable<T> callable){ if(acceptTasks.get()){ return queue.submit(callable); } else { throw new RejectedExecutionException("Database is closed"); } }
[ "private", "<", "T", ">", "Future", "<", "T", ">", "submitTaskToQueue", "(", "SQLQueueCallable", "<", "T", ">", "callable", ")", "{", "if", "(", "acceptTasks", ".", "get", "(", ")", ")", "{", "return", "queue", ".", "submit", "(", "callable", ")", ";...
Adds a task to the queue, checking if the queue is still open to accepting tasks @param callable The task to submit to the queue @param <T> The type of object that the callable returns @return Future representing the task to be executed. @throws RejectedExecutionException If the queue has been shutdown.
[ "Adds", "a", "task", "to", "the", "queue", "checking", "if", "the", "queue", "is", "still", "open", "to", "accepting", "tasks" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L171-L177
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java
SQLDatabaseQueue.getSQLiteVersion
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,...
java
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,...
[ "public", "synchronized", "String", "getSQLiteVersion", "(", ")", "{", "if", "(", "this", ".", "sqliteVersion", "==", "null", ")", "{", "try", "{", "this", ".", "sqliteVersion", "=", "this", ".", "submit", "(", "new", "SQLiteVersionCallable", "(", ")", ")"...
Returns the SQLite Version. @return The SQLite version or "Unknown" if the version could not be determined.
[ "Returns", "the", "SQLite", "Version", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L183-L200
train
cloudant/sync-android
cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/datastore/encryption/KeyManager.java
KeyManager.validateEncryptionKeyData
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; } ret...
java
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; } ret...
[ "private", "boolean", "validateEncryptionKeyData", "(", "KeyData", "data", ")", "{", "if", "(", "data", ".", "getIv", "(", ")", ".", "length", "!=", "ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE", ")", "{", "LOGGER", ".", "warning", "(", "\"IV does not have the expected si...
PRIVATE HELPER METHODS
[ "PRIVATE", "HELPER", "METHODS" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/datastore/encryption/KeyManager.java#L203-L210
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/callables/UpdateIndexCallable.java
UpdateIndexCallable.parametersToIndexRevision
@SuppressWarnings("unchecked") private List<DBParameter> parametersToIndexRevision(DocumentRevision rev, String indexName, List<FieldSort> fieldNames) { Misc.checkNotNull...
java
@SuppressWarnings("unchecked") private List<DBParameter> parametersToIndexRevision(DocumentRevision rev, String indexName, List<FieldSort> fieldNames) { Misc.checkNotNull...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "List", "<", "DBParameter", ">", "parametersToIndexRevision", "(", "DocumentRevision", "rev", ",", "String", "indexName", ",", "List", "<", "FieldSort", ">", "fieldNames", ")", "{", "Misc", ".", "che...
Returns a List of DBParameters containing table name and ContentValues to index a document in an index. For most revisions, a single entry will be returned. If a field is an array, however, multiple entries are required.
[ "Returns", "a", "List", "of", "DBParameters", "containing", "table", "name", "and", "ContentValues", "to", "index", "a", "document", "in", "an", "index", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/callables/UpdateIndexCallable.java#L91-L158
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseFactory.java
SQLDatabaseFactory.internalOpenSQLDatabase
private static SQLDatabase internalOpenSQLDatabase(File dbFile, KeyProvider provider) throws SQLException { boolean runningOnAndroid = Misc.isRunningOnAndroid(); boolean useSqlCipher = (provider.getEncryptionKey() != null); try { if (runningOnAndroid) { if (useSql...
java
private static SQLDatabase internalOpenSQLDatabase(File dbFile, KeyProvider provider) throws SQLException { boolean runningOnAndroid = Misc.isRunningOnAndroid(); boolean useSqlCipher = (provider.getEncryptionKey() != null); try { if (runningOnAndroid) { if (useSql...
[ "private", "static", "SQLDatabase", "internalOpenSQLDatabase", "(", "File", "dbFile", ",", "KeyProvider", "provider", ")", "throws", "SQLException", "{", "boolean", "runningOnAndroid", "=", "Misc", ".", "isRunningOnAndroid", "(", ")", ";", "boolean", "useSqlCipher", ...
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. @param dbFile full file path of the db file or {@code null} for an...
[ "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", "-", "memor...
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseFactory.java#L113-L149
train
cloudant/sync-android
sample/todo-sync/src/com/cloudant/todo/TasksModel.java
TasksModel.createDocument
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 (D...
java
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 (D...
[ "public", "Task", "createDocument", "(", "Task", "task", ")", "{", "DocumentRevision", "rev", "=", "new", "DocumentRevision", "(", ")", ";", "rev", ".", "setBody", "(", "DocumentBodyFactory", ".", "create", "(", "task", ".", "asMap", "(", ")", ")", ")", ...
Creates a task, assigning an ID. @param task task to create @return new revision of the document
[ "Creates", "a", "task", "assigning", "an", "ID", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/sample/todo-sync/src/com/cloudant/todo/TasksModel.java#L120-L131
train
cloudant/sync-android
sample/todo-sync/src/com/cloudant/todo/TasksModel.java
TasksModel.updateDocument
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); ...
java
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); ...
[ "public", "Task", "updateDocument", "(", "Task", "task", ")", "throws", "ConflictException", ",", "DocumentStoreException", "{", "DocumentRevision", "rev", "=", "task", ".", "getDocumentRevision", "(", ")", ";", "rev", ".", "setBody", "(", "DocumentBodyFactory", "...
Updates a Task document within the DocumentStore. @param task task to update @return the updated revision of the Task @throws ConflictException if the task passed in has a rev which doesn't match the current rev in the DocumentStore. @throws DocumentStoreException if there was an error updating the rev for this task
[ "Updates", "a", "Task", "document", "within", "the", "DocumentStore", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/sample/todo-sync/src/com/cloudant/todo/TasksModel.java#L141-L150
train
cloudant/sync-android
sample/todo-sync/src/com/cloudant/todo/TasksModel.java
TasksModel.deleteDocument
public void deleteDocument(Task task) throws ConflictException, DocumentNotFoundException, DocumentStoreException { this.mDocumentStore.database().delete(task.getDocumentRevision()); }
java
public void deleteDocument(Task task) throws ConflictException, DocumentNotFoundException, DocumentStoreException { this.mDocumentStore.database().delete(task.getDocumentRevision()); }
[ "public", "void", "deleteDocument", "(", "Task", "task", ")", "throws", "ConflictException", ",", "DocumentNotFoundException", ",", "DocumentStoreException", "{", "this", ".", "mDocumentStore", ".", "database", "(", ")", ".", "delete", "(", "task", ".", "getDocume...
Deletes a Task document within the DocumentStore. @param task task to delete @throws ConflictException if the task passed in has a rev which doesn't match the current rev in the DocumentStore. @throws DocumentNotFoundException if the rev for this task does not exist @throws DocumentStoreException if there was an error ...
[ "Deletes", "a", "Task", "document", "within", "the", "DocumentStore", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/sample/todo-sync/src/com/cloudant/todo/TasksModel.java#L160-L162
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexCreator.java
IndexCreator.validFieldName
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.SEVE...
java
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.SEVE...
[ "protected", "static", "boolean", "validFieldName", "(", "String", "fieldName", ")", "{", "String", "[", "]", "parts", "=", "fieldName", ".", "split", "(", "\"\\\\.\"", ")", ";", "for", "(", "String", "part", ":", "parts", ")", "{", "if", "(", "part", ...
Validate the field name string is usable. The only restriction so far is that the parts don't start with a $ sign, as this makes the query language ambiguous.
[ "Validate", "the", "field", "name", "string", "is", "usable", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexCreator.java#L222-L233
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/TokenizerHelper.java
TokenizerHelper.tokenizerToJson
public static String tokenizerToJson(Tokenizer tokenizer) { Map<String, String> settingsMap = new HashMap<String, String>(); if (tokenizer != null) { settingsMap.put(TOKENIZE, tokenizer.tokenizerName); // safe to store args even if they are null settingsMap.put(TOKENI...
java
public static String tokenizerToJson(Tokenizer tokenizer) { Map<String, String> settingsMap = new HashMap<String, String>(); if (tokenizer != null) { settingsMap.put(TOKENIZE, tokenizer.tokenizerName); // safe to store args even if they are null settingsMap.put(TOKENI...
[ "public", "static", "String", "tokenizerToJson", "(", "Tokenizer", "tokenizer", ")", "{", "Map", "<", "String", ",", "String", ">", "settingsMap", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "if", "(", "tokenizer", "!=", "nul...
Convert Tokenizer into serialized options, or empty map if null @param tokenizer a {@link Tokenizer} used by a text index, or null (this will be the case for JSON indexes) @return a JSON string representing these options
[ "Convert", "Tokenizer", "into", "serialized", "options", "or", "empty", "map", "if", "null" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/TokenizerHelper.java#L39-L47
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/UnindexedMatcher.java
UnindexedMatcher.matcherWithSelector
public static UnindexedMatcher matcherWithSelector(Map<String, Object> selector) { ChildrenQueryNode root = buildExecutionTreeForSelector(selector); if (root == null) { return null; } UnindexedMatcher matcher = new UnindexedMatcher(); matcher.root = root; r...
java
public static UnindexedMatcher matcherWithSelector(Map<String, Object> selector) { ChildrenQueryNode root = buildExecutionTreeForSelector(selector); if (root == null) { return null; } UnindexedMatcher matcher = new UnindexedMatcher(); matcher.root = root; r...
[ "public", "static", "UnindexedMatcher", "matcherWithSelector", "(", "Map", "<", "String", ",", "Object", ">", "selector", ")", "{", "ChildrenQueryNode", "root", "=", "buildExecutionTreeForSelector", "(", "selector", ")", ";", "if", "(", "root", "==", "null", ")"...
Return a new initialised matcher. Assumes selector is valid as we're calling this late in the query processing.
[ "Return", "a", "new", "initialised", "matcher", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/UnindexedMatcher.java#L99-L110
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/UnindexedMatcher.java
UnindexedMatcher.compareLT
protected static boolean compareLT(Object l, Object r) { if (l == null || r == null) { return false; // null fails all lt/gt/lte/gte tests } else if (!(l instanceof String || l instanceof Number)) { String msg = String.format("Value in document not a Number or String: %s", l); ...
java
protected static boolean compareLT(Object l, Object r) { if (l == null || r == null) { return false; // null fails all lt/gt/lte/gte tests } else if (!(l instanceof String || l instanceof Number)) { String msg = String.format("Value in document not a Number or String: %s", l); ...
[ "protected", "static", "boolean", "compareLT", "(", "Object", "l", ",", "Object", "r", ")", "{", "if", "(", "l", "==", "null", "||", "r", "==", "null", ")", "{", "return", "false", ";", "// null fails all lt/gt/lte/gte tests", "}", "else", "if", "(", "!"...
4. BLOB
[ "4", ".", "BLOB" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/UnindexedMatcher.java#L335-L361
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/query/QueryResult.java
QueryResult.documentIds
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; }
java
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; }
[ "public", "List", "<", "String", ">", "documentIds", "(", ")", "{", "List", "<", "String", ">", "documentIds", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "List", "<", "DocumentRevision", ">", "docs", "=", "CollectionUtils", ".", "newArra...
Returns a list of the document IDs in this query result. This method is implemented this way to ensure that the list of document IDs is consistent with the iterator results. @return list of the document IDs
[ "Returns", "a", "list", "of", "the", "document", "IDs", "in", "this", "query", "result", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/query/QueryResult.java#L84-L91
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DocumentRevsUtils.java
DocumentRevsUtils.createRevisionIdHistory
public static List<String> createRevisionIdHistory(DocumentRevs documentRevs) { validateDocumentRevs(documentRevs); String latestRevision = documentRevs.getRev(); int generation = CouchUtils.generationFromRevId(latestRevision); assert generation == documentRevs.getRevisions().getStart()...
java
public static List<String> createRevisionIdHistory(DocumentRevs documentRevs) { validateDocumentRevs(documentRevs); String latestRevision = documentRevs.getRev(); int generation = CouchUtils.generationFromRevId(latestRevision); assert generation == documentRevs.getRevisions().getStart()...
[ "public", "static", "List", "<", "String", ">", "createRevisionIdHistory", "(", "DocumentRevs", "documentRevs", ")", "{", "validateDocumentRevs", "(", "documentRevs", ")", ";", "String", "latestRevision", "=", "documentRevs", ".", "getRev", "(", ")", ";", "int", ...
Create the list of the revision IDs in ascending order. The DocumentRevs is for a single tree. There should be one DocumentRevs for each open revision. @param documentRevs a deserialised JSON document including the _revisions structure. See <a target="_blank" href="http://docs.couchdb.org/en/latest/api/document/common...
[ "Create", "the", "list", "of", "the", "revision", "IDs", "in", "ascending", "order", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DocumentRevsUtils.java#L41-L52
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java
DatabaseImpl.delete
@Override 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...
java
@Override 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...
[ "@", "Override", "public", "List", "<", "DocumentRevision", ">", "delete", "(", "final", "String", "id", ")", "throws", "DocumentNotFoundException", ",", "DocumentStoreException", "{", "Misc", ".", "checkNotNull", "(", "id", ",", "\"ID\"", ")", ";", "try", "{"...
delete all leaf nodes
[ "delete", "all", "leaf", "nodes" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java#L1054-L1075
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java
DatabaseImpl.get
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); } }
java
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); } }
[ "public", "static", "<", "T", ">", "T", "get", "(", "Future", "<", "T", ">", "future", ")", "throws", "ExecutionException", "{", "try", "{", "return", "future", ".", "get", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "log...
helper to avoid having to catch ExecutionExceptions
[ "helper", "to", "avoid", "having", "to", "catch", "ExecutionExceptions" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java#L1082-L1089
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java
Misc.join
public static String join(String separator, Collection<String> stringsToJoin) { StringBuilder builder = new StringBuilder(); // Check if there is at least 1 element then use do/while to avoid trailing separator int index = stringsToJoin.size(); for (String str : stringsToJoin) { ...
java
public static String join(String separator, Collection<String> stringsToJoin) { StringBuilder builder = new StringBuilder(); // Check if there is at least 1 element then use do/while to avoid trailing separator int index = stringsToJoin.size(); for (String str : stringsToJoin) { ...
[ "public", "static", "String", "join", "(", "String", "separator", ",", "Collection", "<", "String", ">", "stringsToJoin", ")", "{", "StringBuilder", "builder", "=", "new", "StringBuilder", "(", ")", ";", "// Check if there is at least 1 element then use do/while to avoi...
Utility to join strings with a separator. Skips null strings and does not append a trailing separator. @param separator the string to use to separate the entries @param stringsToJoin the strings to join together @return the joined string
[ "Utility", "to", "join", "strings", "with", "a", "separator", ".", "Skips", "null", "strings", "and", "does", "not", "append", "a", "trailing", "separator", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java#L69-L83
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java
Misc.checkNotNull
public static void checkNotNull(Object param, String errorMessagePrefix) throws IllegalArgumentException { checkArgument(param != null, (errorMessagePrefix != null ? errorMessagePrefix : "Parameter") + " must not be null."); }
java
public static void checkNotNull(Object param, String errorMessagePrefix) throws IllegalArgumentException { checkArgument(param != null, (errorMessagePrefix != null ? errorMessagePrefix : "Parameter") + " must not be null."); }
[ "public", "static", "void", "checkNotNull", "(", "Object", "param", ",", "String", "errorMessagePrefix", ")", "throws", "IllegalArgumentException", "{", "checkArgument", "(", "param", "!=", "null", ",", "(", "errorMessagePrefix", "!=", "null", "?", "errorMessagePref...
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.". @param param the parameter to check @param errorMessagePrefix the prefix of the error message to use for the Illegal...
[ "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", ...
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java#L95-L99
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java
Misc.checkNotNullOrEmpty
public static void checkNotNullOrEmpty(String param, String errorMessagePrefix) throws IllegalArgumentException { checkNotNull(param, errorMessagePrefix); checkArgument(!param.isEmpty(), (errorMessagePrefix != null ? errorMessagePrefix : "Parameter") + " must not be empty.");...
java
public static void checkNotNullOrEmpty(String param, String errorMessagePrefix) throws IllegalArgumentException { checkNotNull(param, errorMessagePrefix); checkArgument(!param.isEmpty(), (errorMessagePrefix != null ? errorMessagePrefix : "Parameter") + " must not be empty.");...
[ "public", "static", "void", "checkNotNullOrEmpty", "(", "String", "param", ",", "String", "errorMessagePrefix", ")", "throws", "IllegalArgumentException", "{", "checkNotNull", "(", "param", ",", "errorMessagePrefix", ")", ";", "checkArgument", "(", "!", "param", "."...
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". @param param the string to check @param errorMessagePrefix the prefix of the error message to use ...
[ "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", ...
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java#L111-L116
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/MultipartAttachmentWriter.java
MultipartAttachmentWriter.setup
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) { ...
java
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) { ...
[ "private", "void", "setup", "(", ")", "{", "try", "{", "this", ".", "partBoundary", "=", "(", "\"--\"", "+", "boundary", ")", ".", "getBytes", "(", "\"UTF-8\"", ")", ";", "this", ".", "trailingBoundary", "=", "(", "\"--\"", "+", "boundary", "+", "\"--\...
common constructor stuff
[ "common", "constructor", "stuff" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/MultipartAttachmentWriter.java#L117-L136
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java
IndexUpdater.updateAllIndexes
public static void updateAllIndexes(List<Index> indexes, Database database, SQLDatabaseQueue queue) throws QueryException { IndexUpdater updater = new IndexUpdater(database, queue); updater.updateAllIndexes(indexes); ...
java
public static void updateAllIndexes(List<Index> indexes, Database database, SQLDatabaseQueue queue) throws QueryException { IndexUpdater updater = new IndexUpdater(database, queue); updater.updateAllIndexes(indexes); ...
[ "public", "static", "void", "updateAllIndexes", "(", "List", "<", "Index", ">", "indexes", ",", "Database", "database", ",", "SQLDatabaseQueue", "queue", ")", "throws", "QueryException", "{", "IndexUpdater", "updater", "=", "new", "IndexUpdater", "(", "database", ...
Update all indexes in a set. These indexes are assumed to already exist. @param indexes Map of indexes and their definitions. @param database The local {@link Database} @param queue The executor service queue @return index update success status (true/false)
[ "Update", "all", "indexes", "in", "a", "set", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java#L67-L73
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java
IndexUpdater.updateIndex
public static void updateIndex(String indexName, List<FieldSort> fieldNames, Database database, SQLDatabaseQueue queue) throws QueryException { IndexUpdater updater = new IndexUpdater(database, queu...
java
public static void updateIndex(String indexName, List<FieldSort> fieldNames, Database database, SQLDatabaseQueue queue) throws QueryException { IndexUpdater updater = new IndexUpdater(database, queu...
[ "public", "static", "void", "updateIndex", "(", "String", "indexName", ",", "List", "<", "FieldSort", ">", "fieldNames", ",", "Database", "database", ",", "SQLDatabaseQueue", "queue", ")", "throws", "QueryException", "{", "IndexUpdater", "updater", "=", "new", "...
Update a single index. This index is assumed to already exist. @param indexName Name of index to update @param fieldNames List of field names in the sort format @param database The local {@link Database} @param queue The executor service queue @return index update success status (true/false)
[ "Update", "a", "single", "index", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java#L86-L93
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/DocumentRevs.java
DocumentRevs.setOthers
@JsonAnySetter public void setOthers(String name, Object value) { if(name.startsWith("_")) { // Just be defensive throw new RuntimeException("This is a reserved field, and should not be treated as document content."); } this.others.put(name, value); }
java
@JsonAnySetter public void setOthers(String name, Object value) { if(name.startsWith("_")) { // Just be defensive throw new RuntimeException("This is a reserved field, and should not be treated as document content."); } this.others.put(name, value); }
[ "@", "JsonAnySetter", "public", "void", "setOthers", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "name", ".", "startsWith", "(", "\"_\"", ")", ")", "{", "// Just be defensive", "throw", "new", "RuntimeException", "(", "\"This is a reser...
Jackson will automatically put any field it can not find match to this @JsonAnySetter bucket. This is effectively all the document content.
[ "Jackson", "will", "automatically", "put", "any", "field", "it", "can", "not", "find", "match", "to", "this" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/DocumentRevs.java#L79-L86
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java
QueryValidator.normaliseAndValidateQuery
@SuppressWarnings("unchecked") public static Map<String, Object> normaliseAndValidateQuery(Map<String, Object> query) throws QueryException{ boolean isWildCard = false; if (query.isEmpty()) { isWildCard = true; } // First expand the query to include a leading compound pr...
java
@SuppressWarnings("unchecked") public static Map<String, Object> normaliseAndValidateQuery(Map<String, Object> query) throws QueryException{ boolean isWildCard = false; if (query.isEmpty()) { isWildCard = true; } // First expand the query to include a leading compound pr...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Map", "<", "String", ",", "Object", ">", "normaliseAndValidateQuery", "(", "Map", "<", "String", ",", "Object", ">", "query", ")", "throws", "QueryException", "{", "boolean", "isWildCard", ...
Expand implicit operators in a query, and validate
[ "Expand", "implicit", "operators", "in", "a", "query", "and", "validate" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java#L54-L111
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java
QueryValidator.validateSelector
@SuppressWarnings("unchecked") private static void validateSelector(Map<String, Object> selector) throws QueryException { String topLevelOp = (String) selector.keySet().toArray()[0]; // top level op can only be $and or $or after normalisation if (topLevelOp.equals(AND) || topLevelOp.equals(...
java
@SuppressWarnings("unchecked") private static void validateSelector(Map<String, Object> selector) throws QueryException { String topLevelOp = (String) selector.keySet().toArray()[0]; // top level op can only be $and or $or after normalisation if (topLevelOp.equals(AND) || topLevelOp.equals(...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "void", "validateSelector", "(", "Map", "<", "String", ",", "Object", ">", "selector", ")", "throws", "QueryException", "{", "String", "topLevelOp", "=", "(", "String", ")", "selector", "...
we are going to need to walk the query tree to validate it before executing it
[ "we", "are", "going", "to", "need", "to", "walk", "the", "query", "tree", "to", "validate", "it", "before", "executing", "it" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java#L414-L427
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java
QueryValidator.validateCompoundOperatorClauses
@SuppressWarnings("unchecked") private static void validateCompoundOperatorClauses(List<Object> clauses, Boolean[] textClauseLimitReached) throws QueryException { for (Object obj : clauses) { if (!(obj instanceof Map)) { ...
java
@SuppressWarnings("unchecked") private static void validateCompoundOperatorClauses(List<Object> clauses, Boolean[] textClauseLimitReached) throws QueryException { for (Object obj : clauses) { if (!(obj instanceof Map)) { ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "void", "validateCompoundOperatorClauses", "(", "List", "<", "Object", ">", "clauses", ",", "Boolean", "[", "]", "textClauseLimitReached", ")", "throws", "QueryException", "{", "for", "(", "O...
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. @param clauses A list of clauses making up a query selector @param textClauseLimitReached A flag used to track the text clause limit throughout the validation process. ...
[ "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", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java#L439-L479
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentStreamFactory.java
AttachmentStreamFactory.getInputStream
public InputStream getInputStream(File file, Attachment.Encoding encoding) throws IOException { // First, open a stream to the raw bytes on disk. // Then, if we have a key assume the file is encrypted, so add a stream // to the chain which decrypts the data as we read from disk. // Fina...
java
public InputStream getInputStream(File file, Attachment.Encoding encoding) throws IOException { // First, open a stream to the raw bytes on disk. // Then, if we have a key assume the file is encrypted, so add a stream // to the chain which decrypts the data as we read from disk. // Fina...
[ "public", "InputStream", "getInputStream", "(", "File", "file", ",", "Attachment", ".", "Encoding", "encoding", ")", "throws", "IOException", "{", "// First, open a stream to the raw bytes on disk.", "// Then, if we have a key assume the file is encrypted, so add a stream", "// to ...
Return a stream to be used to read from the file on disk. Stream's bytes will be unzipped, unencrypted attachment content. @param file File object to read from. @param encoding Encoding of attachment. @return Stream for reading attachment data. @throws IOException if there's a problem reading from disk, including iss...
[ "Return", "a", "stream", "to", "be", "used", "to", "read", "from", "the", "file", "on", "disk", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentStreamFactory.java#L81-L113
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentStreamFactory.java
AttachmentStreamFactory.getOutputStream
public OutputStream getOutputStream(File file, Attachment.Encoding encoding) throws IOException { // First, open a stream to the raw bytes on disk. // Then, if we have a key assume the file should be encrypted before writing, // so wrap the file stream in a stream which encrypts dur...
java
public OutputStream getOutputStream(File file, Attachment.Encoding encoding) throws IOException { // First, open a stream to the raw bytes on disk. // Then, if we have a key assume the file should be encrypted before writing, // so wrap the file stream in a stream which encrypts dur...
[ "public", "OutputStream", "getOutputStream", "(", "File", "file", ",", "Attachment", ".", "Encoding", "encoding", ")", "throws", "IOException", "{", "// First, open a stream to the raw bytes on disk.", "// Then, if we have a key assume the file should be encrypted before writing,", ...
Get stream for writing attachment data to disk. Opens the output stream using {@link FileUtils#openOutputStream(File)}. Data should be written to the stream unencoded, unencrypted. @param file File to write to. @param encoding Encoding to use. @return Stream for writing. @throws IOException if there's a problem writ...
[ "Get", "stream", "for", "writing", "attachment", "data", "to", "disk", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentStreamFactory.java#L129-L176
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java
ValueListMap.addValueToKey
public void addValueToKey(K key, V value) { this.addValuesToKey(key, Collections.singletonList(value)); }
java
public void addValueToKey(K key, V value) { this.addValuesToKey(key, Collections.singletonList(value)); }
[ "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. @param key the key to associate the values with @param value the value to add to the key
[ "Add", "a", "value", "to", "the", "map", "under", "the", "existing", "key", "or", "creating", "a", "new", "key", "if", "it", "does", "not", "yet", "exist", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java#L55-L57
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java
ValueListMap.addValuesToKey
public void addValuesToKey(K key, Collection<V> valueCollection) { if (!valueCollection.isEmpty()) { // Create a new collection to store the values (will be changed to internal type by call // to putIfAbsent anyway) List<V> collectionToAppendValuesOn = new ArrayList<V>(); ...
java
public void addValuesToKey(K key, Collection<V> valueCollection) { if (!valueCollection.isEmpty()) { // Create a new collection to store the values (will be changed to internal type by call // to putIfAbsent anyway) List<V> collectionToAppendValuesOn = new ArrayList<V>(); ...
[ "public", "void", "addValuesToKey", "(", "K", "key", ",", "Collection", "<", "V", ">", "valueCollection", ")", "{", "if", "(", "!", "valueCollection", ".", "isEmpty", "(", ")", ")", "{", "// Create a new collection to store the values (will be changed to internal type...
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. @param key the key to associate the values with @param valueCollection a collection of values to add to the key
[ "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", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java#L66-L78
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchURIHelper.java
CouchURIHelper.queryAsString
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.encodeQ...
java
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.encodeQ...
[ "private", "String", "queryAsString", "(", "Map", "<", "String", ",", "Object", ">", "query", ")", "{", "ArrayList", "<", "String", ">", "queryParts", "=", "new", "ArrayList", "<", "String", ">", "(", "query", ".", "size", "(", ")", ")", ";", "for", ...
Joins the entries in a map into a URL-encoded query string. @param query map containing query params @return joined, URL-encoded query params
[ "Joins", "the", "entries", "in", "a", "map", "into", "a", "URL", "-", "encoded", "query", "string", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchURIHelper.java#L165-L174
train
cloudant/sync-android
sample/todo-sync/src/com/cloudant/todo/TodoActivity.java
TodoActivity.replicationComplete
void replicationComplete() { reloadTasksFromModel(); Toast.makeText(getApplicationContext(), R.string.replication_completed, Toast.LENGTH_LONG).show(); dismissDialog(DIALOG_PROGRESS); }
java
void replicationComplete() { reloadTasksFromModel(); Toast.makeText(getApplicationContext(), R.string.replication_completed, Toast.LENGTH_LONG).show(); dismissDialog(DIALOG_PROGRESS); }
[ "void", "replicationComplete", "(", ")", "{", "reloadTasksFromModel", "(", ")", ";", "Toast", ".", "makeText", "(", "getApplicationContext", "(", ")", ",", "R", ".", "string", ".", "replication_completed", ",", "Toast", ".", "LENGTH_LONG", ")", ".", "show", ...
Called by TasksModel when it receives a replication complete callback. TasksModel takes care of calling this on the main thread.
[ "Called", "by", "TasksModel", "when", "it", "receives", "a", "replication", "complete", "callback", ".", "TasksModel", "takes", "care", "of", "calling", "this", "on", "the", "main", "thread", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/sample/todo-sync/src/com/cloudant/todo/TodoActivity.java#L178-L184
train
cloudant/sync-android
sample/todo-sync/src/com/cloudant/todo/TodoActivity.java
TodoActivity.replicationError
void replicationError() { Log.i(LOG_TAG, "error()"); reloadTasksFromModel(); Toast.makeText(getApplicationContext(), R.string.replication_error, Toast.LENGTH_LONG).show(); dismissDialog(DIALOG_PROGRESS); }
java
void replicationError() { Log.i(LOG_TAG, "error()"); reloadTasksFromModel(); Toast.makeText(getApplicationContext(), R.string.replication_error, Toast.LENGTH_LONG).show(); dismissDialog(DIALOG_PROGRESS); }
[ "void", "replicationError", "(", ")", "{", "Log", ".", "i", "(", "LOG_TAG", ",", "\"error()\"", ")", ";", "reloadTasksFromModel", "(", ")", ";", "Toast", ".", "makeText", "(", "getApplicationContext", "(", ")", ",", "R", ".", "string", ".", "replication_er...
Called by TasksModel when it receives a replication error callback. TasksModel takes care of calling this on the main thread.
[ "Called", "by", "TasksModel", "when", "it", "receives", "a", "replication", "error", "callback", ".", "TasksModel", "takes", "care", "of", "calling", "this", "on", "the", "main", "thread", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/sample/todo-sync/src/com/cloudant/todo/TodoActivity.java#L190-L197
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java
AttachmentManager.prepareAttachment
protected static PreparedAttachment prepareAttachment(String attachmentsDir, AttachmentStreamFactory attachmentStreamFactory, Attachment attachment, long length, long encodedLength) throws AttachmentException { PreparedAttachment pa = new PreparedAttachm...
java
protected static PreparedAttachment prepareAttachment(String attachmentsDir, AttachmentStreamFactory attachmentStreamFactory, Attachment attachment, long length, long encodedLength) throws AttachmentException { PreparedAttachment pa = new PreparedAttachm...
[ "protected", "static", "PreparedAttachment", "prepareAttachment", "(", "String", "attachmentsDir", ",", "AttachmentStreamFactory", "attachmentStreamFactory", ",", "Attachment", "attachment", ",", "long", "length", ",", "long", "encodedLength", ")", "throws", "AttachmentExce...
prepare an attachment and check validity of length and encodedLength metadata
[ "prepare", "an", "attachment", "and", "check", "validity", "of", "length", "and", "encodedLength", "metadata" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L212-L228
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java
AttachmentManager.findExistingAttachments
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()) { ...
java
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()) { ...
[ "public", "static", "Map", "<", "String", ",", "SavedAttachment", ">", "findExistingAttachments", "(", "Map", "<", "String", ",", "?", "extends", "Attachment", ">", "attachments", ")", "{", "Map", "<", "String", ",", "SavedAttachment", ">", "existingAttachments"...
Return a map of the existing attachments in the map passed in. @param attachments Attachments to search. @return Map of attachments which already exist in the attachment store, or an empty map if none.
[ "Return", "a", "map", "of", "the", "existing", "attachments", "in", "the", "map", "passed", "in", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L236-L245
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java
AttachmentManager.findNewAttachments
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 SavedAttachment)...
java
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 SavedAttachment)...
[ "public", "static", "Map", "<", "String", ",", "Attachment", ">", "findNewAttachments", "(", "Map", "<", "String", ",", "?", "extends", "Attachment", ">", "attachments", ")", "{", "Map", "<", "String", ",", "Attachment", ">", "newAttachments", "=", "new", ...
Return a map of the new attachments in the map passed in. @param attachments Attachments to search. @return Map of attachments which need adding to the attachment store, or an empty map if none.
[ "Return", "a", "map", "of", "the", "new", "attachments", "in", "the", "map", "passed", "in", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L253-L261
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java
AttachmentManager.copyAttachment
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(par...
java
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(par...
[ "public", "static", "void", "copyAttachment", "(", "SQLDatabase", "db", ",", "long", "parentSequence", ",", "long", "newSequence", ",", "String", "filename", ")", "throws", "SQLException", "{", "Cursor", "c", "=", "null", ";", "try", "{", "c", "=", "db", "...
Copy a single attachment for a given revision to a new revision. @param db database to use @param parentSequence identifies sequence number of revision to copy attachment data from @param newSequence identifies sequence number of revision to copy attachment data to @param filename filename of attachment to copy
[ "Copy", "a", "single", "attachment", "for", "a", "given", "revision", "to", "a", "new", "revision", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L398-L408
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java
AttachmentManager.purgeAttachments
public static void purgeAttachments(SQLDatabase db, String attachmentsDir) { // it's easier to deal with Strings since java doesn't know how to compare byte[]s Set<String> currentKeys = new HashSet<String>(); Cursor c = null; try { // delete attachment table entries for revs ...
java
public static void purgeAttachments(SQLDatabase db, String attachmentsDir) { // it's easier to deal with Strings since java doesn't know how to compare byte[]s Set<String> currentKeys = new HashSet<String>(); Cursor c = null; try { // delete attachment table entries for revs ...
[ "public", "static", "void", "purgeAttachments", "(", "SQLDatabase", "db", ",", "String", "attachmentsDir", ")", "{", "// it's easier to deal with Strings since java doesn't know how to compare byte[]s", "Set", "<", "String", ">", "currentKeys", "=", "new", "HashSet", "<", ...
Called by DatabaseImpl on the execution queue, this needs to have the db passed to it. @param db database to purge attachments from
[ "Called", "by", "DatabaseImpl", "on", "the", "execution", "queue", "this", "needs", "to", "have", "the", "db", "passed", "to", "it", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L414-L471
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java
AttachmentManager.generateFilenameForKey
static String generateFilenameForKey(SQLDatabase db, String keyString) throws NameGenerationException { String filename = null; long result = -1; // -1 is error for insert call int tries = 0; while (result == -1 && tries < 200) { byte[] randomBytes = new byte[2...
java
static String generateFilenameForKey(SQLDatabase db, String keyString) throws NameGenerationException { String filename = null; long result = -1; // -1 is error for insert call int tries = 0; while (result == -1 && tries < 200) { byte[] randomBytes = new byte[2...
[ "static", "String", "generateFilenameForKey", "(", "SQLDatabase", "db", ",", "String", "keyString", ")", "throws", "NameGenerationException", "{", "String", "filename", "=", "null", ";", "long", "result", "=", "-", "1", ";", "// -1 is error for insert call", "int", ...
Iterate candidate filenames generated from the filenameRandom generator until we find one which doesn't already exist. We try inserting the new record into attachments_key_filename to find a unique filename rather than checking on disk filenames. This is because we can make use of the fact that this method is called o...
[ "Iterate", "candidate", "filenames", "generated", "from", "the", "filenameRandom", "generator", "until", "we", "find", "one", "which", "doesn", "t", "already", "exist", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L552-L582
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/sqlite4java/Tuple.java
Tuple.put
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); }
java
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); }
[ "public", "void", "put", "(", "int", "index", ",", "long", "value", ")", "{", "if", "(", "desc", ".", "get", "(", "index", ")", "!=", "Cursor", ".", "FIELD_TYPE_INTEGER", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Inserting an integer, but...
Internally we always store the SQLite number as long
[ "Internally", "we", "always", "store", "the", "SQLite", "number", "as", "long" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/sqlite4java/Tuple.java#L65-L70
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/replication/ReplicatorBuilder.java
ReplicatorBuilder.addAuthInterceptorIfRequired
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); ...
java
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); ...
[ "private", "URI", "addAuthInterceptorIfRequired", "(", "URI", "uri", ")", "{", "String", "uriProtocol", "=", "uri", ".", "getScheme", "(", ")", ";", "String", "uriHost", "=", "uri", ".", "getHost", "(", ")", ";", "String", "uriPath", "=", "uri", ".", "ge...
- else add cookie interceptor if needed
[ "-", "else", "add", "cookie", "interceptor", "if", "needed" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/replication/ReplicatorBuilder.java#L157-L167
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/replication/ReplicatorBuilder.java
ReplicatorBuilder.username
public E username(String username) { Misc.checkNotNull(username, "username"); this.username = username; //noinspection unchecked return (E) this; }
java
public E username(String username) { Misc.checkNotNull(username, "username"); this.username = username; //noinspection unchecked return (E) this; }
[ "public", "E", "username", "(", "String", "username", ")", "{", "Misc", ".", "checkNotNull", "(", "username", ",", "\"username\"", ")", ";", "this", ".", "username", "=", "username", ";", "//noinspection unchecked", "return", "(", "E", ")", "this", ";", "}...
Sets the username to use when authenticating with the server. Setting the username and password (using the {@link ReplicatorBuilder#password(String)}) method takes precedence over credentials passed via the URI. @param username The username to use when authenticating. @return The current instance of {@link Replicator...
[ "Sets", "the", "username", "to", "use", "when", "authenticating", "with", "the", "server", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/replication/ReplicatorBuilder.java#L495-L500
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/replication/ReplicatorBuilder.java
ReplicatorBuilder.password
public E password(String password) { Misc.checkNotNull(password, "password"); this.password = password; //noinspection unchecked return (E) this; }
java
public E password(String password) { Misc.checkNotNull(password, "password"); this.password = password; //noinspection unchecked return (E) this; }
[ "public", "E", "password", "(", "String", "password", ")", "{", "Misc", ".", "checkNotNull", "(", "password", ",", "\"password\"", ")", ";", "this", ".", "password", "=", "password", ";", "//noinspection unchecked", "return", "(", "E", ")", "this", ";", "}...
Sets the password to use when authenticating with the server. Setting the username (using the {@link ReplicatorBuilder#username(String)}) and password method takes precedence over credentials passed via the URI. @param password The password to use when authenticating. @return The current instance of {@link Replicator...
[ "Sets", "the", "password", "to", "use", "when", "authenticating", "with", "the", "server", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/replication/ReplicatorBuilder.java#L513-L518
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryImpl.java
QueryImpl.listIndexes
@Override 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); thro...
java
@Override 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); thro...
[ "@", "Override", "public", "List", "<", "Index", ">", "listIndexes", "(", ")", "throws", "QueryException", "{", "try", "{", "return", "DatabaseImpl", ".", "get", "(", "dbQueue", ".", "submit", "(", "new", "ListIndexesCallable", "(", ")", ")", ")", ";", "...
Get a list of indexes and their definitions as a Map. Returns: { indexName: { type: json, name: indexName, fields: [field1, field2] } @return Map of indexes in the database.
[ "Get", "a", "list", "of", "indexes", "and", "their", "definitions", "as", "a", "Map", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryImpl.java#L124-L134
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryImpl.java
QueryImpl.ensureIndexed
private Index ensureIndexed(List<FieldSort> fieldNames, String indexName, IndexType indexType, Tokenizer tokenizer) throws QueryException { // synchronized to prevent race conditions in IndexCreator when looking for ...
java
private Index ensureIndexed(List<FieldSort> fieldNames, String indexName, IndexType indexType, Tokenizer tokenizer) throws QueryException { // synchronized to prevent race conditions in IndexCreator when looking for ...
[ "private", "Index", "ensureIndexed", "(", "List", "<", "FieldSort", ">", "fieldNames", ",", "String", "indexName", ",", "IndexType", "indexType", ",", "Tokenizer", "tokenizer", ")", "throws", "QueryException", "{", "// synchronized to prevent race conditions in IndexCreat...
Add a single, possibly compound, index for the given field names. This function generates a name for the new index. @param fieldNames List of field names in the sort format @param indexName Name of index to create or null to generate an index name. @param indexType The type of index (json or text currently supported)...
[ "Add", "a", "single", "possibly", "compound", "index", "for", "the", "given", "field", "names", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryImpl.java#L158-L172
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryImpl.java
QueryImpl.deleteIndex
@Override 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) { ...
java
@Override 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) { ...
[ "@", "Override", "public", "void", "deleteIndex", "(", "final", "String", "indexName", ")", "throws", "QueryException", "{", "Misc", ".", "checkNotNullOrEmpty", "(", "indexName", ",", "\"indexName\"", ")", ";", "Future", "<", "Void", ">", "result", "=", "dbQue...
Delete an index. @param indexName Name of index to delete
[ "Delete", "an", "index", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryImpl.java#L179-L197
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryImpl.java
QueryImpl.refreshAllIndexes
@Override public void refreshAllIndexes() throws QueryException { List<Index> indexes = listIndexes(); IndexUpdater.updateAllIndexes(indexes, database, dbQueue); }
java
@Override public void refreshAllIndexes() throws QueryException { List<Index> indexes = listIndexes(); IndexUpdater.updateAllIndexes(indexes, database, dbQueue); }
[ "@", "Override", "public", "void", "refreshAllIndexes", "(", ")", "throws", "QueryException", "{", "List", "<", "Index", ">", "indexes", "=", "listIndexes", "(", ")", ";", "IndexUpdater", ".", "updateAllIndexes", "(", "indexes", ",", "database", ",", "dbQueue"...
Update all indexes.
[ "Update", "all", "indexes", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryImpl.java#L203-L208
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryExecutor.java
QueryExecutor.find
public QueryResult find(Map<String, Object> query, final List<Index> indexes, long skip, long limit, List<String> fields, final List<FieldSort> sortDocument) throws QueryException ...
java
public QueryResult find(Map<String, Object> query, final List<Index> indexes, long skip, long limit, List<String> fields, final List<FieldSort> sortDocument) throws QueryException ...
[ "public", "QueryResult", "find", "(", "Map", "<", "String", ",", "Object", ">", "query", ",", "final", "List", "<", "Index", ">", "indexes", ",", "long", "skip", ",", "long", "limit", ",", "List", "<", "String", ">", "fields", ",", "final", "List", "...
Execute the query passed using the selection of index definition provided. The index definitions are presumed to already exist and be up to date for the {@link Database} and its underlying {@link SQLDatabaseQueue} passed to the constructor. @param query query to execute. @param indexes indexes to use (this method wil...
[ "Execute", "the", "query", "passed", "using", "the", "selection", "of", "index", "definition", "provided", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryExecutor.java#L80-L152
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryExecutor.java
QueryExecutor.validateFields
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 (...
java
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 (...
[ "private", "void", "validateFields", "(", "List", "<", "String", ">", "fields", ")", "{", "if", "(", "fields", "==", "null", ")", "{", "return", ";", "}", "List", "<", "String", ">", "badFields", "=", "new", "ArrayList", "<", "String", ">", "(", ")",...
Checks if the fields are valid.
[ "Checks", "if", "the", "fields", "are", "valid", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryExecutor.java#L170-L187
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryExecutor.java
QueryExecutor.sortIds
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_THRES...
java
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_THRES...
[ "private", "List", "<", "String", ">", "sortIds", "(", "Set", "<", "String", ">", "docIdSet", ",", "List", "<", "FieldSort", ">", "sortDocument", ",", "List", "<", "Index", ">", "indexes", ",", "SQLDatabase", "db", ")", "throws", "QueryException", "{", "...
Return ordered list of document IDs using provided indexes. Method assumes 'sortDocument' is valid. @param docIdSet Set of current results which are sorted @param sortDocument Array of ordering definitions '[ {"fieldName": "asc"}, {"fieldName2", "desc"} ]' @param indexes dictionary of indexes @param db database conta...
[ "Return", "ordered", "list", "of", "document", "IDs", "using", "provided", "indexes", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryExecutor.java#L288-L327
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryExecutor.java
QueryExecutor.sqlToSortIds
protected static SqlParts sqlToSortIds(Set<String> docIdSet, List<FieldSort> sortDocument, List<Index> indexes) throws QueryException { String chosenIndex = chooseIndexForSort(sortDocument, indexes); if (chosenIndex == null) { ...
java
protected static SqlParts sqlToSortIds(Set<String> docIdSet, List<FieldSort> sortDocument, List<Index> indexes) throws QueryException { String chosenIndex = chooseIndexForSort(sortDocument, indexes); if (chosenIndex == null) { ...
[ "protected", "static", "SqlParts", "sqlToSortIds", "(", "Set", "<", "String", ">", "docIdSet", ",", "List", "<", "FieldSort", ">", "sortDocument", ",", "List", "<", "Index", ">", "indexes", ")", "throws", "QueryException", "{", "String", "chosenIndex", "=", ...
Return SQL to get ordered list of docIds. Method assumes `sortDocument` is valid. @param docIdSet The original set of document IDs @param sortDocument Array of ordering definitions [ { "fieldName" : "asc" }, { "fieldName2", "desc" } ] @param indexes dictionary of indexes @return the SQL containing the order by clause
[ "Return", "SQL", "to", "get", "ordered", "list", "of", "docIds", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryExecutor.java#L340-L387
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/CouchUtils.java
CouchUtils.generateNextRevisionId
public static String generateNextRevisionId(String revisionId) { validateRevisionId(revisionId); int generation = generationFromRevId(revisionId); String digest = createUUID(); return Integer.toString(generation + 1) + "-" + digest; }
java
public static String generateNextRevisionId(String revisionId) { validateRevisionId(revisionId); int generation = generationFromRevId(revisionId); String digest = createUUID(); return Integer.toString(generation + 1) + "-" + digest; }
[ "public", "static", "String", "generateNextRevisionId", "(", "String", "revisionId", ")", "{", "validateRevisionId", "(", "revisionId", ")", ";", "int", "generation", "=", "generationFromRevId", "(", "revisionId", ")", ";", "String", "digest", "=", "createUUID", "...
DBObject IDs have a generation count, a hyphen, and a UUID.
[ "DBObject", "IDs", "have", "a", "generation", "count", "a", "hyphen", "and", "a", "UUID", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/CouchUtils.java#L86-L91
train
cloudant/sync-android
cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/internal/sqlite/android/AndroidSQLCipherSQLite.java
AndroidSQLCipherSQLite.open
public static AndroidSQLCipherSQLite open(File path, KeyProvider provider) { //Call SQLCipher-based method for opening database, or creating if database not found SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(path, KeyUtils.sqlCipherKeyForKeyProvider(provider), null); ...
java
public static AndroidSQLCipherSQLite open(File path, KeyProvider provider) { //Call SQLCipher-based method for opening database, or creating if database not found SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(path, KeyUtils.sqlCipherKeyForKeyProvider(provider), null); ...
[ "public", "static", "AndroidSQLCipherSQLite", "open", "(", "File", "path", ",", "KeyProvider", "provider", ")", "{", "//Call SQLCipher-based method for opening database, or creating if database not found", "SQLiteDatabase", "db", "=", "SQLiteDatabase", ".", "openOrCreateDatabase"...
Constructor for creating SQLCipher-based SQLite database. @param path full file path of the db file @param provider Provider object that contains the key to encrypt the SQLCipher database @return
[ "Constructor", "for", "creating", "SQLCipher", "-", "based", "SQLite", "database", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/internal/sqlite/android/AndroidSQLCipherSQLite.java#L52-L59
train
cloudant/sync-android
cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java
PeriodicReplicationService.upgradePreferences
protected void upgradePreferences() { String alarmDueElapsed = "com.cloudant.sync.replication.PeriodicReplicationService.alarmDueElapsed"; if (mPrefs.contains(alarmDueElapsed)) { // These are old style preferences. We need to rewrite them in the new form that allows // multiple r...
java
protected void upgradePreferences() { String alarmDueElapsed = "com.cloudant.sync.replication.PeriodicReplicationService.alarmDueElapsed"; if (mPrefs.contains(alarmDueElapsed)) { // These are old style preferences. We need to rewrite them in the new form that allows // multiple r...
[ "protected", "void", "upgradePreferences", "(", ")", "{", "String", "alarmDueElapsed", "=", "\"com.cloudant.sync.replication.PeriodicReplicationService.alarmDueElapsed\"", ";", "if", "(", "mPrefs", ".", "contains", "(", "alarmDueElapsed", ")", ")", "{", "// These are old st...
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.
[ "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", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java#L134-L158
train
cloudant/sync-android
cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java
PeriodicReplicationService.startPeriodicReplication
public synchronized void startPeriodicReplication() { if (!isPeriodicReplicationEnabled()) { setPeriodicReplicationEnabled(true); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent alarmIntent = new Intent(this, clazz); alar...
java
public synchronized void startPeriodicReplication() { if (!isPeriodicReplicationEnabled()) { setPeriodicReplicationEnabled(true); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent alarmIntent = new Intent(this, clazz); alar...
[ "public", "synchronized", "void", "startPeriodicReplication", "(", ")", "{", "if", "(", "!", "isPeriodicReplicationEnabled", "(", ")", ")", "{", "setPeriodicReplicationEnabled", "(", "true", ")", ";", "AlarmManager", "alarmManager", "=", "(", "AlarmManager", ")", ...
Start periodic replications.
[ "Start", "periodic", "replications", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java#L253-L283
train
cloudant/sync-android
cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java
PeriodicReplicationService.stopPeriodicReplication
public synchronized void stopPeriodicReplication() { if (isPeriodicReplicationEnabled()) { setPeriodicReplicationEnabled(false); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent alarmIntent = new Intent(this, clazz); alarm...
java
public synchronized void stopPeriodicReplication() { if (isPeriodicReplicationEnabled()) { setPeriodicReplicationEnabled(false); AlarmManager alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); Intent alarmIntent = new Intent(this, clazz); alarm...
[ "public", "synchronized", "void", "stopPeriodicReplication", "(", ")", "{", "if", "(", "isPeriodicReplicationEnabled", "(", ")", ")", "{", "setPeriodicReplicationEnabled", "(", "false", ")", ";", "AlarmManager", "alarmManager", "=", "(", "AlarmManager", ")", "getSys...
Stop replications currently in progress and cancel future scheduled replications.
[ "Stop", "replications", "currently", "in", "progress", "and", "cancel", "future", "scheduled", "replications", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java#L286-L300
train
cloudant/sync-android
cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java
PeriodicReplicationService.setPeriodicReplicationEnabled
private void setPeriodicReplicationEnabled(boolean running) { SharedPreferences.Editor editor = mPrefs.edit(); editor.putBoolean(constructKey(PERIODIC_REPLICATION_ENABLED_SUFFIX), running); editor.apply(); }
java
private void setPeriodicReplicationEnabled(boolean running) { SharedPreferences.Editor editor = mPrefs.edit(); editor.putBoolean(constructKey(PERIODIC_REPLICATION_ENABLED_SUFFIX), running); editor.apply(); }
[ "private", "void", "setPeriodicReplicationEnabled", "(", "boolean", "running", ")", "{", "SharedPreferences", ".", "Editor", "editor", "=", "mPrefs", ".", "edit", "(", ")", ";", "editor", ".", "putBoolean", "(", "constructKey", "(", "PERIODIC_REPLICATION_ENABLED_SUF...
Set a flag in SharedPreferences to indicate whether periodic replications are enabled. @param running true to indicate that periodic replications are enabled, otherwise false.
[ "Set", "a", "flag", "in", "SharedPreferences", "to", "indicate", "whether", "periodic", "replications", "are", "enabled", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java#L351-L355
train
cloudant/sync-android
cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java
PeriodicReplicationService.setExplicitlyStopped
private void setExplicitlyStopped(boolean explicitlyStopped) { SharedPreferences.Editor editor = mPrefs.edit(); editor.putBoolean(constructKey(EXPLICITLY_STOPPED_SUFFIX), explicitlyStopped); editor.apply(); }
java
private void setExplicitlyStopped(boolean explicitlyStopped) { SharedPreferences.Editor editor = mPrefs.edit(); editor.putBoolean(constructKey(EXPLICITLY_STOPPED_SUFFIX), explicitlyStopped); editor.apply(); }
[ "private", "void", "setExplicitlyStopped", "(", "boolean", "explicitlyStopped", ")", "{", "SharedPreferences", ".", "Editor", "editor", "=", "mPrefs", ".", "edit", "(", ")", ";", "editor", ".", "putBoolean", "(", "constructKey", "(", "EXPLICITLY_STOPPED_SUFFIX", "...
Set a flag in SharedPreferences to indicate whether periodic replications were explicitly stopped. @param explicitlyStopped true to indicate that periodic replications were stopped explicitly by the sending of COMMAND_STOP_PERIODIC_REPLICATION, otherwise false.
[ "Set", "a", "flag", "in", "SharedPreferences", "to", "indicate", "whether", "periodic", "replications", "were", "explicitly", "stopped", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java#L381-L385
train
cloudant/sync-android
cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java
PeriodicReplicationService.resetAlarmDueTimesOnReboot
private void resetAlarmDueTimesOnReboot() { // As the device has been rebooted, we use clock time rather than elapsed time since // booting to set check whether we missed any alarms while the device was off and to // make sure the next alarm time isn't too far in the future (indicating the syste...
java
private void resetAlarmDueTimesOnReboot() { // As the device has been rebooted, we use clock time rather than elapsed time since // booting to set check whether we missed any alarms while the device was off and to // make sure the next alarm time isn't too far in the future (indicating the syste...
[ "private", "void", "resetAlarmDueTimesOnReboot", "(", ")", "{", "// As the device has been rebooted, we use clock time rather than elapsed time since", "// booting to set check whether we missed any alarms while the device was off and to", "// make sure the next alarm time isn't too far in the futur...
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.
[ "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", "occ...
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java#L400-L433
train
cloudant/sync-android
cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java
PeriodicReplicationService.setReplicationsPending
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(); ...
java
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(); ...
[ "public", "static", "void", "setReplicationsPending", "(", "Context", "context", ",", "Class", "<", "?", "extends", "PeriodicReplicationService", ">", "prsClass", ",", "boolean", "pending", ")", "{", "SharedPreferences", "prefs", "=", "context", ".", "getSharedPrefe...
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. @param context @param prsClass @param pending true if there is a replicat...
[ "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...
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java#L470-L477
train
cloudant/sync-android
cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java
PeriodicReplicationService.replicationsPending
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...
java
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...
[ "public", "static", "boolean", "replicationsPending", "(", "Context", "context", ",", "Class", "<", "?", "extends", "PeriodicReplicationService", ">", "prsClass", ")", "{", "SharedPreferences", "prefs", "=", "context", ".", "getSharedPreferences", "(", "PREFERENCES_FI...
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. @param context @param prsClass @return
[ "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", "replicat...
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android/src/main/java/com/cloudant/sync/replication/PeriodicReplicationService.java#L487-L492
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java
CouchClient.executeWithRetry
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; ...
java
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; ...
[ "private", "<", "T", ">", "T", "executeWithRetry", "(", "final", "Callable", "<", "ExecuteResult", ">", "task", ",", "InputStreamProcessor", "<", "T", ">", "processor", ")", "throws", "CouchException", "{", "int", "attempts", "=", "10", ";", "CouchException", ...
return an InputStream if successful or throw an exception
[ "return", "an", "InputStream", "if", "successful", "or", "throw", "an", "exception" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java#L344-L381
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java
CouchClient.update
public Response update(String id, Object document) { Misc.checkNotNullOrEmpty(id, "id"); Misc.checkNotNull(document, "Document"); // Get the latest rev, will throw if doc doesn't exist getDocumentRev(id); return putUpdate(id, document); }
java
public Response update(String id, Object document) { Misc.checkNotNullOrEmpty(id, "id"); Misc.checkNotNull(document, "Document"); // Get the latest rev, will throw if doc doesn't exist getDocumentRev(id); return putUpdate(id, document); }
[ "public", "Response", "update", "(", "String", "id", ",", "Object", "document", ")", "{", "Misc", ".", "checkNotNullOrEmpty", "(", "id", ",", "\"id\"", ")", ";", "Misc", ".", "checkNotNull", "(", "document", ",", "\"Document\"", ")", ";", "// Get the latest ...
Document should be complete document include "_id" matches ID
[ "Document", "should", "be", "complete", "document", "include", "_id", "matches", "ID" ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java#L738-L746
train
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java
CouchClient.bulkCreateSerializedDocs
public List<Response> bulkCreateSerializedDocs(List<String> serializedDocs) { Misc.checkNotNull(serializedDocs, "Serialized doc list"); String payload = generateBulkSerializedDocsPayload(serializedDocs); return bulkCreateDocs(payload); }
java
public List<Response> bulkCreateSerializedDocs(List<String> serializedDocs) { Misc.checkNotNull(serializedDocs, "Serialized doc list"); String payload = generateBulkSerializedDocsPayload(serializedDocs); return bulkCreateDocs(payload); }
[ "public", "List", "<", "Response", ">", "bulkCreateSerializedDocs", "(", "List", "<", "String", ">", "serializedDocs", ")", "{", "Misc", ".", "checkNotNull", "(", "serializedDocs", ",", "\"Serialized doc list\"", ")", ";", "String", "payload", "=", "generateBulkSe...
Bulk insert a list of document that are serialized to JSON data already. For performance reasons, the JSON doc is not validated. @param serializedDocs list of JSON documents @return list of Response
[ "Bulk", "insert", "a", "list", "of", "document", "that", "are", "serialized", "to", "JSON", "data", "already", ".", "For", "performance", "reasons", "the", "JSON", "doc", "is", "not", "validated", "." ]
5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchClient.java#L820-L824
train
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/favorites/FavoritesEditController.java
FavoritesEditController.initializeView
@RenderMapping public String initializeView(Model model, RenderRequest renderRequest) { IUserInstance ui = userInstanceManager.getUserInstance(portalRequestUtils.getCurrentPortalRequest()); UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager(); IUs...
java
@RenderMapping public String initializeView(Model model, RenderRequest renderRequest) { IUserInstance ui = userInstanceManager.getUserInstance(portalRequestUtils.getCurrentPortalRequest()); UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager(); IUs...
[ "@", "RenderMapping", "public", "String", "initializeView", "(", "Model", "model", ",", "RenderRequest", "renderRequest", ")", "{", "IUserInstance", "ui", "=", "userInstanceManager", ".", "getUserInstance", "(", "portalRequestUtils", ".", "getCurrentPortalRequest", "(",...
Handles all Favorites portlet EDIT mode renders. Populates model with user's favorites and selects a view to display those favorites. <p>View selection: <p>Returns "jsp/Favorites/edit" in the normal case where the user has at least one favorited portlet or favorited collection. <p>Returns "jsp/Favorites/edit_zero" i...
[ "Handles", "all", "Favorites", "portlet", "EDIT", "mode", "renders", ".", "Populates", "model", "with", "user", "s", "favorites", "and", "selects", "a", "view", "to", "display", "those", "favorites", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/favorites/FavoritesEditController.java#L69-L118
train
Jasig/uPortal
uPortal-layout/uPortal-layout-core/src/main/java/org/apereo/portal/layout/dlm/FragmentNodeInfo.java
FragmentNodeInfo.getAttributeValue
public String getAttributeValue(String name) { Attr att = node.getAttributeNode(name); if (att == null) return null; return att.getNodeValue(); }
java
public String getAttributeValue(String name) { Attr att = node.getAttributeNode(name); if (att == null) return null; return att.getNodeValue(); }
[ "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.
[ "Returns", "the", "value", "of", "an", "attribute", "or", "null", "if", "such", "an", "attribute", "is", "not", "defined", "on", "the", "underlying", "element", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-core/src/main/java/org/apereo/portal/layout/dlm/FragmentNodeInfo.java#L39-L43
train
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/HandlerUtils.java
HandlerUtils.getPLFNode
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 plfNo...
java
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 plfNo...
[ "public", "static", "Element", "getPLFNode", "(", "Element", "compViewNode", ",", "IPerson", "person", ",", "boolean", "create", ",", "boolean", "includeChildNodes", ")", "throws", "PortalException", "{", "Document", "plf", "=", "(", "Document", ")", "person", "...
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.
[ "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", "ret...
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/HandlerUtils.java#L36-L53
train
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/HandlerUtils.java
HandlerUtils.createPlfNodeAndPath
public static Element createPlfNodeAndPath( Element compViewNode, boolean includeChildNodes, IPerson person) throws PortalException { // first attempt to get parent Element compViewParent = (Element) compViewNode.getParentNode(); Element plfParent = getPLFNode(compViewPar...
java
public static Element createPlfNodeAndPath( Element compViewNode, boolean includeChildNodes, IPerson person) throws PortalException { // first attempt to get parent Element compViewParent = (Element) compViewNode.getParentNode(); Element plfParent = getPLFNode(compViewPar...
[ "public", "static", "Element", "createPlfNodeAndPath", "(", "Element", "compViewNode", ",", "boolean", "includeChildNodes", ",", "IPerson", "person", ")", "throws", "PortalException", "{", "// first attempt to get parent", "Element", "compViewParent", "=", "(", "Element",...
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.
[ "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", "lay...
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/HandlerUtils.java#L59-L83
train
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/HandlerUtils.java
HandlerUtils.createILFCopy
private static Element createILFCopy( Element compViewNode, Element compViewParent, boolean includeChildNodes, Document plf, Element plfParent, IPerson person) throws PortalException { Element plfNode = (Element) plf.importNode(...
java
private static Element createILFCopy( Element compViewNode, Element compViewParent, boolean includeChildNodes, Document plf, Element plfParent, IPerson person) throws PortalException { Element plfNode = (Element) plf.importNode(...
[ "private", "static", "Element", "createILFCopy", "(", "Element", "compViewNode", ",", "Element", "compViewParent", ",", "boolean", "includeChildNodes", ",", "Document", "plf", ",", "Element", "plfParent", ",", "IPerson", "person", ")", "throws", "PortalException", "...
Creates a copy of an ilf node in the plf and sets up necessary storage attributes.
[ "Creates", "a", "copy", "of", "an", "ilf", "node", "in", "the", "plf", "and", "sets", "up", "necessary", "storage", "attributes", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/HandlerUtils.java#L86-L132
train
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/HandlerUtils.java
HandlerUtils.createOrMovePLFOwnedNode
static Element createOrMovePLFOwnedNode( Element compViewNode, Element compViewParent, boolean createIfNotFound, boolean createChildNodes, Document plf, Element plfParent, IPerson person) throws PortalException { Ele...
java
static Element createOrMovePLFOwnedNode( Element compViewNode, Element compViewParent, boolean createIfNotFound, boolean createChildNodes, Document plf, Element plfParent, IPerson person) throws PortalException { Ele...
[ "static", "Element", "createOrMovePLFOwnedNode", "(", "Element", "compViewNode", ",", "Element", "compViewParent", ",", "boolean", "createIfNotFound", ",", "boolean", "createChildNodes", ",", "Document", "plf", ",", "Element", "plfParent", ",", "IPerson", "person", ")...
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 clear...
[ "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", ...
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/HandlerUtils.java#L140-L189
train
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/ILFBuilder.java
ILFBuilder.mergeFragment
public static void mergeFragment( Document fragment, Document composite, IAuthorizationPrincipal ap) throws AuthorizationException { Element fragmentLayout = fragment.getDocumentElement(); Element fragmentRoot = (Element) fragmentLayout.getFirstChild(); Element compositeL...
java
public static void mergeFragment( Document fragment, Document composite, IAuthorizationPrincipal ap) throws AuthorizationException { Element fragmentLayout = fragment.getDocumentElement(); Element fragmentRoot = (Element) fragmentLayout.getFirstChild(); Element compositeL...
[ "public", "static", "void", "mergeFragment", "(", "Document", "fragment", ",", "Document", "composite", ",", "IAuthorizationPrincipal", "ap", ")", "throws", "AuthorizationException", "{", "Element", "fragmentLayout", "=", "fragment", ".", "getDocumentElement", "(", ")...
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. @throws AuthorizationException
[ "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"...
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/ILFBuilder.java#L93-L101
train
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/ILFBuilder.java
ILFBuilder.mergeAllowed
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); }
java
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); }
[ "private", "static", "boolean", "mergeAllowed", "(", "Element", "child", ",", "IAuthorizationPrincipal", "ap", ")", "throws", "AuthorizationException", "{", "if", "(", "!", "child", ".", "getTagName", "(", ")", ".", "equals", "(", "\"channel\"", ")", ")", "ret...
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. @param child @param person @return @throws AuthorizationException @throws NumberFormatException
[ "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", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/ILFBuilder.java#L169-L175
train
Jasig/uPortal
uPortal-groups/uPortal-groups-smartldap/src/main/java/org/apereo/portal/groups/smartldap/SmartLdapGroupStore.java
SmartLdapGroupStore.getPersonGroupMemberKeys
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().isEmp...
java
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().isEmp...
[ "private", "Object", "[", "]", "getPersonGroupMemberKeys", "(", "IGroupMember", "gm", ")", "{", "Object", "[", "]", "keys", "=", "null", ";", "EntityIdentifier", "ei", "=", "gm", ".", "getUnderlyingEntityIdentifier", "(", ")", ";", "IPersonAttributes", "attr", ...
gm should already be determined to be reference to person
[ "gm", "should", "already", "be", "determined", "to", "be", "reference", "to", "person" ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-smartldap/src/main/java/org/apereo/portal/groups/smartldap/SmartLdapGroupStore.java#L270-L281
train
Jasig/uPortal
uPortal-groups/uPortal-groups-smartldap/src/main/java/org/apereo/portal/groups/smartldap/SmartLdapGroupStore.java
SmartLdapGroupStore.newInstance
@Override public IEntityGroup newInstance(Class entityType) throws GroupsException { log.warn("Unsupported method accessed: SmartLdapGroupStore.newInstance"); throw new UnsupportedOperationException(UNSUPPORTED_MESSAGE); }
java
@Override public IEntityGroup newInstance(Class entityType) throws GroupsException { log.warn("Unsupported method accessed: SmartLdapGroupStore.newInstance"); throw new UnsupportedOperationException(UNSUPPORTED_MESSAGE); }
[ "@", "Override", "public", "IEntityGroup", "newInstance", "(", "Class", "entityType", ")", "throws", "GroupsException", "{", "log", ".", "warn", "(", "\"Unsupported method accessed: SmartLdapGroupStore.newInstance\"", ")", ";", "throw", "new", "UnsupportedOperationExceptio...
Return an UnsupportedOperationException ! @param entityType @return @throws GroupsException
[ "Return", "an", "UnsupportedOperationException", "!" ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-smartldap/src/main/java/org/apereo/portal/groups/smartldap/SmartLdapGroupStore.java#L415-L419
train
Jasig/uPortal
uPortal-groups/uPortal-groups-smartldap/src/main/java/org/apereo/portal/groups/smartldap/SmartLdapGroupStore.java
SmartLdapGroupStore.searchForGroups
@Override public EntityIdentifier[] searchForGroups(String query, SearchMethod method, Class leaftype) throws GroupsException { if (isTreeRefreshRequired()) { refreshTree(); } log.debug( "Invoking searchForGroups(): query={}, method={}, leaftype=", ...
java
@Override public EntityIdentifier[] searchForGroups(String query, SearchMethod method, Class leaftype) throws GroupsException { if (isTreeRefreshRequired()) { refreshTree(); } log.debug( "Invoking searchForGroups(): query={}, method={}, leaftype=", ...
[ "@", "Override", "public", "EntityIdentifier", "[", "]", "searchForGroups", "(", "String", "query", ",", "SearchMethod", "method", ",", "Class", "leaftype", ")", "throws", "GroupsException", "{", "if", "(", "isTreeRefreshRequired", "(", ")", ")", "{", "refreshTr...
Treats case sensitive and case insensitive searching the same.
[ "Treats", "case", "sensitive", "and", "case", "insensitive", "searching", "the", "same", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-smartldap/src/main/java/org/apereo/portal/groups/smartldap/SmartLdapGroupStore.java#L422-L500
train
Jasig/uPortal
uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java
UpdatePreferencesServlet.removeElement
@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, res...
java
@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, res...
[ "@", "RequestMapping", "(", "method", "=", "RequestMethod", ".", "POST", ",", "params", "=", "\"action=removeElement\"", ")", "public", "ModelAndView", "removeElement", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOExc...
Remove an element from the layout. @param request @param response @return @throws IOException
[ "Remove", "an", "element", "from", "the", "layout", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java#L167-L205
train
Jasig/uPortal
uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java
UpdatePreferencesServlet.removeByFName
@RequestMapping(method = RequestMethod.POST, params = "action=removeByFName") public ModelAndView removeByFName( HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "fname") String fname) throws IOException { IUserInstance ui = use...
java
@RequestMapping(method = RequestMethod.POST, params = "action=removeByFName") public ModelAndView removeByFName( HttpServletRequest request, HttpServletResponse response, @RequestParam(value = "fname") String fname) throws IOException { IUserInstance ui = use...
[ "@", "RequestMapping", "(", "method", "=", "RequestMethod", ".", "POST", ",", "params", "=", "\"action=removeByFName\"", ")", "public", "ModelAndView", "removeByFName", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "@", "RequestPar...
Remove the first element with the provided fname from the layout. @param request HttpServletRequest @param response HttpServletResponse @param fname fname of the portlet to remove from the layout @return json response @throws IOException if the person cannot be retrieved
[ "Remove", "the", "first", "element", "with", "the", "provided", "fname", "from", "the", "layout", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java#L216-L261
train
Jasig/uPortal
uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java
UpdatePreferencesServlet.addFolder
@RequestMapping(method = RequestMethod.POST, params = "action=addFolder") public ModelAndView addFolder( HttpServletRequest request, HttpServletResponse response, @RequestParam("targetId") String targetId, @RequestParam(value = "siblingId", required = false) String si...
java
@RequestMapping(method = RequestMethod.POST, params = "action=addFolder") public ModelAndView addFolder( HttpServletRequest request, HttpServletResponse response, @RequestParam("targetId") String targetId, @RequestParam(value = "siblingId", required = false) String si...
[ "@", "RequestMapping", "(", "method", "=", "RequestMethod", ".", "POST", ",", "params", "=", "\"action=addFolder\"", ")", "public", "ModelAndView", "addFolder", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "@", "RequestParam", "...
Add a new folder to the layout. @param request @param response @param targetId - id of the folder node to add the new folder to. By default, the folder will be inserted after other existing items in the node unless a siblingId is provided. @param siblingId - if set, insert new folder prior to the node with this id, ot...
[ "Add", "a", "new", "folder", "to", "the", "layout", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java#L993-L1040
train
Jasig/uPortal
uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java
UpdatePreferencesServlet.renameTab
@RequestMapping(method = RequestMethod.POST, params = "action=renameTab") public ModelAndView renameTab(HttpServletRequest request, HttpServletResponse response) throws IOException { IUserInstance ui = userInstanceManager.getUserInstance(request); UserPreferencesManager upm = (UserPrefe...
java
@RequestMapping(method = RequestMethod.POST, params = "action=renameTab") public ModelAndView renameTab(HttpServletRequest request, HttpServletResponse response) throws IOException { IUserInstance ui = userInstanceManager.getUserInstance(request); UserPreferencesManager upm = (UserPrefe...
[ "@", "RequestMapping", "(", "method", "=", "RequestMethod", ".", "POST", ",", "params", "=", "\"action=renameTab\"", ")", "public", "ModelAndView", "renameTab", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException",...
Rename a specified tab. @param request @throws IOException
[ "Rename", "a", "specified", "tab", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java#L1113-L1163
train
Jasig/uPortal
uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java
UpdatePreferencesServlet.setObjectAttributes
private void setObjectAttributes( IUserLayoutNodeDescription node, HttpServletRequest request, Map<String, Map<String, String>> attributes) { // Attempt to set the object attributes for (String name : attributes.get("attributes").keySet()) { try { ...
java
private void setObjectAttributes( IUserLayoutNodeDescription node, HttpServletRequest request, Map<String, Map<String, String>> attributes) { // Attempt to set the object attributes for (String name : attributes.get("attributes").keySet()) { try { ...
[ "private", "void", "setObjectAttributes", "(", "IUserLayoutNodeDescription", "node", ",", "HttpServletRequest", "request", ",", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "attributes", ")", "{", "// Attempt to set the object attributes",...
Attempt to map the attribute values to the given object. @param node @param request @param attributes
[ "Attempt", "to", "map", "the", "attribute", "values", "to", "the", "given", "object", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java#L1349-L1378
train
Jasig/uPortal
uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java
UpdatePreferencesServlet.isTab
protected boolean isTab(IUserLayoutManager ulm, String folderId) throws PortalException { // we could be a bit more careful here and actually check the type return ulm.getRootFolderId().equals(ulm.getParentId(folderId)); }
java
protected boolean isTab(IUserLayoutManager ulm, String folderId) throws PortalException { // we could be a bit more careful here and actually check the type return ulm.getRootFolderId().equals(ulm.getParentId(folderId)); }
[ "protected", "boolean", "isTab", "(", "IUserLayoutManager", "ulm", ",", "String", "folderId", ")", "throws", "PortalException", "{", "// we could be a bit more careful here and actually check the type", "return", "ulm", ".", "getRootFolderId", "(", ")", ".", "equals", "("...
A folder is a tab if its parent element is the layout element @param ulm User Layout Manager @param folderId the folder in question @return <code>true</code> if the folder is a tab, otherwise <code>false</code>
[ "A", "folder", "is", "a", "tab", "if", "its", "parent", "element", "is", "the", "layout", "element" ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java#L1401-L1404
train
Jasig/uPortal
uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java
UpdatePreferencesServlet.getMessage
protected String getMessage(String key, String defaultMessage, Locale locale) { try { return messageSource.getMessage(key, new Object[] {}, defaultMessage, locale); } catch (Exception e) { // sadly, messageSource.getMessage can throw e.g. when message is ill formatted. ...
java
protected String getMessage(String key, String defaultMessage, Locale locale) { try { return messageSource.getMessage(key, new Object[] {}, defaultMessage, locale); } catch (Exception e) { // sadly, messageSource.getMessage can throw e.g. when message is ill formatted. ...
[ "protected", "String", "getMessage", "(", "String", "key", ",", "String", "defaultMessage", ",", "Locale", "locale", ")", "{", "try", "{", "return", "messageSource", ".", "getMessage", "(", "key", ",", "new", "Object", "[", "]", "{", "}", ",", "defaultMess...
Syntactic sugar for safely resolving a no-args message from message bundle. @param key Message bundle key @param defaultMessage Ready-to-present message to fall back upon. @param locale desired locale @return Resolved interpolated message or defaultMessage.
[ "Syntactic", "sugar", "for", "safely", "resolving", "a", "no", "-", "args", "message", "from", "message", "bundle", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java#L1424-L1432
train
Jasig/uPortal
uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java
UpdatePreferencesServlet.moveElementInternal
private boolean moveElementInternal( HttpServletRequest request, String sourceId, String destinationId, String method) { logger.debug( "moveElementInternal invoked for sourceId={}, destinationId={}, method={}", sourceId, destinationId, ...
java
private boolean moveElementInternal( HttpServletRequest request, String sourceId, String destinationId, String method) { logger.debug( "moveElementInternal invoked for sourceId={}, destinationId={}, method={}", sourceId, destinationId, ...
[ "private", "boolean", "moveElementInternal", "(", "HttpServletRequest", "request", ",", "String", "sourceId", ",", "String", "destinationId", ",", "String", "method", ")", "{", "logger", ".", "debug", "(", "\"moveElementInternal invoked for sourceId={}, destinationId={}, me...
Moves the source element. <p>- If the destination is a tab, the new element automatically goes to the end of the first column or in a new column. - If the destination is a folder, the element is added to the end of the folder. - Otherwise, the element is inserted before the destination (the destination can't be a tab ...
[ "Moves", "the", "source", "element", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-api/uPortal-api-rest/src/main/java/org/apereo/portal/layout/dlm/remoting/UpdatePreferencesServlet.java#L1504-L1577
train
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/BaseStatisticsReportController.java
BaseStatisticsReportController.setReportFormGroups
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()); } ...
java
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()); } ...
[ "protected", "final", "void", "setReportFormGroups", "(", "final", "F", "report", ")", "{", "if", "(", "!", "report", ".", "getGroups", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "final", "Set", "<", "AggregatedGroupMapping", ">", ...
Set the groups to have selected by default if not already set
[ "Set", "the", "groups", "to", "have", "selected", "by", "default", "if", "not", "already", "set" ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/BaseStatisticsReportController.java#L173-L182
train
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/BaseStatisticsReportController.java
BaseStatisticsReportController.showFullColumnHeaderDescriptions
protected final boolean showFullColumnHeaderDescriptions(F form) { boolean showFullHeaderDescriptions = false; switch (form.getFormat()) { case csv: { showFullHeaderDescriptions = true; break; } case html: ...
java
protected final boolean showFullColumnHeaderDescriptions(F form) { boolean showFullHeaderDescriptions = false; switch (form.getFormat()) { case csv: { showFullHeaderDescriptions = true; break; } case html: ...
[ "protected", "final", "boolean", "showFullColumnHeaderDescriptions", "(", "F", "form", ")", "{", "boolean", "showFullHeaderDescriptions", "=", "false", ";", "switch", "(", "form", ".", "getFormat", "(", ")", ")", "{", "case", "csv", ":", "{", "showFullHeaderDesc...
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. @param form the form @return True if report columns should have full header descriptions.
[ "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", "....
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/BaseStatisticsReportController.java#L386-L405
train
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/BaseStatisticsReportController.java
BaseStatisticsReportController.extractGroupsArray
private AggregatedGroupMapping[] extractGroupsArray(Set<D> columnGroups) { Set<AggregatedGroupMapping> groupMappings = new HashSet<AggregatedGroupMapping>(); for (D discriminator : columnGroups) { groupMappings.add(discriminator.getAggregatedGroup()); } return groupMappings.t...
java
private AggregatedGroupMapping[] extractGroupsArray(Set<D> columnGroups) { Set<AggregatedGroupMapping> groupMappings = new HashSet<AggregatedGroupMapping>(); for (D discriminator : columnGroups) { groupMappings.add(discriminator.getAggregatedGroup()); } return groupMappings.t...
[ "private", "AggregatedGroupMapping", "[", "]", "extractGroupsArray", "(", "Set", "<", "D", ">", "columnGroups", ")", "{", "Set", "<", "AggregatedGroupMapping", ">", "groupMappings", "=", "new", "HashSet", "<", "AggregatedGroupMapping", ">", "(", ")", ";", "for",...
use a Set to filter down to unique values.
[ "use", "a", "Set", "to", "filter", "down", "to", "unique", "values", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/statistics/BaseStatisticsReportController.java#L574-L580
train
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PreferenceInputFactory.java
PreferenceInputFactory.createSingleTextPreference
public static Preference createSingleTextPreference(String name, String label) { return createSingleTextPreference( name, "attribute.displayName." + name, TextDisplay.TEXT, null); }
java
public static Preference createSingleTextPreference(String name, String label) { return createSingleTextPreference( name, "attribute.displayName." + name, TextDisplay.TEXT, null); }
[ "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. @param name @param label @return
[ "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"...
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PreferenceInputFactory.java#L45-L48
train
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PreferenceInputFactory.java
PreferenceInputFactory.createSingleTextPreference
public static Preference createSingleTextPreference( String name, String label, TextDisplay displayType, String defaultValue) { SingleTextPreferenceInput input = new SingleTextPreferenceInput(); input.setDefault(defaultValue); input.setDisplay(displayType); Preference pref =...
java
public static Preference createSingleTextPreference( String name, String label, TextDisplay displayType, String defaultValue) { SingleTextPreferenceInput input = new SingleTextPreferenceInput(); input.setDefault(defaultValue); input.setDisplay(displayType); Preference pref =...
[ "public", "static", "Preference", "createSingleTextPreference", "(", "String", "name", ",", "String", "label", ",", "TextDisplay", "displayType", ",", "String", "defaultValue", ")", "{", "SingleTextPreferenceInput", "input", "=", "new", "SingleTextPreferenceInput", "(",...
Craete a single-valued text input preference. @param name @param label @param displayType @param defaultValue @return
[ "Craete", "a", "single", "-", "valued", "text", "input", "preference", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PreferenceInputFactory.java#L59-L75
train
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PreferenceInputFactory.java
PreferenceInputFactory.createSingleChoicePreference
public static Preference createSingleChoicePreference( String name, String label, SingleChoiceDisplay displayType, List<Option> options, String defaultValue) { SingleChoicePreferenceInput input = new SingleChoicePreferenceInput(); input.setDefa...
java
public static Preference createSingleChoicePreference( String name, String label, SingleChoiceDisplay displayType, List<Option> options, String defaultValue) { SingleChoicePreferenceInput input = new SingleChoicePreferenceInput(); input.setDefa...
[ "public", "static", "Preference", "createSingleChoicePreference", "(", "String", "name", ",", "String", "label", ",", "SingleChoiceDisplay", "displayType", ",", "List", "<", "Option", ">", "options", ",", "String", "defaultValue", ")", "{", "SingleChoicePreferenceInpu...
Create a single-valued choice preference input. @param name @param label @param displayType @param options @param defaultValue @return
[ "Create", "a", "single", "-", "valued", "choice", "preference", "input", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PreferenceInputFactory.java#L87-L108
train
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PreferenceInputFactory.java
PreferenceInputFactory.createMultiTextPreference
public static Preference createMultiTextPreference( String name, String label, TextDisplay displayType, List<String> defaultValues) { MultiTextPreferenceInput input = new MultiTextPreferenceInput(); input.getDefaults().addAll(defaultValues); input.setDisplay(displayType); Pr...
java
public static Preference createMultiTextPreference( String name, String label, TextDisplay displayType, List<String> defaultValues) { MultiTextPreferenceInput input = new MultiTextPreferenceInput(); input.getDefaults().addAll(defaultValues); input.setDisplay(displayType); Pr...
[ "public", "static", "Preference", "createMultiTextPreference", "(", "String", "name", ",", "String", "label", ",", "TextDisplay", "displayType", ",", "List", "<", "String", ">", "defaultValues", ")", "{", "MultiTextPreferenceInput", "input", "=", "new", "MultiTextPr...
Create a multi-valued text input preference. @param name @param label @param displayType @param defaultValues @return
[ "Create", "a", "multi", "-", "valued", "text", "input", "preference", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PreferenceInputFactory.java#L119-L135
train
Jasig/uPortal
uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PreferenceInputFactory.java
PreferenceInputFactory.createMultiChoicePreference
public static Preference createMultiChoicePreference( String name, String label, MultiChoiceDisplay displayType, List<Option> options, List<String> defaultValues) { MultiChoicePreferenceInput input = new MultiChoicePreferenceInput(); input.getD...
java
public static Preference createMultiChoicePreference( String name, String label, MultiChoiceDisplay displayType, List<Option> options, List<String> defaultValues) { MultiChoicePreferenceInput input = new MultiChoicePreferenceInput(); input.getD...
[ "public", "static", "Preference", "createMultiChoicePreference", "(", "String", "name", ",", "String", "label", ",", "MultiChoiceDisplay", "displayType", ",", "List", "<", "Option", ">", "options", ",", "List", "<", "String", ">", "defaultValues", ")", "{", "Mul...
Create a multi-valued choice input preference. @param name @param label @param displayType @param options @param defaultValues @return
[ "Create", "a", "multi", "-", "valued", "choice", "input", "preference", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-portlets/src/main/java/org/apereo/portal/portlets/account/PreferenceInputFactory.java#L147-L168
train
Jasig/uPortal
uPortal-marketplace/src/main/java/org/apereo/portal/portlet/marketplace/MarketplacePortletDefinition.java
MarketplacePortletDefinition.initRelatedPortlets
private void initRelatedPortlets() { final Set<MarketplacePortletDefinition> allRelatedPortlets = new HashSet<>(); for (PortletCategory parentCategory : this.portletCategoryRegistry.getParentCategories(this)) { final Set<IPortletDefinition> portletsInCategory = ...
java
private void initRelatedPortlets() { final Set<MarketplacePortletDefinition> allRelatedPortlets = new HashSet<>(); for (PortletCategory parentCategory : this.portletCategoryRegistry.getParentCategories(this)) { final Set<IPortletDefinition> portletsInCategory = ...
[ "private", "void", "initRelatedPortlets", "(", ")", "{", "final", "Set", "<", "MarketplacePortletDefinition", ">", "allRelatedPortlets", "=", "new", "HashSet", "<>", "(", ")", ";", "for", "(", "PortletCategory", "parentCategory", ":", "this", ".", "portletCategory...
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.
[ "Initialize", "related", "portlets", ".", "This", "must", "be", "called", "lazily", "so", "that", "MarketplacePortletDefinitions", "instantiated", "as", "related", "portlets", "off", "of", "a", "MarketplacePortletDefinition", "do", "not", "always", "instantiate", "the...
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-marketplace/src/main/java/org/apereo/portal/portlet/marketplace/MarketplacePortletDefinition.java#L243-L263
train
Jasig/uPortal
uPortal-marketplace/src/main/java/org/apereo/portal/portlet/marketplace/MarketplacePortletDefinition.java
MarketplacePortletDefinition.getRandomSamplingRelatedPortlets
public Set<MarketplacePortletDefinition> getRandomSamplingRelatedPortlets(final IPerson user) { Validate.notNull(user, "Cannot filter to BROWSEable by a null user"); final IAuthorizationPrincipal principal = AuthorizationPrincipalHelper.principalFromUser(user); // lazy init is...
java
public Set<MarketplacePortletDefinition> getRandomSamplingRelatedPortlets(final IPerson user) { Validate.notNull(user, "Cannot filter to BROWSEable by a null user"); final IAuthorizationPrincipal principal = AuthorizationPrincipalHelper.principalFromUser(user); // lazy init is...
[ "public", "Set", "<", "MarketplacePortletDefinition", ">", "getRandomSamplingRelatedPortlets", "(", "final", "IPerson", "user", ")", "{", "Validate", ".", "notNull", "(", "user", ",", "\"Cannot filter to BROWSEable by a null user\"", ")", ";", "final", "IAuthorizationPrin...
Obtain up to QUANTITY_RELATED_PORTLETS_TO_SHOW random related portlets BROWSEable by the given user. @return a non-null potentially empty Set of related portlets BROWSEable by the user
[ "Obtain", "up", "to", "QUANTITY_RELATED_PORTLETS_TO_SHOW", "random", "related", "portlets", "BROWSEable", "by", "the", "given", "user", "." ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-marketplace/src/main/java/org/apereo/portal/portlet/marketplace/MarketplacePortletDefinition.java#L345-L378
train
Jasig/uPortal
uPortal-marketplace/src/main/java/org/apereo/portal/portlet/marketplace/MarketplacePortletDefinition.java
MarketplacePortletDefinition.getRenderUrl
public String getRenderUrl() { final String alternativeMaximizedUrl = getAlternativeMaximizedLink(); if (null != alternativeMaximizedUrl) { return alternativeMaximizedUrl; } final String contextPath = PortalWebUtils.currentRequestContextPath(); // TODO: stop abstra...
java
public String getRenderUrl() { final String alternativeMaximizedUrl = getAlternativeMaximizedLink(); if (null != alternativeMaximizedUrl) { return alternativeMaximizedUrl; } final String contextPath = PortalWebUtils.currentRequestContextPath(); // TODO: stop abstra...
[ "public", "String", "getRenderUrl", "(", ")", "{", "final", "String", "alternativeMaximizedUrl", "=", "getAlternativeMaximizedLink", "(", ")", ";", "if", "(", "null", "!=", "alternativeMaximizedUrl", ")", "{", "return", "alternativeMaximizedUrl", ";", "}", "final", ...
Convenience method for getting a bookmarkable URL for rendering the defined portlet, <p>Normally this is the portal rendering of the portlet, addressed by fname, and in that case this method will *ONLY* work when invoked in the context of a Spring-managed HttpServletRequest available via RequestContextHolder. <p>When...
[ "Convenience", "method", "for", "getting", "a", "bookmarkable", "URL", "for", "rendering", "the", "defined", "portlet" ]
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-marketplace/src/main/java/org/apereo/portal/portlet/marketplace/MarketplacePortletDefinition.java#L395-L407
train
Jasig/uPortal
uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/PositionManager.java
PositionManager.evaluateAndApply
static void evaluateAndApply( List<NodeInfo> order, Element compViewParent, Element positionSet, IntegrationResult result) throws PortalException { adjustPositionSet(order, positionSet, result); if (hasAffectOnCVP(order, compViewParent)) { ...
java
static void evaluateAndApply( List<NodeInfo> order, Element compViewParent, Element positionSet, IntegrationResult result) throws PortalException { adjustPositionSet(order, positionSet, result); if (hasAffectOnCVP(order, compViewParent)) { ...
[ "static", "void", "evaluateAndApply", "(", "List", "<", "NodeInfo", ">", "order", ",", "Element", "compViewParent", ",", "Element", "positionSet", ",", "IntegrationResult", "result", ")", "throws", "PortalException", "{", "adjustPositionSet", "(", "order", ",", "p...
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.
[ "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", "ap...
c1986542abb9acd214268f2df21c6305ad2f262b
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-layout/uPortal-layout-impl/src/main/java/org/apereo/portal/layout/dlm/PositionManager.java#L137-L150
train