本文整理汇总了Java中org.lightcouch.CouchDbClient.remove方法的典型用法代码示例。如果您正苦于以下问题:Java CouchDbClient.remove方法的具体用法?Java CouchDbClient.remove怎么用?Java CouchDbClient.remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lightcouch.CouchDbClient
的用法示例。
在下文中一共展示了CouchDbClient.remove方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: remove
import org.lightcouch.CouchDbClient; //导入方法依赖的package包/类
public boolean remove(E entity, String path, String revision) {
if (entity == null)
return false;
CouchDbClient dbClient = connectionProvider.getDBClient(
CouchDbClient.class, path);
Response resp = dbClient.remove(entity.get_id(), revision);
resp = dbClient.purge(path, entity.get_id(), new String[]{revision});
System.out.println("remove object revision: " + entity.get_id() + ", repsonse: " + resp);
return true;
}
示例2: removeDBLease
import org.lightcouch.CouchDbClient; //导入方法依赖的package包/类
@Override
public boolean removeDBLease(DBLease lease, String path)
{
CouchDbClient dbClient = connectionProvider.getDBClient(
CouchDbClient.class, path);
Response resp = null;
if (lease.get_rev() != null)
{
try {
resp = dbClient.remove(lease.get_id(), lease.get_rev());
} catch (Exception e) {
DBLease entity2 = reload(lease.get_id(), path);
if (entity2 != null)
{
lease = entity2;
resp = dbClient.remove(lease.get_id(), lease.get_rev());
}
}
}
String rev = null;
if (resp != null)
{
rev = resp.getRev();
}
else
{
rev = lease.get_rev();
}
dbClient.purge(path, lease.get_id(), new String[]{rev});
return true;
}
示例3: removeDatabaseUser
import org.lightcouch.CouchDbClient; //导入方法依赖的package包/类
@Override
public boolean removeDatabaseUser(BTSUser user) {
CouchDbClient dbClient = connectionProvider.getDBClient(
CouchDbClient.class, _USERS);
try {
dbClient.remove(COUCHDB_USERS_PREFIX + user.getUserName());
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
示例4: checkAndAddAuthentication
import org.lightcouch.CouchDbClient; //导入方法依赖的package包/类
private void checkAndAddAuthentication(BTSProjectDBCollection collection) {
CouchDbClient dbClient = connectionProvider.getDBClient(
CouchDbClient.class, collection.getCollectionName());
JsonObject jsonObject = null;
try {
jsonObject = dbClient.find(JsonObject.class, "_design/auth");
} catch (Exception e) {
logger.info("_design/auth JsonObject Not found for collection "
+ collection.getCollectionName());
}
if (!collection.getRoleDescriptions().isEmpty()) // auth required
{
if (jsonObject == null) // auth not found
{
String json = "{ ";
json += "\"_id\": \"_design/auth\",";
json += "\"language\": \"javascript\",";
json += "\"validate_doc_read\": \"" + VALIDATE_DOC_READ + "\",";
json += "\"validate_doc_update\": \"" + VALIDATE_DOC_UPDATE
+ "\"";
json += "}";
JsonObject jsonobj = dbClient.getGson().fromJson(json,
JsonObject.class);
dbClient.save(jsonobj);
logger.info("_design/auth created for collection "
+ collection.getCollectionName() + ", doc content: "
+ json);
} else {
boolean changed = false;
if (jsonObject.get("validate_doc_read") == null
|| !jsonObject.get("validate_doc_read").getAsString()
.equals(VALIDATE_DOC_READ)) {
jsonObject.addProperty("validate_doc_read",
VALIDATE_DOC_READ);
changed = true;
}
if (jsonObject.get("validate_doc_update") == null
|| !jsonObject.get("validate_doc_update").getAsString()
.equals(VALIDATE_DOC_UPDATE)) {
jsonObject.addProperty("validate_doc_update",
VALIDATE_DOC_UPDATE);
changed = true;
}
if (changed) {
// jsonObject.remove("_rev");
dbClient.update(jsonObject);
}
}
} else
// no auth required
{
if (jsonObject != null) // auth found
{
dbClient.remove(jsonObject); // delete auth
}
}
}