@Test public void testUpdate() throws Exception { final SourceDocumentReferenceMetaInfo sourceDocumentReferenceMetaInfo = new SourceDocumentReferenceMetaInfo("a", new ImageMetaInfo(10, 10, "", "", "", null, null, null), null, null, null); sourceDocumentReferenceMetaInfoDao.create(sourceDocumentReferenceMetaInfo, WriteConcern.NONE); final SourceDocumentReferenceMetaInfo updatedSourceDocumentReferenceMetaInfo = new SourceDocumentReferenceMetaInfo(sourceDocumentReferenceMetaInfo.getId(), new ImageMetaInfo(20, 20, "", "", "", null, null, null), null, null, null); assertNotEquals(updatedSourceDocumentReferenceMetaInfo.getImageMetaInfo().getHeight(), sourceDocumentReferenceMetaInfoDao.read( sourceDocumentReferenceMetaInfo.getId()).getImageMetaInfo().getHeight()); assertTrue(sourceDocumentReferenceMetaInfoDao.update(updatedSourceDocumentReferenceMetaInfo, WriteConcern.NONE)); assertEquals(updatedSourceDocumentReferenceMetaInfo.getImageMetaInfo().getHeight(), sourceDocumentReferenceMetaInfoDao.read( sourceDocumentReferenceMetaInfo.getId()).getImageMetaInfo().getHeight()); sourceDocumentReferenceMetaInfoDao.delete(updatedSourceDocumentReferenceMetaInfo.getId()); final SourceDocumentReferenceMetaInfo checkUpdateSourceDocumentReferenceMetaInfo = new SourceDocumentReferenceMetaInfo("a", new ImageMetaInfo(20, 20, "", "", "", null, null, null), null, null, null); assertFalse(sourceDocumentReferenceMetaInfoDao.update(checkUpdateSourceDocumentReferenceMetaInfo, WriteConcern.NONE)); }
@Override public boolean update(SourceDocumentReferenceMetaInfo sourceDocumentReferenceMetaInfo, WriteConcern writeConcern) { if(read(sourceDocumentReferenceMetaInfo.getId()) != null) { datastore.save(sourceDocumentReferenceMetaInfo, writeConcern); return true; } return false; }
SourceDocumentReferenceMetaInfoDaoImpl implements SourceDocumentReferenceMetaInfoDao { @Override public boolean update(SourceDocumentReferenceMetaInfo sourceDocumentReferenceMetaInfo, WriteConcern writeConcern) { if(read(sourceDocumentReferenceMetaInfo.getId()) != null) { datastore.save(sourceDocumentReferenceMetaInfo, writeConcern); return true; } return false; } }
SourceDocumentReferenceMetaInfoDaoImpl implements SourceDocumentReferenceMetaInfoDao { @Override public boolean update(SourceDocumentReferenceMetaInfo sourceDocumentReferenceMetaInfo, WriteConcern writeConcern) { if(read(sourceDocumentReferenceMetaInfo.getId()) != null) { datastore.save(sourceDocumentReferenceMetaInfo, writeConcern); return true; } return false; } SourceDocumentReferenceMetaInfoDaoImpl(Datastore datastore); }
SourceDocumentReferenceMetaInfoDaoImpl implements SourceDocumentReferenceMetaInfoDao { @Override public boolean update(SourceDocumentReferenceMetaInfo sourceDocumentReferenceMetaInfo, WriteConcern writeConcern) { if(read(sourceDocumentReferenceMetaInfo.getId()) != null) { datastore.save(sourceDocumentReferenceMetaInfo, writeConcern); return true; } return false; } SourceDocumentReferenceMetaInfoDaoImpl(Datastore datastore); @Override Long getCount(); @Override boolean create(SourceDocumentReferenceMetaInfo sourceDocumentReferenceMetaInfo, WriteConcern writeConcern); @Override Iterable<com.google.code.morphia.Key<SourceDocumentReferenceMetaInfo>> createOrModify(Collection<SourceDocumentReferenceMetaInfo> sourceDocumentReferenceMetaInfos, WriteConcern writeConcern); @Override SourceDocumentReferenceMetaInfo read(String id); @Override List<SourceDocumentReferenceMetaInfo> read(Collection<String> ids); @Override boolean update(SourceDocumentReferenceMetaInfo sourceDocumentReferenceMetaInfo, WriteConcern writeConcern); @Override WriteResult delete(String id); }
SourceDocumentReferenceMetaInfoDaoImpl implements SourceDocumentReferenceMetaInfoDao { @Override public boolean update(SourceDocumentReferenceMetaInfo sourceDocumentReferenceMetaInfo, WriteConcern writeConcern) { if(read(sourceDocumentReferenceMetaInfo.getId()) != null) { datastore.save(sourceDocumentReferenceMetaInfo, writeConcern); return true; } return false; } SourceDocumentReferenceMetaInfoDaoImpl(Datastore datastore); @Override Long getCount(); @Override boolean create(SourceDocumentReferenceMetaInfo sourceDocumentReferenceMetaInfo, WriteConcern writeConcern); @Override Iterable<com.google.code.morphia.Key<SourceDocumentReferenceMetaInfo>> createOrModify(Collection<SourceDocumentReferenceMetaInfo> sourceDocumentReferenceMetaInfos, WriteConcern writeConcern); @Override SourceDocumentReferenceMetaInfo read(String id); @Override List<SourceDocumentReferenceMetaInfo> read(Collection<String> ids); @Override boolean update(SourceDocumentReferenceMetaInfo sourceDocumentReferenceMetaInfo, WriteConcern writeConcern); @Override WriteResult delete(String id);  }