@Test public void testCreate() throws Exception { final SourceDocumentReference sourceDocumentReference = new SourceDocumentReference(new ReferenceOwner("1", "1", "1"), "test", null, null, 0l, null, true); assertNotNull(sourceDocumentReference.getId()); sourceDocumentReferenceDao.createOrModify(sourceDocumentReference, WriteConcern.NONE); assertEquals(sourceDocumentReference.getUrl(), sourceDocumentReferenceDao.read(sourceDocumentReference.getId()).getUrl()); sourceDocumentReferenceDao.delete(sourceDocumentReference.getId()); }
@Override public boolean create(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern) { if(read(sourceDocumentReference.getId()) == null) { datastore.save(sourceDocumentReference, writeConcern); return true; } else { return false; } }
SourceDocumentReferenceDaoImpl implements SourceDocumentReferenceDao { @Override public boolean create(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern) { if(read(sourceDocumentReference.getId()) == null) { datastore.save(sourceDocumentReference, writeConcern); return true; } else { return false; } } }
SourceDocumentReferenceDaoImpl implements SourceDocumentReferenceDao { @Override public boolean create(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern) { if(read(sourceDocumentReference.getId()) == null) { datastore.save(sourceDocumentReference, writeConcern); return true; } else { return false; } } SourceDocumentReferenceDaoImpl(Datastore datastore); }
SourceDocumentReferenceDaoImpl implements SourceDocumentReferenceDao { @Override public boolean create(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern) { if(read(sourceDocumentReference.getId()) == null) { datastore.save(sourceDocumentReference, writeConcern); return true; } else { 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 create(SourceDocumentReference sourceDocumentReference, WriteConcern writeConcern) { if(read(sourceDocumentReference.getId()) == null) { datastore.save(sourceDocumentReference, writeConcern); return true; } else { 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);  }