public class CouchDbDesign
extends java.lang.Object
// read from system files DesignDocument design1 = dbClient.design().getFromDesk("example"); // sync with the database dbClient.design().synchronizeWithDb(design1); // sync all with the database dbClient.syncDesignDocsWithDb(); // read from the database DesignDocument design2 = dbClient.design().getFromDb("_design/example");
DesignDocument
Modifier and Type | Method and Description |
---|---|
java.util.List<DesignDocument> |
getAllFromDesk()
Gets all design documents from desk.
|
DesignDocument |
getFromDb(java.lang.String id)
Gets a design document from the database.
|
DesignDocument |
getFromDb(java.lang.String id,
java.lang.String rev)
Gets a design document from the database.
|
DesignDocument |
getFromDesk(java.lang.String id)
Gets a design document from desk.
|
java.lang.String |
readContent(java.util.List<java.lang.String> elements,
java.lang.String rootPath,
java.lang.String element) |
void |
synchronizeAllWithDb()
Synchronize all design documents on desk to the database.
|
Response |
synchronizeWithDb(DesignDocument document)
Synchronizes a design document to the Database.
|
public Response synchronizeWithDb(DesignDocument document)
This method will first try to find a document in the database with the same id as the given document, if it is not found then the given document will be saved to the database.
If the document was found in the database, it will be compared with the given document using
equals()
. If both documents are not equal, then the given document will be saved to the
database and updates the existing document.
document
- The design document to synchronizeResponse
as a result of a document save or update, or returns null
if no
action was taken and the document in the database is up-to-date with the given document.public void synchronizeAllWithDb()
public DesignDocument getFromDb(java.lang.String id)
id
- The document idDesignDocument
public DesignDocument getFromDb(java.lang.String id, java.lang.String rev)
id
- The document idrev
- The document revisionDesignDocument
public java.util.List<DesignDocument> getAllFromDesk()
getFromDesk(String)
public DesignDocument getFromDesk(java.lang.String id)
id
- The document id to get.DesignDocument
public java.lang.String readContent(java.util.List<java.lang.String> elements, java.lang.String rootPath, java.lang.String element)
Copyright © 2011-2017. All Rights Reserved.