/** * Returns the identifier of the document to remove. * * @return The document id. */ public DocumentId getDocumentId() { return remove.getId(); }
@Override public long getSequenceId() { return Arrays.hashCode(remove.getId().getGlobalId()); }
@Override public boolean remove(DocumentRemove documentRemove) { if (documentRemove.getCondition().isPresent()) { throw new UnsupportedOperationException("test-and-set is not supported."); } access.documents.remove(documentRemove.getId()); return true; }
@Override public int getApproxSize() { return super.getApproxSize() + 4 + remove.getId().toString().length(); }
public Object evaluate(DocumentOperation op) { DocumentType doct; if (op instanceof DocumentPut) { doct = ((DocumentPut)op).getDocument().getDataType(); } else if (op instanceof DocumentUpdate) { doct = ((DocumentUpdate)op).getDocumentType(); } else if (op instanceof DocumentRemove) { DocumentRemove removeOp = (DocumentRemove)op; return (removeOp.getId().getDocType().equals(type) ? op : Boolean.FALSE); } else if (op instanceof DocumentGet) { DocumentGet getOp = (DocumentGet)op; return (getOp.getId().getDocType().equals(type) ? op : Boolean.FALSE); } else { throw new IllegalStateException("Document class '" + op.getClass().getName() + "' is not supported."); } return doct.isA(this.type) ? op : Boolean.FALSE; }
@Override public boolean remove(DocumentRemove documentRemove) { RemoveDocumentMessage msg = new RemoveDocumentMessage(documentRemove.getId()); msg.setCondition(documentRemove.getCondition()); return remove(msg); }
@Override public boolean remove(DocumentRemove documentRemove, DocumentProtocol.Priority pri) { RemoveDocumentMessage msg = new RemoveDocumentMessage(documentRemove.getId()); msg.setPriority(pri); msg.setCondition(documentRemove.getCondition()); return remove(msg); }
static DocumentOperationMessageV3 newRemoveMessage(VespaXMLFeedReader.Operation op, String operationId) { DocumentRemove remove = new DocumentRemove(op.getRemove()); remove.setCondition(op.getCondition()); Message msg = new RemoveDocumentMessage(remove); String id = (operationId == null) ? remove.getId().toString() : operationId; return new DocumentOperationMessageV3(id, msg); }