/** * Delete an object from this ObjectStore, delegate to internal ObjectStoreWriter. * * @param o the object to delete * @throws ObjectStoreException if an error occurs during deletion of the object */ public void delete(InterMineObject o) throws ObjectStoreException { osw.delete(o); }
/** * Delete an object from this ObjectStore, delegate to internal ObjectStoreWriter. * * @param o the object to delete * @throws ObjectStoreException if an error occurs during deletion of the object */ public void delete(InterMineObject o) throws ObjectStoreException { osw.delete(o); }
/** * {@inheritDoc} */ public void delete(QueryClass qc, Constraint c) throws ObjectStoreException { osw.delete(qc, c); }
/** * {@inheritDoc} */ public void delete(QueryClass qc, Constraint c) throws ObjectStoreException { osw.delete(qc, c); }
/** * Delete a tag object from the database. * @param tag Tag object */ public synchronized void deleteTag(Tag tag) { try { tagCache = null; osWriter.delete(tag); } catch (ObjectStoreException e) { LOG.error("delete tag failed" + e); throw new RuntimeException("Delete tag failed", e); } }
/** * Delete a tag object from the database. * @param tag Tag object */ public synchronized void deleteTag(Tag tag) { try { tagCache = null; osWriter.delete(tag); } catch (ObjectStoreException e) { LOG.error("delete tag failed" + e); throw new RuntimeException("Delete tag failed", e); } }
public void tearDown() throws Exception { Iterator deleteIter = toDelete.iterator(); while (deleteIter.hasNext()) { InterMineObject o = (InterMineObject) deleteIter.next(); writer.delete(o); } if (file != null) { file.delete(); } loader.close(); writer.close(); }
@Test public void testWriteInterMineObject() throws Exception { InterMineObject o = (InterMineObject) DynamicUtil.createObject(Collections.singleton(InterMineObject.class)); try { writer.store(o); } finally { writer.delete(o); } }
private void deleteAddress() throws ObjectStoreException { ObjectStoreWriter osw = os.getNewWriter(); osw.delete(os.getObjectById(ADDRESS_ID)); osw.close(); } }
private void deleteObjects(QueryClass qc, Constraint con, Query checkQuery) throws Exception { storeDataWriter.delete(qc, con); SingletonResults res = osForOsTests.executeSingleton(checkQuery); Assert.assertEquals(0, res.size()); }
@Test public void testWriteDynamicObject() throws Exception { InterMineObject o = (InterMineObject) DynamicUtil.createObject(new HashSet(Arrays.asList(new Class[] {Company.class, Employee.class}))); try { writer.store(o); Assert.fail("Expected: error"); } catch (ObjectStoreException e) { Assert.assertEquals("Non-flat model heirarchy used in flat mode. Cannot store object with classes = [interface org.intermine.model.testmodel.Company, class org.intermine.model.testmodel.Employee]", e.getMessage()); } finally { writer.delete(o); } }
@Test public void testWriteCloneable() throws Exception { InterMineObject o = (InterMineObject) DynamicUtil.createObject(new HashSet(Arrays.asList(new Class[] {Employee.class, Cloneable.class}))); try { writer.store(o); o = writer.getObjectById(o.getId(), Employee.class); if (!(o instanceof Cloneable)) { fail("Expected a Cloneable back"); } } finally { writer.delete(o); } }
@Test public void testWriteInterMineObject() throws Exception { InterMineObject o = (InterMineObject) DynamicUtil.createObject(Collections.singleton(InterMineObject.class)); try { writer.store(o); Assert.fail("Expected: error"); } catch (ObjectStoreException e) { Assert.assertEquals("Object [interface org.intermine.model.InterMineObject] does not map onto any database table.", e.getMessage()); } finally { writer.delete(o); } }
private void clearDatabase() throws Exception { Query q = new Query(); QueryClass qc = new QueryClass(InterMineObject.class); q.addToSelect(qc); q.addFrom(qc); SingletonResults res = os.executeSingleton(q, 20000, false, false, true); ObjectStoreWriter osw = os.getNewWriter(); Iterator<?> resIter = res.iterator(); while (resIter.hasNext()) { InterMineObject o = (InterMineObject) resIter.next(); osw.delete(o); } osw.close(); }
@Test public void testDeleteNonInterMineObjectByQueryClass() throws Exception { // SimpleObject is just a FastPathObject, not an InterMineObject SimpleObject itemA = new SimpleObject(); itemA.setName("simpleobject A"); writer.store(itemA); QueryClass qc = new QueryClass(SimpleObject.class); writer.delete(qc, null); }
@Test public void testWriteCleaner() throws Exception { InterMineObject o = new Cleaner(); try { writer.store(o); Assert.fail("Expected: error"); } catch (ObjectStoreException e) { Assert.assertEquals("Cannot store object [class org.intermine.model.testmodel.Cleaner] - no column for field evenings in table Employee", e.getMessage()); } finally { writer.delete(o); } }
@Test public void testDeleteInterMineObjectByQueryClass() throws Exception { Address addressA = new Address(); addressA.setAddress("Address A"); writer.store(addressA); boolean gotException = false; try { QueryClass addressQc = new QueryClass(Address.class); writer.delete(addressQc, null); } catch (ObjectStoreException e) { gotException = true; } Assert.assertTrue(gotException); }
@Test public void testWriteCleaner() throws Exception { InterMineObject o = new Cleaner(); try { writer.store(o); o = writer.getObjectById(o.getId(), Employee.class); if (!(o instanceof Cleaner)) { fail("Expected a Cleaner back"); } } finally { writer.delete(o); } }
@Test public void testWriteBigDepartment() throws Exception { InterMineObject o = new BigDepartment(); try { writer.store(o); o = writer.getObjectById(o.getId(), Department.class); if (!(o instanceof BigDepartment)) { fail("Expected a BigDepartment back"); } } finally { writer.delete(o); } }
/** * Delete all InterMineObjects from the objectstore. */ private void cleanObjects(ObjectStoreWriter osw) throws ObjectStoreException { Query q = new Query(); QueryClass queryClass = new QueryClass(InterMineObject.class); q.addToSelect(queryClass); q.addFrom(queryClass); SingletonResults r = osw.getObjectStore().executeSingleton(q); for (InterMineObject o: (List<InterMineObject>) ((List) r)) { osw.delete(o); } }