@Override
  public void processCas(CAS aCAS) throws ResourceProcessException {
    JCas jcas = null;
    try {
      jcas = aCAS.getJCas();
    } catch (CASException e) {
      throw new ResourceProcessException(e);
    }

    String sentenceId = "";
    FSIterator<TOP> sentenceIterator = jcas.getJFSIndexRepository().getAllIndexedFS(Sentence.type);
    if (sentenceIterator.hasNext()) {
      Sentence sentence = (Sentence) sentenceIterator.next();
      sentenceId = sentence.getSentenceId();
    }

    for (org.apache.uima.jcas.tcas.Annotation geneEntity : jcas
            .getAnnotationIndex(FinalAnnotation.type)) {
      FinalAnnotation thisGeneEntity = (FinalAnnotation) geneEntity;
      String outputString = sentenceId + "|" + ((Integer) thisGeneEntity.getBegin()).toString()
              + " " + ((Integer) thisGeneEntity.getEnd()).toString() + "|"
              + thisGeneEntity.getAnnotatedText() + "\n";
      try {
        mBufferedWriter.write(outputString);
        mBufferedWriter.flush();
      } catch (IOException e) {
        e.printStackTrace();
      }
    }
  }