@Test public void testUpdate() throws Exception { final SourceDocumentReference sourceDocumentReference = new SourceDocumentReference(new ReferenceOwner("1", "1", "1"),"test", null, null, 0l, null, true); assertFalse(sourceDocumentReferenceDao.update(sourceDocumentReference, WriteConcern.NONE)); sourceDocumentReferenceDao.createOrModify(sourceDocumentReference, WriteConcern.NONE); final SourceDocumentReference newSourceDocumentReference = new SourceDocumentReference(sourceDocumentReference.getId(), sourceDocumentReference.getReferenceOwner(), "test2", null, null, 0l, null, true); assertTrue(sourceDocumentReferenceDao.update(newSourceDocumentReference, WriteConcern.NONE)); assertEquals(sourceDocumentReferenceDao.read(sourceDocumentReference.getId()).getUrl(), "test2"); sourceDocumentReferenceDao.delete(newSourceDocumentReference.getId()); }
@Override public boolean update(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern) { if(read(sourceDocumentReference.getId()) != null) { datastore.save(sourceDocumentReference, writeConcern); return true; } return false; }
SourceDocumentReferenceDaoImpl implements SourceDocumentReferenceDao { @Override public boolean update(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern) { if(read(sourceDocumentReference.getId()) != null) { datastore.save(sourceDocumentReference, writeConcern); return true; } return false; } }
SourceDocumentReferenceDaoImpl implements SourceDocumentReferenceDao { @Override public boolean update(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern) { if(read(sourceDocumentReference.getId()) != null) { datastore.save(sourceDocumentReference, writeConcern); return true; } return false; } SourceDocumentReferenceDaoImpl(Datastore datastore); }
SourceDocumentReferenceDaoImpl implements SourceDocumentReferenceDao { @Override public boolean update(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern) { if(read(sourceDocumentReference.getId()) != null) { datastore.save(sourceDocumentReference, writeConcern); return true; } return false; } SourceDocumentReferenceDaoImpl(Datastore datastore); @Override Long getCount(); @Override boolean create(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern); @Override Iterable<com.google.code.morphia.Key<SourceDocumentReference>> createOrModify(Collection<SourceDocumentReference> sourceDocumentReferences, WriteConcern writeConcern); @Override void createOrModify(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern); @Override SourceDocumentReference read(String id); @Override List<SourceDocumentReference> read(List<String> ids); @Override boolean update(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern); @Override WriteResult delete(String id); @Override List<SourceDocumentReference> findByRecordID(String recordID); @Override List<SourceDocumentReference> deactivateDocuments(ReferenceOwner owner, WriteConcern concern); }
SourceDocumentReferenceDaoImpl implements SourceDocumentReferenceDao { @Override public boolean update(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern) { if(read(sourceDocumentReference.getId()) != null) { datastore.save(sourceDocumentReference, writeConcern); return true; } return false; } SourceDocumentReferenceDaoImpl(Datastore datastore); @Override Long getCount(); @Override boolean create(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern); @Override Iterable<com.google.code.morphia.Key<SourceDocumentReference>> createOrModify(Collection<SourceDocumentReference> sourceDocumentReferences, WriteConcern writeConcern); @Override void createOrModify(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern); @Override SourceDocumentReference read(String id); @Override List<SourceDocumentReference> read(List<String> ids); @Override boolean update(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern); @Override WriteResult delete(String id); @Override List<SourceDocumentReference> findByRecordID(String recordID); @Override List<SourceDocumentReference> deactivateDocuments(ReferenceOwner owner, WriteConcern concern);  }