public boolean removeJob(JobKey jobKey) throws JobPersistenceException { CouchDbJobDetail job = retrieveJob(jobKey); if (job == null) { return false; } db.delete(job); return true; }
@Override protected void deleteById(final String id) { logger.debug("Delete id: {}", id); try { final InputStream oldDocStream = couchDbConnector.getAsStream(id); final JsonNode oldDoc = objectMapper.readTree(oldDocStream); final String rev = oldDoc.get("_rev").asText(); couchDbConnector.delete(id, rev); } catch (DocumentNotFoundException e) { logger.debug("id {} is not in the database", id); } catch (IOException e) { logger.error("Unexpected IO CouchDB Exception", e); } }
public boolean removeTrigger(TriggerKey triggerKey) throws JobPersistenceException { logger.info("removeTrigger: " + triggerKey + "[" + Thread.currentThread().getId() + "]"); CouchDbTrigger trigger = getTriggerByKey(triggerKey); if (trigger == null) { return false; } if (logger.isDebugEnabled()) { logger.debug(String.format("Document ID : %s; Revision: %s", trigger.getId(), trigger.getRevision())); } db.delete(trigger); return true; }
public void removeAll() { try { for (CouchDbCalendar doc : getAll()) { db.delete(db.get(CouchDbCalendar.class, doc.getId())); } } catch (Exception e) { logger.error(e.getMessage(), e); } } }
public void removeAll() { try { for (CouchDbTrigger doc : getAll()) { db.delete(db.get(CouchDbTrigger.class, doc.getId())); } } catch (Exception e) { logger.error(e.getMessage(), e); } } }
public void removeAll() { try { for (CouchDbJobDetail doc : getAll()) { db.delete(db.get(CouchDbJobDetail.class, doc.getId())); } } catch (Exception e) { logger.error(e.getMessage(), e); } } }
/** * Deletes the object with the given key * * @param key the key of the object * @return whether the object was successfully deleted */ @Override public boolean delete(K key) { if (key == null) { deleteSchema(); createSchema(); return true; } final String keyString = key.toString(); final Map<String, Object> referenceData = db.get(Map.class, keyString); return StringUtils.isNotEmpty(db.delete(keyString, referenceData.get("_rev").toString())); }
/** * Deletes the object with the given key * * @param key the key of the object * @return whether the object was successfully deleted */ @Override public boolean delete(K key) throws GoraException { if (key == null) { deleteSchema(); createSchema(); return true; } try { final String keyString = key.toString(); final Map<String, Object> referenceData = db.get(Map.class, keyString); return StringUtils.isNotEmpty(db.delete(keyString, referenceData.get("_rev").toString())); } catch (Exception e) { throw new GoraException(e); } }
public void remove(T entity) { assertEntityNotNull(entity); db.delete(Documents.getId(entity), Documents.getRevision(entity)); } /**
@Override public void execute() throws MetaModelException { Table table = getTable(); List<FilterItem> whereItems = getWhereItems(); CouchDbConnector connector = _updateCallback.getConnector(table.getName()); CouchDbDataContext dataContext = _updateCallback.getDataContext(); DataSet dataSet = dataContext.query().from(table) .select(CouchDbDataContext.FIELD_ID, CouchDbDataContext.FIELD_REV).where(whereItems).execute(); try { while (dataSet.next()) { Row row = dataSet.getRow(); String id = (String) row.getValue(0); String revision = (String) row.getValue(1); connector.delete(id, revision); } } finally { dataSet.close(); } }