multilingual-ctap-web/src/main/java/com/ctapweb/web/server/analysis/StatusCallbackListenerImpl.java
@Override
	public void entityProcessComplete(CAS cas, EntityProcessStatus entityProcessStatus) {
		//get text id from cas
		try {
			long textID = 0;
			JCas jCas = cas.getJCas();
			Iterator<CorpusTextInfo> iter = jCas.getAllIndexedFS(CorpusTextInfo.class);
			if(iter.hasNext()) {
				textID = iter.next().getId();
			}

			//record exceptions if occurred
			if (entityProcessStatus.isException()) {
				logger.warn(LogMarker.CTAP_SERVER_MARKER, 
						"Exceptions thrown while processing text " + textID + ":");
				for (Exception e : entityProcessStatus.getExceptions()) {
					logger.throwing(e);
				}
				return;
			}
			
			//update analysis status
			completedEntityCount++;
			
			//update analysis status 
			double progress = (double) completedEntityCount / totalEntityCount;
			AnalysisStatus analysisStatus = new AnalysisStatus();
			analysisStatus.setAnalysisID(analysis.getId());
			analysisStatus.setProgress(progress);
			
			AnalysisUtils.updateAnalysisProgress(analysisStatus);
			
			logger.info(LogMarker.CTAP_SERVER_MARKER, 
					"Text {} successfully processed. Total texts completed: {}.", textID, completedEntityCount);
			
		} catch (CASException | SQLException e) {
			logger.catching(e);
		}

//		updateAnalysisProgress((double) completedEntityCount / totalEntityCount);

//		String docText = cas.getDocumentText();
//		if (docText != null) {
//			size += docText.length();
//		}
//		logger.info("Processed " + completedEntityCount+ " documents with " + docText.length() + " characters.");

		//wait for some time, for debugging
		//			try {
		//				Thread.sleep(5000);
		//			} catch (InterruptedException e) {
		//				e.printStackTrace();
		//			}
	}
/**
	 * Called when the processing of a Document is completed. <br>
	 * The process status can be looked at and corresponding actions taken.
	 * 
	 * @param cas
	 *          CAS corresponding to the completed processing
	 * @param entityProcessStatus
	 *          EntityProcessStatus that holds the status of all the events for aEntity
	 */
Called when the processing of a Document is completed. 
The process status can be looked at and corresponding actions taken.

@param cas
CAS corresponding to the completed processing
@param entityProcessStatus
EntityProcessStatus that holds the status of all the events for aEntity
Called when the processing of a Document is completed . The process status can be looked at and corresponding actions taken . @param cas CAS corresponding to the completed processing @param entityProcessStatus EntityProcessStatus that holds the status of all the events for aEntity
@Override
	public void entityProcessComplete(CAS cas, EntityProcessStatus entityProcessStatus) {
		try {
			long textID = 0;
			JCas jCas = cas.getJCas();
			Iterator<CorpusTextInfo> iter = jCas.getAllIndexedFS(CorpusTextInfo.class);
			if(iter.hasNext()) {
				textID = iter.next().getId();
			}
			if (entityProcessStatus.isException()) {
				logger.warn(LogMarker.CTAP_SERVER_MARKER, 
						"Exceptions thrown while processing text " + textID + ":");
				for (Exception e : entityProcessStatus.getExceptions()) {
					logger.throwing(e);
				}
				return;
			}
			completedEntityCount++;
			double progress = (double) completedEntityCount / totalEntityCount;
			AnalysisStatus analysisStatus = new AnalysisStatus();
			analysisStatus.setAnalysisID(analysis.getId());
			analysisStatus.setProgress(progress);
			AnalysisUtils.updateAnalysisProgress(analysisStatus);
			logger.info(LogMarker.CTAP_SERVER_MARKER, 
					"Text {} successfully processed. Total texts completed: {}.", textID, completedEntityCount);
		} catch (CASException | SQLException e) {
			logger.catching(e);
		}
	}
@ Override public void entityProcessComplete ( CAS cas , EntityProcessStatus entityProcessStatus ) { try { long textID = 0 ; JCas jCas = cas . getJCas ( ) ; Iterator < CorpusTextInfo > iter = jCas . getAllIndexedFS ( CorpusTextInfo . class ) ; if ( iter . hasNext ( ) ) { textID = iter . next ( ) . getId ( ) ; } if ( entityProcessStatus . isException ( ) ) { logger . warn ( LogMarker . CTAP_SERVER_MARKER , "Exceptions thrown while processing text " + textID + ":" ) ; for ( Exception e : entityProcessStatus . getExceptions ( ) ) { logger . throwing ( e ) ; } return ; } completedEntityCount ++ ; double progress = ( double ) completedEntityCount / totalEntityCount ; AnalysisStatus analysisStatus = new AnalysisStatus ( ) ; analysisStatus . setAnalysisID ( analysis . getId ( ) ) ; analysisStatus . setProgress ( progress ) ; AnalysisUtils . updateAnalysisProgress ( analysisStatus ) ; logger . info ( LogMarker . CTAP_SERVER_MARKER , "Text {} successfully processed. Total texts completed: {}." , textID , completedEntityCount ) ; } catch ( CASException | SQLException e ) { logger . catching ( e ) ; } }
Called when the processing of a Document is completed.
Called when the processing of a Document is completed .
//get text id from cas //record exceptions if occurred //update analysis status //update analysis status  //		updateAnalysisProgress((double) completedEntityCount / totalEntityCount); //		String docText = cas.getDocumentText(); //		if (docText != null) { //			size += docText.length(); //		} //		logger.info("Processed " + completedEntityCount+ " documents with " + docText.length() + " characters."); //wait for some time, for debugging //			try { //				Thread.sleep(5000); //			} catch (InterruptedException e) { //				e.printStackTrace(); //			}