MongoDocument implements DBObject, DatabaseDocument<MongoType> { @Override public boolean removeFetchedBy(String stage) { if(fetchedBy(stage)) { touchedMetadata.add(FETCHED_METADATA_TAG); return getMetadataSubMap(FETCHED_METADATA_TAG).remove(stage)!=null; } return false; } MongoDocument();  MongoDocument(String json); @Override Action getAction(); @Override void setAction(Action action); @Override final void putAll(BSONObject o); @Override Object get(String key); @SuppressWarnings("unchecked") @Override Map<String, Object> toMap(); @Override Object removeField(String key); @Override boolean hasErrors(); @Override void addError(String from, Throwable t); @Override @Deprecated boolean containsKey(String s); @Deprecated @Override /** * This method will in most cases only return true for keys "_id", "metadata" and "content". * Use containsMetadataField or containsContentField instead to look inside those maps. */ boolean containsField(String key); @Override boolean hasMetadataField(String key); @Override boolean hasContentField(String key); @Override void markAsPartialObject(); @Override boolean isPartialObject(); @Override @Deprecated Object put(String key, Object v); @Override final Object putContentField(String key, Object v); @Override Object getContentField(String key); @Override Object getMetadataField(String key); @SuppressWarnings("unchecked") Map<String, Object> getMetadataMap(); @SuppressWarnings("unchecked") @Override Map<String, Object> getContentMap(); @Override final Object putMetadataField(String key, Object v); @Override final Object removeContentField(String key); @Override MongoDocumentID getID(); String getIDKey(); @SuppressWarnings({ "rawtypes" }) @Override final void putAll(Map m); @Override final void putAll(Document<?> d); @Override Set<String> keySet(); String toString(); boolean isActionTouched(); Set<String> getTouchedContent(); Set<String> getTouchedMetadata(); @Override Set<String> getContentFields(); @Override boolean isEqual(Document<?> d); @Override final void fromJson(String json); @Override String toJson(); @Override String contentFieldsToJson(Iterable<String> contentFields); @Override String metadataFieldsToJson(Iterable<String> metadataFields); @Override final void clear(); @Override Status getStatus(); @Override boolean touchedBy(String stage); @Override boolean fetchedBy(String stage); @Override boolean removeFetchedBy(String stage); @SuppressWarnings("unchecked") @Override boolean removeTouchedBy(String stage); @Override Set<String> getTouchedBy(); @Override Set<String> getFetchedBy(); @Override Date getTouchedTime(String stage); @Override Date getFetchedTime(String stage); @Override Date getCompletedTime(); @Override String getCompletedBy(); @Override void setID(DocumentID<MongoType> id); @Override boolean matches(DatabaseQuery<MongoType> query); final void setFetchedBy(String stage, Date date); final void setTouchedBy(String stage, Date date); MongoDocument copy(); static final String MONGO_ID_KEY; }
@Test public void testRemoveFetchedBy() { MongoDocument md = new MongoDocument(); md.setFetchedBy("stage", new Date()); md.setFetchedBy("stage2", new Date()); assertEquals(2, md.getFetchedBy().size()); md.removeFetchedBy("stage2"); assertEquals(1, md.getFetchedBy().size()); assertTrue(md.fetchedBy("stage")); }