@Override public boolean treeExists() throws Exception { CouchDb db = atlasDesign.getDatabase(); boolean exists = false; try { exists = db.documentExists(DATE_CLUSTER_DOC_ID); } catch (Exception e) { // Ignore for now throw new Exception("Unable to verify cluster document existence", e); } return exists; }
static public UserDesignDocumentImpl getUserDesignDocument(CouchDb couchDb) throws Exception { if( false == couchDb.documentExists(DD_ID) ) { throw new Exception("Design document "+DD_ID+" was not found"); } CouchDesignDocument dd = couchDb.getDesignDocument(DD_NAME); return new UserDesignDocumentImpl(dd); }
try { CouchDb db = documentDbDesignDocument.getDatabase(); boolean exist = db.documentExists(DOC_ID_NUNALIIT_USER_AGREEMENT); if( exist ) { agreementDoc = db.getDocument(DOC_ID_NUNALIIT_USER_AGREEMENT);
int uploadedVersion = 0; boolean exists = couchDb.documentExists(DD_ID); if( exists ) { JSONObject uploaded = couchDb.getDocument(DD_ID);
@Override public void saveTree(Tree tree) throws Exception { CouchDb db = atlasDesign.getDatabase(); boolean exists = db.documentExists(DATE_CLUSTER_DOC_ID); JSONObject jsonDoc = null; if( exists ) { jsonDoc = db.getDocument(DATE_CLUSTER_DOC_ID); } else { jsonDoc = new JSONObject(); jsonDoc.put("_id", "org.nunaliit.date_clusters"); } jsonDoc.put("nunaliit_date_clusters", tree.toJSON()); CouchAuthenticationContext authContext = db.getClient().getSession().getAuthenticationContext(); CouchNunaliitUtils.adjustDocumentForStorage(jsonDoc, authContext); if( exists ){ db.updateDocument(jsonDoc); } else { db.createDocument(jsonDoc); } }
SkeletonDocumentsDetector docFinder = new SkeletonDocumentsDetector(couchDb,gs); for(String docId : docFinder.getSkeletonDocIds()){ if( couchDb.documentExists(docId) ){ docIds.add(docId); } else {
if( false == couchDb.documentExists(docId) ) { creationRequired = true; updateSpecifier = UpdateSpecifier.computeUpdateSpecifier(