@Test public void testViewTextCopier() throws ResourceInitializationException, AnalysisEngineProcessException, CASException { String text = "sample text"; String sourceViewName = "SourceView"; String destinationViewName = "DestinationView"; jCas.setDocumentText(text); AnalysisEngine viewCreator = AnalysisEngineFactory.createEngine( ViewTextCopierAnnotator.class, typeSystemDescription, ViewTextCopierAnnotator.PARAM_SOURCE_VIEW_NAME, CAS.NAME_DEFAULT_SOFA, ViewTextCopierAnnotator.PARAM_DESTINATION_VIEW_NAME, destinationViewName); viewCreator.process(jCas); JCas destinationView = jCas.getView(destinationViewName); assertNotNull(destinationView); assertEquals(text, destinationView.getDocumentText()); jCas.reset(); jCas.setDocumentText(text); jCas.createView(destinationViewName); viewCreator.process(jCas); destinationView = jCas.getView(destinationViewName); assertNotNull(destinationView); assertEquals(text, destinationView.getDocumentText()); viewCreator = AnalysisEngineFactory.createEngine(ViewTextCopierAnnotator.class, typeSystemDescription, ViewTextCopierAnnotator.PARAM_SOURCE_VIEW_NAME, sourceViewName, ViewTextCopierAnnotator.PARAM_DESTINATION_VIEW_NAME, destinationViewName); jCas.reset(); JCas sourceView = jCas.createView(sourceViewName); sourceView.setDocumentText(text); viewCreator.process(jCas); destinationView = jCas.getView(destinationViewName); assertNotNull(destinationView); assertEquals(text, destinationView.getDocumentText()); assertNull(jCas.getDocumentText()); }
@Override public void process(final JCas jCas) throws AnalysisEngineProcessException { try { final JCas sourceView = jCas.getView(sourceViewName); JCas destinationView; try { destinationView = jCas.getView(destinationViewName); } catch (CASRuntimeException ce) { destinationView = jCas.createView(destinationViewName); } destinationView.setDocumentText(sourceView.getDocumentText()); } catch (CASException e) { throw new AnalysisEngineProcessException(e); } }
ViewTextCopierAnnotator extends JCasAnnotator_ImplBase { @Override public void process(final JCas jCas) throws AnalysisEngineProcessException { try { final JCas sourceView = jCas.getView(sourceViewName); JCas destinationView; try { destinationView = jCas.getView(destinationViewName); } catch (CASRuntimeException ce) { destinationView = jCas.createView(destinationViewName); } destinationView.setDocumentText(sourceView.getDocumentText()); } catch (CASException e) { throw new AnalysisEngineProcessException(e); } } }
ViewTextCopierAnnotator extends JCasAnnotator_ImplBase { @Override public void process(final JCas jCas) throws AnalysisEngineProcessException { try { final JCas sourceView = jCas.getView(sourceViewName); JCas destinationView; try { destinationView = jCas.getView(destinationViewName); } catch (CASRuntimeException ce) { destinationView = jCas.createView(destinationViewName); } destinationView.setDocumentText(sourceView.getDocumentText()); } catch (CASException e) { throw new AnalysisEngineProcessException(e); } }  }
ViewTextCopierAnnotator extends JCasAnnotator_ImplBase { @Override public void process(final JCas jCas) throws AnalysisEngineProcessException { try { final JCas sourceView = jCas.getView(sourceViewName); JCas destinationView; try { destinationView = jCas.getView(destinationViewName); } catch (CASRuntimeException ce) { destinationView = jCas.createView(destinationViewName); } destinationView.setDocumentText(sourceView.getDocumentText()); } catch (CASException e) { throw new AnalysisEngineProcessException(e); } }  @Override void process(final JCas jCas); }
ViewTextCopierAnnotator extends JCasAnnotator_ImplBase { @Override public void process(final JCas jCas) throws AnalysisEngineProcessException { try { final JCas sourceView = jCas.getView(sourceViewName); JCas destinationView; try { destinationView = jCas.getView(destinationViewName); } catch (CASRuntimeException ce) { destinationView = jCas.createView(destinationViewName); } destinationView.setDocumentText(sourceView.getDocumentText()); } catch (CASException e) { throw new AnalysisEngineProcessException(e); } }  @Override void process(final JCas jCas); static final String PARAM_SOURCE_VIEW_NAME; static final String PARAM_DESTINATION_VIEW_NAME; }