@Test public void testCreate() throws Exception { final WebResourceMetaInfo sourceDocumentReferenceMetaInfo = new WebResourceMetaInfo("a", new ImageMetaInfo(10, 10, "", "", "", null, null, null), null, null, null); assertNotNull(sourceDocumentReferenceMetaInfo.getId()); webResourceMetaInfoDao.create(sourceDocumentReferenceMetaInfo, WriteConcern.NONE); assertEquals(sourceDocumentReferenceMetaInfo.getImageMetaInfo().getHeight(), webResourceMetaInfoDao.read( sourceDocumentReferenceMetaInfo.getId()).getImageMetaInfo().getHeight()); webResourceMetaInfoDao.delete(sourceDocumentReferenceMetaInfo.getId()); }
@Override public boolean create(WebResourceMetaInfo webResourceMetaInfo, WriteConcern writeConcern) { if(read(webResourceMetaInfo.getId()) == null) { datastore.save(webResourceMetaInfo, writeConcern); return true; } else { return false; } }
WebResourceMetaInfoDaoImpl implements WebResourceMetaInfoDao { @Override public boolean create(WebResourceMetaInfo webResourceMetaInfo, WriteConcern writeConcern) { if(read(webResourceMetaInfo.getId()) == null) { datastore.save(webResourceMetaInfo, writeConcern); return true; } else { return false; } } }
WebResourceMetaInfoDaoImpl implements WebResourceMetaInfoDao { @Override public boolean create(WebResourceMetaInfo webResourceMetaInfo, WriteConcern writeConcern) { if(read(webResourceMetaInfo.getId()) == null) { datastore.save(webResourceMetaInfo, writeConcern); return true; } else { return false; } } WebResourceMetaInfoDaoImpl(DB mongoDB,Morphia morphia,Datastore datastore); }
WebResourceMetaInfoDaoImpl implements WebResourceMetaInfoDao { @Override public boolean create(WebResourceMetaInfo webResourceMetaInfo, WriteConcern writeConcern) { if(read(webResourceMetaInfo.getId()) == null) { datastore.save(webResourceMetaInfo, writeConcern); return true; } else { return false; } } WebResourceMetaInfoDaoImpl(DB mongoDB,Morphia morphia,Datastore datastore); @Override boolean create(WebResourceMetaInfo webResourceMetaInfo, WriteConcern writeConcern); @Override int createOrModify(Collection<WebResourceMetaInfo> webResourceMetaInfos, WriteConcern writeConcern); @Override WebResourceMetaInfo read(String id); @Override List<WebResourceMetaInfo> read(List<String> ids); @Override boolean update(WebResourceMetaInfo webResourceMetaInfo, WriteConcern writeConcern); @Override WriteResult delete(String id); }
WebResourceMetaInfoDaoImpl implements WebResourceMetaInfoDao { @Override public boolean create(WebResourceMetaInfo webResourceMetaInfo, WriteConcern writeConcern) { if(read(webResourceMetaInfo.getId()) == null) { datastore.save(webResourceMetaInfo, writeConcern); return true; } else { return false; } } WebResourceMetaInfoDaoImpl(DB mongoDB,Morphia morphia,Datastore datastore); @Override boolean create(WebResourceMetaInfo webResourceMetaInfo, WriteConcern writeConcern); @Override int createOrModify(Collection<WebResourceMetaInfo> webResourceMetaInfos, WriteConcern writeConcern); @Override WebResourceMetaInfo read(String id); @Override List<WebResourceMetaInfo> read(List<String> ids); @Override boolean update(WebResourceMetaInfo webResourceMetaInfo, WriteConcern writeConcern); @Override WriteResult delete(String id);  }