Package org.lightcouch
Class CouchDbDesign
java.lang.Object
org.lightcouch.CouchDbDesign
Provides API to work with design documents.
Usage Example:
// 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");
- Since:
- 0.0.2
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CouchDbClientBase
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
private static final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets all design documents from desk.Gets a design document from the database.Gets a design document from the database.getFromDesk
(String id) Gets a design document from desk.populateMap
(String rootPath, List<String> elements, String element) readContent
(List<String> elements, String rootPath, String element) void
Synchronize all design documents on desk to the database.synchronizeWithDb
(DesignDocument document) Synchronizes a design document to the Database.
-
Field Details
-
DESIGN_DOCS_DIR
- See Also:
-
JAVASCRIPT
- See Also:
-
DESIGN_PREFIX
- See Also:
-
VALIDATE_DOC
- See Also:
-
VIEWS
- See Also:
-
FILTERS
- See Also:
-
SHOWS
- See Also:
-
LISTS
- See Also:
-
UPDATES
- See Also:
-
REWRITES
- See Also:
-
FULLTEXT
- See Also:
-
INDEXES
- See Also:
-
MAP_JS
- See Also:
-
REDUCE_JS
- See Also:
-
dbc
-
-
Constructor Details
-
CouchDbDesign
CouchDbDesign(CouchDbClientBase dbc)
-
-
Method Details
-
synchronizeWithDb
Synchronizes a design document to the Database.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.- Parameters:
document
- The design document to synchronize- Returns:
Response
as a result of a document save or update, or returnsnull
if no action was taken and the document in the database is up-to-date with the given document.
-
synchronizeAllWithDb
public void synchronizeAllWithDb()Synchronize all design documents on desk to the database.- See Also:
-
getFromDb
Gets a design document from the database.- Parameters:
id
- The document id- Returns:
DesignDocument
-
getFromDb
Gets a design document from the database.- Parameters:
id
- The document idrev
- The document revision- Returns:
DesignDocument
-
getAllFromDesk
Gets all design documents from desk.- Returns:
- a list of all design documents
- See Also:
-
getFromDesk
Gets a design document from desk.- Parameters:
id
- The document id to get.- Returns:
DesignDocument
-
populateMap
-
readContent
-