@Test public void updateTextAnnotation() throws Exception { TextAnnotation ta = DummyTextAnnotationGenerator.generateAnnotatedTextAnnotation(false, 2); mapDBHandler.addTextAnnotation(testDataset,ta); ta = mapDBHandler.getDataset(testDataset).next(); String viewName = "TEST_VIEW"; View dummyView = new View(viewName, "TEST", ta, 0.0); ta.addView(viewName, dummyView); assertTrue(ta.hasView(viewName)); mapDBHandler.updateTextAnnotation(ta); ta = mapDBHandler.getDataset(testDataset).next(); assertTrue(ta.hasView(viewName)); ta.removeView(viewName); mapDBHandler.updateTextAnnotation(ta); ta = mapDBHandler.getTextAnnotation(ta); assertFalse(ta.hasView(viewName)); }
@Override public void updateTextAnnotation(TextAnnotation ta) { for (String dataset : getAllDatasets()) { final ConcurrentMap<Integer, byte[]> data = getMap(dataset); try { data.replace(ta.getTokenizedText().hashCode(), SerializationHelper.serializeTextAnnotationToBytes(ta)); } catch (IOException e) { throw new RuntimeException(e); } } db.commit(); }
TextAnnotationMapDBHandler implements TextAnnotationCache { @Override public void updateTextAnnotation(TextAnnotation ta) { for (String dataset : getAllDatasets()) { final ConcurrentMap<Integer, byte[]> data = getMap(dataset); try { data.replace(ta.getTokenizedText().hashCode(), SerializationHelper.serializeTextAnnotationToBytes(ta)); } catch (IOException e) { throw new RuntimeException(e); } } db.commit(); } }
TextAnnotationMapDBHandler implements TextAnnotationCache { @Override public void updateTextAnnotation(TextAnnotation ta) { for (String dataset : getAllDatasets()) { final ConcurrentMap<Integer, byte[]> data = getMap(dataset); try { data.replace(ta.getTokenizedText().hashCode(), SerializationHelper.serializeTextAnnotationToBytes(ta)); } catch (IOException e) { throw new RuntimeException(e); } } db.commit(); } TextAnnotationMapDBHandler(String dbFile); }
TextAnnotationMapDBHandler implements TextAnnotationCache { @Override public void updateTextAnnotation(TextAnnotation ta) { for (String dataset : getAllDatasets()) { final ConcurrentMap<Integer, byte[]> data = getMap(dataset); try { data.replace(ta.getTokenizedText().hashCode(), SerializationHelper.serializeTextAnnotationToBytes(ta)); } catch (IOException e) { throw new RuntimeException(e); } } db.commit(); } TextAnnotationMapDBHandler(String dbFile); void close(); boolean isCached(String dataset, String dbFile); @Override void addTextAnnotation(String dataset, TextAnnotation ta); @Override void updateTextAnnotation(TextAnnotation ta); @Override IResetableIterator<TextAnnotation> getDataset(String dataset); @Override boolean contains(TextAnnotation ta); @Override void removeTextAnnotation(TextAnnotation ta); @Override TextAnnotation getTextAnnotation(TextAnnotation ta); }
TextAnnotationMapDBHandler implements TextAnnotationCache { @Override public void updateTextAnnotation(TextAnnotation ta) { for (String dataset : getAllDatasets()) { final ConcurrentMap<Integer, byte[]> data = getMap(dataset); try { data.replace(ta.getTokenizedText().hashCode(), SerializationHelper.serializeTextAnnotationToBytes(ta)); } catch (IOException e) { throw new RuntimeException(e); } } db.commit(); } TextAnnotationMapDBHandler(String dbFile); void close(); boolean isCached(String dataset, String dbFile); @Override void addTextAnnotation(String dataset, TextAnnotation ta); @Override void updateTextAnnotation(TextAnnotation ta); @Override IResetableIterator<TextAnnotation> getDataset(String dataset); @Override boolean contains(TextAnnotation ta); @Override void removeTextAnnotation(TextAnnotation ta); @Override TextAnnotation getTextAnnotation(TextAnnotation ta);  }