public final class NoneRepository extends Object implements Repository
| Constructor and Description |
|---|
NoneRepository(String name)
Constructs a none repository with the specified name.
|
| Modifier and Type | Method and Description |
|---|---|
String |
add(JSONObject jsonObject)
Adds the specified json object.
|
Transaction |
beginTransaction()
Begins a transaction against the repository.
|
long |
count()
Gets the count of all json objects.
|
long |
count(Query query)
Gets the count of json objects by the specified query.
|
Map<String,JSONObject> |
get(Iterable<String> ids)
Gets json objects by the specified ids.
|
JSONObject |
get(Query query)
Gets json objects by the specified query.
|
JSONObject |
get(String id)
Gets a json object by the specified id.
|
String |
getName()
Gets the name of this repository.
|
List<JSONObject> |
getRandomly(int fetchSize)
Gets a list of json objects randomly with the specified fetch size.
|
boolean |
has(String id)
Determines a json object specified by the given id exists in this repository.
|
boolean |
hasTransactionBegun()
Whether the repository within a transaction.
|
boolean |
isWritable()
Whether the repository is writable.
|
void |
remove(Query query)
Removes json objects by the specified query.
|
void |
remove(String id)
Removes a json object by the specified id.
|
List<JSONObject> |
select(String statement,
Object... params)
Gets json objects by the specified query statement.
|
void |
setDebug(boolean debugEnabled)
Sets whether the repository is debug to show SQL with the specified flag.
|
void |
setWritable(boolean writable)
Sets whether the repository is writable with the specified flag.
|
void |
update(String id,
JSONObject jsonObject,
String... propertyNames)
Updates a certain json object specified by the given id with the specified new json object and property names.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFirst, getListpublic NoneRepository(String name)
name - the specified namepublic String add(JSONObject jsonObject)
Repositoryadd in interface RepositoryjsonObject - the specified json objectpublic void update(String id, JSONObject jsonObject, String... propertyNames)
Repositoryupdate in interface Repositoryid - the specified idjsonObject - the specified new json objectpropertyNames - the specified property names to update, update all properties if not specifiedpublic void remove(String id)
Repositoryremove in interface Repositoryid - the specified idpublic void remove(Query query)
Repositoryremove in interface Repositoryquery - the specified querypublic JSONObject get(String id)
Repositoryget in interface Repositoryid - the specified idnull if not foundpublic Map<String,JSONObject> get(Iterable<String> ids)
Repositoryget in interface Repositoryids - the specified idspublic boolean has(String id)
Repositoryhas in interface Repositoryid - the given idtrue if it exists, otherwise falsepublic JSONObject get(Query query)
Repository
-1 or null) by caller (as the argument
Query.setPageCount(int)), the value will be used in the returned value. In other words, the page count result
will not be calculated by this interface, otherwise, the returned value pagination.paginationPageCount and
pagination.paginationRecordCount will be calculated with query condition.
Note: The order of elements of the returned result list is decided by datastore implementation, excepts
Query.addSort(java.lang.String, org.b3log.latke.repository.SortDirection) be invoked.
get in interface Repositoryquery - the specified query
{
"pagination": {
"paginationPageCount": 10, // May be specified by the specified query.pageCount
"paginationRecordCount": "100" // If query.pageCount has been specified with not -1 or null, this value will
be 0 also
},
"rslts": [{
"oId": "...."
}, ....]
}
public List<JSONObject> select(String statement, Object... params)
Repositoryselect in interface Repositorystatement - the specified query statementparams - the specified parameterspublic List<JSONObject> getRandomly(int fetchSize)
RepositorygetRandomly in interface RepositoryfetchSize - the specified fetch sizepublic long count()
Repositorycount in interface Repository-1 if not availablepublic long count(Query query)
Repositorycount in interface Repositoryquery - the specified query-1 if not availablepublic String getName()
RepositorygetName in interface Repositorypublic Transaction beginTransaction()
Repository
Callers are responsible for explicitly calling Transaction.commit() or
Transaction.rollback() when they no longer need the Transaction. The Transaction
returned by this call will be considered the current transaction until one of the following happens:
Transaction returned by this methodTransaction will no longer be the current
transaction.
Transaction returned by this methodTransaction will no longer be the current
transaction.
beginTransaction in interface Repositorypublic boolean hasTransactionBegun()
RepositoryhasTransactionBegun in interface Repositorytrue if the repository within a transaction, returns false otherwisepublic boolean isWritable()
RepositoryisWritable in interface Repositorytrue if it is writable, returns false otherwisepublic void setWritable(boolean writable)
RepositorysetWritable in interface Repositorywritable - the specified flag, true for writable, false otherwisepublic void setDebug(boolean debugEnabled)
RepositorysetDebug in interface RepositorydebugEnabled - the specified flag, true for enabled, false otherwiseCopyright © 2009–2019 B3log. All rights reserved.