Search in sources :

Example 1 with DesignDocumentManager

use of com.cloudant.client.api.DesignDocumentManager in project java-cloudant by cloudant.

the class Utils method putDesignDocs.

/**
 * Test utility to put design documents under the testing resource folder in to the database.
 *
 * @param db        database to put the design docs
 * @param directory location of design docs
 */
public static void putDesignDocs(Database db, File directory) throws FileNotFoundException {
    // Get design documents from directory
    List<DesignDocument> designDocuments = DesignDocumentManager.fromDirectory(directory);
    DesignDocumentManager designDocumentManager = db.getDesignDocumentManager();
    DesignDocument[] designDocArray = designDocuments.toArray(new DesignDocument[designDocuments.size()]);
    // Put documents into database
    designDocumentManager.put(designDocArray);
}
Also used : DesignDocument(com.cloudant.client.api.model.DesignDocument) DesignDocumentManager(com.cloudant.client.api.DesignDocumentManager)

Aggregations

DesignDocumentManager (com.cloudant.client.api.DesignDocumentManager)1 DesignDocument (com.cloudant.client.api.model.DesignDocument)1