public class DocumentAccess
extends java.lang.Object
| Constructor and Description |
|---|
DocumentAccess() |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
findDocument(java.lang.Class<T> classType,
java.lang.String docId)
Finds a document given id and revision .
|
java.util.ArrayList<java.lang.String> |
getAttachmentsByDocId(java.lang.String docId)
to get all the terms(keywords) of a paper document by the given docId
|
org.lightcouch.CouchDbClient |
getDbClient() |
java.lang.String |
getDBUri()
db string with ip and port
|
<T> java.util.ArrayList<T> |
getList(java.lang.Class<T> classOfT,
java.lang.String viewName,
boolean includeDocs)
get a list by given model class,view name and if includedocs
|
<T> java.util.ArrayList<T> |
getListBy2Parameters(java.lang.Class<T> classOfT,
java.lang.String viewName,
boolean includeDocs,
java.lang.String parameter1,
java.lang.String parameter2)
get a list by given model class,view name and 2 query conditions
|
<T> java.util.ArrayList<T> |
getListByParameter(java.lang.Class<T> classOfT,
java.lang.String viewName,
boolean includeDocs,
java.lang.String Parameter)
get a conditional list by given model class, view name , parameter and if includedocs
|
java.util.ArrayList<java.lang.String> |
getVolumePaperAttachmentsByDocId(java.lang.String docId) |
static void |
main(java.lang.String[] args) |
void |
printClassPath() |
org.lightcouch.Response |
remove(java.lang.String id,
java.lang.String rev) |
<T> boolean |
removeAllByViewAndClass(java.lang.String viewName,
java.lang.Class<T> classOfT) |
org.lightcouch.Response |
removeDocument(java.lang.Object object)
Removes a document from the database.
|
org.lightcouch.Response |
saveDocument(java.lang.Object aModel)
Saves an object in the database.
|
java.lang.String |
saveModel(DBDocModel aModel)
save a DBDocModel, most models are children of this model
|
org.lightcouch.Response |
updateDocument(java.lang.Object object)
Updates an object in the database, the object must have the correct id and revision values.
|
org.lightcouch.View |
view(java.lang.String viewId)
Provides access to CouchDB View APIs.
|
public org.lightcouch.CouchDbClient getDbClient()
public java.util.ArrayList<java.lang.String> getAttachmentsByDocId(java.lang.String docId)
docId - document id of a record in DBpublic java.util.ArrayList<java.lang.String> getVolumePaperAttachmentsByDocId(java.lang.String docId)
public org.lightcouch.Response saveDocument(java.lang.Object aModel)
aModel - The object to saveResponseorg.lightcouch.DocumentConflictException - If a conflict is detected during the save.public java.lang.String saveModel(DBDocModel aModel)
aModel - model contains datapublic <T> T findDocument(java.lang.Class<T> classType,
java.lang.String docId)
T - Object type.classType - The name of document class ,exp: Model.class .docId - The document _id field.org.lightcouch.NoDocumentException - If the document is not found in the database.public org.lightcouch.Response updateDocument(java.lang.Object object)
object - The object to updateResponseorg.lightcouch.DocumentConflictException - If a conflict is detected during the update.public org.lightcouch.View view(java.lang.String viewId)
viewId - name of viewpublic org.lightcouch.Response removeDocument(java.lang.Object object)
The object must have the correct _id and _rev values.
object - The document to remove as object.Responseorg.lightcouch.NoDocumentException - If the document is not found in the database.public org.lightcouch.Response remove(java.lang.String id,
java.lang.String rev)
public <T> boolean removeAllByViewAndClass(java.lang.String viewName,
java.lang.Class<T> classOfT)
public <T> java.util.ArrayList<T> getListByParameter(java.lang.Class<T> classOfT,
java.lang.String viewName,
boolean includeDocs,
java.lang.String Parameter)
classOfT - the type of model that map dataviewName - design viewParameter - query conditionincludeDocs - if return whole docpublic <T> java.util.ArrayList<T> getList(java.lang.Class<T> classOfT,
java.lang.String viewName,
boolean includeDocs)
classOfT - the type of model that map dataviewName - design viewincludeDocs - if return whole docpublic <T> java.util.ArrayList<T> getListBy2Parameters(java.lang.Class<T> classOfT,
java.lang.String viewName,
boolean includeDocs,
java.lang.String parameter1,
java.lang.String parameter2)
classOfT - the type of model that map dataviewName - design viewincludeDocs - if return whole docparameter1 - first key of queryparameter2 - second key of querypublic java.lang.String getDBUri()
public static void main(java.lang.String[] args)
public void printClassPath()